
	/*******************************************************************************************
		 Function    : Reset()
		 DateTime    : 13/02/2008.
		 Author      : Pankaj Padole.
		 Purpose     : This function is used to reset the form
		 Parameter   :
		                frm - object - instance of the form object
		 Change Log  :
		______________________________________________________________________________________
		   No   |      Author       |      Date/Time            |     Issue 
		______________________________________________________________________________________
		        |                   |                           |
		        |                   |                           | 
    *******************************************************************************************/
	
	function Reset(frm)
	{
		document.forms(frm).reset();		
	}
	
    /*******************************************************************************************
		 Function    : chkvalid()
		 DateTime    : 13/02/2008.
		 Author      : Pankaj Padole.
		 Purpose     : This function is used to validate the textboxes in contact-us.asp page.
		 Parameter   :
		                tf - object - instance of the form object
		 Change Log  :
		______________________________________________________________________________________
		   No   |      Author       |      Date/Time            |     Issue 
		______________________________________________________________________________________
		        |                   |                           |
		        |                   |                           | 
    *******************************************************************************************/
	function chkvalid(tf)
	{			
		r=0;
		if(tf.txtName.value=="")
		{
			alert("Please enter your name.");
			tf.txtName.focus();
			r=1;
			return false;
		}			
		else
		{
			str = tf.txtName.value;
			str=str.toLowerCase();
			if((str.match("online")!=null) || (str.match("viagra")!=null) || (str.match("discount")!=null) || (str.match("kamagra")!=null) || (str.match("buycialis")!=null))
			{
				alert("Invalid Name");
				return false;
			}
		}
		if(tf.txtAddress.value!="")
		{
			str = tf.txtAddress.value;
			str=str.toLowerCase();
			if((str.match("online")!=null) || (str.match("viagra")!=null) || (str.match("discount")!=null) || (str.match("kamagra")!=null) || (str.match("buycialis")!=null))
			{
				alert("Invalid Address");
				return false;
			}
		}
		if(tf.txtCity.value=="")
		{
			alert("Please enter your city.");
			tf.txtCity.focus();
			r=1;
			return false;
		}
		
		if(tf.txtPhoneNo.value=="")
		{
			alert("Please enter your contact no.");
			tf.txtPhoneNo.focus();
			r=1;
			return false;
		}		
		if(tf.txtEmail.value=="")
		{
			alert("Please enter your Email-Id.");
			tf.txtEmail.focus();
			r=1;
			return false;
	
		}
		else
		{
			if(tf.txtEmail.value!="")
			{
				/*if(tf.txtEmail.value.indexOf("@")==-1 || tf.txtEmail.value.indexOf(".")==-1)
				{
					alert("Your email-id is not valid.");
					tf.txtEmail.focus();
					r=1;
					return false;
				}*/
				var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
				var address = tf.txtEmail.value;
				if(reg.test(address) == false) 
				{
				   alert("Your email-id is not valid.");
				   tf.txtEmail.focus();
				   r=1;
				   return false;
				}
			}
		}
		if(tf.txtWebsite.value!="")
		{
			/*if(tf.txtWebsite.value.indexOf(".")==-1)
			{
				alert("Your website name is not valid.");
				tf.txtWebsite.focus();
				r=1;
				return false;
			}*/
			
			var v = new RegExp(); 
			v.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
			if (!v.test(tf.txtWebsite.value) )
			{ 
				alert("Your website name is not valid."); 
				tf.txtWebsite.focus();
				r=1;
				return false;
			}
		}
		if((tf.radioRefer[0].checked == false) && (tf.radioRefer[1].checked == false) && (tf.radioRefer[2].checked == false) && (tf.radioRefer[3].checked == false))
		{
			alert("Please select the source of reference.");
			tf.radioRefer[0].focus();
			r=1;
			return false;
		}
		
		if(tf.txtSuggestions.value=="")
		{
			alert("Please enter your Suggestion.")
			tf.txtSuggestions.focus();
			r=1
			return false;
		}
		else
		{
			str = tf.txtSuggestions.value;
			str=str.toLowerCase();
			if((str.match("viagra")!=null) || (str.match("discount")!=null) || (str.match("kamagra")!=null) || (str.match("buycialis")!=null))
			{
				alert("Invalid Suggestion");
				return false;
			}
			if((str.match("http://")!=null) || (str.match("www.")!=null))
			{
				alert("Invalid Suggestion.");
				return false;
			}
		}

		if(tf.txtCaptcha.value=="")
		{
			alert("Please enter Verification Code.")
			tf.txtCaptcha.focus();
			r=1;
			return false;
		}			
		if(r==0)
		{
			return true;			
		}
	}
    
     /*******************************************************************************************
         Function    : PhoneNumber()
         DateTime    : 13/02/2008.
         Author      : Pankaj Padole.
         Purpose     : This function is used to validate phone no,fax no,extension no. 
         Returns     : 
                        Returnvalue - boolean - true if unblock key is press, otherwise false.
         Change Log  :
        ______________________________________________________________________________________
           No   |      Author       |      Date/Time            |     Issue 
        ______________________________________________________________________________________
                |                   |                           |
                |                   |                           |
    *******************************************************************************************/	
	function PhoneNumber()
	{
	    var key = window.event.keyCode;
	    if (key > 57 || key < 48 )
	    {
	        if(key!=45 && key!=40 && key!=41 && key!=43 && key!=13 && key!=32)
	        {
	            window.event.returnValue = false;
	        }
        }
	}

     /*******************************************************************************************
         Function    : Numeric()
         DateTime    : 13/02/2008.
         Author      : Pankaj Padole.
         Purpose     : This function is used to validate numeric fields.
         Returns     : 
                        Returnvalue - boolean - true if unblock key is press, otherwise false.
         Change Log  :
        ______________________________________________________________________________________
           No   |      Author       |      Date/Time            |     Issue 
        ______________________________________________________________________________________
                |                   |                           |
                |                   |                           | 
    *******************************************************************************************/		
	function Numeric()
	{
	    var key = window.event.keyCode;
	    if (key > 57 || key < 48 )
	    {
			if(key!=46 )
			{
				if(key!=13)
				{
        		    window.event.returnValue = false;
 				}
 			}
    	}
	}

    /*******************************************************************************************
		 Function    : chkvalidate()
		 DateTime    : 15/02/2008.
		 Author      : Pankaj Padole.
		 Purpose     : This function is used to validate the textboxes in login page.
		 Parameter   :
		                frm - object - instance of the form object
		 Change Log  :
		______________________________________________________________________________________
		   No   |      Author       |      Date/Time            |     Issue 
		______________________________________________________________________________________
		        |                   |                           |
		        |                   |                           | 
    *******************************************************************************************/ 
    function chkvalidate(tf)
    {
	    if(tf.txtUsername.value==null || tf.txtUsername.value=="")
	    {
		    alert("User Name cannot be blank.");
		    tf.txtUsername.focus();
		    return false;
	    }
	    else if(tf.txtPassword.value==null || tf.txtPassword.value=="")
	    {
		    alert("Password cannot be blank.");
		    tf.txtPassword.focus();
		    return false;
	    }
	    else
	    {
		    return true;
	    }
    }
            
     	function OpenSite()
	{
		window.open("http://www.automaticinfotech.com","_parent","");
	}