// JavaScript Document

/*function flashtopleft(){
	var flashobject = document.getElementById("header");
	var contentobj = document.getElementById("textcontainer");
	
	/*	var top=flashobject.style.top;
	alert(top)
	var xPosition1=(screen.width-990)/2 - 1;*/
/*	var xpos=findPosX(flashobject);
	xpos=xpos+(360*1);
	contentobj.style.top="-10px";
	contentobj.style.left=xpos+438+35+"px";
	contentobj.style.display='block';
}*/

/*function flashtopleft(){
	var obj=document.getElementById("flash");
	var leftPos=findPosX(obj);
	leftPos=leftPos+800;
	var topPos=findPosY(obj);
	
	document.getElementById('textcontainer').style.display="block";
	document.getElementById('textcontainer').style.left=leftPos+"px";
	document.getElementById('textcontainer').style.top=topPos+"px";
	
	if(window.filmstrippositioner){
		filmstrippositioner();
	}
}*/

function flashtopleft(){
	var obj=document.getElementById("flash");
	var leftPos=findPosX(obj);
	leftPos=leftPos+800;
	var topPos=findPosY(obj);
	
	document.getElementById('textcontainer').style.display="block";
	document.getElementById('textcontainer').style.left=leftPos+"px";
	document.getElementById('textcontainer').style.top=topPos+"px";
	
	var subcontest=document.getElementById("menu");
	var leftsubcontest=findPosX(subcontest);

	document.getElementById("concorsi-menu").style.left=leftsubcontest+206+"px";
	document.getElementById("event-menu").style.left=leftsubcontest+318+"px";
	
	if(window.filmstrippositioner){
		filmstrippositioner();
	}	
}

/*function flashtopleft(){
	var browserName = navigator.appName;
	var varExtraWidth,varMainDiv;
	var varFlashDiv,varScreenWidth;
	var varFlashDivLeft;

	//varScreenWidth = screen.width;
	if (document.all){
		varScreenWidth = document.body.clientWidth;
	}
	else{
		varScreenWidth = window.innerWidth;
	}
	
	varExtraWidth = (((varScreenWidth*1) - 940) / 2);
	varFlashDiv = document.getElementById('textcontainer').style;
	varFlashDivLeft = (940 - 150);
	if (varExtraWidth > 0){
		if (browserName=='Netscape'){
			varFlashDiv.left = varFlashDivLeft + varExtraWidth + 3 +"px";
		}else{
			varFlashDiv.left = varFlashDivLeft + varExtraWidth + 10 +"px";
		}
	}else{
		varFlashDiv.left = varFlashDivLeft + 10 + "px";	
	}
	varFlashDiv.top = "-10px";
	varFlashDiv.display = 'block';

	var subcontest=document.getElementById("menu");
	var leftsubcontest=findPosX(subcontest);

	document.getElementById("concorsi-menu").style.left=leftsubcontest+206+"px";
	document.getElementById("event-menu").style.left=leftsubcontest+318+"px";
	
	if(window.filmstrippositioner){
		filmstrippositioner();
	}


//	document.getElementById('menu-div').style.width = screen.width;
//	document.getElementById('menu-div').style.display = 'block';
//	document.getElementById('footer-div').style.width = screen.width;
	
}*/

function myResize(){
	if (document.all)
		{alert(document.body.clientWidth);}
	else
		{alert(window.innerWidth);}
}


