// JavaScript Document
var siteurl="http://www.derwentrealestate.com.au/RealEstateTalk";//FOR SITE
//var siteurl="http://192.168.1.191/Derwent_Realty/RealEstateTalk";//FOR LOCAL
function load_fns()
{		
	listSuburb();
	list_watch_list(); 
	quick_srch_price_from();
}
function checkemail(em)   //Email validation 
{
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(em))
		return true
		else
		return false
}
///////////FOR LIST SUBURB IN QUICK SEARCH
function listSuburb()
{
	var XMLHttpreqobj1004 = false;
	if(window.XMLHttpRequest)
	{
		XMLHttpreqobj1004 = new XMLHttpRequest();
		if(XMLHttpreqobj1004.overrideMimeType)
		{
			XMLHttpreqobj1004.overrideMimeType("text/xml");
		}
	}
	else if (window.ActiveXObject)
	{
			XMLHttpreqobj1004 = new ActiveXObject("Microsoft.XMLHTTP");
	}
		if (XMLHttpreqobj1004)
		{
			XMLHttpreqobj1004.open("POST",siteurl+"/listSuburb.php");
			XMLHttpreqobj1004.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			XMLHttpreqobj1004.onreadystatechange = function()
			{
				if(XMLHttpreqobj1004.readyState == 4 && XMLHttpreqobj1004.status == 200)
				{
					document.getElementById("suburbID").innerHTML=XMLHttpreqobj1004.responseText;	
				}					
			}
			XMLHttpreqobj1004.send(null);//send datas
		}
}
////////////////FOR Get Ads in your Mailbox DETAILS PAGE
function listCities()
{
		var XMLHttpreqobj1004 = false;
		if(window.XMLHttpRequest)
		{
			XMLHttpreqobj1004 = new XMLHttpRequest();
			if(XMLHttpreqobj1004.overrideMimeType)
			{
				XMLHttpreqobj1004.overrideMimeType("text/xml");
			}
		}
		else if (window.ActiveXObject)
		{
			XMLHttpreqobj1004 = new ActiveXObject("Microsoft.XMLHTTP");
		}
		if (XMLHttpreqobj1004)
		{
			XMLHttpreqobj1004.open("POST",siteurl+"/getCities.php");
			XMLHttpreqobj1004.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			XMLHttpreqobj1004.onreadystatechange = function()
			{
				if(XMLHttpreqobj1004.readyState == 4 && XMLHttpreqobj1004.status == 200)
				{
					document.getElementById("cityList").innerHTML=XMLHttpreqobj1004.responseText;
				}					
			}
			XMLHttpreqobj1004.send(null);//send datas
		}
}

//FOR NEWSLETTER
function newsletter() 
{
		var missinginfo;
		missinginfo = "";
		if(document.getElementById("newsName").value== "---Enter Your Name---") 
		{
			missinginfo += "\n     - Name";
			document.getElementById("newsName").focus();
		}
		if(document.getElementById("newsEmail").value == "") 
		{
			missinginfo += "\n     - Email Id";
			document.getElementById("newsEmail").focus();
		}
		if(document.getElementById("newsEmail").value!="")
		{
			var emailcheck = checkemail(document.getElementById("newsEmail").value);
			if(emailcheck==false)
			missinginfo += "\n -Enter a Valid Email ID!";
			document.getElementById("newsEmail").focus();
		}
		if(missinginfo != "") 
		{
			missinginfo ="_____________________________\n" + "You failed to correctly fill in your:\n" + missinginfo + "\n_____________________________" + "\nPlease re-enter and submit again!";
			alert(missinginfo);
			return false;
		}
		else 
		{
			document.getElementById("first_name").value=document.getElementById("newsEmail").value;
			document.getElementById("email").value=document.getElementById("newsEmail").value;
			document.fnewsletter.action="http://www.derwentrealestate.com.au/cgi-bin/arp3/arp3-formcapture.pl";
			document.fnewsletter.submit();
			//return true;
			//subscription('storeSubscriber.php');
		}
}
function subscription(datasource)//FOR SUBSCRIBED USER
{	
		var subContents='emailID='+document.getElementById("newsEmail").value;
		var XMLHttpreqobj = false;
		if(window.XMLHttpRequest)
		{
			XMLHttpreqobj = new XMLHttpRequest();
			if(XMLHttpreqobj.overrideMimeType)
				XMLHttpreqobj.overrideMimeType("text/xml");
		}
		else if (window.ActiveXObject)
			XMLHttpreqobj = new ActiveXObject("Microsoft.XMLHTTP");
		if (XMLHttpreqobj)
		{
			XMLHttpreqobj.open("POST",datasource,true);
			XMLHttpreqobj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
			XMLHttpreqobj.onreadystatechange = function()
			{
				if (XMLHttpreqobj.readyState == 4 && XMLHttpreqobj.status == 200)
				{	
				//alert(XMLHttpreqobj.responseText);
					if(XMLHttpreqobj.responseText=='True')
					{
						document.getElementById("newsLETterDiv").innerHTML = '<span class="sucessmsg">Sucessfully !!</span>';//alert(XMLHttpreqobj.responseText);
						document.getElementById("newsEmail").value="---Enter Your Email---";
					}
				else
				{
					document.getElementById("newsLETterDiv").innerHTML = '<span class="errmsg">Email Id Already Exist!!</span>';		
				}
			}
			else
			{
				document.getElementById("newsLETterDiv").innerHTML = '<div><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="90" height="40"><param name="movie" value="images/loading2.swf" /><param name="quality" value="high" />      <embed src="images/loading2.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="90" height="40"></embed></object></div>';
			}
		}
			XMLHttpreqobj.send(subContents);
		}
}

