var root="";

function ApriPopup(idElem,lingua,stampa){
	window.open(root + '/News_popup.aspx?idElemento=' + idElem + '&lingua=' + lingua + '&stampa=' + stampa,'News','width=600,height=400,scrollbars=yes,toolbar=no,statusbar=no,resizable=yes');
	return false;
}
function InviaAmico(idElem,lingua){
	window.open(root + '/InviaAmico_popup.aspx?idElemento=' + idElem + '&lingua=' + lingua,'InviaAmico','width=600,height=450,scrollbars=yes,toolbar=no,statusbar=no,resizable=yes');
	return false;
}
function ValidaCategorie(oSrc, args){
	args.IsValid=false;
	var input=document.getElementsByTagName("input");
	for (i=0;i<input.length;i++) {
		if (input[i].id.substring(0,21)=="Template_chkCategorie") {
			if (input[i].checked) args.IsValid=true;
		}
	}
}
 function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

document.onmousemove=sM;
document.onmouseup=sU;
var stD=false;
var mX,sMr;
function sD(e){
document.onmousedown=function(){return false;};
document.onselectstart=new Function ("return false");
sMr=document.getElementById("sM");
sMr.style.left=mX-1;
sMr.style.top=document.body.scrollTop;
sMr.style.height=document.body.clientHeight+"px";
sMr.style.display="block";
stD=true;
}
function sU(){
if(stD==false)return;
stD=false;
sMr.style.display="none";
el=document.getElementById("sL");
if(mX-3<50)mX=53;
else if(mX-3>500)mX=503;
el.style.width=mX-20+"px";
document.onselectstart=new Function("return true");
document.onmousedown=function(){return true;};
}
function sM(e){
if(window.event)mX=event.clientX;
else mX=e.pageX;
if(stD==true){
if(mX-1>49&&mX-1<501){sMr.style.left=mX-1;}
}
}
function NewWindow(url, w, h) 
{

// If you place Thumb.aspx in a different directory that your root image directory,
// you will need to add the image directory to url below, like:
// url = "/rootImageDirectory/" + url + ".jpg"

  //url = "fotogallery/" + url ;//+ ".jpg"
  //alert(url);
  if (w > screen.width || h > screen.width)
  {
    if (w > screen.width && h <= screen.height)
    {
      var nw = screen.width - 70;
      var nh = parseInt(h) + 36
    }
    if (h > screen.height && w <= screen.width)
    {
      var nh = screen.height - 70;
      var nw = parseInt(w) + 36
    }
    if (w > screen.width && h > screen.height)
    {
      var nh = screen.height - 70;
      var nw = screen.width - 70;
    }

    window.open(url,"_blank","width=" + nw + ",height=" + nh + ",left=0,top=0,scrollbars=yes,resizable=yes");

  }
  else
  {
    var nh = parseInt(h) + 25;
    var nw = parseInt(w) + 25;
    window.open(url,"_blank","width=" + nw + ",height=" + nh + ",scrollbars=no,resizable=no");
  }
  return false;
}
