
 function overlang(el) {
 el.setAttribute("class", "BannerLanguageButtonOver");
 el.className = "BannerLanguageButtonOver";
}
function outlang(el) {
  el.setAttribute("class", "BannerLanguageButton");
  el.className = "BannerLanguageButton";
}



function overc(el) {
 el.setAttribute("class", "BannerButtonOver");
 el.className = "BannerButtonOver";
}
function outc(el) {
  el.setAttribute("class", "BannerButton");
  el.className = "BannerButton";
}


      

function overb(el) {
 el.setAttribute("class", "TopicButtonOver");
 el.className ="TopicButtonOver";
}
function outb(el) {
  el.setAttribute("class", "TopicButton");
  el.className ="TopicButton";
}

    
 var baseText = null;
  
var PopupToHide="";
var popupToHideTimerId = 0;
  
 function showPopup(el, w, h, popUpId)
 {
      if(PopupToHide != "")
      {
         if(PopupToHide.id == popUpId) 
         {
            clearTimeout(popupToHideTimerId);
            return;
         }
      }
      
      hideOldPopupNow();
      
      var popUp = document.getElementById(popUpId);

      var top = getElementTopPosition(el) +30;
      var left = getElementLeftPosition(el)-w+45;
      
      popUp.style.top = top;
      popUp.style.left = left;
      
      popUp.style.width = w + "px";
      popUp.style.height = h + "px";
     
      if (baseText == null) baseText = popUp.innerHTML;
      
      popUp.style.visibility = "visible";
 
}


function hidePopup(popUpId){

   PopupToHide = document.getElementById(popUpId);

   popupToHideTimerId = setTimeout(hideOldPopupNow, 100);

}     
     
function hideOldPopupNow()
{
   if(popupToHideTimerId == 0) return;
   
   PopupToHide.style.visibility = "hidden";
   
   PopupToHide = "";
   popupToHideTimerId = 0;
   
}
    
    
function KeepPopup()
{
   clearTimeout(popupToHideTimerId);
   PopupToHide = "";
}



 function getElementTopPosition(el)
 {

   var offsetTrail = el;
   var offsetLeft = 0;
   var offsetTop = 0;
   while (offsetTrail)
   {
      offsetLeft += offsetTrail.offsetLeft;
      offsetTop += offsetTrail.offsetTop;
      offsetTrail = offsetTrail.offsetParent;
   }
   
   if (navigator.userAgent.indexOf('Mac') != -1 && typeof document.body.leftMargin != 'undefined')
   {
      offsetLeft += document.body.leftMargin;
      offsetTop += document.body.topMargin;
   }
      return offsetTop;
}


function getElementLeftPosition(el)
{

   var offsetTrail = el;
   var offsetLeft = 0;
   var offsetTop = 0;
   while (offsetTrail)
   {
      offsetLeft += offsetTrail.offsetLeft;
      offsetTop += offsetTrail.offsetTop;
      offsetTrail = offsetTrail.offsetParent;
   }
   
   if (navigator.userAgent.indexOf('Mac') != -1 && typeof document.body.leftMargin != 'undefined')
   {
      offsetLeft += document.body.leftMargin;
      offsetTop += document.body.topMargin;
   }
      return offsetLeft;
}


function PositionContent(contentId,  posLeft, posTop)
{
    var contentEl = document.getElementById(contentId);
    
    var HeaderEl = document.getElementById("header");
    
    
    var left = getElementLeftPosition(HeaderEl) + posLeft;
    var top = getElementTopPosition(HeaderEl) + posTop;
    
    
    // left = left +  posLeft ;
    // top = top + posTop;
     

      //var top = getElementTopPosition(el) +30;
      //var left = getElementLeftPosition(el)-w+45;
   
      
      contentEl.style.top = top ;
      contentEl.style.left = left;
      
      //alert ("top = " + top + "  left = " + left);
}



function ShowScrollBar(id)
{
   var el = document.getElementById(id);
   
   el.style.visibility = "hidden";
   
   fleXenv.globalInit();
}


