var bName = navigator.appName;
var bVer = parseFloat(navigator.appVersion);

function checkStyles()
{
	if(bName=="Netscape"){
		document.write('<link rel="stylesheet" type="text/css" href="public/styles_moz.css">');}
	else{
		document.write('<link rel="stylesheet" type="text/css" href="public/styles.css">');}
}

var requiredVersion = 8;   
var useRedirect = false;
var flashPage   = ""
var noFlashPage = ""
var upgradePage = ""
var flash2Installed = false;    
var flash3Installed = false;    
var flash4Installed = false;    
var flash5Installed = false;    
var flash6Installed = false;    
var flash7Installed = false;    
var flash8Installed = false;    
var flash9Installed = false;    
var maxVersion = 9;             
var actualVersion = 0;          
var hasRightVersion = false;    
var jsVersion = 1.0;

var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; 
jsVersion = 1.1;

if(isIE && isWin){

  document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
  document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
  document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
  document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
  document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
  document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
  document.write('flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');
  document.write('flash9Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');
  document.write('<\/SCR' + 'IPT\> \n'); 

}

function detectFlash() {  

  if (navigator.plugins) {
    if (navigator.plugins["Shockwave Flash 2.0"]
        || navigator.plugins["Shockwave Flash"]) {
      var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
      var flashVersion = parseInt(flashDescription.substring(16));
      flash2Installed = flashVersion == 2;    
      flash3Installed = flashVersion == 3;
      flash4Installed = flashVersion == 4;
      flash5Installed = flashVersion == 5;
      flash6Installed = flashVersion == 6;
      flash7Installed = flashVersion == 7;
      flash8Installed = flashVersion == 8;
      flash9Installed = flashVersion >= 9;
    }
  }
  for (var i = 2; i <= maxVersion; i++) {  
    if (eval("flash" + i + "Installed") == true) actualVersion = i;
  }
  if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 4;  
  if (actualVersion >= requiredVersion) {
    if (useRedirect) {
      if(jsVersion > 1.0) {
        window.location.replace(flashPage);  
      } else {
        window.location = flashPage;
      }
    }
    hasRightVersion = true;                
  } else {  
    if (useRedirect) {
      if(jsVersion > 1.0) {
        window.location.replace((actualVersion >= 2) ? upgradePage : noFlashPage);
      } else {
        window.location = (actualVersion >= 2) ? upgradePage : noFlashPage;
      }
    }
  }
}
detectFlash();

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs






    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}
/******* menu *********/
function swap(obj, img, activate)
{
	var onOff="";
	var flip=true;
	if(activate)
	{
		onOff="On";
	}
	else
	{
		if(id==img)
			flip=false;
	}
	
	if(flip)
		obj.src="images/M"+img+onOff+".gif";
}

