﻿function SetOpacity(object,opacityPct)
{
  // IE.
  object.style.filter = 'alpha(opacity=' + opacityPct + ')';
  // Old mozilla and firefox
  object.style.MozOpacity = opacityPct/100;
  // Everything else.
  object.style.opacity = opacityPct/100;
}
function ChangeOpacity(id,msDuration,msStart,fromO,toO)
{
  var element=document.getElementById(id);
  var opacity = element.style.opacity * 100;
  var msNow = (new Date()).getTime();
  opacity = fromO + (toO - fromO) * (msNow - msStart) / msDuration;
  if (opacity<0) 
    SetOpacity(element,0)
  else if (opacity>100)
    SetOpacity(element,100)
  else
  {
    SetOpacity(element,opacity);
    element.timer = window.setTimeout("ChangeOpacity('" + id + "'," + msDuration + "," + msStart + "," + fromO + "," + toO + ")",1);
  }
}
function FadeIn(id)
{
  var element=document.getElementById(id);
  if (element.timer) window.clearTimeout(element.timer); 
  var startMS = (new Date()).getTime();
  element.timer = window.setTimeout("ChangeOpacity('" + id + "',1000," + startMS + ",0,100)",1);
}
function FadeOut(id)
{
  var element=document.getElementById(id);
  if (element.timer) window.clearTimeout(element.timer); 
  var startMS = (new Date()).getTime();
  element.timer = window.setTimeout("ChangeOpacity('" + id + "',1000," + startMS + ",100,0)",1);
}
function FadeInImage(foregroundID,newImage,backgroundID)
{
  var foreground=document.getElementById(foregroundID);
  if (backgroundID)
  {
    var background=document.getElementById(backgroundID);
    if (background)
    {
      background.style.backgroundImage = 'url(' + foreground.src + ')';
      background.style.backgroundRepeat = 'no-repeat';
    }
  }
  SetOpacity(foreground,0);
  foreground.src = newImage;
  if (foreground.timer) window.clearTimeout(foreground.timer); 
  var startMS = (new Date()).getTime();
  foreground.timer = window.setTimeout("ChangeOpacity('" + foregroundID + "',1000," + startMS + ",0,100)",10);
}

function hideDiv(pass) { 
	var divs = document.getElementsByTagName('div'); 
	for(i=0;i<divs.length;i++){ 
		if(divs[i].id.match(pass)){//if they are 'see' divs 
			if (document.getElementById) // DOM3 = IE5, NS6 
			divs[i].style.visibility="hidden";// show/hide 
			else 
				if (document.layers) // Netscape 4 
				document.layers[divs[i]].display = 'hidden'; 
				else // IE 4 
				document.all.hideShow.divs[i].visibility = 'hidden'; 
		} 
	} 
}

function showDiv(pass) { 
	var divs = document.getElementsByTagName('div'); 
	for(i=0;i<divs.length;i++){ 
		if(divs[i].id.match(pass)){ 
			if (document.getElementById) 
			divs[i].style.visibility="visible"; 
			else 
				if (document.layers) // Netscape 4 
				document.layers[divs[i]].display = 'visible'; 
				else // IE 4 
				document.all.hideShow.divs[i].visibility = 'visible'; 
		} 
	} 
} 
//we show the box by setting the visibility of the element and incrementing the height smoothly
function ShowBox(cover, span, title, hh)
{
	//Depending on the amount of text, set the maximum height here in pixels
	//hh = 64;
	obj = document.getElementById(cover);
	whiteboxspanid = document.getElementById(span);
	whiteboxtitleid = document.getElementById(title);
	
	obj.style.visibility = 'visible';	
	whiteboxspanid.style.height = 'auto';
	obj.style.height = hh + 'px';
	
	whiteboxspanid.style.visibility = 'visible';
	whiteboxspanid.style.display = 'block';
	whiteboxtitleid.style.visibility = 'visible';
	
	return;
}
function HideBox(cover, span, title, hh)
{
	obj = document.getElementById(cover);
	whiteboxspanid = document.getElementById(span);
	whiteboxtitleid = document.getElementById(title);
 
	whiteboxspanid.style.visibility = 'hidden';
	whiteboxtitleid.style.visibility = 'hidden';
 
    obj.style.height = hh + 'px';
    
	obj.style.visibility = 'hidden';
	whiteboxtitleid.style.height = 0;
	whiteboxspanid.style.height = 0;
	return;	
}

/*function ShowBox2()
{
//Depending on the amount of text, set the maximum height here in pixels
	if(hh2==64)
	{
	whiteboxspanid.style.visibility = 'visible';
	whiteboxspanid.style.display = 'block';
	whiteboxtitleid.style.visibility = 'visible';
	//closeid.style.visibility = 'visible';		
	clearInterval(inter2);
	inter2 = 0;
	return;	
	}
 
	obj = document.getElementById("whiteboxcover2");
	whiteboxspanid = document.getElementById("whiteboxspan2");
	whiteboxtitleid = document.getElementById("whiteboxtitle2");
	//closeid = document.getElementById("closerate");
	//obj.style.backgroundColor = '#FFFFFF';//Added
	obj.style.visibility = 'visible';	
	whiteboxspanid.style.height = 'auto';
	
	hh2+=2;
	obj.style.height = hh2 + 'px';
}*/

/*function HideBox()
{
	obj = document.getElementById("whiteboxcover");
	whiteboxspanid = document.getElementById("whiteboxspan");
	whiteboxtitleid = document.getElementById("whiteboxtitle");
	//closeid = document.getElementById("closerate");	
 
	whiteboxspanid.style.visibility = 'hidden';
	whiteboxtitleid.style.visibility = 'hidden';
	//closeid.style.visibility = 'hidden';
 
	if(hh==2)
	{
	obj.style.visibility = 'hidden';
	//obj.style.backgroundColor = 'transparent';//Added
	whiteboxtitleid.style.height = 0;
	//closeid.style.height = 0;
	whiteboxspanid.style.height = 0;
	clearInterval(inter);
	return;
	}
	hh-=2;
	obj.style.height = hh + 'px';
}*/
