function checkForm(){
firstName=document.formChecked.firstName.value
lastName=document.formChecked.lastName.value
email=document.formChecked.email.value

if(firstName == "" || firstName == "nome*" || firstName == null || !isNaN(firstName) || firstName.charAt(0) == ' ') {
	alert('Inserire il nome');
	return false;
}
else if(lastName == "" || lastName == "cognome*" || lastName == null || !isNaN(lastName) || lastName.charAt(0) == ' '){
	alert('Inserire il cognome');
	return false;
}
else if(!indirizzoEmailValido(email)){
	alert('Indirizzo email non valido');
	return false;
}
else if(document.formChecked.privacy.checked==false){
	alert('Per procedere con l\'invio del modulo e\' necessario accettare le condizioni presenti nell\'informativa.');
	return false;
}
else{
	return true;
} 
}

function indirizzoEmailValido(indirizzo) {
if (window.RegExp) {
var nonvalido = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
var valido = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
var regnv = new RegExp(nonvalido);
var regv = new RegExp(valido);
if (!regnv.test(indirizzo) && regv.test(indirizzo))
  return true;
return false;
}
else {
if(indirizzo.indexOf("@") >= 0)
  return true;
return false;
}
};
function asd(){
	var uno = document.getElementById('hide')
if(uno.style.display=='none'){
	uno.style.display='block'
} else{
	uno.style.display='none'
}
}
				  