function propertySearch() //FOR PROPERTY ID SEARCH
{
		//alert(document.getElementById("PiD").value);
		var missinginfo;
		missinginfo = "";
		if(document.getElementById("PiD").value == "" || document.getElementById("PiD").value =="---Enter Property ID---") 
		{
			missinginfo += "\n      -Property ID ";
			document.getElementById("PiD").focus();
		}
		if(missinginfo != "") 
		{
			missinginfo ="_____________________________\n" + "You failed to correctly fill in your:\n" + missinginfo + "\n_____________________________" + "\nPlease re-enter and submit again!";
			alert(missinginfo);
			return false;
		}
		else 
		{
			existAdId(document.getElementById("PiD").value);
			//show_ad_details(document.getElementById("PiD").value);
		}
}
function existAdId(id)
{
		
		var XMLHttpreqobj1004 = false;
		if(window.XMLHttpRequest)
		{
			XMLHttpreqobj1004 = new XMLHttpRequest();
			if(XMLHttpreqobj1004.overrideMimeType)
			{
				XMLHttpreqobj1004.overrideMimeType("text/xml");
			}
		}
		else if (window.ActiveXObject)
		{
			XMLHttpreqobj1004 = new ActiveXObject("Microsoft.XMLHTTP");
		}
		if (XMLHttpreqobj1004)
		{
			XMLHttpreqobj1004.open("POST",siteurl+"/checkAdid.php");
			XMLHttpreqobj1004.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			XMLHttpreqobj1004.onreadystatechange = function()
			{
				//alert(XMLHttpreqobj1004.readyState+"-"+XMLHttpreqobj1004.status);
				if(XMLHttpreqobj1004.readyState == 4 && XMLHttpreqobj1004.status == 200)
				{
					if(XMLHttpreqobj1004.responseText==1)
					{
						//alert(id);
						show_ad_details(id);						
					}
					else
					{
						alert("This Ad Temporary Hide/Deleted");
						document.getElementById("PiD").focus();
					}
				}					
			}
			XMLHttpreqobj1004.send("id="+id);//send datas
		}
}

/////////////FOR Get Ads in your Mailbox 
function wishList() 
{
		var missinginfo;
		missinginfo = "";
		if(document.getElementById("wishEmail").value == "") 
		{
			missinginfo += "\n     - Email Id";
			document.getElementById("wishEmail").focus();
		}
		if(document.getElementById("wishEmail").value!="")
		{
			var emailcheck = checkemail(document.getElementById("wishEmail").value);
			if(emailcheck==false)
			missinginfo += "\n -Enter a Valid Email ID!";
			document.getElementById("wishEmail").focus();
		}
		if(missinginfo != "") 
		{
			missinginfo ="_____________________________\n" + "You failed to correctly fill in your:\n" + missinginfo + "\n_____________________________" + "\nPlease re-enter and submit again!";
			alert(missinginfo);
			return false;
		}
		else 
		{
			document.getElementById("wishlist_div").style.display='';
			//alert(wish_str());
			document.getElementById("wishlist_div").innerHTML=wish_str();
			document.getElementById("blog_content").style.display='none';
			document.getElementById("ads_content").style.display='none';
			listCities();
			getSuburb();
		}
}


function wishmail()
{
	document.getElementById("suburbID").value;
}

function wish_str()
{
	str='<form>';
	str=str+'<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td colspan="3"><h1>My property wish list - Get ads in your mailbox</h1></td></tr><tr><td><a name="top">&nbsp;</a></td><td align="center"><div id="msg"></div></td><td>&nbsp;</td></tr><tr><td width="8%">&nbsp;</td><td width="84%"><table class="newborderandbg" width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td>';
	str=str+'<table width="90%"  border="0" cellspacing="0" cellpadding="0" align="center"><tr>  <td align="right">&nbsp;</td><td>&nbsp;</td><td colspan="2">&nbsp;</td></tr><tr><td width="27%" align="right"><span class="forformtxt2">Mode of Business :</span></td><td width="5%">&nbsp;</td><td colspan="2"><input type="radio" name="smode" id="modeR" value="rent" checked/><span class="forformtxt2">Rent</span>&nbsp;&nbsp;<input type="radio" name="smode" value="sale" id="modeS"/><span class="forformtxt2">Sales</span> </td></tr>';
	str=str+'<tr><td>&nbsp;</td><td>&nbsp;</td><td colspan="2">&nbsp;</td></tr><tr><td align="right"><span class="forformtxt2">Property&nbsp;Type :</span></td><td>&nbsp;</td><td colspan="2"><input  type="radio" name="ptype" id="pRtype" value="Residential" checked onclick="javascript:changeType()"/><span class="forformtxt2">Residential</span>&nbsp;&nbsp;<input type="radio" name="ptype" id="pCtype" value="Commercial" onclick="javascript:changeType()"/><span class="forformtxt2">Commercial</span>&nbsp;&nbsp;<input type="radio" name="ptype" id="pLtype" value="Land" onclick="javascript:changeType()"/><span class="forformtxt2">Land </span></td></tr>';
	str=str+'<tr><td>&nbsp;</td><td>&nbsp;</td><td colspan="2">&nbsp;</td></tr><tr><td align="right"><span class="forformtxt2">Price :</span></td><td>&nbsp;</td>   <td width="20%"><select class="forlistbx2" name="min" id="min"><option value="0" selected="selected">Min Price</option><option value="500">0.5K</option><option value="1000">1K</option><option value="2000">2K</option><option value="3000">3K</option><option value="4000">4K</option><option value="5000">5K</option><option value="10000">10K</option><option value="20000">20K</option><option value="30000">30K</option><option value="40000">40K</option><option value="50000">50K</option><option value="100000">100K</option><option value="150000">150K</option><option value="200000">200K</option><option value="250000">250K</option><option value="300000">300K</option><option value="350000">350K</option><option value="400000">400K</option><option value="450000">450K</option><option value="500000">500K</option><option value="550000">550K</option>';
	str=str+'<option value="600000">600K</option><option value="650000">650K</option><option value="700000">700K</option><option value="750000">750K</option><option value="800000">800K</option><option value="850000">850K</option><option value="900000">900K</option><option value="950000">950K</option><option value="1000000">1.00M</option><option value="1250000">1.25M</option><option value="1500000">1.50M</option><option value="1750000">1.75M</option><option value="2000000">2.00M</option><option value="2250000">2.25M</option><option value="2500000">2.50M</option><option value="2750000">2.75M</option><option value="3000000">3.00M</option>';
	str=str+'<option value="3500000">3.50M</option><option value="4000000">4.00M</option><option value="4500000">4.50M</option><option value="5000000">5.00M</option> <option value="6000000">6.00M</option><option value="7000000">7.00M</option><option value="8000000">8.00M</option><option value="9000000">9.00M</option><option value="10000000">10.00M</option><option value="2000000">20.00M</option><option value="3000000">30.00M</option></select></td>';
	str=str+'<td width="48%"><select class="forlistbx2" name="max" id="max"><option value="0" selected="selected">Max Price</option><option value="500">0.5K</option><option value="1000">1K</option><option value="2000">2K</option><option value="3000">3K</option><option value="4000">4K</option><option value="5000">5K</option><option value="10000">10K</option><option value="20000">20K</option><option value="30000">30K</option><option value="40000">40K</option><option value="50000">50K</option><option value="100000">100K</option><option value="150000">150K</option><option value="200000">200K</option><option value="250000">250K</option><option value="300000">300K</option><option value="350000">350K</option><option value="400000">400K</option><option value="450000">450K</option><option value="500000">500K</option><option value="550000">550K</option><option value="600000">600K</option><option value="650000">650K</option><option value="700000">700K</option><option value="750000">750K</option>';
	str=str+'<option value="800000">800K</option><option value="850000">850K</option><option value="900000">900K</option><option value="950000">950K</option><option value="1000000">1.00M</option><option value="1250000">1.25M</option><option value="1500000">1.50M</option><option value="1750000">1.75M</option><option value="2000000">2.00M</option><option value="2250000">2.25M</option><option value="2500000">2.50M</option><option value="2750000">2.75M</option><option value="3000000">3.00M</option><option value="3500000">3.50M</option><option value="4000000">4.00M</option><option value="4500000">4.50M</option><option value="5000000">5.00M</option> <option value="6000000">6.00M</option><option value="7000000">7.00M</option><option value="8000000">8.00M</option><option value="9000000">9.00M</option><option value="10000000">10.00M</option><option value="2000000">20.00M</option><option value="3000000">30.00M</option></select></td></tr>';
	str=str+'<tr><td>&nbsp;</td><td>&nbsp;</td><td colspan="2">&nbsp;</td></tr>';
	str=str+'<tr><td align="right"><span class="forformtxt2">Neighbourhoods :</span></td><td>&nbsp;</td><td colspan="2"><input type="text" class="forforms" name="neighbourhoods" id="neighbourhoods" />&nbsp;<span class="foritalics">(Seprated by commas)</span></td></tr>';
	str=str+'<tr><td>&nbsp;</td><td>&nbsp;</td><td colspan="2">&nbsp;</td></tr>';
	str=str+'<tr><td align="right" valign="top"><span class="forformtxt2">City :</span></td><td>&nbsp;</td><td colspan="2"><table width="100%"  border="0" cellspacing="0" cellpadding="0"><tr><td width="33%" rowspan="2"><div id="cityList"><select class="forforms" name="list1" id="list1" size="10" multiple="multiple" style="width: 150px;"></select></div></td><td width="10%" height="75"><div align="center"><input name="button" type="button" class="buttonadd" onclick="move(this.form.list1,this.form.list2);genString(this.form.list2);" value="&gt;&gt;" /></div></td><td width="60%" rowspan="2"><select class="forforms" multiple="multiple" size="10" name="list2" style="width:150px;" id="list2"></select></td></tr>';
	str=str+'<tr><td align="center"><input name="button" type="button" class="buttonadd" onclick="move(this.form.list2,this.form.list1);genString(this.form.list2);" value=" &lt;&lt;" /></td></tr></table></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td colspan="2">&nbsp;</td></tr>';
	str=str+'<tr><td align="right" valign="top"><span class="forformtxt2">Suburb :</span></td><td>&nbsp;</td><td colspan="2"><div id="div"><table width="100%"  border="0" cellspacing="0" cellpadding="0"><tr><td width="33%" rowspan="2"><div id="suburbDiv"><select class="forforms" name="list3" size="10" multiple="multiple" style="width: 150px;"></select></div></td><td width="10%" height="75"><div align="center"><input name="button" type="button" class="buttonadd" onclick="move(this.form.list3,this.form.list4);" value="&gt;&gt;" /></div></td><td width="60%" rowspan="2"><select class="forforms" multiple="multiple" size="10" name="list4" style="width:150px;" id="list4"></select></td></tr><tr><td align="center"><input name="button" type="button" class="buttonadd" onclick="move(this.form.list4,this.form.list3);" value=" &lt;&lt;" /></td></tr></table></div></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td colspan="2">&nbsp;</td></tr>';
	str=str+'<tr><td colspan="4"><div id="resFeatures"><table width="100%"  border="0" cellspacing="0" cellpadding="0"><tr><td align="right"><span class="forformtxt2">Property Type:</span></td><td>&nbsp;</td><td><select class="forforms" name="resPropType" id="resPropType"><option value="" selected>Select One</option><option value="House">House</option><option value="Unit">Unit</option><option value="Apartment">Apartment</option><option value="Villa">Villa</option><option value="Flat">Flat</option><option value="Warehouse">Warehouse</option><option value="Studio">Studio</option><option value="Townhouse">Townhouse</option><option value="City Apartment">City Apartment</option></select></td><td>&nbsp;</td></tr><tr><td align="right">&nbsp;</td><td>&nbsp;</td><td colspan="2">&nbsp;</td></tr>';
	str=str+'<tr><td width="33%" align="right"><span class="forformtxt2">Floor area :</span></td><td width="6%">&nbsp;</td><td width="61%" colspan="2"><table width="350"  border="0" cellspacing="0" cellpadding="0"><tr>   <td width="32%"><select class="forforms" name="resFlrMode" id="resFlrMode"><option value="e" selected="selected">Equal To</option><option value="g">Greater Than</option><option value="l">Less Than</option></select></td><td width="24%"><input class="forforms" size="8" type="text" name="resFlrArea" id="resFlrArea" /></td><td width="44%"><select class="forforms" name="resFlrMesure" id="resFlrMesure"><option value="Squares approx">Squares approx.</option><option value="Sq. Feet approx">Sq. Feet approx.</option><option value="Sq. Metres approx">Sq. Metres approx.</option><option value="Sq. Yards approx">Sq. Yards approx.</option></select></td></tr></table></td></tr>';
	str=str+'<tr><td align="right">&nbsp;</td><td>&nbsp;</td><td colspan="2">&nbsp;</td></tr>';
	str=str+'<tr><td align="right"><span class="forformtxt2">Land area :</span></td><td>&nbsp;</td><td colspan="2"><table width="350"  border="0" cellspacing="0" cellpadding="0"><tr><td width="32%"><select class="forforms" name="resLndMode" id="resLndMode"><option value="e" selected="selected">Equal To</option><option value="g">Greater Than</option><option value="l">Less Than</option></select></td><td width="24%"><input class="forforms" size="8" type="text" name="resLandArea" id="resLandArea"></td><td width="44%"><select class="forforms" name="resLandMesure" id="resLandMesure"><option value="Sq. Feet approx">Sq. Feet approx.</option><option value="Sq. Metres approx">Sq. Metres approx.</option><option value="Sq. Yards approx">Sq. Yards approx.</option><option value="Acres approx">Acres approx.</option><option value="Hectares approx">Hectares approx.</option></select></td></tr></table></td></tr>';
	str=str+'<tr><td align="right">&nbsp;</td><td>&nbsp;</td><td colspan="2">&nbsp;</td></tr><tr><td align="right"><span class="forformtxt2">Bed room :</span></td><td>&nbsp;</td><td colspan="2"><table width="350"  border="0" cellspacing="0" cellpadding="0"><tr><td width="32%"><select class="forforms" name="resBedMode" id="resBedMode"><option value="e" selected="selected">Equal To</option><option value="g">Greater Than</option><option value="l">Less Than</option></select></td><td width="36%"><input class="forforms" size="8" type="text" name="resBedRoom" id="resBedRoom"/></td><td width="32%">&nbsp;</td></tr></table></td></tr><tr><td align="right">&nbsp;</td><td>&nbsp;</td><td colspan="2">&nbsp;</td></tr><tr><td align="right"><span class="forformtxt2">Bath room :</span></td><td>&nbsp;</td><td colspan="2">';
	str=str+'<table width="350"  border="0" cellspacing="0" cellpadding="0"><tr><td width="32%"><select class="forforms" name="resBathMode" id="resBathMode"><option value="e" selected="selected">Equal To</option><option value="g">Greater Than</option><option value="l">Less Than</option></select></td><td width="36%"><input class="forforms" size="8" type="text" name="resBathRoom" id="resBathRoom"/></td><td width="32%">&nbsp;</td></tr></table></td></tr><tr><td align="right">&nbsp;</td><td>&nbsp;</td><td colspan="2">&nbsp;</td></tr><tr><td align="right"><span class="forformtxt2">Car space :</span> </td><td>&nbsp;</td><td colspan="2"><table width="350"  border="0" cellspacing="0" cellpadding="0"><tr><td width="33%"><select class="forforms" name="resCarMode" id="resCarMode"><option value="e" selected="selected">Equal To</option><option value="g">Greater Than</option><option value="l">Less Than</option></select></td><td width="35%"><input class="forforms" size="8" type="text" name="resCarSpace" id="resCarSpace"/>';
	str=str+'</td><td width="32%">&nbsp;</td></tr></table></td></tr></table></div><div  id="landFeatures" style="display:none"><table width="100%"  border="0" cellspacing="0" cellpadding="0"><tr><td width="33%" align="right"><span class="forformtxt2">Property&nbsp;Type:</span></td><td width="6%">&nbsp;</td><td width="61%"><table width="350"  border="0" cellspacing="0" cellpadding="0"><tr><td width="24%"><select name="landPropType" class="forforms" id="landPropType"><option value="Dairy">Dairy</option><option value="Horticulture">Horticulture</option><option value="Cropping">Cropping</option><option value="Farmlet">Farmlet</option><option value="Livestock">Livestock</option><option value="Other">Other</option></select></td><td width="44%">&nbsp;</td><td width="32%">&nbsp;</td></tr></table></td></tr><tr><td align="right">&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td align="right"><span class="forformtxt2">Land area :</span></td><td>&nbsp;</td><td>';
	str=str+'<table width="350"  border="0" cellspacing="0" cellpadding="0"><tr><td width="32%"><select class="forforms" name="lndAreMode" id="lndAreMode"><option value="e" selected="selected">Equalto</option><option value="g">Greaterthan</option><option value="l">Lessthan</option></select></td><td width="24%"><input class="forforms" size="8" type="text" name="lndArea" id="lndArea"/></td><td width="44%"><select class="forforms" name="lndMesure" id="lndMesure"><option value="Sq. Feet approx">Sq. Feet approx.</option><option value="Sq. Metres approx">Sq. Metres approx.</option><option value="Sq. Yards approx">Sq. Yards approx.</option><option value="Acres approx">Acres approx.</option><option value="Hectares approx">Hectares approx.</option></select></td></tr></table></td></tr><tr><td align="right">&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table></div><div  id="comFeatures" style="display:none">';
	str=str+'<table width="100%"  border="0" cellspacing="0" cellpadding="0"><tr><td width="33%" align="right"><span class="forformtxt2">Commercial Type :</span></td><td width="6%">&nbsp;</td><td width="61%"><table width="350"  border="0" cellspacing="0" cellpadding="0"><tr><td width="24%"><select class="forforms" name="comType" id="comType"><option value="" selected>Select One</option><option value="Retail">Retail</option><option value="Development">Development</option><option value="Commercial">Commercial</option><option value="Investment">Investment</option><option value="Showroom">Showroom</option><option value="Industrial">Industrial</option><option value="Offices">Offices</option><option value="Other">Other</option></select></td><td width="44%"></td> <td width="32%"></td></tr></table></td></tr><tr><td align="right">&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td align="right"><span class="forformtxt2">Commercial Area:</span></td><td>&nbsp;</td><td>';
	str=str+'<table width="350"  border="0" cellspacing="0" cellpdding="0"><tr><td width="32%"><select class="forforms" name="cmlAreaMode" id="cmlAreaMode"><option value="e" selected="selected">Equal To</option><option value="g">Greater Than</option><option value="l">Less Than</option></select></td><td width="24%"><input class="forforms" size="8" type="text" name="cmlArea" id="cmlArea"/></td><td width="44%"><select class="forforms" name="cmlMesure" id="cmlMesure" onchange="javascript:measure_converter()"><option value="Sq. Feet approx">Sq. Feet approx.</option><option value="Sq. Metres approx">Sq. Metres approx.</option><option value="Sq. Yards approx">Sq. Yards approx.</option><option value="Acres approx">Acres approx.</option><option value="Hectares approx">Hectares approx.</option></select></td></tr></table></td></tr><tr><td align="right">&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table></div></td></tr></table></td></tr><tr><td>';
	str=str+'<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="34%">&nbsp;</td><td width="61%" class="forbottomline" >&nbsp;</td><td width="5%" >&nbsp;</td></tr></table></td></tr><tr><td height="5"></td></tr><tr><td><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="34%">&nbsp;</td><td width="66%"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="67%" height="33"><div align="right"></div></td><td width="9%">&nbsp;</td><td width="24%"><input type="button" class="loginButton" name="Submit2" value="Submit" onclick="javascript:gen_wishlist_string()"/></td></tr></table></td></tr></table></td></tr><tr><td>&nbsp;</td></tr></table></td><td width="8%">&nbsp;</td></tr><tr><td colspan="3">&nbsp;</td></tr></table> <input type="hidden" value="" name="cityName" id="cityName"></form>';
	return str;
}

function entsub(whichSearch) 
{
	if (window.event && window.event.keyCode == 13) {
	if (whichSearch == 'keyword') {
	return keywordSearch();
	}
	else {
	return basicSearch();
	}
	}
	else {
	return true;
	}
}

function list_watch_list(ad_id)//FOR LIST WISH LIST
{ 	
		/*if(document.getElementById("msg_div"))
		alert("ok...");
		else
		alert("nooo..");*/
		var XMLHttpreqobj1004 = false;
		if(window.XMLHttpRequest)
		{
			XMLHttpreqobj1004 = new XMLHttpRequest();
			if(XMLHttpreqobj1004.overrideMimeType)
			{
			XMLHttpreqobj1004.overrideMimeType("text/xml");
			}
		}
		else if (window.ActiveXObject)
		{
			XMLHttpreqobj1004 = new ActiveXObject("Microsoft.XMLHTTP");
		}
		if(XMLHttpreqobj1004)
		{
			XMLHttpreqobj1004.open("POST",siteurl+"/get_watch_list.php");
			XMLHttpreqobj1004.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			XMLHttpreqobj1004.onreadystatechange = function()
			{
				if(XMLHttpreqobj1004.readyState == 4 && XMLHttpreqobj1004.status == 200)
				{
					document.getElementById("watch_list_div").style.display='';
					document.getElementById("watch_list_div").innerHTML=XMLHttpreqobj1004.responseText;
					//location.href="#wtchqq";
				}
				else
				{
					document.getElementById("watch_list_div").innerHTML ='<div class="processmsg">Processing....</div>';
				}
			}
				XMLHttpreqobj1004.send("advt_id="+ad_id);//send datas
		}
}
function email_div()// FOR EMAIL IT WISH LIST
{
	document.getElementById("send_email_div").style.display='';	
}
function remove_wishlist(w_id)//FOR REMOVE WISH LIST
{
	//alert(w_id);
	var XMLHttpreqobj2001 = false;
	if(window.XMLHttpRequest)
	{
		XMLHttpreqobj2001 = new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		XMLHttpreqobj2001 = new ActiveXObject("Microsoft.XMLHTTP");
	}
	if (XMLHttpreqobj2001)
	{
		XMLHttpreqobj2001.open("POST",siteurl+"/remove_watch_list.php",true);
		XMLHttpreqobj2001.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
		XMLHttpreqobj2001.onreadystatechange = function()
		{
			//alert(XMLHttpreqobj2001.readyState +"   " +XMLHttpreqobj2001.status);
			if(XMLHttpreqobj2001.readyState == 4 && XMLHttpreqobj2001.status == 200)
			{
				//alert(XMLHttpreqobj2001.responseText);
				if(XMLHttpreqobj2001.responseText==true)
				{
					//alert("enter");
					document.getElementById("msg_div").innerHTML ='<div class="processmsgdel">Sucessfully Deleted into Your Wishlist!!</div>';							
					list_watch_list();	
				}
			}
			else
	{
	document.getElementById("msg_div").innerHTML ='<div class="processmsgdel">Processing....</div>';
	//location.href="#layOk";
	}
	}
	XMLHttpreqobj2001.send("wId="+w_id);
	}
}

