function OpenZoomKeypointsWindow(v_strIdLanguage, v_strIdImage,v_strQueryString){
	var l_strZoomPageUrl = "";
	l_strZoomPageUrl = "tools/keyPoints/zoom.asp?lng=" + v_strIdLanguage + "&i=" + v_strIdImage + (v_strQueryString!=null?"&"+v_strQueryString:"");

	window.open(l_strZoomPageUrl,"zoomImage","dependent=yes,Height=0,Width=0,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,titlebar=yes,toolbar=no");
}

function openCredits(v_intIdLanguage){
	window.open("credits.htm","Credits","dependent=yes,Height=140,Width=320,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=yes,toolbar=no");
}

function OpenImageZoomWindow(v_strIdImage,v_strTitle,v_strCharatteristics){
	var l_strZoomPageUrl = "";
	l_strZoomPageUrl = "tools/ZoomWindow.aspx?img=" + v_strIdImage + "&title=" + escape(v_strTitle) + "&chrt=" + escape(v_strCharatteristics);
	
	window.open(l_strZoomPageUrl,"zoomImage","dependent=yes,Height=0,Width=0,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=yes,toolbar=no");
}

function OpenZoomWindow(sImg,sTitle,sWidth,sHeight,sClose){
	if(sClose==null) sClose = "close";
	var oWin = window.open('','','status=0,scrollbars=0,height='+(sHeight/1+17)+'px,width='+sWidth+'px');
	var sHtml = '<html>\n';
	sHtml += '<head><title>' + sTitle + '</title>\n';
	sHtml += '<style type=\"text/css\">\n';
	sHtml += '.fntDefault { text-decoration: none; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #514C3C }\n';
	sHtml += '</style>\n</head>\n';
	sHtml += '<body bgcolor=\"#ffffff\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\n';
	sHtml += '<table width=\"100%\" height=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n';
	sHtml += '<tr><td align=\"center\" valign=\"middle\"><img border=\"0\" src=\"'+sImg+'\"></td></tr>\n';
	sHtml += '<tr height=\"2\"><td bgcolor=\"#EBEAE5\"><img src=\"img/np.gif\" height=\"2\"></td></tr>\n';
	sHtml += '<tr height=\"15\"><td bgcolor=\"#F8F7F1\" align=\"right\" valign=\"middle\" class=\"fntDefault\"><a class=\"fntDefault\" href=\"javascript:window.close()\">' + sClose + '</a>&nbsp;&nbsp;</td></tr>\n';
	sHtml += '</table>\n';
	sHtml += '</body>\n';
	sHtml += '</html>';
	oWin.document.write(sHtml);
}

function WindowPrint(){
	window.print();
}

function OpenPrintWindow(v_strURLPrint){
	var oWin = window.open(v_strURLPrint,'winPrint','status=0,scrollbars=1,width=590px,height=400px');
	oWin.focus();
}
function LoadDataToPrint(){
	var strId = 'tdPrint';
	var objSource = window.opener.document.getElementById(strId);
	var objDest = window.document.getElementById(strId);
	objDest.innerHTML = objSource.innerHTML;
}

function swapImgRestore() {
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}


function findObj(n, d) {
  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=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function swapImage() {
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function calcCharLeft() {
	var msgLen;
	var MaxLength;
	MaxLength = 160;
	msgLen=document.getElementById("sms_idSMSMessage").value.length;

	if (msgLen >= MaxLength ){		
		document.getElementById("sms_idCharsleft").value= "0";
		window.alert("Il messaggio puo' contenere massimo " + MaxLength + " caratteri.");
		document.getElementById("sms_idSMSMessage").value=document.getElementById("sms_idSMSMessage").value.substring(0,MaxLength);
	}else{
		document.getElementById("sms_idCharsleft").value = MaxLength - msgLen;
	}
}

function openWinSMS(){
	window.open("toolsAR/sms/invioSMS.aspx","SMS","Height=200,Width=250,location=no,menubar=no,resizable=no,scrollbars=no,titlebar=yes,toolbar=no");
}

