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 load() {
      if (GBrowserIsCompatible()) {
        
				var map = new GMap2(document.getElementById("map"));
        		var center = new GLatLng(38.706992, -9.396049);
				map.setCenter(center, 13);
				map.addControl(new GLargeMapControl());
          		//map.addControl(new GMapTypeControl());
		
				var marker = new GMarker(center);
				
				GEvent.addListener(marker, "click", function() {
				  marker.openInfoWindowHtml("<div style='width:200px;font-size:11px;'>Centro Congressos do Estoril<br/>Avenida Amaral<br/>2765 Cascais, Portugal<br/>http://www.estorilcc.com?</div>");
				});
		
				
		
				map.addOverlay(marker);
				
				marker.openInfoWindowHtml("<div style='width:200px;font-size:11px;'>Centro Congressos do Estoril<br/>Avenida Amaral<br/>2765 Cascais, Portugal<br/>http://www.estorilcc.com</div>");
     }
}

function loadvideo(){

	var m=document.getElementById('mask');
	var c=document.getElementById('site');
	var s=document.getElementById('videoholder');
	var v=document.getElementById('videoclose');

	c.style.height="100%";
	c.style.overflow="hidden";
	m.style.display="block";
	s.style.display="block";
	v.style.display="block";
	
	flv="wyrf_2009_promo_final_edit.flv";
	url="http://www.smartartsmedia.com/wyrf/2009eventvideo/";
	var so = new SWFObject(url+"videoplayerhome.swf?r=5&flv="+url+flv, "wyrfvideo", 590, 380, "8", "#FFFFFF");
	so.addParam("wmode", "transparent");
	so.write("videoholder");	

}

function closevideo(){

	var m=document.getElementById('mask');
	var c=document.getElementById('site');
	var s=document.getElementById('videoholder');
	var v=document.getElementById('videoclose');

	c.style.height="auto";
	c.style.overflow="visible";
	m.style.display="none";
	s.style.display="none";
	v.style.display="none";
	

}


function loadflashgallery(gid,iid,r){
	
	var m=document.getElementById('mask');
	var c=document.getElementById('site');
	var s=document.getElementById('flashgallery');

	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, "swfdisplay", 960, 600, "8", "#000000");
	so.write("flashgallery");	
	
}

function closeflashgallery(){
	
	var m=document.getElementById('mask');
	var c=document.getElementById('site');
	var s=document.getElementById('flashgallery');

	c.style.height="auto";
	c.style.overflow="visible";
	m.style.display="none";
	s.style.display="none";
	
	
}

function printflash(swf,w,h,div){
		var so = new SWFObject(swf, "swfdisplay", w, h, "8", "#ffffff");
		so.addParam("wmode", "transparent");
		so.addParam("play", "true");
		so.write(div);	
}

function mouseover(x,value){
	
	x.style.opacity = value/10;
	x.style.filter = 'alpha(opacity=' + value*10 + ')';

}

var totnav=0;

function gettotalheights(tn){
	
	totnav=tn-1;
	//totnavx=totnav;
	
	for(i=1;i<=totnav;i++){
		
		var divh = document.getElementById('subnav'+i).offsetHeight;
		th[i]=divh;
		
		document.getElementById('subnav'+i).style.visibility="visible";
		document.getElementById('subnav'+i).style.height="0px";

	}
	
}


function load_nav(x,id){

	//alert(th[id]);

	if(x==1){
		action[id]='grow';
	}else{
		action[id]='shrink';
	}
	
	if(notstarted==0){
		notstarted=1;
		timer=setTimeout(enterframe,10);
	}

}

notstarted=0;
action=Array();
ch=Array(0,0,0,0,0,0,0,0,0,0,0);
th=Array(0,0,0,0,0,0,0,0,0,0,0);

function enterframe(){
	
	for(i=1;i<=totnav;i++){
	
		if(action[i]=='grow'){
			if(ch[i]<th[i]){
				ch[i]=ch[i]+4;
			}
		}else{
			if(ch[i]>0){
				ch[i]=ch[i]-4;
			}
		}
		
		document.getElementById("subnav"+i).style.height=ch[i]+"px";
	
	}
	
	timer=setTimeout(enterframe,10)
	
}
