function checkInputPresantationOrder() {
	if( !document.frm ) {
      		alert( 'שגיאה: הדף לא נטען במלואו, נא רענן את הדף טרם שליחת הטופס' );
      		return false;
		}	
    	if( !document.frm.contact.value ) {
	   		alert("נא למלא שם פרטי");
     		document.frm.contact.focus();
     		return false;
    	}

    else if( !document.frm.phone.value ) {
			alert('נא למלא  טלפון');
      		document.frm.phone.focus();
      		return false;
		}
 
 	else{
			return true;
		}	
}

function checkInputSupport() {
	if( !document.frm ) {
      		alert( 'שגיאה: הדף לא נטען במלואו, נא רענן את הדף טרם שליחת הטופס' );
      		return false;
		}	
    	if( !document.frm.contact.value ) {
	   		alert("נא למלא שם פרטי");
     		document.frm.contact.focus();
     		return false;
    	}
    else if( !document.frm.company.value ) {
			alert('נא למלא חברה');
      		document.frm.company.focus();
      		return false;
		}
    else if( !document.frm.phone.value ) {
			alert('נא למלא טלפון');
      		document.frm.phone.focus();
		 	return false;
		}
	else{
			return true;
		}	
}

function checkInputUpdate() {
	if( !document.frm ) {
      		alert( 'שגיאה: הדף לא נטען במלואו, נא רענן את הדף טרם שליחת הטופס' );
      		return false;
		}	

    if( !document.frm.contact.value ) {
	   		alert("נא למלא שם פרטי");
     		document.frm.contact.focus();
     		return false;
    	}
    else if( !document.frm.company.value ) {
			alert('נא למלא חברה');
      		document.frm.company.focus();
      		return false;
		}
    else if( !document.frm.phone.value ) {
			alert('נא למלא טלפון');
      		document.frm.phone.focus();
		 	return false;
		}
	else if(document.frm.email.value.length==0) {
			alert('נא למלא כתובת דואר אלקטרוני');
			document.frm.email.focus();
			return false;
		}
	else if (!emailcheck(document.frm.email.value))
		{
			document.frm.email.focus();
			return false;
		}
	else if(!document.frm.noteconfirm.checked==true) 
                {
			alert('יש לאשר את תוכן ההערה לפני המשך');
			document.frm.noteconfirm.focus();
			return false;
		}
	else
		{
 		 return true;
		}
}


function checkInputContact() {
	if( !document.frm ) {
      		alert( 'שגיאה: הדף לא נטען במלואו, נא רענן את הדף טרם שליחת הטופס' );
      		return false;
		}	
    if( !document.frm.contact.value ) {
	   		alert("נא למלא שם פרטי");
     		document.frm.contact.focus();
     		return false;
    	}

    else if( !document.frm.phone.value ) {
			alert('נא למלא  טלפון');
      		document.frm.phone.focus();
      		return false;
		}
  	else{
			return true;
		}	
}


/// Check that E-mail conforms to specific format with allowed characters.
function emailcheck(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("נא למלא כתובת דואר אלקטרוני נכונה")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("נא למלא כתובת דואר אלקטרוני נכונה")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("נא למלא כתובת דואר אלקטרוני נכונה")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("נא למלא כתובת דואר אלקטרוני נכונה")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("נא למלא כתובת דואר אלקטרוני נכונה")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("נא למלא כתובת דואר אלקטרוני נכונה")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("נא למלא כתובת דואר אלקטרוני נכונה")
		    return false
		 }

 		 return true					
	}
	
	