	/**
	* @author - Vivek Shukla
	* @desc - This .JS file contains all the javaScript functions of search module.
	*/ 
	//////////////////////////////////////////////////////////////////////////////////
	/**
	* @author - Vivek Shukla (24th July 2007)
	* @name - clearTAF()
	* @desc - Function is responsible to clear the message box.
	*/ 
	function clearTAF()
	{
		obj = document.getElementById("SearchMessage");
		obj.value = '';
		obj.focus();
	}
	//////////////////////////////////////////////////////////////////////////////////
	/**
	* @author - Vivek Shukla (24th July 2007)
	* @name - openPopupWindow()
	* @desc - Function is responsible for the opening of popup window.
	*/ 
	function openPopupWindow(theURL, winName, features) 
	{ 
	  window.open(theURL, winName, features);
	}
	//////////////////////////////////////////////////////////////////////////////////
	/**
	* @author - Vivek Shukla (05th July 2007)
	* @name - chkEmail()
	* @desc - Function is responsible for the correct format of email id.
	* @return - Boolean value (true/false)
	*/ 
	function chkEmail(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					
	}
	///////////////////////////////////////////////////////////////////////////////////
	/**
	* @author - Vivek Shukla (28th June 2007)
	* @name - chkFlagListing()
	* @desc - Function is responsible for the validation of req. fields for 'Flag Listing' module.
	* @return - Boolean value (true/false)
	* @Note - Presently, this func. is not in use, bcoz. cakephp validation rules is used to handle these tasks.
	*/ 
	function chkFlagListing()
	{
		var x = document.getElementById("FlagListingReason");
		var y = document.getElementById("FlagListingComment");
		if(x.value == 0)
		{
			alert("Select Any Reason To Continue.");
			x.focus();
			return false;
		}
		if(!y.value)
		{
			alert("Required Comment To Continue.");
			y.focus();
			return false;
		}
		if(confirm("By flagging this property listing will restrain this listing from the site.\n" + 
				   "Kindly confirm."))
		{
			document.frm.submit();
		}
		return false;
	}
	//////////////////////////////////////////////////////////////////////////////////
	/**
	* @author - Vivek Shukla (22nd June 2007)
	* @name - chkTAF()
	* @desc - Function is responsible for the validation of req. fields for 'Tell A Friend' module.
	* @return - Boolean value (true/false)
	*/ 
	function chkTAF()
	{
		var x = document.getElementById("SearchEmail");
		var y = document.getElementById("SearchFriendEmail");
		var z = document.getElementById("SearchMessage");
		if(!x.value)
		{
			alert("Please, Enter Your E-mail Id To Continue.");
			x.focus();
			return false;
		}
		if(!chkEmail(x.value))
		{
			x.value = "";
			x.focus();
			return false
		}	
		if(!y.value)
		{
			alert("Please, Enter Your Friend E-mail Id To Continue.");
			y.focus();
			return false;
		}
		if(!chkEmail(y.value))
		{
			y.value = "";
			y.focus();
			return false
		}	
		if(!z.value)
		{
			alert('Please, Enter Message Text To Continue.');
			z.focus();
			return false;
		}
		if(confirm("We will be emailing your friend to the email address you have provided.\n" + 
				   "Please confirm that you have typed your friend's email address correctly:\n\n" + 
				   y.value))
		{
			document.frm.submit();
		}
		return false;
	}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////	