function formCheck1(formobj){

	// start modify the following

    // Enter name of mandatory/required fields

    // These are the actual names of the form fields (<input type="text" name="firstname">)

    // Pls. keep in mind that how many fields you want to be required must be the same number

    // of entries in fieldRequired and fieldDescription.

    var fieldRequired = Array (

						"product",
    					"fullname",
    					"address",
						"email",
						"contact",
		  				"message"	
    						  );

    

    // Enter field description to appear in the dialog box

    var fieldDescription = Array (

						"Product is required",
						"Fullname is required",
						"Mailing Address is required",
						"Email is required",
						"Contact Number is required",
						"Message is required"
						

    							 );

    // dialog message

    var alertMsg = "Please complete the following fields:\n";

   // end modify the following

    

    // DO NOT edit below this line

    var l_Msg = alertMsg.length;

    

    for (var i = 0; i < fieldRequired.length; i++){

        var obj = formobj.elements[fieldRequired[i]];

        if (obj){

            switch(obj.type){

            case "select-one":

                if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){

                    alertMsg += " - " + fieldDescription[i] + "\n";

                }

                break;

            case "select-multiple":

                if (obj.selectedIndex == -1){

                    alertMsg += " - " + fieldDescription[i] + "\n";

                }

                break;

            case "text":

            case "textarea":

                if (obj.value == "" || obj.value == null){

                    alertMsg += " - " + fieldDescription[i] + "\n";

                }

                break;

            default:

            }

            if (obj.type == undefined){

                var blnchecked = false;

                for (var j = 0; j < obj.length; j++){

                    if (obj[j].checked){

                        blnchecked = true;

                    }

                }

                if (!blnchecked){

                    alertMsg += " - " + fieldDescription[i] + "\n";

                }

            }

        }

    }



    if (alertMsg.length == l_Msg){

        return true;

    }else{

        alert(alertMsg);

        return false;

    }

}





function echeck(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("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true				}
		 
		 
		 function isPhoneNumber(str){
		 var stripped = str.replace(/[\(\)\.\-\ ]/g, '');
   			 if (isNaN(parseInt(stripped))) {
        		alert("The phone number contains illegal characters. \n It must be numeric")
				return false
    		}
		return true
 		}

function formCheck(){
var Name=document.send_email.fullname
var Address=document.send_email.address
var Email=document.send_email.email
var Telephone=document.send_email.contact
var Message=document.send_email.message
var Security=document.send_email.secure
var code1="JWH730";
var code2="M4AM11";
var code3="M6A9RT";
var code4="DBZ45A";
var code5="jwh730";
var code6="m4am11";
var code7="m6a9rt";
var code8="dbz45a";


if((Name.value==null)||(Name.value=="")){
alert("Please enter your name");
Name.focus()
return false
}
if((Name.value==null)||(Name.value=="")){
alert("Please enter your name");
Name.focus()
return false
}
if((Address.value==null)||(Address.value=="")){
alert("Please enter your Address");
Address.focus()
return false
}
if((Email.value==null)||(Email.value=="")){
alert("Please enter your Email");
Email.focus()
return false
}
if (echeck(Email.value)==false){
		Email.value=""
		Email.focus()
		return false
	}
if((Telephone.value==null)||(Telephone.value=="")){
alert("Please enter your Telephone");
Telephone.focus()
return false
}

if (isPhoneNumber(Telephone.value)==false){
		Telephone.value=""
		Telephone.focus()
		return false}

if((Message.value==null)||(Message.value=="")){
alert("Please enter your questions and suggestions");
Message.focus()
return false
}
if((Security.value==null)||(Security.value=="")){
alert("Please enter the security code below");
Security.focus()
return false
}
if(Security.value!=code1&&Security.value!=code2&&Security.value!=code3&&Security.value!=code4&&Security.value!=code5&&Security.value!=code6&&Security.value!=code7&&Security.value!=code8){
alert("Invalid Code, Please enter the correct code");
Security.focus()
return false
}
}


