function isValidEmail(address) 
{
	if (address.indexOf('@') < 1) return false;
	var name = address.substring(0, address.indexOf('@'));
	var domain = address.substring(address.indexOf('@') + 1);
	if (name.indexOf('(') != -1 || name.indexOf(')') != -1 || name.indexOf('<') != -1 || name.indexOf('>') != -1 || name.indexOf(',') != -1 || name.indexOf(';') != -1 || name.indexOf(':') != -1 || name.indexOf('\\') != -1 || name.indexOf('"') != -1 || name.indexOf('[') != -1 || name.indexOf(']') != -1 || name.indexOf(' ') != -1) return false;
	if (domain.indexOf('(') != -1 || domain.indexOf(')') != -1 || domain.indexOf('<') != -1 || domain.indexOf('>') != -1 || domain.indexOf(',') != -1 || domain.indexOf(';') != -1 || domain.indexOf(':') != -1 || domain.indexOf('\\') != -1 || domain.indexOf('"') != -1 || domain.indexOf('[') != -1 || domain.indexOf(']') != -1 || domain.indexOf(' ') != -1) return false;
	return true;
}


function isValidEmailStrict(address)
{
	if (isValidEmail(address) == false) return false;
	var domain = address.substring(address.indexOf('@') + 1);
	if (domain.indexOf('.') == -1) return false;
	if (domain.indexOf('.') == 0 || domain.indexOf('.') == domain.length - 1) return false;
	return true;
}
//Check Numeric
function CheckNumeric(checkStr)
{
		var checknotOK = "0123456789";
		var allValid = false;
		for (i = 0;  i < checkStr.length;  i++)
		{
			ch = checkStr.charAt(i);
			ch1 = checkStr.charAt(0);
			for (k=0; k < checknotOK.length; k++)
			{
				//alert(ch+"  "+checknotOK.charAt(k));
				if (ch == checknotOK.charAt(k))
				{
					allValid = true;
					break;
				}
				if (k == checknotOK.length)
				{
					 allValid = false;
					 break;
				}
			}
		}
		return allValid;
}

function EnquiryValidate()
{
	 var txtCaptcha=document.enquiry.txtCaptcha.value;
	 var txtGetCaptcha=document.enquiry.txtGetCaptcha.value;
	
		if(document.enquiry.name.value=='Name' || document.enquiry.name.value =='')
		{
			alert('Enter Name');
			document.enquiry.name.focus();
			return false;
		}
		if(document.enquiry.email.value=='E-mail' || document.enquiry.email.value =='')
		{
				alert('Enter Email');
				document.enquiry.email.focus();
				
				return false;
		}
		if(document.enquiry.email.value!='')
		{
			if(!isValidEmailStrict(document.enquiry.email.value))
			{
				
				alert('Enter Valid Email');
				document.enquiry.email.focus();
				return false;
			}
		}
		
		if(document.enquiry.contact_no.value=='Contact no' || document.enquiry.contact_no.value =='')
		{
				alert('Enter Contact No');
				document.enquiry.contact_no.focus();
				return false;
		}
		if(document.enquiry.contact_no.value!='')
		{
			if(!CheckNumeric(document.enquiry.contact_no.value))
			{
				
				alert('Enter Only Numeric Value');
				document.enquiry.contact_no.focus();
				return false;
			}
		}
		if(document.enquiry.message.value=='Your Message' || document.enquiry.message.value =='')
		{
				alert('Enter Message');
				document.enquiry.message.focus();
				return false;
		}
		if(txtCaptcha=='') 
		 {
			 alert("Please enter verification code.!");
                document.enquiry.txtCaptcha.focus();
                return false;
		 }
		  if(txtCaptcha != txtGetCaptcha)
             {
	           alert("Please enter  Correct verification code.!");
			    document.enquiry.txtCaptcha.focus();
				return false;           
			 }
		 
		else
		{
			
		return true;
		}
}
//Inner Pages Validatation
function QuickValidate()
{
	if(document.quick.name.value =='')
		{
			alert('Enter Name');
			document.quick.name.focus();
			return false;
		}
		if(document.quick.email.value =='')
		{
				alert('Enter Email');
				document.quick.email.focus();
				
				return false;
		}
		if(document.quick.email.value!='')
		{
			if(!isValidEmailStrict(document.enquiry.email.value))
			{
				
				alert('Enter Valid Email');
				document.quick.email.focus();
				return false;
			}
		}
		
		if(document.quick.message.value=='')
		{
				alert('Enter Message');
				document.quick.message.focus();
				return false;
		}
		else
		{
			return true;
		}
}

function CareerValidate()
{
		if(document.career.txtname.value=='Name' || document.career.txtname.value =='')
		{
			alert('Enter Name');
			document.career.txtname.focus();
			return false;
		}
		if(document.career.txtemail.value=='E-mail' || document.career.txtemail.value =='')
		{
				alert('Enter Email');
				document.career.txtemail.focus();
				
				return false;
		}
		if(document.career.txtemail.value!='')
		{
			if(!isValidEmailStrict(document.career.txtemail.value))
			{
				
				alert('Enter Valid Email');
				document.career.txtemail.focus();
				return false;
			}
		}
		
	if(document.career.txtcontact.value=='Contact no' || document.career.txtcontact.value =='')
		{
				alert('Enter Contact No');
				document.career.txtcontact.focus();
				return false;
		}
		if(document.career.txtcontact.value!='')
		{
			if(!CheckNumeric(document.career.txtcontact.value))
			{
				
				alert('Enter Only Numeric Value');
				document.career.txtcontact.focus();
				return false;
			}
		}
		if(document.career.txtquali.value=='')
		{
			alert('Enter Qualification');
			document.career.txtquali.focus()
			return false;
		}
		if(document.career.txtupload.value=='')
		{
			alert('Please Select Resume');
			document.career.txtupload.focus();
			return false;
		}
		else
		{
				return true;
		}
		
}
