/* CONTROL SEARCH */

function fnCtr(f) 
{    
  
    var valore = getById('textToSearch').value;

    f.text.value = valore;
    f.submit();    
}

/* POPUP*/

function isNotEmpty(elem) {
    var str = elem.value; 
    var re = /.+/;	
    if(!str.match(re))
      return false;	
    else	
      return true;
}

function isNotValidEmail(elem) {
	var str = elem.value;
	var re  = /\b[a-z0-9._%-]+@[a-z0-9._%-]+\.[a-z0-9._%-]{2,4}\b/;
	if (!str.match(re))
		return false;
	else
		return true;
}



function PopUp(urlPopup)
			{
				newWindow=window.open(urlPopup,'_load','width=550px,height=480px,toolbar=no,location=no, status=no,menubar=no,scrollbars=yes,resizable=no');          
      	newWindow.focus();
      }
function submitValidate (nameEmail, nameNote) {
  
	
	// note = document.getElementById(nameNote).value	 

		
	if (!isNotEmpty(document.forms['nmsForm'].elements[nameEmail])) 
	{			
		alert("L'email è obbligatoria");
		return false;
	}
	
	
	if (!isNotValidEmail(document.forms['nmsForm'].elements['dato_email']))
	{
	
		alert("il formato dell'email non è corretto");
		return false;
	}

	if (document.getElementById(nameNote).value == '' || document.getElementById(nameNote).value == ' ') 
	{
			
		alert('Inserisci una richiesta');
		return false;
	}
	
	
	return true;

}

function privacy()
	{	  
	  accept = document.getElementById('accept').checked;
	  
		if (accept == true)
		{
		document.getElementById('pushSubmit').disabled = false;
		document.getElementById('pushSubmit').className="nms";
		}
	
		if (accept == false)
		{
		document.getElementById('pushSubmit').disabled = true;
		document.getElementById('pushSubmit').className="disab";
		}
	
	}

/* END POPUP*/
function writeFlash(){
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="740" height="140" id="newmedia" align="middle">');
document.write('<param name="allowScriptAccess" value="sameDomain" />');
document.write('<param name="movie" value="flash/newmedia.swf" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="devicefont" value="true" />');
document.write('<param name="bgcolor" value="#ffffff" />');
document.write('<param name=FlashVars value="pathxml=flash/&pathimages=img/img_progetti/" />');
document.write('<embed src="flash/newmedia.swf" FlashVars="pathxml=flash/&pathimages=img/img_progetti/" quality="high" devicefont="true" bgcolor="#ffffff" width="740" height="140" name="newmedia" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
}
