
switch(navigator.appName){case"Netscape":var Browser="NS";break;default:var Browser="IE";break;}
function number_format(N,NDec){switch(arguments.length){case 2:var DecSep=",";var MigSep=".";break;case 3:var DecSep=arguments[2];var MigSep=".";break;case 4:var DecSep=arguments[2];var MigSep=arguments[3];break;}
var intero=Math.round(N);if(intero==N){var S=String(N);var SDec=DecSep;for(var I=0;I<NDec;I++)SDec+="0";}else{var S=String(N)+DecSep;var SDec=String(intero-N);SDec=SDec.substr(SDec,2);var SMigliaia=String(Math.pow(10,NDec));SMigliaia=SMigliaia.substr(1);SDec+=SMigliaia;SDec=DecSep+SDec.substr(0,NDec);S=String(intero);}
if(S.length>3)
for(I=S.length-3;I>0;I=I-3){S=S.substr(0,I)+MigSep+S.substr(I);}
S+=SDec;return S;}
function TestoLayer(idDiv,testo){if(document.getElementById)
document.getElementById(idDiv).innerHTML=testo;if(document.layers){document.layers[idDiv].document.write(testo);document.layers[idDiv].document.close();}}
function Centered(W,H){var X=screen.width/2-W/2;var Y=screen.height/2-H/2;switch(Browser){case"IE":return"left="+X+", top="+Y;break;default:return"screenX="+X+", screenY="+Y;break;}}
function ViewLayer(LayerName,View){if(document.getElementById){if(View){var SView="visible";}else{var SView="hidden";}
eval("document.getElementById(\""+LayerName+"\").style.visibility = \""+SView+"\"");}else{if(document.layers){if(View){var SView="show";}else{var SView="hidden";}
document.layers[LayerName].visibility=SView;}else{if(document.all){if(View){var SView="visible";}else{var SView="hidden";}
eval("document.all."+LayerName+".style.visibility = \""+SView+"\"");}}}}
function StatusBarScroll(){if(window.status>100){var WinStatus=window.status;window.status=WinStatus.substr(1)+WinStatus.substr(0,1)
setTimeout("StatusBarScroll()",150);}}
function VerifyEmail(email){if(email.length>=5){for(var i=0,nAt=0,pAt=0,pPt=0;i<email.length;i++){switch(email.substr(i,1)){case"@":nAt++;pAt=i;break;case".":pPt=i;break;}}
if(nAt!=1){return false;}else{if(pPt>pAt){return true;}else{return false;}}}else{return false;}}
function Explode(Sep,Str){var NVal=0;var SubS="";for(var I=0;I<Str.length;I++){if(Str.substr(I,1)==Sep){if(NVal==0){var A=new Array(1);A[0]=SubS;}else{A[A.length]=SubS;}
SubS="";NVal++;}else{SubS=SubS+Str.substr(I,1)}}
if(SubS.length>0){if(NVal==0){var A=new Array(1);A[0]=SubS;}else{A[A.length]=SubS;}}
return A;}
function Implode(Sep,Ar){var S="";for(var I=0;I<Ar.length;I++){if(S==""){S=Ar[I];}else{S=S+Sep+Ar[I];}}
return S;}
function in_array(A,What){var Found=-1;if((A!="")&&(typeof(A)!="undefined")){if(A.length>0){for(var I=0;(I<A.length)&&(Found==-1);I++){if(A[I]==What){Found=I;}}}}
return Found;}
function Replace(Dove,Cosa,Con){if((Dove!="")&&(Cosa!="")){var I=0;do{if(Dove.substr(I,Cosa.length)==Cosa){Dove=Dove.substr(0,I)+Con+Dove.substr(I+Cosa.length);}
I++;}while(I<Dove.length);}
return Dove;}
function ViewPreview(PathImg,Width,Height){switch(arguments.length){case 3:var Title="";var BGColor="";var PathWin="";break;case 4:var Title=arguments[3];var BGColor="";var PathWin="";break;case 5:var Title=arguments[3];var BGColor=arguments[4];var PathWin="";break;case 6:var Title=arguments[3];var BGColor=arguments[4];var PathWin=arguments[5];break;}
if(BGColor.substr(0,1)=="#")BGColor=BGColor.substr(1);switch(Browser){case"IE":var WinWidth=Width+10;var WinHeight=Height+29;var Resizable="no";break;default:var WinWidth=Width;var WinHeight=Height;var Resizable="yes";break;}
var ScrollBars="no";if(WinWidth>window.screen.availWidth){ScrollBars="yes";WinWidth=window.screen.availWidth;}
if(WinHeight>window.screen.availHeight){ScrollBars="yes";WinHeight=window.screen.availHeight;}
var ScreenX=Math.ceil((screen.width/2)-(WinWidth/2));var ScreenY=Math.ceil((screen.height/2)-(WinHeight/2));switch(Browser){case"IE":ScreenX="left="+ScreenX;ScreenY="top="+ScreenY;break;default:ScreenX="ScreenX="+ScreenX;ScreenY="ScreenY="+ScreenY;break;}
PathImg=Replace(PathImg,"/","%2F");var WinPreview=window.open(PathWin+"?Img="+PathImg+"&Title="+Title+"&BGColor="+BGColor+"&MaxWinHeight="+window.screen.availHeight+"&MaxWinWidth="+window.screen.availWidth+"&Resizable="+Resizable,"WinPreview","menubar=no,personalbar=no,toolbar=no,resizable="+Resizable+",width="+WinWidth+",height="+WinHeight+",scrollbars="+ScrollBars+","+ScreenX+","+ScreenY);}
