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 map_fs(){
	
	m=document.getElementById('map');
	
	m.style.top="0px";
	m.style.left="0px";
	m.style.marginLeft="0px";
	m.style.width="100%";
	m.style.height="100%";
	
	var c=document.getElementById('holder');

	c.style.height="100%";
	c.style.overflow="hidden";
}


function vote(v){
	
	document.getElementById('formrating').value=v;
	document.formvote.submit();
	
}

tp=0;
function viewplates(){
	
	if(tp<100) tp=tp+10;
	
	var s=document.getElementById('site');
	s.style.top=tp+"px";
	
	if(tp<100) vptmr=setTimeout(viewplates,10);
	
}


he=0;
function showlogin(){
	
	if(he<150) he=he+10;
	
	var lp=document.getElementById('loginpopup');
	
	lp.style.height=he+"px";
	lp.style.display="block";

	if(he<150) lptmr=setTimeout(showlogin,10);
	
}


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.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";
	
	
}



platekey=0;

function uploadcomplete(){
	
	var plate=document.getElementById("platenum").value;
	var userid=document.getElementById("userid").value;
	var userip=document.getElementById("userip").value;
	

	xmlHttp=GetXmlHttpObject();
	var url="inc/saveplate.php?userid="+userid+"&userip="+userip+"&platekey="+platekey+"&plate="+plate;
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", url.length);
	xmlHttp.send(null);
	

	
}

function stateChanged() { 
	if (xmlHttp.readyState==4){ 
		if(xmlHttp.responseText=="OK"){
			window.location.href="upload_plate_complete.html?id="+platekey
		}else{
			window.location.href="error.php";
		}
	}
}


function GetXmlHttpObject(){

	var xmlHttp=null;
	
	try {
	  xmlHttp=new XMLHttpRequest();
	}catch (e){
	  	try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	   	}catch (e){
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	   }
	}
	return xmlHttp;
	
}