function findPosX(obj){
	var curleft = 0;
	if(obj.offsetParent)
		while(1) 
		{
		  curleft += obj.offsetLeft;
		  if(!obj.offsetParent)
			break;
		  obj = obj.offsetParent;
		}
	else if(obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj){
	var curtop = 0;
	if(obj.offsetParent)
		while(1)
		{
		  curtop += obj.offsetTop;
		  if(!obj.offsetParent)
			break;
		  obj = obj.offsetParent;
		}
	else if(obj.y)
		curtop += obj.y;
	return curtop;
}

function checkvalid(){
	var Email 
	var Pass
	Email = document.frmlogin.email.value;
	Pass = document.frmlogin.password.value;
	
	if(Email==""|| Pass==""){
		alert("Email or Password should Not Be Blank");
	}else{
//		confirmSubmitlogin();
		window.location.href = 'login.asp?hEmail='+Email+'&hPass='+Pass+'';	
	}
}

function confirmSubmitlogin()
{
	 /*var agree=confirm("Amico devi essere loggato per votare. Non sei ancora iscritto? Iscriviti!");
	if (agree)
		window.location.href="registrazione_categoria.asp";
	else
		return false;  */
	 var msgTextlogin;
	
	msgTextlogin = '<table><tr><td colspan="2" ><font color="#000000"><b>Ricordami per 7 anni?</b></font></td></tr>';
	msgTextlogin = msgTextlogin + '<tr><td align="right"><input type="button" value=" Yes " onClick="javascript:logwithchecked();"</td><td align="left"><input type="button" value=" No " onClick="javascript:logwithnotchecked();"</td></tr></table>';

	document.getElementById("msgWindowlogin").innerHTML =  ""; 
	document.getElementById("msgWindowlogin").innerHTML =  msgTextlogin; 
	//alert(document.getElementById("msgWindowlogin").innerHTML);
	displayWindowlogin();
}

function logwithchecked(){
	var Email 
	var Pass
	Email = document.frmlogin.email.value;
	Pass = document.frmlogin.password.value;
	if (Email==""){
		hiddenFloatingDiv('msgWindowlogin');
		alert("Nome utente non dovrebbe essere vuoto.");
	}else{
		hiddenFloatingDiv('msgWindowlogin');
		window.location.href = 'login.asp?azione=IN&hEmail='+Email+'&hPass='+Pass+'&vfRemP=1';	
	}	
}

function logwithnotchecked(){
	var Email 
	var Pass
	Email = document.frmlogin.email.value;
	Pass = document.frmlogin.password.value;	
	if (Email==""){
		hiddenFloatingDiv('msgWindowlogin');
		alert("User Name Should not be Blank.");
	}else{
		hiddenFloatingDiv('msgWindowlogin');
		window.location.href = 'login.asp?azione=IN&hEmail='+Email+'&hPass='+Pass+'&vfRemP=1';	
	}	
}

function displayWindowlogin(){
	var w, h, l, t;
	w = 200;
	h = 100;
	l = screen.width/2 -100;	
	t = 200;
	
	// no title		        
	// displayFloatingDiv('windowcontent', '', w, h, l, t);

	// with title		        
	displayFloatingDiv('msgWindowlogin', '', w, h, l, t);
}

function checkcount(iobj,ncount){
	var n, chrcount ;
	var x=iobj.value;

	n = x.length;
	
	if (n >= ncount){
		return false;
	}else{
		return true;
	}			
}

function checkcount1(iobj,ncount)
{
	var n, chrcount ;
	var x=iobj.value;

	n = x.length;
	
	if (n > ncount){
		//alert("The maxium limit is " + ncount + ".  You have lost some characters!");
		alert("Hai superato il limite massimo di caratteri ammessi " + ncount + ". La parte in eccesso del testo è stata cancellata.");
		iobj.value = iobj.value.substr(0,ncount);
		iobj.focus();
	}
}

var nav4 = window.Event ? true : false;
function checkEnter(iobj,ncount,e) {
	//alert(nav4)
	if (nav4) // Navigator 4.0x
		var whichCode = e.which
	else // Internet Explorer 4.0x
		if (e.type == "keypress") // the user entered a character
		var whichCode = e.keyCode
		//alert(whichCode);

	if ( whichCode == "13" ) //{
		return false;
			//document.form2.submit();
/*	}else{
		var n, chrcount ;
		var x=iobj.value;
	
		n = x.length;
		
		if (n >= ncount){
			return false;
		}else{
			return true;
		}			
	}*/
}

function noCopyMouse(e) {
	var isRight = (e.button) ? (e.button == 2) : (e.which == 3);

	if(isRight) {	
	//alert('You are prompted to type this twice for a reason!');
	return false;	
	}
	return true;
}

/*function checkcount(textArea, length) {
	if (textArea.value.length > length) {
		textArea.value = textArea.value.substr(0,length);
	}
	if (textArea.value.length > length + 1){
		alert('The max limit is 100.  You have lost some characters!');
	}	
	
}*/


//function checkAlphanum(strObject)
//{
	/* Returns true if the field has all alphanumeric characters, false if
	not.
	You must pass in a input (text) object, not the value. */

//	var re = /^[A-Za-z0-9]+$/;
	
//	if (!strObject || isBlank(strObject)){
//		return false;
//	}else{ 
//		return re.test(strObject.value);
//	}
//}

//function isBlank(strObject)
//{
	/* Returns true if the field is blank, false if not.
	You must pass in an input (text) object (not the value) */

//	var re = /\S+/;

//	if (!strObject){
//		return true;
//		return re.test(strObject.value));
//	}
//}

