
function emailValidate(incomingString, defaultValue)
{
	if(trimSpace(incomingString).length == 0 || incomingString.search(/^[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/g) == -1 || incomingString==defaultValue)
	{
		return false;
	}
	else
		return true;	
}	

function txtValidate(field)
{
    if (field.indexOf('<') == -1 || field.indexOf('>') == -1)
    return false;
    else
    return true;
}

function txtlim(obj,limit){
	var mlength=parseInt(limit);
	if (obj.value.length>mlength)
	obj.value=obj.value.substring(0,mlength)
}
function trim(strText) { 
    // get rid of leading spaces 
	if(strText!='')
	{
			while (strText.substring(0,1) == ' ') 
				strText = strText.substring(1, strText.length);
		
			// get rid of trailing spaces 
			while (strText.substring(strText.length-1,strText.length) == ' ')
				strText = strText.substring(0, strText.length-1);
	}
   return strText;
   
}

function chkinput(val,chklst)
{
	 //var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
	var checkOK =chklst ;
	var checkStr = val;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
		{
			ch = checkStr.charAt(i);
			for (j = 0;  j < checkOK.length;  j++)
			  if (ch == checkOK.charAt(j))
			  break;
			  if (j == checkOK.length)
				{
				  allValid = false;
				  break;
				}
		  }

	if (!allValid)
	  {	
		return false;
		//obj.value=obj.value.substring(0,(checkStr.length));
	  }
}
function trimSpace(x)
{
	if(x!='')
	{
		var emptySpace = / /g;
		var trimAfter = x.replace(emptySpace,"");
	}
	return(trimAfter);
}

function Ref(arg)
{
	return document.getElementById(arg);
}




function Category()
{

var category = document.getElementById("cmbCategory");
var product = document.getElementById("cmbProduct");

 

for (var j = 0; j < product.options.length; i++) 
	    {
        product.options[j] = null;
        }
        
    for(var i=0;i<category.options.length;i++)
	{
	 
	 	if(category.options[0].selected==true)
		{
			
			    document.getElementById('selProduct').style.display = 'block';
			    product.style.display = 'block';    
				product.options[0] = new Option("Select","Select");
				
		}
	
	
		if(category.options[1].selected==true)
		{
			
			    document.getElementById('selProduct').style.display = 'block';
			    product.style.display = 'block';    
				product.options[0] = new Option("Accounts","Accounts");
				product.options[1] = new Option("Loans","Loans");
				product.options[2] = new Option("Cards","Cards");
				product.options[3] = new Option("Deposits","Deposits");
				product.options[4] = new Option("Insurance","Insurance");
				product.options[5] = new Option("Demat","Demat");
				product.options[6] = new Option("Mutual Funds","Mutual Funds");
			    product.options[7] = new Option("Vehicle Loans","Vehicle Loans");
			
		}
			if(category.options[2].selected==true)
		{
		        document.getElementById('selProduct').style.display = 'block';
		        product.style.display = 'block';    
			    product.options[0] = new Option("Accounts","Accounts");
				product.options[1] = new Option("Loans","Loans");
				product.options[2] = new Option("Cards","Cards");
				product.options[3] = new Option("General Insurance","General Insurance");
				
			
		}
			if(category.options[3].selected==true)
		{
			    document.getElementById('selProduct').style.display = 'block';
			    product.style.display = 'block';    
			    product.options[0] = new Option("Bank Accounts","Bank Accounts");
				product.options[1] = new Option("Loans","Loans");
				product.options[2] = new Option("Cards","Cards");
				product.options[3] = new Option("Deposits","Deposits");
				product.options[4] = new Option("Remittances","Remittances");
				product.options[5] = new Option("Demat Services","Demat Services");
				product.options[6] = new Option("Mutual Funds","Mutual Funds");
				
			
		}
			if(category.options[4].selected==true)
		{
			    document.getElementById('selProduct').style.display = 'block';
			    product.style.display = 'block';    
			    product.options[0] = new Option("Bank Accounts","Bank Accounts");
				product.options[1] = new Option("Deposits","Deposits");
				product.options[2] = new Option("Remittances","Remittances");
				product.options[3] = new Option("Cards","Cards");
				product.options[4] = new Option("Investment Facilities","Investment Facilities");
				
				
			
		}
		if(category.options[5].selected==true)
		{
			 
		    document.getElementById('selProduct').style.display = 'none';
		    product.style.display = 'none';
		    
			
		}
	}
}

function fnSubmit()
{
if(document.getElementById("cmbCategory").value=="select")
    {
        alert("Please select a category!");
       
        return false;
       
    }

if (document.getElementById("txtFirstname").value=="First Name")
		{
			alert("Please enter your First Name.");
			document.getElementById("txtFirstname").focus();
			document.getElementById("txtFirstname").select();
			return false;
		}
		
      		
		
	if (document.getElementById("txtFirstname").value.charAt(0)==" " || txtValidate(document.getElementById("txtFirstname").value))
		{
			alert("Please enter valid First Name.");
			document.getElementById("txtFirstname").focus();
			document.getElementById("txtFirstname").select();
			return false;
		}
		
		if (document.getElementById("txtLastName").value=="Last Name")
		{
			alert("Please enter your Last Name.");
			document.getElementById("txtLastName").focus();
			document.getElementById("txtLastName").select();
			return false;
		}
	   if (document.getElementById("txtLastName").value.charAt(0)==" " || txtValidate(document.getElementById("txtLastName").value))
		{
			alert("Please enter valid Last Name.");
			document.getElementById("txtLastName").focus();
			document.getElementById("txtLastName").select();
			return false;
		}
		
		  if (document.getElementById("txtEmailId").value=="Email ID")
		{
			alert("Please enter Email ID.");
			document.getElementById("txtEmailId").focus();
			document.getElementById("txtEmailId").select();
			return false;
		}
      if (document.getElementById("txtEmailId").value!="Email ID" && emailValidate(document.getElementById("txtEmailId").value)==false)
		{
			alert("Please enter a Valid Email ID.");
			document.getElementById("txtEmailId").focus();
			document.getElementById("txtEmailId").select();
			return false;
		}
		
		if (document.getElementById("txtPhone").value=="Phone no.")
		{
			alert("Please enter your Phone No.");
			document.getElementById("txtPhone").focus();
			document.getElementById("txtPhone").select();
			return false;
		}
		
		if (document.getElementById("txtlocation").value=="Location")
		{
			alert("Please enter your Location.");
			document.getElementById("txtlocation").focus();
			document.getElementById("txtlocation").select();
			return false;
		}
	   if (document.getElementById("txtlocation").value.charAt(0)==" " || txtValidate(document.getElementById("txtlocation").value))
		{
			alert("Please enter valid Location.");
			document.getElementById("txtlocation").focus();
			document.getElementById("txtlocation").select();
			return false;
		}

	     if (txtValidate(document.getElementById("txtQuery").value))
		{
			alert("Please enter valid Query.");
			document.getElementById("txtQuery").focus();
			document.getElementById("txtQuery").select();
			return false;
		}
    
    document.getElementById("LeaveQuery").submit();
    

}


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)
		{
		return false;
		}
	}