function DisplayPopup(id)
{
   
  
   
   
   
   if(id.substring(0,1) == 'i')
   {
      var displayImg = document.getElementById(id);
       var ClientRow = id.substring(6,7+(id.length-7))
   }
   else
   {
       var displayImg = document.getElementById('image_' + id.substring(7,8+(id.length-8)));
        var ClientRow = id.substring(7,8+(id.length-8))
   }
         
         
   var popUpContainter = document.getElementById("ClientPopupContainer_"+ClientRow);
   var popUpImg = document.getElementById("ClientPopupImage_"+ClientRow);
      
   
  // popUpImg.src = displayImg.src;
   
   
   
   var left = getElementLeftPosition(displayImg);
   var top = getElementTopPosition(displayImg);
   
   if(id.substring(0,1) == 'i')
   {
        popUpContainter.style.top = top-50 ;
        popUpContainter.style.left = left-255;
   }
   else
   {
      popUpContainter.style.top = top-50 ;
      popUpContainter.style.left = left-150;
   }
   
   popUpContainter.style.display="";
   
   //alert("in Display");
}

function HidePopup(rowID)
{
   var popUpContainter = document.getElementById("ClientPopupContainer_"+rowID);
   popUpContainter.style.display="none";
   //popUpImg.src="";
   //alert("in Hide");
}

function pausecomp(millis)
{
var date = new Date();
var curDate = null;

do { curDate = new Date(); }
while(curDate-date < millis);
}


function goodbye(e) {

 var xmlHttp = getXMLHttpGoodBye();
 

  xmlHttp.open("GET", "/TrackLeavingPage.php", true);
  xmlHttp.send(null);

//alert("sent");
}



function getXMLHttpGoodBye()
{
  var xmlHttp

  try
  {
    //Firefox, Opera 8.0+, Safari
    xmlHttp = new XMLHttpRequest();
  }
  catch(e)
  {
    //Internet Explorer
    try
    {
      xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e)
    {
      try
      {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch(e)
      {
        alert("Your browser does not support AJAX!")
        return false;
      }
    }
  }
  return xmlHttp;
}



function createPopUp(popUpCode) 
{ 
   var div = document.createElement('div'); 
   div.innerHTML = popUpCode; 
   document.body.appendChild(div.firstChild); 
}



function PlayVideo(locationEl, videoId, leftOffSet, topOffSet, Media_Language_Link_ID)
{

   
   var div = document.createElement('div');  
   
   var innerHTML  = "";


  // var locationEl = document.getElementById(locationId);
   var left = getElementLeftPosition(locationEl);
   var top = getElementTopPosition(locationEl);

     
   left = left + leftOffSet;   
   top = top + topOffSet;
     
   left = left + 'px';
   top = top + 'px';

   
   innerHTML = ""; 
   innerHTML +='<div class="popUp" id="popUp" style="top: ' + top + '; left: ' + left + ';">';
   innerHTML +='      <div class="PopupHorizontal">';
   innerHTML +='        <div class="popUpTopLeft">&nbsp</div>';
   innerHTML +='         <div class="PopupHorizontalMiddle">&nbsp</div>';
   innerHTML +='         <div class="popUpTopRight" onclick="CloseVideo();">&nbsp</div>';
   innerHTML +='     </div>';
   innerHTML +='     <div class="PopupContent">';
   innerHTML +='        <iframe width="90%"  align="center" SCROLLING="no"  height="100%"  src="PlayVideo.php?VidID=' + escape(videoId) + '"></iframe><br>';
   innerHTML +='     </div>';
   innerHTML +='     <div class="PopupHorizontal">';
   innerHTML +='           <div class="popUpBottomLeft">&nbsp</div>';
   innerHTML +='           <div class="PopupHorizontalMiddle">&nbsp</div>';
   innerHTML +='           <div class="popUpBottomRight">&nbsp</div>';
   innerHTML +='        </div>';
   innerHTML +='</div>';  
   

   div.innerHTML = innerHTML;
   
   document.body.appendChild(div.firstChild); 
   
}


function CloseVideo()
{
  document.getElementById('popUp').parentNode.removeChild(document.getElementById('popUp'));
}



window.onbeforeunload=goodbye;