function MM_preloadImages() {
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { 
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() {
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	obj.visibility=v; }
}

function P7_Snap() {
	var x,y,ox,bx,oy,p,tx,a,b,k,d,da,e,el,tw,q0,xx,yy,w1,pa='px',args=P7_Snap.arguments;a=parseInt(a);
	if(document.layers||window.opera){pa='';}for(k=0;k<(args.length);k+=4){
	if((g=MM_findObj(args[k]))!=null){if((el=MM_findObj(args[k+1]))!=null){
	a=parseInt(args[k+2]);b=parseInt(args[k+3]);x=0;y=0;ox=0;oy=0;p="";tx=1;
	da="document.all['"+args[k]+"']";if(document.getElementById){
	d="document.getElementsByName('"+args[k]+"')[0]";if(!eval(d)){
	d="document.getElementById('"+args[k]+"')";if(!eval(d)){d=da;}}
	}else if(document.all){d=da;}if(document.all||document.getElementById){while(tx==1){
	p+=".offsetParent";if(eval(d+p)){x+=parseInt(eval(d+p+".offsetLeft"));y+=parseInt(eval(d+p+".offsetTop"));
	}else{tx=0;}}ox=parseInt(g.offsetLeft);oy=parseInt(g.offsetTop);tw=x+ox+y+oy;
	if(tw==0||(navigator.appVersion.indexOf("MSIE 4")>-1&&navigator.appVersion.indexOf("Mac")>-1)){
	ox=0;oy=0;if(g.style.left){x=parseInt(g.style.left);y=parseInt(g.style.top);}else{
	w1=parseInt(el.style.width);bx=(a<0)?-5-w1:-10;a=(Math.abs(a)<1000)?0:a;b=(Math.abs(b)<1000)?0:b;
	x=document.body.scrollLeft+event.clientX+bx;y=document.body.scrollTop+event.clientY;}}
	}else if(document.layers){x=g.x;y=g.y;q0=document.layers,dd="";for(var s=0;s<q0.length;s++){
	dd='document.'+q0[s].name;if(eval(dd+'.document.'+args[k])){x+=eval(dd+'.left');y+=eval(dd+'.top');
	break;}}}e=(document.layers)?el:el.style;xx=parseInt(x+ox+a),yy=parseInt(y+oy+b);
	if(navigator.appVersion.indexOf("MSIE 5")>-1 && navigator.appVersion.indexOf("Mac")>-1){
	xx+=parseInt(document.body.leftMargin);yy+=parseInt(document.body.topMargin);}
	e.left=xx+pa;e.top=yy+pa;}}}
}

function HideAll(){
	MM_showHideLayers('HideAll','','hide','sub1','','hide','sub2','','hide')
}
function MenuChange(id,btn,text,linkit){
		if (id==btn){
			document.write('<span class="MenuBtn2">'+ text + '</span>');}
		else{
			document.write('<a href="'+ linkit +'">'+ text +'</a>');}
}

function LeftMenuChange(id,btn,text,linkit,img){
		if (id==btn){
			document.write('<span class="GreyLinkBold FontSizeX">' +text+ '</span>');
			var image = document.getElementById(img);
			if(image != null)
			    image.src = "../Public/Images/darrowrighton2.gif";
		}
		else{
			document.write('<a href="'+ linkit +'">'+ text +'</a>');
			var image = document.getElementById(img);
			if(image != null)
			    image.src = "../Public/Images/darrowright.gif";
		}
}

function LeftSubMenuChange(id,btn,text,linkit){
		if (id==btn){
			document.write('<span style="color: #808080">' +text+ '</span>');}
		else{
			document.write('<a href="'+ linkit +'">'+ text +'</a>');}
}
/*********************************/
var fontSize = 9;
	
FontSizeSet();
	
function FontSizeSet()
{
	var el, n = 1;
	while (el = document.getElementById('textpart' + n++))
	el.style.fontSize = fontSize + 'pt';

	return false;
}

function SetFontLarger()
{
	if (fontSize < 13)
	fontSize++;
	
	return FontSizeSet();
}

function SetFontSmaller()
{
	if (fontSize > 7)
	fontSize--;
	
	return FontSizeSet();
}

/*******************************/

function HomeTabs(pos,total){
	var div1;
	var div2;
	var div3;
	for(var i=1; i<=total;i++){
		div1=document.getElementById("A"+i+"Content");
		div2=document.getElementById("A"+i+"ContentTitle");
		div3=document.getElementById("A"+i+"Contentimg");
		if(pos==i){
			div1.style.display='block';
			div2.className='RightHomeTitleOn';
			div3.src='../Public/Images/minus.png';
		}
		else{
			div1.style.display='none';
			div2.className='RightHomeTitle';
			div3.src='../Public/Images/plus.png';
		}
	}
}
function ImageLoop(pos,text){
	var div1;
	var div2;
	var div3;
	div1=document.getElementById("MainText");
	div2=document.getElementById("BigImg");
	div1.innerHTML=text;
	div2.src='../Public/Images/receive/' + pos +'.jpg';
	for(i=1; i<=8;i++){
		div3=document.getElementById("smallimg"+i);
		if(div3!= null){
		    if(i==pos){
			    div3.src='../Public/Images/receive/' + i +'On.gif';
		    }
		    else{
			    div3.src='../Public/Images/receive/' + i +'.gif';
		    }
		}
	}
}

function ImageLoop2(pos,text){
	var div1;
	var div2;
	var div3;
	div1=document.getElementById("MainText");
	div2=document.getElementById("BigImg");
	div1.innerHTML=text;
	div2.src='../Public/Images/receive2/' + pos +'.jpg';
	for(i=1; i<=8;i++){
		div3=document.getElementById("smallimg"+i);
		if(div3!= null){
		    if(i==pos){
			    div3.src='../Public/Images/receive2/' + i +'On.gif';
		    }
		    else{
			    div3.src='../Public/Images/receive2/' + i +'.gif';
		    }
		}
	}
}

function changeDivIn(){
		document.getElementById('MenuFlash').style.zIndex="800"; 
		document.getElementById('pagessub').style.zIndex="1"; 
		document.getElementById('pagessub').style.position="static";
		//document.getElementById('MenuFlash').style.overflow="visible"; 
		//setFlashHeight("flashResizer",350);
}
function changeDivOut(){
	    //setFlashHeight("flashResizer", 50)
	       document.getElementById('MenuFlash').style.zIndex="1"; 
		   document.getElementById('pagessub').style.zIndex="800"; 
		   document.getElementById('pagessub').style.position="relative";
			//document.getElementById('MenuFlash').style.overflow="hidden"; 
			//document.getElementById('MenuFlash').style.height=33; 
			
}

/********************* Bookmark ******************************/
function bookmark()
{
	var browser = BrowserDetect.browser;
	
	if(browser == 'Safari')
		alert('You need to press CTRL + D to bookmark our site.');
	else
	{
		if (navigator.appName != 'Microsoft Internet Explorer')
		{
			window.sidebar.addPanel(document.title,location.href,"");
		}
		else 
		{
			window.external.AddFavorite(location.href, document.title);
		}
	}
}

/********************* Browser Detection **************************/
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

/************************** Watermark *****************************/
function WatermarkFocus(txtElem, strWatermark) {
    if (txtElem.value == strWatermark) txtElem.value = '';
}

function WatermarkBlur(txtElem, strWatermark) {
    if (txtElem.value == '') txtElem.value = strWatermark;
}

function FlipImage(idtag,imgname){
    var div=document.getElementById(idtag); 
    div.src='../Public/Images/'+imgname;
}

/****************************** Print **********************************/

function printPage(id, langId, typeI)
{

    	var style = 'toolbar=0,menubar=0,resizable=1,scrollbars=1,width=700,height=500';
    	window.open("PrintPage.aspx?id="+ id + "&langId=" + langId + "&typeId=" + typeId, "Article", style);    
}

//function print()
//{	
//	window.print();
//}


function DisplayOffOn(num){
    var div=document.getElementById("tabit"+num); 
    var divpic=document.getElementById("plusimg"+num); 
    if(div.style.display=='none'){
        div.style.display='block';
        divpic.src='../Public/Images/minus.gif';
    }
    else{
        div.style.display='none';
        divpic.src='../Public/Images/plus.gif';
    }
}

function DisplayHide(num){
    var div=document.getElementById("tabit"+num); 
    var divTitle=document.getElementById("tab"+num); 
    if(div.style.display=='none'){
        div.style.display='block';
        divTitle.style.display='none';
    }
    else {
        div.style.display='none';
        divTitle.style.display='block';
    }
}

//////////////////////////////////////////////////////////////////
var fontSize2=12;
function SetFontLarger2(id1)
{
    var div=document.getElementById(id1); 
	if (fontSize2 < 13)
	fontSize2++;
	
	div.style.fontSize = fontSize2 + 'px';
}

function SetFontSmaller2(id1)
{
    var div=document.getElementById(id1); 
	if (fontSize2 > 9)
	fontSize2--;
	
	div.style.fontSize = fontSize2 + 'px';
}
//////////////////////////////////////////

function RollTabMedia(currentid,num){
	var div1=document.getElementById(currentid);	
	if(num==0){
		div1.className='TabMedia';
	}
	else if(num==1){
		div1.className='TabOnMedia';
	}
	
}

/************************* Popup Control ******************************/
function ShowPopUp(id, windowName, url)
{
    // Constants represent popup dimensions
    var posX = (document.documentElement.offsetWidth - 400) /2;
    var posY = (document.documentElement.offsetHeight - 400) /2;

    // Get popup
    var popupMeeting = popupMain.GetWindowByName(windowName);

    if(bName == "Netscape")
    {
        // Show Popup
        popupMain.ShowWindowAtPos(popupMeeting, parseInt(posX), parseInt(posY));
        popupMain.SetWindowSize(popupMeeting);
    }
    else
    {
        // Show Popup
        popupMain.ShowWindowAtPos(popupMeeting, posX, posY);
        popupMain.SetWindowSize(popupMeeting, 472, 362);
    }      

    // Add page
    popupMain.SetWindowContentUrl(popupMeeting, url + id);
}

function ShowPopUp2(id, windowName, url)
{
    // Constants represent popup dimensions
    var posX = (document.documentElement.offsetWidth - 400) /2;
    var posY = (document.documentElement.offsetHeight - 400) /2;

    // Get popup
    var popupMeeting = popupPage.GetWindowByName(windowName);

    if(bName == "Netscape")
    {
        // Show Popup
        popupPage.ShowWindowAtPos(popupMeeting, parseInt(posX), parseInt(posY));
        popupPage.SetWindowSize(popupMeeting);
    }
    else
    {
        // Show Popup
        popupPage.ShowWindowAtPos(popupMeeting, posX, posY);
        popupPage.SetWindowSize(popupMeeting, 750, 490);
    }      

    // Add page
    popupPage.SetWindowContentUrl(popupMeeting, url + id);
}

function closePopup(id)
{
    var popup = window.parent.popupMain.GetWindowByName(id);
    window.parent.popupMain.HideWindow(popup);
    window.parent.location.reload();
}

function closePopupNoRefresh(id)
{
    var popup = window.parent.popupMain.GetWindowByName(id);
    window.parent.popupMain.HideWindow(popup);
}

function closePopupNoRefresh2(id)
{
    var popup = window.parent.popupPage.GetWindowByName(id);
    window.parent.popupPage.HideWindow(popup);
}

/************************* Login Box ******************************/
function flipDivs(number)
{
    if(number == '1')
    {
        if(document.getElementById('header_userLogin') == null)
            document.getElementById('ctl00_header_userLogin').style.display = 'block';
        else
            document.getElementById('header_userLogin').style.display = 'block';
            
        if(document.getElementById('header_corporateLogin') == null)
        {
            document.getElementById('ctl00_header_corporateLogin').style.visibility = 'hidden';
            document.getElementById('ctl00_header_corporateLogin').style.display = 'none';
        }
        else
        {
            document.getElementById('header_corporateLogin').style.visibility = 'hidden';
            document.getElementById('header_corporateLogin').style.display = 'none';
        }
    }
    else if(number == '2')
    {
        if(document.getElementById('header_userLogin') == null)
            document.getElementById('ctl00_header_userLogin').style.display = 'none';
        else
            document.getElementById('header_userLogin').style.display = 'none';
            
        if(document.getElementById('header_corporateLogin') == null)
        {
            document.getElementById('ctl00_header_corporateLogin').style.visibility = 'visible';
            document.getElementById('ctl00_header_corporateLogin').style.display = 'block';
        }
        else
        {
            document.getElementById('header_corporateLogin').style.visibility = 'visible';
            document.getElementById('header_corporateLogin').style.display = 'block';
        }
    }
}
/************************** Swap Images ****************************/
intImage = 2;
function swapImage(image1, image2) {
    var img1 = document.getElementById('ctl00_MainBodyContainer_img');
    switch (intImage) {
     case 1:
       img1.src = image1
       intImage = 2  
       return(false);
    case 2:
       img1.src = image2
       intImage = 1
       return(false);
    } 
}

/////////////////////////////////////////////////
var TimeToFade = 400.0;

function fadein(eid,inout){
	var element = document.getElementById(eid);
	element.style.display="block";
	fade(eid,1);
}
function fadeout(eid,inout){
	var element = document.getElementById(eid);
	fade(eid,-1);
	
}
function fade(eid,inout)
{
  var element = document.getElementById(eid);
  if(element == null)
    return;
   
  if(element.FadeState == null)
  {
    if(element.style.opacity == null
        || element.style.opacity == ''
        || element.style.opacity == '1')
    {
      element.FadeState = 2;
    }
    else
    {
      element.FadeState = -2;
    }
  }
   
  if(element.FadeState == 1 || element.FadeState == -1)
  {
    element.FadeState = element.FadeState == 1 ? -1 : 1;
    element.FadeTimeLeft = TimeToFade - element.FadeTimeLeft;
  }
  else
  {
    element.FadeState = inout;
    element.FadeTimeLeft = TimeToFade;
    setTimeout("animateFade(" + new Date().getTime()
        + ",'" + eid + "')", 33);
  } 
}

function animateFade(lastTick, eid)
{ 
  var curTick = new Date().getTime();
  var elapsedTicks = curTick - lastTick;
 
  var element = document.getElementById(eid);
 
  if(element.FadeTimeLeft <= elapsedTicks)
  {
    element.style.opacity = element.FadeState == 1 ? '1' : '0';
    element.style.filter = 'alpha(opacity = '
        + (element.FadeState == 1 ? '100' : '0') + ')';
    element.FadeState = element.FadeState == 1 ? 2 : -2;
	if(element.FadeState ==-2){
		element.style.display="none";
	}
    return;
  }
 
  element.FadeTimeLeft -= elapsedTicks;
  var newOpVal = element.FadeTimeLeft/TimeToFade;
  if(element.FadeState == 1)
    newOpVal = 1 - newOpVal;

  element.style.opacity = newOpVal;
  element.style.filter =
      'alpha(opacity = ' + (newOpVal*100) + ')';
 
  setTimeout("animateFade(" + curTick
      + ",'" + eid + "')", 33);
}
function MakeOpique(eid,total){
	var element;
	for(i=1;i<=total;i++){
		element = document.getElementById("Submenu"+ i);
		element.style.opacity = '0';
		element.style.filter = 'alpha(opacity = 0)';
		element.style.display="none";
	}
}

//////////////////////////////////////////////////////////////////////////

function HoverEffect(idsub,direct){
	var div1=document.getElementById(idsub);
	if(direct==1){
		div1.className="SubMenuTabTitle";
	}
	else if(direct== -1){
		div1.className="SubMenuTabTitleOn";
	}
}

function HoverEffectChannels(idsub,direct){
	var div1=document.getElementById(idsub);
	if(direct==1){
		div1.className="SubMenuTabTitleChannels";
	}
	else if(direct== -1){
		div1.className="SubMenuTabTitleChannelsOn";
	}
}

function redirect(page)
{
    window.location = '' + page + '';
    return false;
}

///////////////////////////////////////////////////////////////////
function DisplayEffect(idsub,idimg){
	var div1=document.getElementById(idsub);
	var div2=document.getElementById(idimg);
	
	if(div1.style.display=="none"){
		div1.style.display="block";
		div2.src='../Public/Images/darrowrightOn.gif';
	}
	else if(div1.style.display=="block"){
		div1.style.display="none";
		div2.src='../Public/Images/darrowright.gif';
	}
}
function DisplayHtml(idsub,data){
	var div1=document.getElementById(idsub);
	if(direct==1){
		div1.innerHTML=data;
	}
	else if(direct== -1){
		div1.innerHTML=data;
	}
}

function SwapImage(idsub,idimg){
    var div1=document.getElementById(idsub);
    if(div1 != null)
	    div1.src='../Public/Images/'+ idimg;
}
function SwapSatelliteImage(idsub,idimg){
    var div1=document.getElementById(idsub);
	div1.src=idimg;
}
function DisplayData(idsub,data){
	var div1=document.getElementById(idsub);
	if(div1 != null)
	    div1.innerHTML=data;
}

function DisplayEffect2(idsub,idimg,idbtn,colorid){
	var div1=document.getElementById(idsub);
	var div2=document.getElementById(idimg);
	var div3=document.getElementById(idbtn);
	if(div1.style.display=="none"){
		div1.style.display="block";
		div2.src='../Public/Images/darrowrightOn.gif';
		if(colorid==1){
		    div3.className="FloatLeft BlueLinktemp1 PaddItSpecial";
		}
		else if(colorid==2){
		    div3.className="FloatLeft BlueLinktemp2 PaddItSpecialSubLeft";
		}
	}
	else if(div1.style.display=="block"){
		div1.style.display="none";
		div2.src='../Public/Images/darrowright.gif';
		if(colorid==1){
		    div3.className="FloatLeft BlueLinktempH1 PaddItSpecial";
		}
		else if(colorid==2){
		    div3.className="FloatLeft BlueLinktempH2 PaddItSpecialSubLeft";
		}
	}
}

/////////////////////////////////////////////////////////////////////////////
function doClick(buttonName,e)
{
    //the purpose of this function is to allow the enter key to 
    //point to the correct button to click.
    var key;

     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

    if (key == 13)
    {
        //Get the button the user wants to have clicked
        var btn = document.getElementById(buttonName);
        if (btn != null)
        { //If we find the button click it
            btn.click();
            event.keyCode = 0
        }
    }
}

function callPrint(strid)
{
     var prtContent = document.getElementById(strid);
     var WinPrint = window.open('','','left=0,top=0,width=800%,height=600,toolbar=0,scrollbars=0,status=0');
     WinPrint.document.write('<link rel="stylesheet" type="text/css" href="../Public/styles.css">');
     WinPrint.document.write(prtContent.innerHTML);
     WinPrint.document.close();
     WinPrint.focus();
     WinPrint.print();
     WinPrint.close();
     prtContent.innerHTML=strOldOne;
}

///////////////////////////////////////////////////////////////

function checkLink()
{
    var url = document.location.href;
    var found = url.match("Pages");
    if(found == "Pages")
    {
        url = url.replace("Pages", "pages");
        document.location.href = url;
    }
}

///////////////////////////////////////////////////////////////
var redirTime = "3000";
function scroll() {
    self.setTimeout("window.scrollBy(0,300);",redirTime); 
}

function clickLink(linkobj) {
    linkobj = document.getElementById('scroll');
     if (linkobj.getAttribute('onclick') == null) {
          if (linkobj.getAttribute('href')) document.location = linkobj.getAttribute('href');
     }
     else linkobj.onclick();
}

function clickLink1(linkobj) {
    self.setTimeout("clickLink('" + linkobj + "');",redirTime); 
}

function currentYPosition() {
	if (self.pageYOffset)
		 return self.pageYOffset;
	if (document.documentElement && document.documentElement.scrollTop)
		return document.documentElement.scrollTop;
	if (document.body.scrollTop)
		 return document.body.scrollTop;
	return 0;
}
function elmYPosition(eID) {
	var elm  = document.getElementById(eID);
	var y    = elm.offsetTop;
	var node = elm;
	while (node.offsetParent && node.offsetParent != document.body) {
		node = node.offsetParent;
		y   += node.offsetTop;
	} return y;
}
function smoothScroll(eID) {
	var startY   = currentYPosition();
	var stopY    = elmYPosition(eID);
	var distance = stopY > startY ? stopY - startY : startY - stopY;
	if (distance < 100) {
		scrollTo(0, stopY); return;
	}
	var speed = Math.round(distance / 100);
	var step  = Math.round(distance / 25);
	var leapY = stopY > startY ? startY + step : startY - step;
	var timer = 0;
	if (stopY > startY) {
		for ( var i=startY; i<stopY; i+=step ) {
			setTimeout("window.scrollTo(0, "+leapY+")", timer * speed);
			leapY += step; if (leapY > stopY) leapY = stopY; timer++;
		} return;
	}
	for ( var i=startY; i>stopY; i-=step ) {
		setTimeout("window.scrollTo(0, "+leapY+")", timer * speed);
		leapY -= step; if (leapY < stopY) leapY = stopY; timer++;
	}
}

/***********************************************
* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["myframe"]

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller


