<!-- saved from url=(0022)http://internet.e-mail -->
/* This is Script file for front-end */

//---------checking mailid is valid or not----------------
	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 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)
		{
		    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)
		 {
		    alert("Invalid E-mail ID");
		    return false;
		 }
		return true;				
	}

	//delete white-space from textbox 
	function white_space(field)
	{
		field.value = (field.value).replace(/^\s*|\s*$/g,'');
		//field.value = (field.value).replace(' ','_');		 
	}

	//  this function checks the email format is correct or not and return true or false accordingly.
	function is_email(email)
	{
		if(!email.match(/^[A-Za-z0-9\._\-+]+@[A-Za-z0-9_\-+]+(\.[A-Za-z0-9_\-+]+)+$/))
			return false;
		return true;
	}
	/*************** Phone number validation **************/

		// Declaring required variables
		var digits = "0123456789";
		// non-digit characters which are allowed in phone numbers
		var phoneNumberDelimiters = "()- ";
		// characters which are allowed in international phone numbers
		// (a leading + is OK)
		var validWorldPhoneChars = phoneNumberDelimiters + "+";
		// Minimum no of digits in an international phone no.
		var minDigitsInIPhoneNumber = 10;

		function isInteger(s)
		{   var i;
			for (i = 0; i < s.length; i++)
			{   
				// Check that current character is number.
				var c = s.charAt(i);
				if (((c < "0") || (c > "9"))) return false;
			}
			// All characters are numbers.
			return true;
		}

		function stripCharsInBag(s, bag)
		{   
			var i;
			var returnString = "";
			// Search through string's characters one by one.
			// If character is not in bag, append to returnString.
			for (i = 0; i < s.length; i++)
			{   
				// Check that current character isn't whitespace.
				var c = s.charAt(i);
				if (bag.indexOf(c) == -1) returnString += c;
			}
			return returnString;
		}

		function checkInternationalPhone(strPhone)
		{
			s=stripCharsInBag(strPhone,validWorldPhoneChars);
			return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
		}

	function hIDe()
	{
		document.all.tr1.style.display='block';
		document.all.tr2.style.display='none';
	}
	function unhIDe()
	{
		document.all.tr1.style.display='none';
		document.all.tr2.style.display='block';
	}


	function showfield(checked, id)
	{    
		document.getElementById(id).style.display = checked ? 'block' : 'none';
	}

	function showimage(checked, id)
	{    
		document.getElementById(id).style.display = checked ? 'block' : 'none';
	}









//----------------update special property form ----------------
function update_splpropertyForm()
{

//alert();
	if(window.document.post_property.property_type.value=="")
	{
		alert("Select Property Type");
		window.document.post_property.property_type.focus();
		return false;
	}
		
		if(window.document.post_property.city.value=="")
		{
			alert("Please Select City Name");
			window.document.post_property.city.focus();
			return false;
		} 
	

	/*if(window.document.post_property.add1.value=="")
	{
		alert("Enter Address");
		window.document.post_property.add1.focus();
		return false;
	}*/
	if(window.document.post_property.furnished.value=="")
	{
		alert("Select Furnishing");
		window.document.post_property.furnished.focus();
		return false;
	}
	if(window.document.post_property.totalfloor.value=="")
	{
		alert("Enter Total Floors");
		window.document.post_property.totalfloor.focus();
		return false;
	}
	if(window.document.post_property.area.value=="")
	{
		alert("Enter Area Of Property");
		window.document.post_property.area.focus();
		return false;
	}
	if(window.document.post_property.unit.value=="")
	{
		alert("Select Area Unit");
		window.document.post_property.unit.focus();
		return false;
	}
	if(window.document.post_property.desc.value=="")
	{
		alert("Enter Property Description");
		window.document.post_property.desc.focus();
		return false;
	}
	if(window.document.post_property.prop_cat[0].checked==true)
	{
		if(window.document.post_property.tenant.value=="")
		{
			alert("Select Tenant Type");
			window.document.post_property.tenant.focus();
			return false;
		}
		/*acording to onrequest*/
		if(window.document.post_property.ON_VR[0].checked==true){
			if(window.document.post_property.lakh1.value=="0" && window.document.post_property.thousand.value=="0" && window.document.post_property.hundred.value=="0" ){
				alert("Please Enter Property Rent");
				window.document.post_property.thousand.focus();
				return false;
			}
		}
	}else{
		if(window.document.post_property.ON_VR1[0].checked==true){
			if(window.document.post_property.crores.value=="0" && window.document.post_property.lakh.value=="0" && window.document.post_property.thousand1.value=="0" ){
				alert("Please Enter Property Cost");
				window.document.post_property.lakh.focus();
				return false;
			}
			if(window.document.post_property.crores.value==""){
				alert("Enter Crores");
				window.document.post_property.crores.focus();
				return false;
			}
			if(window.document.post_property.lakh.value==""){
				alert("Enter Lakhs");
				window.document.post_property.lakh.focus();
				return false;
			}
			if(window.document.post_property.thousand1.value==""){
				alert("Enter Thousand");
				window.document.post_property.thousand1.focus();
				return false;
			}
		}
	}
		
	if(window.document.post_property.name.value=="")
	{
		alert("Enter Name");
		window.document.post_property.name.focus();
		return false;
	}
	if(window.document.post_property.contactno.value=="")
	{
		alert("Enter Contact No");
		window.document.post_property.contactno.focus();
		return false;
	}
	if(window.document.post_property.email.value=="")
	{
		alert("Enter EmailID");
		window.document.post_property.email.focus();
		return false;
	}
	else if(! is_email(window.document.post_property.email.value))
	{
		alert("EmailID should be in valid format !");
		window.document.post_property.email.value="";
		window.document.post_property.email.focus();
		return false;
	}
	if(window.document.post_property.stime.value=="")
	{
		alert("Select Suitable Time To Call");
		window.document.post_property.stime.focus();
		return false;
	}
	
	return true;
}
//end update spl property validation


//-------------- testimonial form -------------------

function testiForm()
{
	if(window.document.testimonial.heading.value=="")
	{
		alert("Please Enter Heading For your testimonial");
		window.document.testimonial.heading.focus();
		return false;
	} 
	if(window.document.testimonial.detail.value=="")
	{
		alert("Please Enter Description of testimonial");
		window.document.testimonial.detail.focus();
		return false;
	} 
	if(document.testimonial.name.value=="")
	{
		alert("Please Enter your Name");
		document.testimonial.name.focus();
		return false;
	}
	if(document.testimonial.email.value=="")
	{
		alert("Please Enter your Email Address");
		document.testimonial.email.focus();
		return false;
	}
	else if(!echeck(document.testimonial.email.value) && (!is_email(document.testimonial.email.value)))
	{
		document.testimonial.email.value="";
		document.testimonial.email.focus();
		return false;
	}
	if(document.testimonial.phone.value=="")
	{
		alert("Please Enter your Contact Number");
		document.testimonial.phone.focus();
		return false;
	}
	if(document.testimonial.country.value=="")
	{
		alert("Please Enter your Country Name");
		document.testimonial.country.focus();
		return false;
	}
	if(document.testimonial.occupation.value=="")
	{
		alert("Please Enter your Occupation");
		document.testimonial.occupation.focus();
		return false;
	}
}




	
//------------------registerForm -------------------



function registerForm()
{
	username1=white_space(window.document.register.username);
	var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?\' \'";
	for (var i = 0; i < document.register.username.value.length; i++) 
	{
		if (iChars.indexOf(document.register.username.value.charAt(i)) != -1) 
		{
			alert ("Your username has special characters or white space. \nThese are not allowed.\n Please remove them and try again.");
			window.document.register.username.value='';
			window.document.register.username.focus();
			return false;
		}
	}
	if(window.document.register.username.value=="")
	{
		alert("Username should not be blank");
		window.document.register.username.focus();
		return false;
	}
	if(window.document.register.password.value=="")
	{
		alert("Please enter the password");
		window.document.register.password.focus();
		return false;
	}
	if(window.document.register.rpassword.value=="")
	{
		alert("Please re-enter the password");
		window.document.register.rpassword.focus();
		return false;
	}
	else if(window.document.register.password.value != window.document.register.rpassword.value)
		{
			alert("Please enter the same password");
			window.document.register.rpassword.value='';
			window.document.register.rpassword.focus();
			return false;
		}
	if(window.document.register.email.value=="")
	{
		alert("Please enter the email- ID");
		window.document.register.email.focus();
		return false;
	}
	else if(! is_email(document.register.email.value))
	{
		alert("EmailID should be in valid foramt !");
		window.document.register.email.value="";
		window.document.register.email.focus();
		return false;
	}
	if(window.document.register.name.value=="")
	{
		alert("Name should not be blank");
		window.document.register.name.focus();
		return false;
	}
	if(window.document.register.verify_code.value=="")
	{
		alert("Enter Verification Code");
		window.document.register.verify_code.focus();
		return false;
	}
	if(window.document.register.term.checked==false)
	{
		alert("Please Check Our Terms and Conditions");
		window.document.register.verify_code.focus();
		return false;
	}
}

//---------- validation in newuser form in first name & last Name ------------------
	function foc11()
	{
		if(document.signin.username.value=="User Name")
		document.signin.username.value="";
	}
	function foc21()
	{
		if(document.signin.pass.value=="******")
		document.signin.pass.value = "";
	}
	function blur11()
	{
		if(document.signin.username.value=="")
		document.signin.username.value = "User Name";
	}
	function blur21()
	{
		if(document.signin.pass.value=="")
		document.signin.pass.value = "******";
	}

//-----------------------checkall data---------------
	checked = false;
	function checkedAll ()
	{
		if (checked == false){checked = true}else{checked = false}
		for (var i = 0; i < document.getElementById('myform').elements.length; i++) 
		{
			document.getElementById('myform').elements[i].checked = checked;
		}
	}

	function ena(enable)
	{
		document.property.action='enable_disable_property.php?&page=<?php echo $pageNum; ?>&status='+enable;
		document.property.submit();
	}
	function disa(disable)
	{
		document.property.action='enable_disable_property.php?&page=<?php echo $pageNum; ?>&status='+disable;
		document.property.submit();
	}

//------------------ Config Form validation --------------
/*function configForm()
{
	if(window.document.config.url.value=="")
	{
		alert("Enter Website URL Starting with http://");
		window.document.config.url.focus();
		return false;
	}
	if(window.document.config.firstsite.value=="")
	{
		alert("Enter First Site Name");
		window.document.config.firstsite.focus();
		return false;
	}
	if(window.document.config.secondsite.value=="")
	{
		alert("Enter Second Site Name");
		window.document.config.secondsite.focus();
		return false;
	}
	if(window.document.config.thirdsite.value=="")
	{
		alert("Enter Third Site Name");
		window.document.config.thirdsite.focus();
		return false;
	}
	if(window.document.config.email.value=="")
	{
		alert("Enter Site MailID");
		window.document.config.email.focus();
		return false;
	}
	if(window.document.config.headline.value=="")
	{
		alert("Enter Headline");
		window.document.config.headline.focus();
		return false;
	}
	if(window.document.config.webemail.value=="")
	{
		alert("Enter Personal EmailID");
		window.document.config.webemail.focus();
		return false;
	}
	if(window.document.config.name.value=="")
	{
		alert("Enter Full Name Of Owner");
		window.document.config.name.focus();
		return false;
	}
	if(window.document.config.contactemail.value=="")
	{
		alert("Enter Email For Sending Enquiry");
		window.document.config.contactemail.focus();
		return false;
	}
	if(window.document.config.address.value=="")
	{
		alert("Enter Full Address");
		window.document.config.address.focus();
		return false;
	}
	if(window.document.config.city.value=="")
	{
		alert("Enter City Name");
		window.document.config.city.focus();
		return false;
	}
	if(window.document.config.zip.value=="")
	{
		alert("Enter Postal Code");
		window.document.config.zip.focus();
		return false;
	}
	if(window.document.config.state.value=="")
	{
		alert("Enter State Name");
		window.document.config.state.focus();
		return false;
	}
	if(window.document.config.country.value=="")
	{
		alert("Enter Country Name");
		window.document.config.country.focus();
		return false;
	}
	if(window.document.config.contact.value=="")
	{
		alert("Enter Site Contact Number");
		window.document.config.contact.focus();
		return false;
	}
	if(window.document.config.webmsg.value=="")
	{
		alert("Enter Site Message");
		window.document.config.webmsg.focus();
		return false;
	}
}*/

