// JavaScript Document
/* l'ha scritto il Bazz. */

pp_background_image=""; //"url(http://extranet.websolute.it/ws2006/desk_screen/ws_liquidGlass_1024.jpg)";
pp_background_color="#678"; // "#666"
pp_bg_opacity=50;
client_y=0;
mouse_y=0;
function add_popup(){
out="<div id=\"sotto\" style=\"display:none;-moz-opacity:" + pp_bg_opacity/100 + ";filter: alpha(opacity=" + pp_bg_opacity + "); position:absolute;z-index:10;width:100%;height:2000px;left:0;top:0;background: " + pp_background_image + "  " + pp_background_color + ";\"></div>";
	out=out+"<div id=\"sopra\" style=\"display:none; position:absolute;z-index:10;width:100%;height:100%;left:0;top:0;\">";
	out=out+"<table width=\"100%\" id=\"js_tbl_wrapper\"><tr><td valign=\"middle\" align=\"center\" onclick=\"chiudi_popup();\">";
	out=out+"<table id=\"finestra\" cellspacing=\"0\" cellpadding=\"0\" >";
	out=out+"<tr><th align=\"left\"><div id=\"titolo_finestra\"></div></th><th align=\"right\"><a href=\"javascript:chiudi_popup();\" title=\"Chiudi\"><img src=\"required_images/chiudi.gif\" id=\"js_img_zoom\" alt=\"Chiudi\" border=\"0\" /></a></th></tr>";
	out=out+"<tr><td colspan=\"2\">";
	out=out+"<div id=\"popup_content\"></div>";
	out=out+"</td></tr></table>";
	out=out+"</td></tr></table>";
	out=out+"</div>";
	document.write(out);
	document.body.setAttribute("onmouseup","if (window.event){mouse_y=window.event.pageY;client_y=window.event.clientY;} else {mouse_y=event.pageY;client_y=event.clientY;}");
	if(document.body.attachEvent)document.body.attachEvent("onmouseup",set_window_position);
	if(document.body.addEventListener)document.body.addEventListener("onmouseup",set_window_position)
	document.body.onmouseup="if (window.event){mouse_y=window.event.pageY;client_y=window.event.clientY;} else {mouse_y=event.pageY;client_y=event.clientY;}"
}
function set_window_position(){
	if (window.event){
		mouse_y=window.event.pageY;client_y=window.event.clientY;
	} else {
		mouse_y=event.pageY;client_y=event.clientY;
	}
}
function show_img(type,f_url,titol,pph,ppw){
	//alert(params[3]);
	bg_div=document.getElementById('sotto');
	img_div=document.getElementById('sopra');
	pp_content=document.getElementById('popup_content');
	span_title=document.getElementById('titolo_finestra');
	span_title.innerHTML=titol;
	if(type=="img"){
		pp_content.innerHTML="<img src=\"\" id=\"img_sopra\" />";
		img_sup=document.getElementById('img_sopra');
		img_sup.src=f_url;
	}else if(type=="flash"){
		the_obj="<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"" + ppw + "\" height=\"" + pph + "\">";
  		the_obj=the_obj+"<param name=\"movie\" value=\"" + f_url + "\" />";
  "<param name=\"quality\" value=\"high\" />";
  		the_obj=the_obj+"<embed src=\"" + f_url + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + ppw + "\" height=\"" + pph + "\"></embed>";
  		the_obj=the_obj+"</object>";
		pp_content.innerHTML=the_obj;
	}else if(type=="iframe"){
		pp_content.innerHTML="<iframe src=\"\" id=\"iframe_sopra\" width=\"" + ppw + "\" height=\"" + pph + "\"></iframe>";
		//alert(pp_content.innerHTML);
		ifr_sup=document.getElementById('iframe_sopra');
		ifr_sup.src=f_url;
	}
	bg_div.style.display='block';
	img_div.style.display='block';
	if(type="img" && mouse_y>0){
		img_div.style.height=document.height+"px";
		bg_div.style.height=document.height+"px";
		document.getElementById("js_tbl_wrapper").style.position="absolute";
		document.getElementById("js_tbl_wrapper").style.top=(mouse_y - (document.getElementById("js_img_zoom").style.height/2) - client_y)+"px";
	}else{
		document.getElementById("js_tbl_wrapper").height="100%";
		window.location="#";
	}
	bg_div.style.width=document.body.clientWidth;
	img_div.style.width=document.body.clientWidth;
}
function chiudi_popup(){
	bg_div=document.getElementById("sotto");
	bg_div.style.display="none";
	img_div=document.getElementById('sopra');
	img_div.style.display="none";
	
}
add_popup();
