//windows.focus();

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}

function set_title_height(h){
	h=h-5;
	document.getElementById('flashtitle').style.height=h+"px";
}

function get_url(x){
	window.location.href=x;
}

function printflash(swf,w,h,div){
		var so = new SWFObject(swf, "flash-animations", w, h, "8", "#ffffff");
		so.addParam("wmode", "transparent");
		so.addParam("allowScriptAccess", "always");
		so.write(div);	
}

function mouseover(x,value){
	
	x.style.opacity = value/10;
	x.style.filter = 'alpha(opacity=' + value*10 + ')';
	
	if(value==9) x.style.borderColor="#EEEEEE";
	else x.style.borderColor="#CCCCCC";
}


function loadflashgallery(r,gid,iid,type){
	
	var m=document.getElementById('mask');
	var c=document.getElementById('holder');
	var s=document.getElementById('gallery');

	c.style.height="100%";
	c.style.overflow="hidden";
	m.style.display="block";
	s.style.display="block";
	
	var so = new SWFObject("/media/gallery.swf?r="+r+"&www=/&gallid="+gid+"&iid="+iid+"&type="+type, "swfdisplay", 900, 600, "8", "#000000");
	so.write("gallery");	
	
	
}

function closeflashgallery(){
	
	var m=document.getElementById('mask');
	var c=document.getElementById('holder');
	var s=document.getElementById('gallery');

	c.style.height="auto";
	c.style.overflow="visible";
	m.style.display="none";
	s.style.display="none";
	
	
}

tmrset=0;
dnh=0;
dropheight=0;

function showdropnav(){
		
	document.getElementById('dropnavcell').style.backgroundColor="#002942";
	document.getElementById('dropnav').style.display="block";
	document.getElementById('dropnavcelltl').style.display="block";
	document.getElementById('dropnavcelltr').style.display="block";
	document.getElementById('dropdownlink').style.color="#FFFFFF";
	
	if(tmrset==1) { clearTimeout(tmr); tmrset=0; }
	
	dngtmr=setTimeout(growdropnav,20);
	
}

function growdropnav(){
	
	if(dnh<dropheight){
	
		dnh=dnh+10;
		document.getElementById('dropnav').style.height=dnh+"px";
	
	 	dngtmr=setTimeout(growdropnav,20);
	
	}
}

function tmrdropnav(){
	
	if(tmrset==0){
		//alert("SET");
		tmr=setTimeout(hidedropnav,1000);
		tmrset=1;	
	}
	
}

function hidedropnav(){

	clearTimeout(tmr);
	tmrset=0;
	
	document.getElementById('dropdownlink').style.color="#F5B892";
	document.getElementById('dropnavcell').style.backgroundColor="#EA7125";
	document.getElementById('dropnav').style.display="none";
	document.getElementById('dropnavcelltl').style.display="none";
	document.getElementById('dropnavcelltr').style.display="none";

	dnh=0;
	document.getElementById('dropnav').style.height=dnh+"px";
}


ht=Array();
cht=Array();

function get_heights(t){
	
	for(i=0;i<=t;i++){
			cht[i]=0;
			ht[i]=document.getElementById('grp'+i).offsetHeight;
			document.getElementById('grp'+i).style.height="0px";
	}

}

function ini_dlgrp(x){
	
	//alert(ht[x]);
	
	if(cht[x]==0){
		
		growgrp(x);
		//document.getElementById('txt'+x).innerHTML="-";
		
	}else{
		
		shrinkgrp(x);
		//document.getElementById('txt'+x).innerHTML="+";
		
	}
	
}

function growgrp(x){

	d=document.getElementById('grp'+x);

	if((cht[x]+10)<ht[x]){
	
		cht[x]=cht[x]+10;
		d.style.height=cht[x]+"px";
		growtimer=setTimeout(function(){ growgrp(x) },10)
	
	}else{
		
		cht[x]=ht[x];	
		d.style.height=ht[x]+"px";
	
	}

}

function shrinkgrp(x){

	d=document.getElementById('grp'+x);

	if((cht[x]-10)>0){
	
		cht[x]=cht[x]-10;
		d.style.height=cht[x]+"px";
		shrinktimer=setTimeout(function(){ shrinkgrp(x) },10)
	
	}else{
		
		cht[x]=0;	
		d.style.height="0px";
	
	}

}
