function fun_blank_phone_country_code()
{
	 
	   var frm = document.frm_advertise;
		if(frm.adv_phone_country_code.value=="Enter Country Code")
		{
			frm.adv_phone_country_code.value='';
			frm.adv_phone_country_code.className='';
			frm.adv_phone_country_code.focus();
		}
}


function fun_blank_city_code()
{
	 
	   var frm = document.frm_advertise;
		if(frm.adv_city_code.value=="Enter City Code")
		{
			frm.adv_city_code.value='';
			frm.adv_city_code.className='';
			frm.adv_city_code.focus();
		}
}


function fun_blank_phone()
{
	 
	   var frm = document.frm_advertise;
		if(frm.adv_phone_no.value=="Enter Phone No")
		{
			frm.adv_phone_no.value='';
			frm.adv_phone_no.className='';
			frm.adv_phone_no.focus();
		}
}


function fun_blank_mobile_country_code()
{
	 
	   var frm = document.frm_advertise;
		if(frm.adv_mobile_country_code.value=="Enter Country Code")
		{
			frm.adv_mobile_country_code.value='';
			frm.adv_mobile_country_code.className='';
			frm.adv_mobile_country_code.focus();
		}
}


function fun_blank_mobile_no()
{
	 
	   var frm = document.frm_advertise;
		if(frm.adv_mobile_no.value=="Enter Mobile No")
		{
			frm.adv_mobile_no.value='';
			frm.adv_mobile_no.className='';
			frm.adv_mobile_no.focus();
		}
}



function frm_validate()
{
		var frm = document.frm_advertise;
		if(frm.adv_name.value==""){
			alert("Error: Please enter your Name!");
			frm.adv_name.focus();
			return false;
		}
		
		if(frm.adv_email.value==""){
			alert("Error: Please enter your E-mail");
			frm.adv_email.focus();
			return false;
		}
		
		if(!isValidEmail(frm.adv_email.value)){
			alert("Error: Invalid email your address!");
			frm.adv_email.focus();
			return false;
		}
		
		/*
		if(frm.adv_phone_country_code.value==""){
			alert("Error: Please enter your Phone Country Code.!");
			frm.adv_phone_country_code.focus();
			return false;
		}
		
		if(frm.adv_city_code.value==""){
			alert("Error: Please enter your Phone City Code.!");
			frm.adv_city_code.focus();
			return false;
		}
		
		
		if(frm.adv_phone_no.value==""){
			alert("Error: Please enter your Phone No!");
			frm.adv_phone_no.focus();
			return false;
		}
		
		
		
		if(isNaN(frm.adv_phone_country_code.value))
		{
			alert("Error: Please enter valid Phone Country Code.!");
			frm.adv_phone_country_code.focus();
			return false;
		}
		
		if(isNaN(frm.adv_city_code.value))
		{
			alert("Error: Please enter valid Phone City Code.!");
			frm.adv_city_code.focus();
			return false;
		}
		if(isNaN(frm.adv_phone_no.value))
		{
			alert("Error: Please enter valid Phone No.!");
			frm.adv_phone_no.focus();
			return false;
		}
		
		 
		 
		 
		 
		 
		 
		 
		 
		 if(frm.adv_mobile_country_code.value==""){
			alert("Error: Please enter your Mobile Country Code.!");
			frm.adv_mobile_country_code.focus();
			return false;
		}
		
		
		if(frm.adv_mobile_no.value==""){
			alert("Error: Please enter your Mobile No!");
			frm.adv_mobile_no.focus();
			return false;
		}
		
		
		
		if(isNaN(frm.adv_mobile_country_code.value))
		{
			alert("Error: Please enter valid Mobile Country Code.!");
			frm.adv_mobile_country_code.focus();
			return false;
		}
		
		if(isNaN(frm.adv_mobile_no.value))
		{
			alert("Error: Please enter valid Mobile No.!");
			frm.adv_mobile_no.focus();
			return false;
		}
		
		
		*/
		if(frm.adv_comments.value==""){
			alert("Error: Please enter your Comment!");
			frm.adv_comments.focus();
			return false;
		}
				
	  
		return true;
}




function isValidEmail(address) {
	if (address.indexOf('@') < 3) 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;
}


// Check that an email address has the form something@something.something
// This is a stricter standard than RFC 821 (?) which allows addresses like postmaster@localhost
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;
}
 
