/***********************************************
* Dynamic Resource Centre animation script- © Open iWorld (www.openiworld.com)
* Written by Chris Sylvester - not to be copied without prior written permission
* Contact Chris Sylvester at www.openiworld.com/contact.php for details
***********************************************/

y='';
size=0 // Initial size.
function expand_boxes(){ 
clearTimeout(myTimer);
  if(size<225) { //If box is not fully expanded
	clearTimeout(myTimer);
    size+=25; // increase selected box by 25 pixels on each loop
	shrinker=225;
	shrinker-=size; // decrease expanded box by same amount as growing box

for (var i=1; i<=7; i++){
		if(y!='menu'+i+'_window' && document.getElementById("menu"+i+"_window").style.height!='0px'){
		document.getElementById("menu"+i+"_window").style.height=shrinker+"px";
		document.getElementById(y).style.height=size+"px";
		}
	}
	clearTimeout(myTimer);
    myTimer=setTimeout("expand_boxes()", 10); 
  }
  else
    size=0 //reset box size
}
function id_sender(x){

y=x;
	if(document.getElementById(x).style.height=="0px"){
		myTimer=setTimeout("expand_boxes()", 750);
	}
} 


var base=0
function gradinc(fadeobj){
	//alert (document.getElementById("info_panel"));
	imgobj=fadeobj
	browser=fadeobj.filters? "ie" : typeof fadeobj.style.MozOpacity=="string"? "mozilla" : ""
	instantset(base)
	highlighting=setInterval("fade(imgobj)",50)
}

function graddec(fadeobj){
	cleartimer()
	instantset(base)
}

function instantset(degree){
	if (browser=="mozilla")
	imgobj.style.MozOpacity=degree/100
	else if (browser=="ie")
	imgobj.filters.alpha.opacity=degree
}

function cleartimer(){
	if (window.highlighting) clearInterval(highlighting)
}

function fade(incr){
	if (browser=="mozilla" && incr.style.MozOpacity<1)
	incr.style.MozOpacity=Math.min(parseFloat(incr.style.MozOpacity)+0.2, 0.99)
	else if (browser=="ie" && incr.filters.alpha.opacity<100)
	incr.filters.alpha.opacity+=25
	else if (window.highlighting)
	clearInterval(highlighting)
}
