/***************************************************************************/
/*     AUTHOR         :  PHP Dev Team, iFactor Solutions, India            */
/*	   CONTACT 		  :  support@ifactors.com www.ifactors.com			   */
/*     PROGRAMMER     :  DPT                                               */
/*     SCRIPT NAME    :  js.js					                           */
/*     CREATED ON     :  03/MAR/2005                                       */
/*     LAST MODIFIED  :  04/MAR/2005                                       */
/*                                                                         */
/*     Java Script Functions For the Site                                  */
/***************************************************************************/

    /*----------------------------------------------------------------
    Description   :- function to validate the order page
    Programmer    :- DPT
    Last Modified :- 04/MAR/2005
    -------------------------------------------------------------------*/
    function order_validate()
    {
    	//first name
        if(document.frm_order.txt_name.value=='')
        {
        	alert("Please enter your name");
            document.frm_order.txt_name.focus();
            return false;
        }

        //city
        if(document.frm_order.txt_city.value=='')
        {
        	alert("Please enter the city");
            document.frm_order.txt_city.focus();
            return false;
        }

        //email
        if(document.frm_order.txt_emailid.value=='')
        {
        	alert("Please enter your email id");
            document.frm_order.txt_emailid.focus();
            return false;
        }

        //validate email
        if(isBadEmail(document.frm_order.txt_emailid.value))
        {
        	alert("Please enter a valid email id");
            document.frm_order.txt_emailid.focus();
            return false;
        }

        //contact no
        if(document.frm_order.txt_contactno.value=='')
        {
        	alert("Please enter your contact number");
            document.frm_order.txt_contactno.focus();
            return false;
        }

    }


   /*----------------------------------------------------------------
    Description   :- function to validate an email id
    Programmer    :- DPT
    Last Modified :- 03/MAR/2005
    -------------------------------------------------------------------*/
	  function isBadEmail(strg) {
	    email_array = strg.split('@');
	    if (email_array.length != 2) return true;
	    if (email_array[1].split(".").length < 2) return true;
	    if (email_array[1].split(".")[1].length < 1) return true;
	    if (strg.indexOf('@') < 1) return true;
	    if (strg.indexOf(' ') != -1) return true;
	    if (email_array[1].indexOf('.') < 1) return true;
	    if (strg.length < 5) return true;
	    return false;
	  }