function validateloginfrm(frm)
{
	if(frm.username.value=="")
	{
		alert('Kindly Enter The User Name');
		frm.username.focus();
		return false;
	}
	if(frm.password.value=="")
	{
		alert('Kindly Enter The Password');
		frm.password.focus();
		return false;
	}
	return true;
	
}
			function validateForm(form_obj){
				var obj_arr =new Array('UserName','ClientPassword', 're_password', 'FirstName','LastName','StreetAddress1','Suburb','State','Country','Zip','Phone');
				var obj_arr_keys =new Array('Email Address','Password','Re Type Password', 'First Name','Last Name','StreetAddress1','City','State','Country','Zip','Phone Number');
				
				for(i=0;i < obj_arr.length;i++){
					val = obj_arr[i];
	
					obj = eval("form_obj." + val);
					
					if((obj == "undefined") || !obj){

						continue;
					}


					if(obj.value == ""){
						alert("Please fill all the Mandatory Fields("+ obj_arr_keys[i] +")");
						obj.focus();
						return false;
					}
					if(val == "UserName"){
						valid_email = checkemail(obj.value);
						if(!valid_email){
							alert("Please enter a valid email address");
							obj.focus();
							return false;
						}
					}

					if((val == "country_id") || (val == "state_id")){
						if(obj.value == 0){
							alert("Please select " + obj_arr_keys[i]);
							obj.focus();
							return false;
						}
					}
				}

				if(form_obj.password.value != form_obj.re_password.value){
					alert("Password fields don't match");
					form_obj.password.focus();
					return false;
				}
				return true;
			}


			function checkemail(str){
				var filter=/^.+@.+\..{2,3}$/;
				
				testresults=false;

				if (filter.test(str))
					testresults=true;
				
				return testresults;
			}


			function checkForm(form_obj){
				if(validateForm(form_obj)){
					return true;
				}
				return false;
			}
function validatesearchprocess(frm)
{

	if(frm.keyword.value=="")
	{
		alert('Kindly Enter The Directory to search');
		frm.keyword.focus();
		return false;
	}
}
function validatePost(frm)
{
	if(frm.PostingTitle.value=="")
	{
		alert('Kindly Enter The Post Title');
		frm.PostingTitle.focus();
		return false;
	}
	if(frm.location.value=="")
	{
		alert('Kindly Enter The Loaction');
		frm.location.focus();
		return false;
	}
	if(frm.description.value=="")
	{
		alert('Kindly Enter The Description');
		frm.description.focus();
		return false;
	}
	if(frm.FromEMail.value=="")
	{
		alert('Kindly Enter The Email Address');
		frm.FromEMail.focus();
		return false;
	}
	if(frm.ConfirmEMail.value=="")
	{
		alert('Kindly Enter The Confirm Email Address');
		frm.ConfirmEMail.focus();
		return false;
	}
	if(frm.ConfirmEMail.value!=frm.FromEMail.value)
	{
		alert('Both The Email Address Donot match. ');
		frm.FromEMail.focus();
		return false;
	}
	

	if(frm.FromEMail.value){
						valid_email = checkemail(frm.FromEMail.value);
						if(!valid_email){
							alert("Please enter a valid email address !");
							frm.FromEMail.focus();
							return false;
						}
				}
	function checkemail(str){
		var filter=/^.+@.+\..{2,3}$/;
		testresults=false;
		if (filter.test(str))
			testresults=true;
			return testresults;
		}


	if(frm.Street.value=="")
	{
		alert('Kindly Enter The Street');
		frm.Street.focus();
		return false;
	}
	if(frm.Nearest_Cross_Street.value=="")
	{
		alert('Kindly Enter The Nearest Street');
		frm.Nearest_Cross_Street.focus();
		return false;
	}
	if(frm.City.value=="")
	{
		alert('Kindly Enter The City');
		frm.City.focus();
		return false;
	}
	if(frm.state.value=="")
	{
		alert('Kindly Enter The state');
		frm.state.focus();
		return false;
	}


return true;
}
function validate_article(frm)
{
	if(frm.name.value=="")
	{
		alert('Enter the name .');
		frm.name.focus();
		return false;
	}
	if(frm.email.value=="")
	{
		alert('Enter the email address .');
		frm.email.focus();
		return false;
	}
	if(frm.email.value)
	{
		valid_email = checkemail(frm.email.value);
		if(!valid_email)
		{
				alert("Please enter a valid email address !");
				frm.email.focus();
				return false;
		}
	}
	if(frm.site_name.value=="")
	{
		alert('Enter the site name ');
		frm.site_name.focus();
		return false;
	}
	if(frm.site_url.value=="")
	{
		alert('Enter the site url ');
		frm.site_url.focus();
		return false;
	}
	if(frm.title.value=="")
	{
		alert('Enter the title');
		frm.title.focus();
		return false;
	}
	
	if(frm.article_description.value=="")
	{
		alert('Enter the article description');
		frm.article_description.focus();
		return false;
	}
	if(frm.category.value=="")
	{
		alert('Select a Sub category');
		frm.category.focus();
		return false;
	}
	if(frm.spam.value=="")
	{
		alert('Enter the article spam');
		frm.spam.focus();
		return false;
	}
	if(frm.databody.value=="")
	{
		alert('Enter your article');
		frm.databody.focus();
		return false;
	}
	return true;
}
function validateEmail(frm)
{
	if(frm.email.value=="")
	{
		alert('Enter The Email Address');
		frm.email.focus();
		return false;
	}else{
		valid_email = checkemail(frm.email.value);
		if(!valid_email)
		{
				alert("Please enter a valid email address !");
				frm.email.focus();
				return false;
		}

	}
}
function changeState(frm)
{
frm.process.value="";
frm.submit();
}
function validateContactUsform(frm)
{
	if(frm.emailUserName.value=="")
	{
		alert('Enter the name');
		frm.emailUserName.focus();
		return false;
	}
	if(frm.userEmailAddress.value=="")
	{
		alert('Enter the email address')
		frm.userEmailAddress.focus();
		return false;
	}
		valid_email = checkemail(frm.userEmailAddress.value);
		if(!valid_email)
		{
				alert("Please enter a valid email address !");
				frm.userEmailAddress.focus();
				return false;
		}
	if(frm.userEmailAddress2.value=="")
	{
		alert('Enter the confirm email address');
		frm.userEmailAddress2.focus();
		return false;
	}
	if(frm.userEmailAddress.value!=frm.userEmailAddress2.value)
	{
		alert('Both the password do not match');
		frm.userEmailAddress2.focus();
		return false;
	}
	if(frm.userEmailSubject.value=="")
	{
		alert('Enter the subject');
		frm.userEmailSubject.focus();
		return false;
	}
	if(frm.userEmailBody.value=="")
	{
		alert('Enter the issue');
		frm.userEmailBody.focus();
		return false;
	}
	frm.process.value="contact";
	return true;
	
}














