var timer = null;
var content1="<table width=\"100%\" border=0 cellspacing=0 cellpadding=3><tr><td style=\"border-right:0px\" class=\"popupbar\">";
var content2="</td><td style=\"border-left:0px\" class=\"popupbar\" align=\"right\"><a href=\"#\" onclick=\"hidepopup(); return false;\" onmouseover=\"window.status='Close Popup'; return true;\" onmouseout=\"window.status='';\"><img src=\"/images/btn_exit.gif\" width=13 height=13 border=0 alt=\"close\"></a></td></tr><tr><td colspan=2 class=\"popupcontent\">";
var content3="</td></tr></table>";

function visible(yes,pevent,contenttitle,content){
	if(document.getElementById||document.all){
		if(document.getElementById){mc=document.getElementById('mca').style; }else if(document.all){mc=document.all['mca'].style;}
	}
	if(!yes){ 
		clearTimeout(timer);
		timer = setTimeout("hidepopup()", 600);
	}else{
		clearTimeout(timer); hidepopup();
		if(document.getElementById){mcx=document.getElementById('mca'); }else if(document.all){mcx=document.all['mca'];}
		mcx.innerHTML = content1+contenttitle+content2+content+content3;
		if(pevent.y||pevent.pageY){ 
			if(pevent.pageY){
				if( ((pevent.pageY-document.body.scrollTop)+mcheight+5) > window.innerHeight){
					ycoord = pevent.pageY - mcheight - 20;
				}else{
					ycoord = pevent.pageY + 8;
				}
				if( ((pevent.pageX-document.body.scrollLeft)+mcwidth+10) > window.innerWidth){
					xcoord = window.innerWidth - mcwidth - 40;
				}else{
					xcoord = pevent.pageX - 15;
				}
			} else {
				if( (pevent.y+mcheight+8) > document.body.offsetHeight){
					ycoord = pevent.y + document.body.scrollTop - mcheight - 20; 
				}else{
					ycoord = pevent.y + document.body.scrollTop + 8; 
				}
				if( (pevent.x+mcwidth+15) > document.body.offsetWidth){
					xcoord = document.body.offsetWidth + document.body.scrollLeft - mcwidth - 40;
				}else{
					xcoord = pevent.x + document.body.scrollLeft + 15;
				}
			} 
			if (xcoord < 2) xcoord = 2; 
			mc.left=xcoord;mc.top=ycoord;
		}
		mc.visibility = "visible"; 
	}
}

function hidepopup(){
	if(document.getElementById){mc=document.getElementById('mca').style; }else if(document.all){mc=document.all['mca'].style;}
	mc.visibility = "hidden";
}

function visibleid(yes){
	if(yes){clearTimeout(timer);}else{clearTimeout(timer);timer = setTimeout("hidepopup()", 600);}  
}

function showphoto(ev,photourl,url){ 
	if(url){
		visible(1,ev,"Cover","<a href=\""+url+"\" onmouseover=\"window.status='Click for more info'; return true;\" onmouseout=\"window.status='';\"><img src=\""+photourl+"\" border=0 alt=\"\"></a>"); 
	}else{
		visible(1,ev,'Cover','<img src="'+photourl+'" border=0 alt="">'); 
	}
}