function watchEmailFns() //for mail to wish list
{
			var missinginfo;
			missinginfo = "";
			
			if(document.getElementById("watchEmail").value == "") 
			{
			
				missinginfo += "\n     - Email Id";
				document.getElementById("watchEmail").focus();
			}
			if(document.getElementById("watchEmail").value!="")
			{
				var emailcheck = checkemail(document.getElementById("watchEmail").value);
				if(emailcheck==false)
				missinginfo += "\n -Enter a Valid Email ID!";
				document.getElementById("watchEmail").focus();
			}
			if(missinginfo != "") 
			{
				missinginfo ="_____________________________\n" + "You failed to correctly fill in your:\n" + missinginfo + "\n_____________________________" + "\nPlease re-enter and submit again!";
				alert(missinginfo);
				return false;
			}
			else 
			{			
				send_watchlist_mail(document.getElementById("watchEmail").value);
			}
}
function send_watchlist_mail(w_email)
{
		var wh_email=w_email;
		//alert(wh_email);
		var XMLHttpreqobj2001 = false;
		if(window.XMLHttpRequest)
		{
			XMLHttpreqobj2001 = new XMLHttpRequest();
		}
		else if (window.ActiveXObject)
		{
			XMLHttpreqobj2001 = new ActiveXObject("Microsoft.XMLHTTP");
		}
		if (XMLHttpreqobj2001)
		{
			XMLHttpreqobj2001.open("POST",siteurl+"/send_watch_list.php",true);
			XMLHttpreqobj2001.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
			XMLHttpreqobj2001.onreadystatechange = function()
			{
				//alert(XMLHttpreqobj2001.readyState +"   " +XMLHttpreqobj2001.status);
				if (XMLHttpreqobj2001.readyState == 4 && XMLHttpreqobj2001.status == 200)
				{
					//alert(XMLHttpreqobj2001.responseText);
					if(XMLHttpreqobj2001.responseText==true)
					{					
						document.getElementById("msg_div").innerHTML ='<div class="processmsgdel">Sucessfully sent!</div>';											
					}
				}
				else
				{
					document.getElementById("msg_div").innerHTML ='<div class="processmsgdel">Processing....</div>';
					//location.href="#layOk";
				}
		   }
			XMLHttpreqobj2001.send("wh_email="+wh_email);
		}
	}