//-------------update user info ------------------

function UpdateForm()
{
	if(window.document.update.email.value=="")
	{
		alert("Enter EmailID");
		window.document.update.email.focus();
		return false;
	}
	else if(! is_email(window.document.update.email.value))
	{
		alert("EmailID should be in valid format !");
		window.document.update.email.value="";
		window.document.update.email.focus();
		return false;
	}
	if(window.document.update.name.value=="")
	{
		alert("Enter Your Full Name");
		window.document.update.name.focus();
		return false;
	}
	if(window.document.update.add1.value=="")
	{
		alert("Enter Your Address");
		window.document.update.add1.focus();
		return false;
	}
	if(window.document.update.city1.value=="")
	{
		alert("Enter Your City Name");
		window.document.update.city1.focus();
		return false;
	}
	if(window.document.update.pincode1.value=="")
	{
		alert("Enter Postal Code");
		window.document.update.pincode1.focus();
		return false;
	}
	if(window.document.update.contact.value=="")
	{
		alert("Enter Contact Number");
		window.document.update.contact.focus();
		return false;
	}
	if(window.document.update.usertype.value=="")
	{
		alert("Select User Type");
		window.document.update.usertype.focus();
		return false;
	}
}

//------------- Change password form ------------------
	function changepassForm()
	{
		var old_pass,new_pass,new_pass1,verify_code;
		old_pass=window.document.changepass.old_pass.value;
		new_pass=window.document.changepass.new_pass.value;
		new_pass1=window.document.changepass.new_pass1.value;
		len_pass=new_pass.length;

		if(old_pass=="")
		{
			alert("Enter Your Old Password");
			window.document.changepass.old_pass.focus();
			return false;
		}
		if(new_pass=="")
		{
			alert("Enter Your New Password");
			window.document.changepass.new_pass.focus();
			return false;
		}
		if(len_pass <6)
		{
			alert("Incorrect Password - "+len_pass + " digits filled, expected atleast 6 digits");
			window.document.changepass.new_pass.value='';
			window.document.changepass.new_pass.focus();
			return false;
		}
		if(new_pass1=="")
		{
			alert("Confirm Your New Password");
			window.document.changepass.new_pass1.focus();
			return false;
		}
		if(new_pass!=new_pass1)
		{
			alert("New Password Not Matching Please Enter Again");
			window.document.changepass.new_pass1.value='';
			window.document.changepass.new_pass.value='';
			window.document.changepass.new_pass.focus();
			return false;
		}
	}
		
//------------- login form validation ------------
	function loginform()
	{ 
		if(window.document.signin.username.value=="User Name")
		{
			alert("Please Enter UserName");
			window.document.signin.username.value="";
			window.document.signin.username.focus();
			return false;
		}
		if(window.document.signin.pass.value=="******")
		{
			alert("Please Enter Password");
			window.document.signin.pass.value="";
			window.document.signin.pass.focus();
			return false;
		}
	}

