    function fnreset()
    {     
        document.getElementById(txtRemarks).value="";
        document.getElementById(txtName).value="";
        document.getElementById(txtEmail).value="";
        document.getElementById(txtCountryCode).value="";
        document.getElementById(txtAreaCode).value="";
        document.getElementById(txtTelephoneNo).value="";    
        return false;
    }
    
    function maxLength(Object, maxLen)
    {
        return (Object.value.length <= maxLen);
    }
    
    function chkPinPhoneFax(txtElement,Req,Wrong,allowEmpty)
    {
        txtValue=trim(txtElement.value);    
	    if(allowEmpty==false && txtValue.length == 0)
	    {
		    alert(Req);
		    txtElement.focus();
		    return false;
	    }
	    if(txtValue.search("[^0-9,/+]")!=-1)
	    {
		    alert(Wrong);
		    txtElement.focus();
		    return false;
	    }
	    return true;
	}
	
    function checkTextBox(txtElement,ErrorCode)
    {
    	TextBoxValue=trim(txtElement.value);
    	txtElement.value="";
    	txtElement.value=TextBoxValue;
	    if(TextBoxValue.length <= 0)
	    {
		    alert(ErrorCode);
	        txtElement.focus();
		    return false;
	    }
	    return true;
    }    
    
    function ltrim(strText) 
    {
	    return strText.replace(/^\s+/,'');
    }
    
    function rtrim(strText) 
    {
	    return strText.replace(/\s+$/,'');
    }
    
    /*Function to trim the spaces*/
    function trim(strText) 
    {
	    return strText.replace(/^\s+/,'').replace(/\s+$/,'');
    }
    
    function checkEmail(txtElement,EmailReq,EmailWrong,allowEmpty)
    {
	    var str= txtElement.value;
	    str=trim(str);
	    txtElement.value="";
	    txtElement.value=str;
	    if((allowEmpty == false) && (str.length == 0))//empty value is not allowed
	    {
		    alert(EmailReq);
		    txtElement.focus();
		    return false;
	    }
	    if(allowEmpty == true && str.length == 0)//empty value is allowed
	    {
		    return true;
	    }
	    else 
	    {
		    if (test(str))
			    testresults=true;
		    else
		    {
			    alert(EmailWrong);
			    txtElement.focus();
			    testresults=false;
		    }
	    }	
	    return (testresults);
    }
    
    function test(src) 
    {
         var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
         var regex = new RegExp(emailReg);
         return regex.test(src);
    }
    
    function ContactUsValidations(DescriptionReq,NameReq,EmailReq,EmailWrong,CountryCodeReq,CountryCodeWrong,AreaCodeWrong,TelephoneReq,TelephoneWrong)
    {
        description = document.getElementById(txtRemarks);
        name1 = document.getElementById(txtName);
        email = document.getElementById(txtEmail);
        countryCode = document.getElementById(txtCountryCode);
        areaCode = document.getElementById(txtAreaCode);
        telephoneNo = document.getElementById(txtTelephoneNo);
     
        if(!checkTextBox(description,DescriptionReq))
        {
            return false;
        }
        else if(!checkTextBox(name1,NameReq)) 
        {
            return false;
        }
        else if(!checkEmail(email,EmailReq,EmailWrong,false)) 
        {
            return false;      
        }
        else if(!chkPinPhoneFax(countryCode,CountryCodeReq,CountryCodeWrong,false)) 
        {
            return false; 
        }
        else if(!chkPinPhoneFax(areaCode,null,AreaCodeWrong,true)) 
        {
            return false;   
        }
        else if(!chkPinPhoneFax(telephoneNo,TelephoneReq,TelephoneWrong,false)) 
        {
            return false; 
        }
        else
        {     
            return true;
        }   
    }    