function popitup(url)//Print the watch list details
{
	newwindow=window.open(url,'name','height=700,width=800,scrollbars=yes,resizable=yes');
	if (window.focus) {newwindow.focus()}
	return false;
}

function quick_srch_price_from()
{
	document.getElementById("qkpricefrom").innerHTML=quickpricefrom();
	document.getElementById("qkpriceto").innerHTML=quickpriceto();
}
function quickpricefrom()
{
	var pfromstr='<select name="select2"  class="listbox1" id="pricefrom"><option value="0" selected="selected">---Price From---</option><option value="500">0.5K</option><option value="1000">1K</option><option value="2000">2K</option><option value="3000">3K</option><option value="4000">4K</option><option value="5000">5K</option><option value="10000">10K</option><option value="20000">20K</option><option value="30000">30K</option><option value="40000">40K</option><option value="50000">50K</option><option value="100000">100K</option><option value="150000">150K</option><option value="200000">200K</option><option value="250000">250K</option><option value="300000">300K</option><option value="350000">350K</option><option value="400000">400K</option><option value="450000">450K</option><option value="500000">500K</option><option value="550000">550K</option><option value="600000">600K</option><option value="650000">650K</option><option value="700000">700K</option>';
	pfromstr=pfromstr+'<option value="750000">750K</option><option value="800000">800K</option><option value="850000">850K</option><option value="900000">900K</option><option value="950000">950K</option><option value="1000000">1.00M</option><option value="1250000">1.25M</option><option value="1500000">1.50M</option><option value="1750000">1.75M</option><option value="2000000">2.00M</option><option value="2250000">2.25M</option><option value="2500000">2.50M</option>';
	pfromstr=pfromstr+'<option value="2750000">2.75M</option><option value="3000000">3.00M</option><option value="3500000">3.50M</option><option value="4000000">4.00M</option><option value="4500000">4.50M</option><option value="5000000">5.00M</option><option value="6000000">6.00M</option><option value="7000000">7.00M</option><option value="8000000">8.00M</option><option value="9000000">9.00M</option><option value="10000000">10.00M</option><option value="2000000">20.00M</option><option value="3000000">30.00M</option></select>';
	return pfromstr;
}
function quickpriceto()
{
	var ptostr='<select name="select" class="listbox1" id="priceto"><option value="0" selected="selected">---Price To---</option><option value="500">.5K</option><option value="1000">1K</option><option value="2000">2K</option><option value="3000">3K</option><option value="4000">4K</option><option value="5000">5K</option><option value="10000">10K</option><option value="20000">20K</option><option value="30000">30K</option><option value="40000">40K</option><option value="50000">50K</option><option value="100000">100K</option>';
	ptostr=ptostr+'<option value="150000">150K</option><option value="200000">200K</option><option value="250000">250K</option><option value="300000">300K</option><option value="350000">350K</option><option value="400000">400K</option><option value="450000">450K</option><option value="500000">500K</option><option value="550000">550K</option><option value="600000">600K</option><option value="650000">650K</option><option value="700000">700K</option><option value="750000">750K</option><option value="800000">800K</option><option value="850000">850K</option><option value="900000">900K</option><option value="950000">950K</option><option value="1000000">1.00M</option><option value="1250000">1.25M</option><option value="1500000">1.50M</option>';
	ptostr=ptostr+'<option value="1750000">1.75M</option><option value="2000000">2.00M</option><option value="2250000">2.25M</option><option value="2500000">2.50M</option><option value="2750000">2.75M</option><option value="3000000">3.00M</option><option value="3500000">3.50M</option><option value="4000000">4.00M</option><option value="4500000">4.50M</option><option value="5000000">5.00M</option><option value="6000000">6.00M</option><option value="7000000">7.00M</option><option value="8000000">8.00M</option><option value="9000000">9.00M</option><option value="10000000">10.00M</option><option value="2000000">20.00M</option><option value="3000000">30.00M</option></select>';
	return ptostr;
}
function show_hobart()
{
	//alert("hobart");
	document.getElementById("hobartmap").style.display='';
	document.getElementById("imgtabhobart").style.display='';
	document.getElementById("newmap").style.display='none';
	document.getElementById("uppermap").style.display='none';
	document.getElementById("imgtabnewfolk").style.display='none';
	document.getElementById("imgtabupperderwent").style.display='none';
}
function show_newnorfolk()
{
	//alert("new folk");
	document.getElementById("newmap").style.display='';
	document.getElementById("imgtabnewfolk").style.display='';
	document.getElementById("uppermap").style.display='none';
	document.getElementById("imgtabhobart").style.display='none';	
	document.getElementById("hobartmap").style.display='none';
	document.getElementById("imgtabupperderwent").style.display='none';
}
function show_upperderwent()
{
	//alert("upper-derwent");
	document.getElementById("uppermap").style.display='';
	document.getElementById("imgtabupperderwent").style.display='';
	document.getElementById("hobartmap").style.display='none';
	document.getElementById("newmap").style.display='none';
	document.getElementById("imgtabnewfolk").style.display='none';
	document.getElementById("imgtabhobart").style.display='none';
}
//FOR MAPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
function showmap(num)
{
	//alert("yes");
	if(num==1){
	var lat = -42.78116526027807;
	var lang = 147.05921173095703;
	}else if (num==2){
	var lat =  -42.89407640334896;
	var lang = 147.35137939453125;
	}else if (num==3){
	var lat = -42.3070225351585;
	var lang = 146.43024444580078;
	}else if (num==4){
	var lat = -42.76637525213734;
	var lang = 147.24340438842773;
	}else if (num==5){
	var lat = -42.7823306698788;
	var lang = 147.05878257751465;
	}else if (num==6){
	var lat = -42.83309916880974;
	var lang = 147.27580547332764;
	}else if (num==7){
	var lat = -42.88270966922521;
	var lang = 147.33054399490356;}
	var cityId = num;
	document.getElementById("ads_content").style.display = 'none';
	document.getElementById("wishlist_div").style.display = 'none';
	document.getElementById("blog_content").style.display = 'none';
	document.getElementById("showmap_div").style.display = '';
	load(lat,lang,13,cityId);
}

