
// ==================================================================================================
function openPopWindow(theURL,winName,features) {
   featuresArr = features.split(",");
   for(x=0; x<featuresArr.length; x++){
	 if(featuresArr[x].indexOf("width=") >= 0 ) { winHalf_wsize = featuresArr[x].replace("width=","")/2; }
	 else if(featuresArr[x].indexOf("height=") >= 0){ winHalf_hsize = featuresArr[x].replace("height=","")/2; }
   }
   vcent = screen.availHeight/2;
   ocent = screen.availWidth/2;
   vpos  = vcent-winHalf_hsize;
   opos  = ocent-winHalf_wsize;
   popup = window.open(theURL,winName,features);
   popup.moveTo(opos,vpos);
   popup.focus();
}


//=======================================================================================================================
//Data e Ora
var dNames = new Array("Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato");
var mNames = new Array("Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre");
function updTimer() {
	var divObj = document.getElementById("dspTimer");
	var d = new Date();
	mm = d.getMinutes();
	ss = d.getSeconds();
	if(mm < 10) { mm="0"+mm }
	if(ss < 10) { ss="0"+ss }
	if (document.all){
		txt2dsp = dNames[d.getDay()]+" "+d.getDate()+" "+mNames[d.getMonth()]+" "+d.getYear()+" &loz; "+d.getHours()+":"+mm+":"+ss;
    } else {
		txt2dsp = dNames[d.getDay()]+" "+d.getDate()+" "+mNames[d.getMonth()]+" "+(d.getYear()+1900)+" &loz; "+d.getHours()+":"+mm+":"+ss;
    }

	divObj.innerHTML = txt2dsp
	setTimeout("updTimer()",1000);
}
//=======================================================================================================================

//=======================================================================================================================
//Lock Dx
var message="";

function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")

//=======================================================================================================================
//Lock Img
var clickmessage=""

function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
//alert(clickmessage);
return false;
}
}
}
else if (document.layers) {
if (e.which == 3) {
//alert(clickmessage);
return false;
}
}
else if (document.getElementById){
if (e.which==3&&e.target.tagName=="IMG"){
//alert(clickmessage)
return false
}
}
}

function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}

if (document.all)
document.onmousedown=disableclick
else if (document.getElementById)
document.onmouseup=disableclick
else if (document.layers)
associateimages()


//=======================================================================================================================
function stmfla(nome,larghezza,altezza,trasparenza,bgcolor,menu,nomediv,position,ptop,pleft,pright,liv){
//stmfla("swf/simbruina_stagna_cooming.swf",380,180,"transparent","#null","false","fla01","relative",0,0,0,1)

document.write ('<div id="'+nomediv+'" '
+ ' style="background-color:'+ bgcolor +';'
+ ' visibility:visible; '      
+ ' position:'+ position +'; '  //absolute|relative
+ ' top: '+ ptop +'; '         //numeric
+ ' left:'+ pleft +'; '        //numeric
+ ' right:'+ pright +'; '      //numeric
+ ' width: ' + larghezza + ' ;' 
+ ' height:' + altezza + ';'
+ ' z-index:' + liv + '">'     //numeric pos 1..9999

//nome = nome file completo di estenzione
//larghezza = px
//altezza = px
//trasparenza = transparent se vero | se falso null
//bgcolor = se vero #hex | se falso null
//menu = true|false
+ '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
+'codebase="http://download.macro....................................sh.cab#version=5,0,0,0" '
+'WIDTH=' + larghezza + ' HEIGHT=' + altezza + '> '
+'<PARAM NAME=movie VALUE="'  + nome + '"> '
+'<PARAM NAME=quality VALUE=high> '
+'<PARAM NAME=bgcolor VALUE='+ bgcolor +'> '
+'<param name="wmode" value="' + trasparenza + '"> '
+'<PARAM NAME=menu VALUE='+ menu +'> '
+'<EMBED src="' + nome + '" quality=high menu='+ menu +' bgcolor='+ bgcolor +' WIDTH='
+ larghezza + ' HEIGHT=' + altezza
+' TYPE="application/x-shockwave-flash" wmode="' + trasparenza + '"'
+'PLUGINSPAGE="http://www.macromedia.com/shockwave/download"> '
+'</EMBED></OBJECT></DIV>');
}

//=======================================================================================================================
//Random BG 
function bgrandom(){
var Immagini = new Array();
Immagini[0] = "images/bg/01.gif";
Immagini[1] = "images/bg/02.gif";
Immagini[2] = "images/bg/03.gif";
Immagini[3] = "images/bg/04.gif";
Immagini[4] = "images/bg/05.gif";


var rdn = Math.floor(Math.random() * Immagini.length);
document.write("<body background=" + Immagini[rdn] + " >");
}
//=======================================================================================================================