function jsTrim(s) {return s.replace(/(^\s+)|(\s+$)/g, "");}

function Track(trackParm, objLink)
{
    if (objLink.innerText && jsTrim(objLink.innerText))
    {
        // anchor tag, use link text
        LinkText = objLink.innerText;
    }
    else if (objLink.all && objLink.all(0).alt)
    {
        // image, use alt text
        LinkText = objLink.all(0).alt;
    }
         
    var strDomain = document.domain;
    var s = trackParm.split("|");
    var strLinkArea;
    var strLinkId;
    var strPageRegion;
    
    if (trackParm.substring(0,1) == "|")
    {
        strPageRegion = s[1];
        strLinkArea = s[2];
        strLinkId = s[2] + s[3];
    }
    else
    {
            strLinkArea = s[0];
        strLinkId = s[0] + s[1];

    }
    
    if (typeof(LinkText)=="undefined" || !LinkText || LinkText == "")
        LinkText = strLinkId;

    ctUrl = objLink.href + "?LinkId=" + strLinkId + "&LinkArea=" + strLinkArea 

    if (typeof(DCSext)!="undefined") 
    {
            DCSext.wt_strHeadlnLocale = detectedLocale;
            DCSext.wt_strCat=strLinkArea+"|"+detectedLocale;
            DCSext.wt_strUrl = window.location.href.toLowerCase();
            DCSext.wt_strArea = strPageRegion;
    }
        return false; 
}









function TFly_Init(name,  offsetLeft, offsetTop, alignment, anyIter, anyTime, staticHover, popupHover, popupLatency, hideLatency, onInit, onPopup, onHide){
  var TFly = document.getElementById(name); 
  TFly.alignment = alignment;
  TFly.DT = document.getElementById(name+"_Popup")
  TFly.F = document.getElementById(name+"_Anim")
  TFly.oX = offsetLeft
  TFly.oY = offsetTop;
  TFly.AnyIter = anyIter;
  TFly.AnyTime = anyTime;

  TFly.popupLatency = popupLatency;
  TFly.hideLatency = hideLatency;
  TFly.onPopup = onPopup;
  TFly.onHide = onHide;
  
  TFly.onmouseover = function(){if(staticHover!=''){TFly.className_=TFly.className;TFly.className=staticHover;} TFly_Popup(TFly,true);}
  TFly.onmouseout = function(){if(staticHover!=''){TFly.className=TFly.className_};TFly_Popup(TFly,false);}

  if(document.all){
    TFly.onactivate = TFly.onmouseover
    TFly.ondeactivate = TFly.onmouseout
  }else{
    TFly.onfocus = TFly.onmouseover
    TFly.onblur = TFly.onmouseout
  }
 
  TFly.DT.onmouseover = function(){if(popupHover!=''){TFly.DT.className_=TFly.DT.className;TFly.DT.className=popupHover;};TFly_Popup(TFly,true);}
  TFly.DT.onmouseout = function(){if(popupHover!=''){TFly.DT.className=TFly.DT.className_};TFly_Popup(TFly,false);}

  TFly_CallClientFunction(onInit, TFly)
}

function TFly_CallClientFunction(name, TFly){
    if(name!=null &&  name!="")
      eval( name + "(TFly);");
}

function TFly_SetPosition(TFly, obj){
  obj.style.top = TFly.oY + TFly.offsetHeight+ "px";
  obj.style.left = TFly.oX + (TFly.offsetWidth - obj.offsetWidth )*(1+TFly.alignment)/2 + "px";
}

function TFly_Popup(TFly,value){
  if(TFly.timer!=null ) window.clearTimeout(TFly.timer)
  if(value){
    if(TFly.status=="on") return
    var timeout = (TFly.status=="active") ? 0 : TFly.popupLatency
    if(TFly.AnyIter>0 && TFly.AnyTime>0)
      TFly.timer = window.setTimeout(function(){TFly_AnimateStart(TFly,true,TFly.F.curIter);},timeout)
    else
      TFly.timer = window.setTimeout(function(){TFly_SetVisibility(TFly,true);},timeout)
  }else{
    if(TFly.status=="off") return
    var timeout = (TFly.status=="active") ? 0 : TFly.hideLatency
    if(TFly.AnyIter>0 && TFly.AnyTime>0)
      TFly.timer = window.setTimeout(function(){TFly_AnimateStart(TFly,false,TFly.F.curIter);},timeout)
    else
      TFly.timer = window.setTimeout(function(){TFly_SetVisibility(TFly,false);},timeout)
  }
}

function TFly_SetVisibility(TFly, value){
      if(value==true){
        TFly_SetPosition(TFly,TFly.DT);
        TFly.DT.style.visibility = "visible"
        TFly.style.zIndex = "999"
      }else{
        TFly.DT.style.visibility = "hidden"
        TFly.style.zIndex = "0"
        TFly.DT.style.left = "-10000px"
      }
}