function charonly(e)
	{
		var unicode=e.charCode? e.charCode : e.keyCode
		if (unicode!=8)
			{
				if ((unicode!=32 && (unicode<65 || (unicode>90 && 

(unicode<97 || unicode>122)))) && unicode!=39 && unicode!=45&& unicode!=9)
				return false;
			}
	}
	
	function numbersonly(e)
	{
		var unicode=e.charCode? e.charCode : e.keyCode
		if (unicode!=8)
			{
				if ((unicode<48||unicode>57)&& unicode!=9)
				return false;
			}
	}

//function CheckForScript(eve)
//{
//    var v=eve.value.toLowerCase();
//    var myRegExp = /</;
//    var string1 = v;
//    var matchPos1 = string1.search(myRegExp);
//    if(matchPos1 != -1)
//        {
//            alert('Malicious content was found in input string');
//            
//            eve.value="";
//            eve.focus();
//            
//        }
//    else
//        {
//            eve.value=eve.value.toTitleCase();
//            return true;
//        }
//}


    
   

document.write("<form action='/LeaveQuery.aspx' style='padding:0; margin:0' method='post' name='LeaveQuery' id='LeaveQuery'>");
document.write("<div class='internet_login'>");
document.write("<div class='internet_login_head'>");
document.write("<p class='panelheading_black graypheading_space1'>Leave a<span class='panelheading_green'> Query</span><span class='mandatory'>*</span></p>");
document.write("</div>");
document.write("<div class='query_content login_space'>");
document.write("<div class='block_headings_form' ><span class='mandatory'>*</span><strong>Select your category &raquo;</strong></div>");
document.write("<select name='cmbCategory' onchange='Category()' id='cmbCategory'  class='input_space'>");
document.write("<option selected='selected' value='select'>Select</option>");
document.write("<option value='Personal' >Personal</option>");
document.write("<option value='Corporate' >Corporate</option>");
document.write("<option value='Agriculture' >Agriculture</option>");
document.write("<option value='NRI' >NRI</option>");
document.write("<option value='Customer Support' >Customer Support</option>");
document.write("</select>");
document.write("<div class='block_headings_form' id='selProduct'  ><strong>Select your product &raquo;</strong></div>");
document.write("<select name='cmbProduct' id='cmbProduct' class='input_space'>");
document.write("<option selected='selected' value='Select' >Select</option>");
document.write("</select>");
document.write("<div class='clear'></div>");
document.write("<span class='mandatory'>*</span> <input type='text' name='txtFirstname' maxlength='25'  onKeyPress='return charonly(event);' id='txtFirstname' value='First Name' onFocus=\"if (this.value=='First Name') this.value=''\" onBlur=\"if (this.value=='') this.value='First Name'\"/> ");
document.write("<span class='mandatory'>*</span> <input type='text' name='txtLastName' maxlength='25' onKeyPress='return charonly(event);' id='txtLastName' value='Last Name' onFocus=\"if (this.value=='Last Name') this.value=''\" onBlur=\"if (this.value=='') this.value='Last Name'\"/> ");
document.write("<div class='clear'></div>");
document.write("<span class='mandatory'>*</span> <input type='text' name='txtEmailId' maxlength='50' id='txtEmailId' value='Email ID' onFocus=\"if (this.value=='Email ID') this.value=''\" onBlur=\"if (this.value=='') this.value='Email ID'\"/>");
document.write("<span class='mandatory1'>*</span><input type='text' name='txtPhone'  maxlength='10' onKeyPress='return numbersonly(event);' id='txtPhone' class='leftSpace' value='Phone no.' onFocus=\"if (this.value=='Phone no.') this.value=''\" onBlur=\"if (this.value=='') this.value='Phone no.'\"/>");
document.write("<span class='mandatory'>*</span> <input type='text' name='txtlocation' maxlength='25' class='locationSpace' onKeyPress='return charonly(event);' id='txtlocation' value='Location' onFocus=\"if (this.value=='Location') this.value=''\" onBlur=\"if (this.value=='') this.value='Location'\"/>");
document.write("<textarea name='txtQuery'  id='txtQuery' value='Your Query' onFocus=\"if (this.value=='Your Query') this.value=''\" onBlur=\"if (this.value=='') this.value='Your Query'\" >Your Query</textarea>");
//document.write("<center><input type='button' class='grn_submit' onclick='document.LeaveQuery.submit();'/></center>");
document.write("<center><input type='button' class='grn_submit' onclick='return fnSubmit();'/></center><p>&nbsp;</p>");
document.write("<p>(For product inquiries only. For specific feedback / complaints, please use the Link Feedback / Complaint)</p>");
document.write("</div>");
document.write("<div class='internet_login_footer'></div>");
document.write("</div>");
document.write("</form>");