/* image manager */
		//<![CDATA[
		
			function basename (path) { return path.replace( /.*\//, "" ); }
	
			var winimg=null;
			function ps_imagemanager_popup(imgurl,title,w,h) {
				lpos=(screen.width)?(screen.width-w)/2:100;
				tpos=(screen.height)?(screen.height-h)/2:100;
				settings='width='+w+',height='+h+',top='+tpos+',left='+lpos+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
				winimg=window.open('about:blank','imagemanagerpopup',settings);
	
				var doc = '';
				doc += '<html><head>';
				doc += '<title>' + title + ' - ' + basename(imgurl) + '(' + w + 'x' + h +')</title>';
				doc += '<style type="text/css"><!-- body { margin:0px; padding:0px; } --></style>';
				doc += '</head>';
				doc += '<body onload="self.focus();">';
				doc += '<img style="cursor:pointer;" src="' + imgurl + '" title="' + title + '" onclick="self.close();"/>';
				doc += '</body></html>';
				
				winimg.document.writeln(doc);
				winimg.document.close();
			}	
			
		//]]>
/* image manager */


/* popup */
function popupCentrata(width,height) {
    var dim         = new Array();
    var w             = width;
    var h             = height;
    dim['left']     = Math.floor((screen.width-w)/2);
    dim['top']         = Math.floor((screen.height-h)/2);
    dim['width']     = w;
    dim['height']     = h;
    return dim;
}

function openPopUp(popwidth,popheight,page,popname){
    var screendim = popupCentrata(popwidth,popheight);
    var l = screendim['left'];
    var t = screendim['top'];
    var w = screendim['width'];
    var h = screendim['height'];
    finestra = window.open(page,popname,"width="+w+",height="+h+",left="+l+",top="+t+",toolbar=no, location=no,statusbar=no,menubar=no,scrollbars=no,resizable=no");
    return finestra;
}

////// Privacy
  var stile = "top=300, left=350, width=600, height=350, status=no, menubar=no, toolbar=no, scrollbars=yes, resizable=yes";
     function privacy(apri) {
        window.open(apri, "", stile);
     }
	 
	 
////// show hide form privati ed aziende	 
	function aziendaActive()
	{ 
		document.getElementById('modulo_azienda').style.display='block';
		document.getElementById('modulo_privato').style.display='none';
	}
	
	function privatoActive()
	{
		document.getElementById('modulo_azienda').style.display='none';
		document.getElementById('modulo_privato').style.display='block';
	}
	


function checkInfomailForm(){
	ragione_sociale=document.infomailForm.ragione_sociale.value
	settore=document.infomailForm.settore.value
	sito_web=document.infomailForm.sito_web.value
	firstName=document.infomailForm.nome_riferimento.value
	lastName=document.infomailForm.cognome_riferimento.value
	email=document.infomailForm.email_riferimento.value
	phone=document.infomailForm.telefono_riferimento.value
	
	if(ragione_sociale == "" || ragione_sociale == null || !isNaN(ragione_sociale) || ragione_sociale.charAt(0) == ' ') {
	    alert('Inserire la ragione sociale');
		return false;
	} else if(settore == "" || settore == null || !isNaN(settore) || settore.charAt(0) == ' ') {
	    alert('selezionare il settore');
		return false;
	} else if(sito_web == "" || sito_web == null || !isNaN(sito_web) || sito_web.charAt(0) == ' ') {
	    alert('Inserire l\'indirizzo del sito web');
		return false;
	} else if(firstName == "" || firstName == null || !isNaN(firstName) || firstName.charAt(0) == ' ') {
	    alert('Inserire il nome');
		return false;
	} else if(lastName == "" || lastName == null || !isNaN(lastName) || lastName.charAt(0) == ' '){
		alert('Inserire il cognome');
		return false;
	} else if(!indirizzoEmailValido(email)){
		alert('Inserire un indirizzo email valido');
		return false;
	} else if(phone == "" || phone == null || isNaN(phone) || phone.charAt(0) == ' '){
		alert('Inserire un numero di telefono');
		return false;
	} else if(document.infomailForm.privacy.checked==false){
		alert('Per procedere con l\'invio del modulo e\' necessario accettare le condizioni presenti nell\'informativa.');
		return false;
	} else {
		return true
	}
}
function indirizzoEmailValido(indirizzo) {
  if (window.RegExp) {
    var nonvalido = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
    var valido = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
    var regnv = new RegExp(nonvalido);
    var regv = new RegExp(valido);
    if (!regnv.test(indirizzo) && regv.test(indirizzo))
		return true;
		return false;
	}
  else {
    if(indirizzo.indexOf("@") >= 0)
		return true;
		return false;
  }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ShowHide(id1, id2) {
	  if (id1 != '') expMenu(id1);
	  if (id2 != '') expMenu(id2);
	}

function expMenu(id) {
	  var itm = null;
	  if (document.getElementById) {
		itm = document.getElementById(id);
	  } else if (document.all){
		itm = document.all[id];
	  } else if (document.layers){
		itm = document.layers[id];
	  }

	  if (!itm) {
	  } else if (itm.style) {
			if (itm.style.display == "none"){ itm.style.display = ""; }
			else { itm.style.display = "none"; }
	  }
	  else { itm.visibility = "show"; }
}

////// Privacy
  var stile = "top=300, left=350, width=600, height=350, status=no, menubar=no, toolbar=no, scrollbars=yes, resizable=yes";
     function privacy(apri) {
        window.open(apri, "", stile);
     }
////// flash
  var stile = "top=200, left=200, width=800, height=620, status=no, menubar=no, toolbar=no, scrollbars=yes, resizable=yes";
     function flash(apri) {
        window.open(apri, "", stile);
     }
	 
	 
/////// menu a tendina del menu orizzontale

	/* function out(el){
	el.className=el.className.replace(new RegExp("sopra\\b"), "");
		}
		function hover(el){
			el.className+=' sopra';
		}
		function tendina(){
			var objLis = document.getElementById('fln').getElementsByTagName('li');
			for(i=0;i<objLis.length;i++){
				objLis[i].onmouseover=function(){
					hover(this);
				}
				objLis[i].onmouseout=function(){
					out(this);
				}
			}
		}
		window.onload=function(){
			if(document.getElementById('fln')){tendina();}
		} 
	*/ 