function TFly_AnimateStart(TFly, inout, curIter){
    if(TFly.F.timer!=null) window.clearTimeout(TFly.F.timer);
    if(curIter==null) curIter=0;
    if(TFly.status !="active"){
        TFly.status ="active";
        TFly.F.style.visibility = "visible";
        TFly.DT.style.visibility="hidden";
    }
    if(curIter<0 || curIter>TFly.AnyIter ){
        TFly.F.curIter = (curIter<1) ? 0 : TFly.AnyIter;
        TFly.status = (TFly.F.curIter==TFly.AnyIter) ? "on": "off";
        TFly.F.style.visibility = "hidden";
        TFly_SetPosition(TFly,TFly.DT);
        TFly.style.zIndex=(TFly.F.curIter==TFly.AnyIter) ? "999" : "0";
        if(TFly.F.curIter==TFly.AnyIter){
          TFly.status = "on";
          TFly_SetVisibility(TFly,true);
          TFly_CallClientFunction(TFly.onPopup, TFly)
        }else{
          TFly.status = "off";
          TFly_SetVisibility(TFly,false);
          TFly_CallClientFunction(TFly.onHide, TFly)
        }
    }else{
        var per = curIter*(95/TFly.AnyIter)+ 5;
        TFly.F.style.visibility = "hidden";
        TFly.F.style.width=TFly.DT.offsetWidth/100*per + "px";
        TFly.F.style.height=TFly.DT.offsetHeight/100*per + "px";
        TFly_SetPosition(TFly, TFly.F);
        TFly.F.style.visibility = "visible";
        var timeout = (per==100 ) ? 0 : TFly.AnyTime - (TFly.AnyTime/(TFly.AnyIter)*(curIter)); 
        curIter += (inout) ? 1:-1;
        TFly.F.timer = window.setTimeout(function(){TFly_AnimateStart(TFly, inout, curIter)},timeout);
        TFly.F.curIter = curIter;
    }
}










































function CopyCode(elemName)
{
    var obj = document.getElementById(elemName)
    window.clipboardData.setData("Text", obj.innerText);
}





var cleanedDivIds, cleanedImgIds, oExpColSpan, oExpColImg;
var expState = true;

function checkExpCollAll()
{
   
   cleanImgVars();
   
   var open = false;
   var closed = false;
   
   for (i = 0; i < cleanedDivIds.length-1; i++)
   {
		// alert(cleanedDivIds[i]);
        try
        {
            oDiv = document.getElementById(cleanedDivIds[i]);
            oImg = document.getElementById(cleanedImgIds[i]);
            
            if (oDiv.style.display == 'block')
            {
                open = true;
            }
            else
            {
                closed = true;
            }
        }
        catch(e)
	    {
			throw e;
	    }
   }
   if (open != closed)
	{	        
	    if (open)
	        expState = false;
	    if (closed)
	        expState = true;
	        
	    if (typeof(expcalallPres)!='undefined' && expcalallPres == true)
	        expCollButtonToggle();
	}
}

function cleanImgVars()
{
   if (typeof(cleanedDivIds)=='undefined')
   {
        var r1, r2, re;
        re = /undefined/g; 
        r1 = ExpCollDivStr.replace(re, "");
        cleanedDivIds = r1.substring(0, r1.length).split(',');
        
        r2 = ExpCollImgStr.replace(re, "");
        cleanedImgIds = r2.substring(0, r2.length).split(',');
   }
}

//	#5406
function ShowHideCollapsibleArea(strAreaId,strImg)
{
	var oCollAreaDiv = document.getElementById(strAreaId);
	var oCollAreaImg = document.getElementById(strImg);	
	if (oCollAreaDiv.style.display == 'none')
	{
		oCollAreaDiv.style.display = 'block';
		oCollAreaImg.src = imgMinus;
	}
	else
	{		
		oCollAreaDiv.style.display = 'none';
		oCollAreaImg.src = imgPlus;	
	}

	checkExpCollAll();
}









//  function to expand and shorten the main content panel
function ToggleMutliViewTable(strImage)
{
    var thisImgObj = document.getElementById(strImage);  
    var thisPanelOb = document.getElementById(currentDisplayPanel);
    if ( thisPanelOb != null)
    {
        for (i = 0; i < thisPanelOb.parentNode.childNodes.length; i++)
        {
            if(thisPanelOb.parentNode.childNodes[i].style.height == "300px" )
            {
                thisPanelOb.parentNode.childNodes[i].style.height = "auto";
                thisImgObj.childNodes[0].src = mvt_collImage;
            }
            else
            {
                thisPanelOb.parentNode.childNodes[i].style.height = "300px";
                thisImgObj.childNodes[0].src = mvt_expImage; 
            }  
        }
    }
    return;
}   


// function to display the assigned text from the assigned button
function ShowThisTableView(strBannerID,strBannerText, strPanel)
{
    var bannerObj = document.getElementById(strBannerID);
    if ( bannerObj != null)
    {
        bannerObj.innerHTML = strBannerText;
    } 
   
    var currentObj = document.getElementById(strPanel);
    if ( currentObj != null)
    {
        for (i = 0; i < currentObj.parentNode.childNodes.length; i++)
        {
            currentObj.parentNode.childNodes[i].className = "MultiViewPanelClosed";
        }
        currentObj.className = "MultiViewPanelOpen";
        currentDisplayPanel = strPanel;
    }
   return; 
}















