

var mailform = '<form method="post" action="mailform.php" onSubmit="return checkMail(this.email.value)" class="popup">' +
  	'<input type="hidden" value="" id="paramHid" name="paramHid" />' +
	'<input name="subject" type="hidden" value="Neat - Request more information" />' +
   '<input name="nome" id="nome"  type="text" value="name" class="popup" title="insert your name" size="25"/>&nbsp;&nbsp;&nbsp;<input name="cognome" type="text" value="second name" class="popup" title="insert your surame" size="25"/><br />'+
 '<input name="email" type="text" value="email address" class="popup" title="insert your email address" size="25"/><br />'+
 '<input name="tel" type="text" value="Tel" class="popup" title="insert your phone number" size="25"/>&nbsp;&nbsp;&nbsp;<input name="fax" type="text" value="Fax" class="popup" title="insert your fax number" size="25"/><br />'+
 '<input name="company" type="text" value="Company" class="popup" title="insert your company" size="58"/><br />'+
 '<input name="companyWeb" type="text" value="Company website" class="popup" title="insert your company website" size="58"/><br />'+
 ' <input name="companyAdd" type="text" value="Company address" class="popup" title="insert your company address" size="58"/><br />'+
 ' <input name="postalCode" type="text" value="postal code" class="popup" title="insert your postal code" size="25"/>&nbsp;&nbsp;&nbsp;<input name="State" type="text" value="State" class="popup" title="insert your state" size="25"/><br />'+
 ' <select name="seleziona" class="popup" title="Select your option" >'+
 ' <option>You are interested in </option>'+
 ' <option>A design of a new computer</option>'+
 ' <option>A customization of an existing computer</option>'+
 ' <option>GEMINI engine - GEMINI-OS</option>'+
 ' <option>Other</option>'+
 ' </select>'+
 ' <br/>'+
 ' <input name="application" type="text" value="Application" class="popup" title="insert application" size="58"/><br />'+
 
 ' <textarea name="message" id="message" rows="10" cols="55" class="popup">Write here your requests or comments. You&#39;ll be contacted shortly.' +
 ' </textarea><br/>'+
 ' <input type="submit" value="submit" class="popup"/> &nbsp;&nbsp;&nbsp; <input type="reset" value="clear" class="popup"/>'+
 ' <div id="break">&nbsp;</div> ' +
 '  </form>';
 
 
		
	 
 //controllo tutti i campi obbligatori - prima l email
 function checkMail(email){
  
		var at="@"
		var dot="."
		var lat=email.indexOf(at)
		var lstr=email.length
		var ldot=email.indexOf(dot)
	
		if (email.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   document.forms[0].email.focus()
		   document.forms[0].email.select()
		   return false
		}

		if (email.indexOf(at)==-1 || email.indexOf(at)==0 || email.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   document.forms[0].email.focus()
		   document.forms[0].email.select()
		    return false
		}

		if (email.indexOf(dot)==-1 || email.indexOf(dot)==0 || email.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
			document.forms[0].email.focus()
			document.forms[0].email.select()
		    return false
		}

		 if (email.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
			document.forms[0].email.focus()
			document.forms[0].email.select()
		    return false
		 }

		 if (email.substring(lat-1,lat)==dot || email.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
			document.forms[0].email.focus()
			document.forms[0].email.select()
		    return false
		 }

		 if (email.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
			document.forms[0].email.focus()
			document.forms[0].email.select()
		    return false
		 }
		
		 if (email.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
			document.forms[0].email.focus()
			document.forms[0].email.select()
		    return false
		 }

		 if (document.forms[0].nome.value=="name"){
			document.forms[0].nome.focus()
			document.forms[0].nome.select()
		 	alert("Please insert your name")
		    return false
		 }
		 
		 if (document.forms[0].cognome.value=="second name"){
			document.forms[0].cognome.focus()
			document.forms[0].cognome.select()
			alert("Please insert your second name")
		    return false
		 }
		 
		 if (document.forms[0].tel.value=="Tel"){
			document.forms[0].tel.focus()
			document.forms[0].tel.select()
			alert("Please insert your telephone number")
		    return false
		 }
		 
		 
		 if (document.forms[0].company.value=="Company"){
			document.forms[0].company.focus()
			document.forms[0].company.select()
			alert("Please insert your company name")
		    return false
		 }
		  if (document.forms[0].companyWeb.value=="Company website"){
			document.forms[0].companyWeb.focus()
			document.forms[0].companyWeb.select()
			alert("Please insert your company website")
		    return false
		 }
		 
		  if (document.forms[0].companyAdd.value=="Company address"){
			document.forms[0].companyAdd.focus()
			document.forms[0].companyAdd.select()
			alert("Please insert your company address")
		    return false
		 }
		 
		 if (document.forms[0].postalCode.value=="postal code"){
			document.forms[0].postalCode.focus()
			document.forms[0].postalCode.select()
			alert("Please insert your postal code")
		    return false
		 }
		 
		  if (document.forms[0].State.value=="State"){
			document.forms[0].State.focus()
			document.forms[0].State.select()
			alert("Please insert your State")
		    return false
		 }
		 
		 if (document.forms[0].seleziona.selectedIndex==0){
		 document.forms[0].seleziona.focus()
			alert("Please select an option")
		    return false
		 }
 		 
		 
		 if (document.forms[0].application.value=="Application"){
			document.forms[0].application.focus()
			document.forms[0].application.select()
			alert("Please insert your application")
		    return false
		 }
		 
		  if (document.forms[0].message.value==""){
			document.forms[0].message.focus()
			alert("Please insert your message")
		    return false
		 }
		 
		 return true
	}

	
