var rootURL = "http://localhost/personal/volleypiave"
//var rootURL = "http://www.volleypiave.it"
NomiGiorni  = new Array("Domenica","Lunedė","Martedė","Mercoledė","Giovedė","Venerdė","Sabato");
var imgmode = "logo"
var defaultSiteMessage = "Volley Piave Official Web Site\n"

// ==================================================================================================
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;
   var popup = window.open(theURL,winName,features);
   popup.moveTo(opos,vpos);
   popup.focus();
   return popup;
}
// ==================================================================================================
function displayStatusMsg(msg){
// ==================================================================================================
	if(msg=="") {
		window.status = "Volley Piave Official Web Site";
	} else {
		window.status = msg;
	}
	return true;
}
// ==================================================================================================
function controllaEmail(StrMail){
// ==================================================================================================
	msg = "L'indirizzo email inserito non sembra essere valido, controlla i dati e riprova";
	if (StrMail.length>6) {
		var pos;
		var dotpos;
		pos = StrMail.indexOf("@");
		if ( (pos >= (StrMail.length-3) ) || (pos < 2) ) {
			alert(msg);
			return (false);
        }
      	pos=pos+1;
      	dotpos = StrMail.indexOf(".", pos);
      	if (dotpos > (StrMail.length-3) ) {
			alert(msg);
        	return (false);
        }
      	Strmail=StrMail.substr(pos);
		if ( (StrMail.length < 5) || (dotpos <= 0) ){
			alert(msg);
        	return (false);
        }
	} else {
		alert(msg);
		return (false);
	}
    return true;
}
// ==================================================================================================
function right(e) {
// Funzione che riproduce il messaggio di alert in caso di uso del tasto destro del mouse
// ==================================================================================================
	 if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) { return false }
	 else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
		alert("L'utilizzo del tasto destro del mouse č stato disabilitato.\n\nCopyright Volley Piave");
	  	return false;
	 }
	 return true;
}
//if (document.layers) window.captureEvents(Event.MOUSEDOWN);
//window.onmousedown   = right;
//document.onmousedown = right;

// =========================================================================================================================
function printFlashActiveX(swfFileUrl,width,height,flashvars,objName) {
// =========================================================================================================================
	acX = "";
	acX = acX+"<embed src='"+rootURL+"/"+swfFileUrl+"' quality='high' bgcolor='#000000' WIDTH='"+width+"' HEIGHT='"+height+"' NAME='"+objName+"' ALIGN TYPE='application/x-shockwave-flash' PLUGINSPAGE='ttp://www.macromedia.com/go/getflashplayer'>\n";
	document.write(acX)
}
// =========================================================================================================================
function printWmActiveX(WmFileUrl,width,height,objName) {
// =========================================================================================================================
	fileUrl = WmFileUrl
	document.write('<object classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" type="application/x-oleobject" width="'+width+'" height="'+height+'" standby="Loading Microsoft Windows Media Player components..." id="focusplayer">');
	document.write('<param name="url" value="'+fileUrl+'" />');
	document.write('<param name="AutoStart" value="true" />');
	document.write('<param name="ShowControls" value="1" />');
	document.write('<param name="uiMode" value="full" />');
	document.write('<embed src="'+fileUrl+'" width="'+width+'" height="'+height+'" autostart="true" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" filename="'+fileUrl+'" showcontrols="1" showstatusbar="False" showdisplay="True" autorewind="false" url="'+WmFileUrl+'" uimode="full"></embed>');
	document.write('</object>');

}

// =========================================================================================================================
function contaCaratteri(obj,objdsp,maxlen) {
	/* ===============================================================================================
	Funzione per il conteggio dei caratteri inseriti in un campo di input (textarea e text) 
	la funzionč vā applicata sugli evento 'onKeyPress' e/o 'onKeyUp' restituendo un messagio di alert
	quando si raggiunge il numero massimo di caratteri disponibili.

	es di utilizzo: onKeyPress="return contaCaratteri(this,'chrcount',200)"
	obj    = (this) textarea o text dove č associata la funzione
	objdsp = ('chrcount') nome del campo di input dove visualizzare i caratteri disponibili 
			 Se impostato a 0 (zero) identifica che nel documento non esiste il campo di visualizzazione
	maxlen = (200) Numero massimo di caratteri che č possibile inserire.
	=============================================================================================== */
	if(!obj||!maxlen||isNaN(maxlen)) { 
		alert(errorFuncMessage+"'obj' or 'maxlen' not valid!");
		return false;
	}  
	var curlen = obj.value.length;
	if(curlen>=maxlen){	
		alert(defaultSiteMessage+"Hai raggiunto il numero massimo di caratteri disponibili per questo campo."); 
		obj.focus(); 
		return false; 
	}
	if(objdsp==0){ 
		return true;
	} else {
		chrleft = (maxlen-curlen)-1;
		document.getElementById(objdsp).value=chrleft;
		return true;
	}
}
// =========================================================================================================================
function BloccaPulsantiForm(formobj) {
	/* ===============================================================================================
	Funzione che blocca TUTTI i pulsanti di un form
	=============================================================================================== */
	for(i=0;i<formobj.length;i++) {
		if(formobj.elements[i].type=="button" || formobj.elements[i].type=="image" || formobj.elements[i].type=="reset" || formobj.elements[i].type=="submit") {	
			formobj.elements[i].disabled = true; 
		}
	}
}