//---------- validation in left_login form in first name & last Name ------------------
	function foc_left()
	{
		if(document.login.username.value=="User Name")
		document.login.username.value="";
	}
	function foc_left1()
	{
		if(document.login.pass.value=="******")
		document.login.pass.value = "";
	}
	function blur_left()
	{
		if(document.login.username.value=="")
		document.login.username.value = "User Name";
	}
	function blur_left1()
	{
		if(document.login.pass.value=="")
		document.login.pass.value = "******";
	}


//-------------- enquiry form ----------------

function EnquiryForm()
{
	if(window.document.enquiry.name.value=="")
	{
		alert("Enter Your Full Name Please");
		window.document.enquiry.name.focus();
		return false;
	}
	if(window.document.enquiry.email.value=="")
	{
		alert("Enter Your EmailID");
		window.document.enquiry.email.focus();
		return false;
	}
	else if(!echeck(window.document.enquiry.email.value) && (!is_email(document.enquiry.email.value)))
	{
		window.document.enquiry.email.value="";
		window.document.enquiry.email.focus();
		return false;
	}
	if(window.document.enquiry.phone.value=="")
	{
		alert("Enter Your Contact Number");
		window.document.enquiry.phone.focus();
		return false;
	}
	if(window.document.enquiry.message.value=="")
	{
		alert("Enter Your Enquiry");
		window.document.enquiry.message.focus();
		return false;
	}
	if(window.document.enquiry.verify_code.value=="")
	{
		alert("Enter Verification Code, shown in image");
		window.document.enquiry.verify_code.focus();
		return false;
	}
}
//function for display hot product at admin page


function showrent(val)
{
	
	if(val=='1')
	{
		document.getElementById("hotproduct").style.display="block";
		document.getElementById("hotproduct1").style.display="none";
								
	}
	else
	{
		document.getElementById("hotproduct").style.display="none";
		document.getElementById("hotproduct1").style.display="block";
		
									
	}
}

//-------------- subscribe form ------------------------

function subscribeForm()
{
	if(window.document.subscribe.email.value=="")
	{
		alert("Enter Your EmailID");
		window.document.subscribe.email.focus();
		return false;
	}
	else if(! is_email(document.subscribe.email.value))
	{
		alert("EmailID Should be in valid format !");
		window.document.subscribe.email.value="";
		window.document.subscribe.email.focus();
		return false;
	}
	if(window.document.subscribe.sub_type.value=="")
	{
		alert("Select You Subscriber Type");
		window.document.subscribe.sub_type.focus();
		return false;
	}
}

//---------------------------- contactus form ------------------------
function contactForm()
{
	if(window.document.query.name.value=="")
	{
		alert("Name should not be blank");
		window.document.query.name.focus();
		return false;
	}
	if(window.document.query.email.value=="")
	{
		alert("enter the email-ID");
		window.document.query.email.focus();
		return false;
	}
	else if(! is_email(document.query.email.value))
	{
		alert("EmailID Should be in valid format !");
		window.document.query.email.value="";
		window.document.query.email.focus();
		return false;
	}
	if(window.document.query.subject.value=="")
	{
		alert("Please Enter the subject");
		window.document.query.subject.focus();
		return false;
	}
	if(window.document.query.message.value=="")
	{
		alert("Please Enter Your Query Detail");
		window.document.query.message.focus();
		return false;
	}
	if(window.document.query.verify_code.value=="")
	{
		alert("Please Enter Verification Code");
		window.document.query.verify_code.focus();
		return false;
	}
}

