// JScript File
function checkspecial(checkfield)
{
 	var iChars = "!$%^&()[]\\\';,/{}|\":<>?";
	for (var i = 0; i < checkfield.length; i++)
	{
		if (iChars.indexOf(checkfield.charAt(i)) != -1)
		{
			//alert("yes")
			return true;
		}			
	}					
}
function resetquick()
{
	document.q_form.reset();	
	GenNewCap();	
}
function echeck(str)
{
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
	//alert(str.indexOf(dot));
	//alert(lstr);
	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-1))
	{
		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 || str.indexOf("!")!=-1 || str.indexOf("?")!=-1 || str.indexOf("$")!=-1 || str.indexOf("^")!=-1 || str.indexOf("*")!=-1 || str.indexOf("{")!=-1)
	 {
		alert("Invalid E-mail ID");
		return false;
	 }
	 return true;
}
function checkme()
{
	var emailID=document.q_form.email;
	if (document.q_form.fname.value == "")
    {
	    alert("Please Enter Your First Name.");		
	    document.q_form.fname.focus();
	    return false;
    }
    else if(checkspecial(document.q_form.fname.value))
    {
	    alert ("Special characters are not allowed.");		
	    document.q_form.fname.focus();
	    return false;
    }
    else if (document.q_form.lname.value == "")
    {
	    alert("Please Enter Your Last Name.");		
	    document.q_form.lname.focus();
	    return false;}
    else if(checkspecial(document.q_form.lname.value))
    {
	    alert ("Special characters are not allowed.");		
	    document.q_form.lname.focus();
	    return false;
    }    
    if ((emailID.value==null)||(emailID.value==""))
	{
		alert("Please Enter your E-mail ID");		
		emailID.focus();
		return false
	}
	else if (echeck(emailID.value)==false)
	{
		emailID.focus();
		return false
	}    
	else if (echeck(document.q_form.email.value)==false)
    {
       	document.q_form.email.focus();
        return false;
    }
	else if (document.q_form.phone.value == "")
    {
	    alert("Please Enter Your Phone No.");		
	    document.q_form.phone.focus();
	    return false;}
    else if(checkspecial(document.q_form.phone.value))
    {
	    alert ("Special characters are not allowed.");		
	    document.q_form.phone.focus();
	    return false;
    } 		
	else if (document.q_form.country.value == "No")
    {
	    alert("Please Select Your Time");		
	    document.q_form.country.focus();
	    return false;
	}
	else if (document.q_form.question.value == "")
    {
	    alert("Please Enter Your Question.");		
	    document.q_form.question.focus();
	    return false;
	}
	else if(document.getElementById("testtext").value=="")
	{
		alert("Please Enter The Verification Code!");
		document.getElementById("testtext").focus();
		return false;
	}
	else if(document.getElementById("holdCAP").value.toLowerCase()!=document.getElementById("testtext").value.toLowerCase())
	{
		alert("Sorry That Was Not The Correct Code");		
		document.getElementById("testtext").focus();
		return false;
	}		
	else
	{
		return true;
	}
}