var eLearnWindow;
var eLearnMode        = 0;
var timerInterval;
if(document.cookie && document.cookie.toString().search(/eLearn=1/) !=  -1){
  
}
/


function wFireELearn(classname, method, params){
  
  var url = "/weblication/grid/scripts/wELearn.php?action=ajaxTrigger&repository=&classname="+classname+"&method="+method+"&parameters="+params;
  getUrl(url, wFireELearnResponse);
}

/

/

function wFireELearnResponse(strELearn){
  
}

/

/

function windowLoader(){
  timerInterval = window.setInterval('wGetLoaderChecker()', 1000);
  wShowMessagebox('loadingProgram', '', 'Das eLearning Fenster wird geladen. Bitte haben Sie einen Moment Geduld', '', 'loading');
  wCheckPosELearn();
}

/

/

function wGetLoaderChecker(){
  var url = "/weblication/grid/scripts/wELearn.php?action=wELearnCheckLoading";
  getUrl(url, wGetLoaderCheckerResponse);
}

function wGetLoaderCheckerResponse(responseText){
  if(getStatusSoap(responseText) == 1){
    window.focus();
    window.clearInterval(timerInterval);
    hideMessagebox();
  }
}

/

/

function wSetLoaderChecker(){
  var url = "/weblication/grid/scripts/wELearn.php?action=wELearnSetLoading";
  getUrl(url, wSetLoaderCheckerResponse);
}

function wSetLoaderCheckerResponse(responseText){



}

/

/

function wCheckPosELearn(){
  
  var url = "/weblication/grid/scripts/wELearn.php?action=wELearnCheckMode";
  
  getUrl(url, wPosELearn);
}

function wPosELearn(responseText){
  if(getStatusSoap(responseText) == 1){
    var eLearnWidth = 410;
    
    if(ie){
      var screenWidth         = screen.availWidth;
      var eLearnWindowHeight  = screen.availHeight;
      var eLearnWindowLeft    = screen.availWidth - 410;
      
      var winWidth            = document.body.clientWidth;
      var winHeight           = document.body.clientHeight+285;
      
      var diff                = 0;
    }
    else{
      var screenWidth         = screen.width;
      var eLearnWindowHeight  = screen.height - 30;
      var eLearnWindowLeft    = screen.width - 410;
      
      var winWidth            = window.outerWidth;
      var winHeight           = window.outerHeight;
      
      var diff                = 3;
    }
    
    if(winHeight > screen.height){
      var windowHeight = screen.height;
    }
    else{
      var windowHeight = winHeight;
    }
    
    var posX = window.screenX;
    var posY = window.screenY;
      
    if(window.screenX < 0){
      posX = 0;
    }
    else if(window.screenX > screen.width){
      posX = 0;
    }
    else if(window.screenX + winWidth > eLearnWidth){
      posX = screen.width - winWidth - eLearnWidth;
    }
      
    if(window.screenY < 0){
      posY = 0;
    }
    else if(window.screenY > screen.height){
      posY = 0;
    }
    
    if(window.name == "eLearnWindow"){
      window.moveTo(eLearnWindowLeft, 0);
      window.resizeTo(eLearnWidth, eLearnWindowHeight);
    }
    else{
      window.moveTo(posX, posY);
      
      if(winWidth > screenWidth-eLearnWidth+diff){
        window.resizeTo(screenWidth-eLearnWidth+diff, windowHeight);
      }
    }
  }
  return true;
}