//--------------  tell to frnd form validation ----------------
function Frndform()
{
	var sender,senderid,receiver,receiverid,message;
	
	sender=window.document.frndmail.sender.value;
	senderid=window.document.frndmail.senderid.value;
	receiver=window.document.frndmail.receiver.value;
	receiverid=window.document.frndmail.receiverid.value;
	message=window.document.frndmail.message.value;
	
	if(sender=="")
	{
		alert("Please Enter Your Name");
		window.document.frndmail.sender.focus();
		return false;
	}
	if(senderid=="")
	{
		alert("Please Enter Your EmailID");
		window.document.frndmail.senderid.focus();
		return false;
	}
	else if(!echeck(senderid))
	{
		window.document.frndmail.senderid.value= "";
		window.document.frndmail.senderid.focus();
		return false;
	}
	if(receiver=="")
	{
		alert("Please Enter Your Friend Name");
		window.document.frndmail.receiver.focus();
		return false;
	}
	if(receiverid=="")
	{
		alert("Please Enter Your Friend's EmailID");
		window.document.frndmail.receiverid.focus();
		return false;
	}
	else if(!echeck(receiverid))
	{
		window.document.frndmail.receiverid.value= "";
		window.document.frndmail.receiverid.focus();
		return false;
	}
}

//----------------------------feedback ----------------
function feedbackForm()
{
	if(window.document.feedback.name.value=="")
	{
		alert("Name should not be blank");
		window.document.feedback.name.focus();
		return false;
	}
	if(window.document.feedback.email.value=="")
	{
		alert("Please enter the email-ID");
		window.document.feedback.email.focus();
		return false;
	}
	else if(! is_email(window.document.feedback.email.value))
	{
		alert("EmailID should be in valid format !");
		window.document.feedback.email.value="";
		window.document.feedback.email.focus();
		return false;
	}
	/*if(window.document.feedback.subject.value=="")
	{
		alert("Enter Your Feedback Subject");
		window.document.feedback.subject.focus();
		return false;
	}*/
	if(window.document.feedback.message.value=="")
	{
		alert("Enter Your Feedback Message");
		window.document.feedback.message.focus();
		return false;
	}
	if(window.document.feedback.verify_code.value=="")
	{
		alert("Please Enter the veryfication code!");
		window.document.feedback.verify_code.focus();
		return false;
	}
	return true;
}



function ghenquiryForm()
{
	if(document.ghenquiry.name.value=="")
	{
		alert("Please Enter Your Name");
		document.ghenquiry.name.focus();
		return false;
	}
	if(document.ghenquiry.email.value=="")
	{
		alert("Please Enter Your EmailID");
		document.ghenquiry.email.focus();
		return false;
	}
	else if(! is_email(document.ghenquiry.email.value))
	{
		alert("EmailID should be in valid format !");
		document.ghenquiry.email.value="";
		document.ghenquiry.email.focus();
		return false;
	}
	if(document.ghenquiry.phone.value=="")
	{
		alert("Please Enter phone");
		document.ghenquiry.phone.focus();
		return false;
	}
	if(document.ghenquiry.information.value=="")
	{
		alert("Please Enter Your Message");
		document.ghenquiry.information.focus();
		return false;
	}
}

//------------------ validation in housing society enquiry Form ----------------

function enquiry_form()
{  
 if(document.enquiry.name.value=="")
 {
  alert("Please Enter Your Name");
  document.enquiry.name.focus();
  return false;
 }
 if(document.enquiry.city.value=="")
 {
  alert("Please Enter Your City");
  document.enquiry.city.focus();
  return false;
 }
 if(document.enquiry.country.value=="")
 {
  alert("Please Enter Your Country");
  document.enquiry.country.focus();
  return false;
 }
 if(document.enquiry.email.value=="")
 {
  alert("Please Enter EmailID");
  document.enquiry.email.focus();
  return false;
 }
 if(! is_email(document.enquiry.email.value))
 {
  alert("EmailID should be in valid format !");
  document.enquiry.email.value="";
  document.enquiry.email.focus();
  return false;
 }
}

function ForgetpassForm()
{
	if(document.forget_password.username1.value=="" && document.forget_password.email1.value=="")
	{
	  alert("Please Enter any one EmailID Or User Name");
	  document.forget_password.username1.focus();
	  return false;
	}
	if(document.forget_password.email1.value)
	{
		if(!is_email(document.forget_password.email1.value))
		{
		  alert("EmailID should be in valid format !");
		  document.forget_password.email1.value="";
		  document.forget_password.email1.focus();
		  return false;
		}
	}
}

