// JavaScript Document

<!--Validation for Contact Us form-->

function ValidateContact()
{
// Clients Name..
	if(document.getElementById('txtName').value == ''){
	alert('Please enter name.');
	setFocus('txtName');
	return false;
	}
	
// Clients Address..
	if(document.getElementById('txtAddress').value == ''){
	alert('Please enter address.');
	setFocus('txtAddress');
	return false;
	}
	
// Clients Address..
	if(document.getElementById('txtCity').value == ''){
	alert('Please enter city.');
	setFocus('txtCity');
	return false;
	}
		
// Zip Code is numeric...
	if(document.getElementById('txtZip').value == ''){
	alert('Please Enter zip code.');
	setFocus('txtZip');
	return false;
	}
	if(isNaN(document.getElementById('txtZip').value))
	{
		alert("Please Enter Numeric Value For zip code");
		setFocus('txtZip');	
		return false;
	}
	
	
// Clients Address..
	if(document.getElementById('txtCountry').value == '0'){
	alert('Please select country.');
	setFocus('txtCountry');
	return false;
	}
	
// Country Code is numeric...

	if (isNaN(document.getElementById("txtCountryCode").value))
	{
	alert("please enter a valid country code.");
	setFocus('txtCountryCode');
	return false;
	}
// City Code is numeric...

	if (isNaN(document.getElementById("txtCityCode").value))
	{
	alert("please enter a valid city code.");
	setFocus('txtCityCode');
	return false;
	}
// Phone is numeric...

	if (isNaN(document.getElementById("txtPhone").value))
	{
	alert("please enter a valid phone.");
	setFocus('txtPhone');
	return false;
	}
//Fax is numeric...
//
//	if (isNaN(document.getElementById("txtFax").value))
//	{
//	alert("please enter a valid Fax.");
//	setFocus('txtFax');
//	return false;
//	}
// Email..
	
	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){
	alert("Invalid e-mail address.")
	return false
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	alert("Invalid e-mail address.")
	return false
	
	}
	
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	alert("Invalid e-mail address.")
	return false
	}
	
	if (str.indexOf(at,(lat+1))!=-1){
	alert("Invalid e-mail address.")
	return false
	}
	
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	alert("Invalid e-mail address")
	return false
	}
	if (str.indexOf(dot,(lat+2))==-1){
	alert("Invalid e-mail address.")
	return false
	}
	if (str.indexOf(" ")!=-1){
	
	alert("Invalid e-mail address.")
	return false
	}
	return true					
	}
	
	var emailID=document.my_form.txtEmail
	
	if ((emailID.value==null)||(emailID.value=="")){
	alert("Please enter your e-mail address.")
	setFocus('txtEmail');
	return false
	}
	
	if (echeck(emailID.value)==false){
	emailID.value=""
	emailID.focus()
	return false
	}
	
	// Clients Enquiry..
	if(document.getElementById('txtViewFeedback').value == '0'){
	alert('Select Feedback and enter details.');
	setFocus('txtViewFeedback');
	return false;
	}
  // End.......
  
  
  	// Clients Captcha..
	if(document.getElementById('captcha_code').value == ''){
	alert('Please enter verification code carefully.');
	setFocus('captcha_code');
	return false;
	}
	
	// End 
	
	return true;
	}

	 <!--Feedback Drop Down-->
	 
	function showFeedback(id)
	
	{ 
	
		if(id == 0) 
		{	
		document.getElementById('jobDiv').style.display = 'none';
		}
		else 
		{
		document.getElementById('jobDiv').style.display = '';
		}
	}

<!--Validation for Comments Form-->
function ValidateComment()
{
	//alert('hello');
	// Clients Name..
	if(document.getElementById('txtName').value == ''){
	alert('Please enter name.');
	setFocus('txtName');
	return false;
	}

// Email..
	
	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){
	alert("Invalid e-mail address.")
	return false
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	alert("Invalid e-mail address.")
	return false
	
	}
	
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	alert("Invalid e-mail address.")
	return false
	}
	
	if (str.indexOf(at,(lat+1))!=-1){
	alert("Invalid e-mail address.")
	return false
	}
	
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	alert("Invalid e-mail address")
	return false
	}
	if (str.indexOf(dot,(lat+2))==-1){
	alert("Invalid e-mail address.")
	return false
	}
	if (str.indexOf(" ")!=-1){
	
	alert("Invalid e-mail address.")
	return false
	}
	return true					
	}
	var emailID=document.my_form.txtEmail
	
	if ((emailID.value==null)||(emailID.value=="")){
	alert("Please enter your e-mail Address.")
	setFocus('txtEmail');
	return false
	}
	
	if (echeck(emailID.value)==false){
	emailID.value=""
	emailID.focus()
	return false
	}
	
	// Article Comments..
	if(document.getElementById('my_text').value == ''){
	alert('Please enter comment.');
	setFocus('my_text');
	return false;
	}

	// Clients Captcha..
	if(document.getElementById('captcha_code').value == ''){
	alert('Please enter verification code.');
	setFocus('captcha_code');
	return false;
	}

	return true;
	}
	
	function check_length(my_form)
	{
		maxLen = 150; // max number of characters allowed
		if (my_form.my_text.value.length >= maxLen) {
		// Alert message if maximum limit is reached.
		// If required Alert can be removed.
		var msg = "You have reached your maximum limit of characters allowed";
		alert(msg);
		// Reached the Maximum length so trim the textarea
		my_form.my_text.value = my_form.my_text.value.substring(0, maxLen);
		}
		else{ // Maximum length not reached so update the value of my_text counter
		my_form.text_num.value = maxLen - my_form.my_text.value.length;}
	}
	//-->


function check_length_contact(my_form)
	{
		maxLen = 1000; // max number of characters allowed
		if (my_form.txtFeedback.value.length >= maxLen) {
		// Alert message if maximum limit is reached.
		// If required Alert can be removed.
		var msg = "You have reached your maximum limit of characters allowed";
		alert(msg);
		// Reached the Maximum length so trim the textarea
		my_form.txtFeedback.value = my_form.txtFeedback.value.substring(0, maxLen);
		}
		else{ // Maximum length not reached so update the value of my_text counter
		my_form.text_num_contact.value = maxLen - my_form.txtFeedback.value.length;}
	}
	//-->

function check_length_address(my_form)
	{
		maxLen = 100; // max number of characters allowed
		if (my_form.txtAddress.value.length >= maxLen) {
		// Alert message if maximum limit is reached.
		// If required Alert can be removed.
		var msg = "You have reached your maximum limit of characters allowed";
		alert(msg);
		// Reached the Maximum length so trim the textarea
		my_form.txtAddress.value = my_form.txtAddress.value.substring(0, maxLen);
		}
		else{ // Maximum length not reached so update the value of my_text counter
		my_form.text_num_address.value = maxLen - my_form.txtAddress.value.length;}
	}
	//-->