var geocoder = new GClientGeocoder();
function load(lat,lang,zm,cid) {
	//alert("hi");
	var siteurl="http://www.derwentrealestate.com.au/RealEstateTalk";//FOR SITE
//var siteurl="http://192.168.1.191/Derwent_Realty/team";//FOR LOCAL
if (GBrowserIsCompatible()) {
//	alert("Enter");
var map = new GMap2(document.getElementById("map"));
//alert(map);
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(lat, lang), zm);
GDownloadUrl(siteurl+"/phpsqlajax_genxml.php?city="+cid, function(data) {
var xml = GXml.parse(data);
var advt = xml.documentElement.getElementsByTagName("advt");
// alert(advt.length);
for (var i = 0; i < advt.length; i++) {
var id = advt[i].getElementsByTagName("id")[0].firstChild.data;
var title = advt[i].getElementsByTagName("title")[0].firstChild.data;

var point = new GLatLng(parseFloat(advt[i].getElementsByTagName("lat")[0].firstChild.data),
parseFloat(advt[i].getElementsByTagName("lang")[0].firstChild.data));			
//alert(advt[i].childNodes[0].childNodes[0].nodeValue);



//ee = advt[i].getElementsByTagName("type")[0].firstChild.data;
//alert(ee);

var type = advt[i].getElementsByTagName("type")[0].firstChild.data;		
var price = parseFloat(advt[i].getElementsByTagName("price")[0].firstChild.data);	
//alert(type );
if(type=='Land')
{			
var land_area = advt[i].getElementsByTagName("land_area")[0].firstChild.data;		
//var desc = advt[i].childNodes[7].childNodes[0].nodeValue;
var image = advt[i].getElementsByTagName("image")[0].firstChild.data;	
var marker = createMarker55(point, title ,land_area ,image,price,id);

}
else if(type=='Commercial')
{			
var land_area = advt[i].getElementsByTagName("land_area")[0].firstChild.data;		
//var desc = advt[i].childNodes[7].childNodes[0].nodeValue;
var image = advt[i].getElementsByTagName("image")[0].firstChild.data;	
var marker = createMarker66(point, title ,land_area ,image,price,id);

}
else if(type=='Residential')
{
//alert("enter");
var bed_rooms = advt[i].getElementsByTagName("bed_rooms")[0].firstChild.data;	
var bath_rooms = advt[i].getElementsByTagName("bath_rooms")[0].firstChild.data;
var car_space = advt[i].getElementsByTagName("car_space")[0].firstChild.data;	
//var desc = advt[i].childNodes[9].childNodes[0].nodeValue;
var image = advt[i].getElementsByTagName("image")[0].firstChild.data;	
var marker = createMarker22(point, title ,bed_rooms ,bath_rooms ,car_space ,image,price,id);

}
map.addOverlay(marker);

}
});
}
}

