function chk_ricerca(){
	
	with(document.ricerca){
		
		if(chk_txt(val_ricerca,	val_ricerca.alt )){
			return true;
		}
		return false;	
	}
}

function refresh(){
	document.zcode.src = "img/zcode.php" + '?' + (new Date()).getTime();
}

function chk_newsletter(lang){
	
	with(document.newsletter){
		if(
		 chk_txt1(nome,		nome.alt ) &&
		 chk_txt1(cognome,	cognome.alt ) &&
		 chk_email(email,	email.alt ) &&
		 chk_info(informazione.alt) ){
			return true;
		}
		return false;
	}
}



function control_login(){
	with(document.login){
		if((user.value=="")&&(pswd.value=="")){
			return false;
		}
		return true;
	}
}


function PrintThisPage() 
{ 
   var sOption="toolbar=no,location=no,directories=no,menubar=no,"; 
       sOption+="scrollbars=yes,width=800,height=650,left=100,top=25"; 

   var sWinHTML = document.getElementById('contentstart').innerHTML; 
   
   var winprint=window.open("","",sOption); 
       winprint.document.open(); 
       winprint.document.write('<html><LINK href=print.css rel=Stylesheet><body onload="window.print();window.close();">'); 
       winprint.document.write(sWinHTML);          
       winprint.document.write('</body></html>'); 
       winprint.document.close(); 
       winprint.focus(); 
}


function getPageSize() {
	        
	     var xScroll, yScroll;
		
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		
		var windowWidth, windowHeight;
		
		if (self.innerHeight) {	// all except Explorer
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth; 
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		
		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}
	
		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){	
			pageWidth = xScroll;		
		} else {
			pageWidth = windowWidth;
		}

		return [pageWidth,pageHeight];
	}



function vis_on(id) {
	document.getElementById(id).style.display='block';
}

function vis_off(id) {
	document.getElementById(id).style.display='none';
}


function visibility_on(id) {
	document.getElementById(id).style.visibility='visible';
}

function visibility_off(id) {
	document.getElementById(id).style.visibility='hidden';
}

function overlay_on() {
	var arrayPageSize = this.getPageSize();	
	document.getElementById('overlay').style.width= arrayPageSize[0] + 'px';
	document.getElementById('overlay').style.height= arrayPageSize[1] + 'px';
	document.getElementById('overlay').style.visibility='visible';
	document.getElementById('overlay').style.display='block';
}


function changemenu(scheda_sel, menu_sel)
{
	
	document.getElementById('scheda1').style.display = 'none';
	document.getElementById('scheda2').style.display = 'none';
	document.getElementById('scheda3').style.display = 'none';
	document.getElementById('scheda4').style.display = 'none';
	
	document.getElementById(scheda_sel).style.display = "block";
	
	document.getElementById('nav1').className='voce_nav';
	document.getElementById('nav2').className='voce_nav';
	document.getElementById('nav3').className='voce_nav';
	document.getElementById('nav4').className='voce_nav';
	
	document.getElementById(menu_sel).className='voce_nav_over';
}


function getScrollX(id) {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
 
 
  document.getElementById(id).style.top = scrOfY+"px";
}