function createMarker55(point, title ,land_area,image,price,id) {

//alert("here");
var icon = new GIcon();
icon.image = "http://www.derwentrealestate.com.au/RealEstateTalk/images/land_icon.jpg";
//icon.shadow ="images/land_shadow.jpg";
icon.iconSize = new GSize(20, 25);
//icon.shadowSize = new GSize(22, 20);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1); 

var marker = new GMarker(point, icon);
var html = "<b>Title :" + title + "</b><br/>Price :" + price + "<br/>Land Area :" + land_area   ;
if(image!='no_image.jpg')
html =html+ "<br/>Image :<img src=http://www.derwentrealestate.com.au/advt_thumb_pictures/"+image+" alt='no image'>" 
html =html+ "<br/><a href='javascript:;;' onclick='javascript:show_ad_details("+id+")'>Click</a>";
GEvent.addListener(marker, 'click', function() { 
marker.openInfoWindowHtml(html);
});

return marker;
}

function createMarker66(point, title ,land_area,image,price,id) {

var icon = new GIcon();
icon.image = "http://www.derwentrealestate.com.au/RealEstateTalk/images/cmrl_icon.jpg";
//icon.shadow ="images/cmrl_shadow.jpg";
icon.iconSize = new GSize(20, 25);
//icon.shadowSize = new GSize(22, 20);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1); 

var marker = new GMarker(point, icon);
var html = "<b>Title :" + title + "</b><br/>Price :" + price + "<br/>Land Area :" + land_area   ;
if(image!='no_image.jpg')
html =html+ "<br/>Image :<img src=http://www.derwentrealestate.com.au/advt_thumb_pictures/"+image+" alt='no image'>" 
html =html+ "<br/><a href='javascript:;;' onclick='javascript:show_ad_details("+id+",true)'>Click</a>";
GEvent.addListener(marker, 'click', function() { 
marker.openInfoWindowHtml(html);
});

return marker;
}

function createMarker22(point, title ,bed_rooms ,bath_rooms ,car_space ,image,price,id) {

var icon = new GIcon();
icon.image = "http://www.derwentrealestate.com.au/RealEstateTalk/images/resd_icon.jpg";
//icon.shadow ="images/resd_shadow.jpg";
icon.iconSize = new GSize(20, 25);
//icon.shadowSize = new GSize(22, 20);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);

// alert(image);

var marker = new GMarker(point, icon);
var html = "<b>Title :" + title + "</b> <br/>Price :" + price + "<br/>Bed Rooms :" + bed_rooms + "<br/>Bath Rooms :" + bath_rooms + "<br/>Car Space :" + car_space   ;
if(image!='no_image.jpg')
html =html+ "<br/>Image :<img src=http://www.derwentrealestate.com.au/advt_thumb_pictures/"+image+" alt='no image'>" 
html =html+ "<br/><a href='javascript:;;' onclick='javascript:show_ad_details("+id+")'>Click</a>";
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(html);
});

return marker;
}

