var xmlHttp

//<![CDATA[ 
var map_listings = null;				 
 
var mls_num = [];  
var street_num = [];  
var street_address = [];  
var price = [];  
var beds = [];  
var baths = [];  
var sqft = [];  
var description = [];  
var vtour_link = [];  
var home_latitude = [];  
var home_longitude = [];    
var photo = [];   
var map_mls_num = '';

var i_marker_listings = 0;				
var MyMarkers_listings =[];			
var markers_listings =[];					
var point_listings = [];
 
function load_listings(url_google) 
{ 	
 
	if (GBrowserIsCompatible()) 
	{
		map_listings = new GMap2(document.getElementById("map_listings")); 
		map_listings.addControl(new GLargeMapControl());
		map_listings.addControl(new GMapTypeControl()); 
		map_listings.setCenter(new GLatLng(32.311740, -106.782026), 12 );
		map_listings.setMapType(G_NORMAL_MAP);		
		map_listings.disableDoubleClickZoom();
		map_listings.addControl(new GOverviewMapControl());
		map_listings.addControl(new GScaleControl());
	 	 
		 
		var url_listings = url_google;
		//prompt("url_listings",url_listings);
		GDownloadUrl(url_listings, function(data) 
		{ 
			
			var xml_listings = GXml.parse(data);
			
			markers_listings = xml_listings.documentElement.getElementsByTagName("markers_listing");
			//alert(markers_listings.length);
			var current_id_listings;  
			for (i_marker_listings = 0; i_marker_listings < markers_listings.length; i_marker_listings++) 
			{ 
				current_id_listings 							= markers_listings[i_marker_listings].getAttribute("mls_num");
				mls_num[current_id_listings] 					= markers_listings[i_marker_listings].getAttribute("mls_num");
				street_num[current_id_listings] 				= markers_listings[i_marker_listings].getAttribute("street_num");
				street_address[current_id_listings] 			= markers_listings[i_marker_listings].getAttribute("street_address");
				price[current_id_listings] 						= markers_listings[i_marker_listings].getAttribute("price"); 
				beds[current_id_listings] 						= markers_listings[i_marker_listings].getAttribute("beds");
				baths[current_id_listings] 						= markers_listings[i_marker_listings].getAttribute("baths");
				sqft[current_id_listings] 						= markers_listings[i_marker_listings].getAttribute("sqft");
				description[current_id_listings] 				= markers_listings[i_marker_listings].getAttribute("description"); 
				vtour_link[current_id_listings] 				= markers_listings[i_marker_listings].getAttribute("vtour_link");
				home_latitude[current_id_listings] 				= markers_listings[i_marker_listings].getAttribute("home_latitude");
				home_longitude[current_id_listings] 			= markers_listings[i_marker_listings].getAttribute("home_longitude"); 		
				photo[current_id_listings] 						= markers_listings[i_marker_listings].getAttribute("photo"); 
				  
				point_listings[current_id_listings] 		= new GLatLng(home_latitude[current_id_listings],-home_longitude[current_id_listings],false);
				MyMarkers_listings[current_id_listings] 	= createMarker_listings(point_listings[current_id_listings],	mls_num[current_id_listings],	street_num[current_id_listings],	street_address[current_id_listings],	price[current_id_listings],	beds[current_id_listings],	baths[current_id_listings],	sqft[current_id_listings],	description[current_id_listings] ,	vtour_link[current_id_listings],	home_latitude[current_id_listings],	home_longitude[current_id_listings],	photo[current_id_listings], current_id_listings);
				
				map_listings.addOverlay(MyMarkers_listings[current_id_listings]);
			}
		});
		 
	}
	
}
function createMarker_listings(point_listings, mls_num, street_num, street_address, price, beds, baths, sqft, description , vtour_link, home_latitude, home_longitude, photo, current_id_listings) 
{
  
	var icon_listings 					= new GIcon();
    icon_listings.image 				= "http://www.steinborn.com/listings/google_maps/images/flag.png";
    icon_listings.shadow 				= "http://www.steinborn.com/listings/google_maps/images/shadow-flag.png";
    icon_listings.iconSize 				= new GSize(35.0, 35.0);
    icon_listings.shadowSize 			= new GSize(53.0, 35.0);
    icon_listings.iconAnchor 			= new GPoint(17.0, 17.0);
    icon_listings.infoWindowAnchor 		= new GPoint(17.0, 17.0);
	
 	//alert(mls_num);
	
	var marker_listings = new GMarker(point_listings, icon_listings);
	var info 	= "<b>MLS #:  " + mls_num +  "</b><br/>Price:  $" + price + "</b><br/>Beds:  " + beds+ "</b><br/>Baths:  " + baths + "</b><br/>Sq Ft:  " + sqft + "</b><br/>" + street_num + " " + street_address + "<br/><br/><a href=\"http://www.steinborn.com/residential/"+ mls_num +"/');\">View More &raquo;</a>";
    var photo2 	= "<center><a href='http://www.steinborn.com/residential/"+ mls_num +"/'><img src='" + photo + "' width='250' border='0'  /></a><br></center>";
   // var desc 	= "<b>description</b>";
    
	var infoTabs = [
          new GInfoWindowTab("Info", "test"),
          new GInfoWindowTab("Photo", "test"),
         // new GInfoWindowTab("Description", desc) 
        ];
	
	GEvent.addListener(marker_listings, 'click', function() 
	{
		marker_listings.openInfoWindowHtml(info);
		map_listings.setCenter(point_listings, 14,G_NORMAL_MAP);
	}); 
		
	return marker_listings;
}

function map_listing(map_mls_num) 
{
	GEvent.trigger(MyMarkers_listings[map_mls_num], "click");
	map_listings.setCenter(point_listings[map_mls_num], 14,G_NORMAL_MAP);
}

/* functions

validation
//////////////////////////////////////////

function validate_neighborhood_alert(form)
function validate_share_listing(form) 

AJAX/Other
//////////////////////////////////////////

function removeMyHome(account_system_num,mls_num)
function updateRank(rating,account_system_num,mls_num)
function clearDiv(mls_num
function compareHome(account_system_num,mls_num)
function updateCompareHome(account_system_num,mls_num)
function compareHomePopup(account_system_num,mls_num)
function drivingRoute(account_system_num,mls_num)
function removedrivingRoute(account_system_num,mls_num)
function toggle_map()
function toggle_street_options(thisCheckbox)
function showMyHome(thisCheckbox)
function toggle_text_alert(thisCheckbox)

*/
function validate_share_listing(form) 
{
	var e = form.elements, m = '';
	
	if(!e['first_name'].value) 
	{
		m += '- Your First name is required.\n\n';
	}
	if(!e['email'].value) 
	{
		m += '- Your email is required.\n\n';
	}
	if(e['email'].value) 
	{
		var str = e['email'].value;
		var reg = new RegExp("([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})");
				
		if (!reg.test(str))
		{
			m += '- Your E-Mail address is not valid.\n\n';
		}
	}
	if(!e['recipients_first_name'].value) 
	{
		m += '- Recipient\'s First name is required.\n\n';
	}
	if(!e['message'].value) 
	{
		m += '- Message is required.\n\n';
	}
	if(!e['recipients_email'].value) 
	{
		m += '- Recipient\'s email is required.\n\n';
	}
	if(e['recipients_email'].value) 
	{
		var str = e['recipients_email'].value;
		var reg = new RegExp("([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})");
				
		if (!reg.test(str))
		{
			m += '- Recipient\'s E-Mail address is not valid.\n\n';
		}
	}
	if(m) 
	{
		alert('The following error(s) occurred:\n\n' + m);
		return false;
	}
	return true;
}

function validate_neighborhood_alert(form) 
{
	var e = form.elements, m = '';		 
	 
	if(e['receive_na_listings_txt'].checked) 
	{			
		var str = e['na_txt_phone_num'].value;
		var reg = new RegExp("[1-9][0-9]{9}");
		
		if (!reg.test(str))
		{
			m += '- Cell Number must be 10 digits and no other characters.\n\n';
		}	
	}
	
	if(m) 
	{
		alert('The following error(s) occurred:\n\n' + m);
		return false;
	}
	return true;
}

//////	AJAX	//////////////////////////////////////////////////////////////////////////////////////////////

function updateRank(include_url,rating,account_system_num,mls_num)
{
	xmlHttp = GetXmlHttpObject();

	if(xmlHttp == null)
	{
		alert("Browser does not support HTTP Request");
		return;
	} 
	if(account_system_num == "")
	{
		alert("Please Login or Create a Home Tracker Account To Rate This Home");
		return;
	} 
	var   url=include_url+"/modules/mls/assets/php/update_rank.php"
	url	= url+"?account_system_num="+ account_system_num
	url	= url+"&mls_num="+ mls_num
	url	= url+"&rating="+ rating 
	url	= url+"&sid="+Math.random()
	 
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{ 
			//document.getElementById('mls_rating_' + mls_num).innerHTML = xmlHttp.responseText; 
			//setTimeout("clearDiv('"+mls_num+"')",5000);
			rating = rating * 25;
			document.getElementById('current_rating_'+ mls_num).style.width = rating+'px';							
		}  
	}   
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null); 
} 
 
function clearDiv(mls_num)  
{
	document.getElementById('mls_rating_' + mls_num).innerHTML = ""; 
}
function saveHome(include_url,account_system_num,mls_num)
{
	xmlHttp = GetXmlHttpObject();

	if(xmlHttp == null)
	{
		alert("Browser does not support HTTP Request");
		return;
	} 
	if(account_system_num == "")
	{
		alert("Please Login or Create a Home Tracker Account To Save This Home.");
		return;
	} 
	
	var   url=include_url+"/modules/mls/assets/php/save_homes.php"
	url	= url+"?account_system_num="+ account_system_num
	url	= url+"&mls_num="+ mls_num 
	url	= url+"&sid="+Math.random()
	
	//prompt ("",url)
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{ 
			var is_saved_home = xmlHttp.responseText; 
			if(is_saved_home != 0)
			{				
				alert("You have already saved this home.");
				return;
			}  
			else
			{
				document.getElementById('sh_change_' + mls_num).innerHTML = '&#10004; <a href="javascript:removeMyHome(\''+include_url+'\','+account_system_num+','+mls_num+');">Unsave Home</a>';
				alert("This home has been added to your save list. \n Click \"My Homes\" on the left to see your list.");
				return;
			}  
		}  
	}   
	xmlHttp.open("POST",url,true);
	xmlHttp.send(null); 
}
function removeMyHome(include_url,account_system_num,mls_num)
{
	xmlHttp = GetXmlHttpObject();

	if(xmlHttp == null)
	{
		alert("Browser does not support HTTP Request");
		return;
	} 
	/*
	if (!confirm("Are you sure you want to delete this home from your saved homes?"))
	{
		return;
	}
	*/
	
	var   url=include_url+"/modules/mls/assets/php/remove_home.php"
	url	= url+"?account_system_num="+ account_system_num
	url	= url+"&mls_num="+ mls_num 
	url	= url+"&sid="+Math.random()
	
	//prompt ("",url)
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{ 			
			document.getElementById('sh_change_' + mls_num).innerHTML = '&bull; <a href="javascript:saveHome(\''+include_url+'\','+account_system_num+','+mls_num+');" >Save Home</a>';
			return; 
		}  
	}   
	xmlHttp.open("POST",url,true);
	xmlHttp.send(null); 
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//		Compare Functions
// 
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function compareHome(include_url,account_system_num,mls_num)
{
	xmlHttp2 = GetXmlHttpObject();

	if(xmlHttp2 == null)
	{
		alert("Browser does not support HTTP Request");
		return;
	} 
	if(account_system_num == "")
	{
		alert("Please Login or Create a Home Tracker Account To Compare This Home.");
		return;
	} 
	if(mls_num == "")
	{
		activateWindowCompare(include_url+"/modules/mls/assets/content/compare.php?account_system_num="+account_system_num);
		return;
	}  
	var   url=include_url+"/modules/mls/assets/php/compare_homes.php"
	url	= url+"?account_system_num="+ account_system_num
	url	= url+"&mls_num="+ mls_num 
	url	= url+"&sid="+Math.random()
	
	xmlHttp2.onreadystatechange = function()
	{
		if(xmlHttp2.readyState == 4)
		{ 
			document.getElementById('ch_change_' + mls_num).innerHTML = '&#10004; <a href="javascript:compareHomePopup(\''+include_url+'\','+account_system_num+','+mls_num+');">View Compared</a>';
			alert("This home has been added to your compare list. \n Click \"Compare Homes\" on the left to see comparisons.");
		}  
	}   
	xmlHttp2.open("POST",url,true);
	xmlHttp2.send(null); 
}

function compareHomePopup(include_url,account_system_num,mls_num)
{
	xmlHttp = GetXmlHttpObject();

	if(xmlHttp == null)
	{
		alert("Browser does not support HTTP Request");
		return;
	} 
	if(account_system_num == "")
	{
		alert("Please Login or Create a Home Tracker Account To Compare This Home.");
		return;
	} 
	if(mls_num == "")
	{
		activateWindowCompare(include_url+"/modules/mls/assets/content/compare.php");
		return;
	}  
	
	var   url=include_url+"/modules/mls/assets/php/compare_homes.php"
	url	= url+"?account_system_num="+ account_system_num
	url	= url+"&mls_num="+ mls_num 
	url	= url+"&sid="+Math.random()
	
	//prompt ("",url)
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{ 			
			document.getElementById('ch_change_' + mls_num).innerHTML = '&#10004; <a href="javascript:compareHomePopup(\''+include_url+'\','+account_system_num+','+mls_num+');">View Compared</a>';
			activateWindowCompare(include_url+"/modules/mls/assets/content/compare.php");				
			return;
		}  
	}   
	xmlHttp.open("POST",url,true);
	xmlHttp.send(null); 
} 
function updateCompareHome(include_url,account_system_num2,mls_num)
{
	xmlHttp4 = GetXmlHttpObject();

	if(xmlHttp4 == null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}  
	
	if(mls_num != '')
	{
		if (!confirm("Are you sure you want to delete this home from your compare list?"))
		{
			return;
		}
	}
	
	var   url=include_url+"/modules/mls/assets/php/update_my_compared_homes.php"
	url	= url+"?account_system_num="+ account_system_num2
	url	= url+"&mls_num="+ mls_num 
	url	= url+"&sid="+Math.random()

	xmlHttp4.onreadystatechange = function()
	{		
		if(xmlHttp4.readyState == 4)
		{  						
			document.getElementById('mls_compare_homes').innerHTML = xmlHttp4.responseText;						
		}  
	}   
	xmlHttp4.open("POST",url,true);
	xmlHttp4.send(null); 
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//		END Compare Functions
// 
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function drivingRoute(include_url,account_system_num,mls_num)
{
	xmlHttp = GetXmlHttpObject();
	if(account_system_num == "")
	{
		alert("Please Login or Create a Home Tracker Account To Add To Driving Route.");
		return;
	} 
	if(xmlHttp == null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}  
	var   url=include_url+"/modules/mls/assets/php/driving_route.php" 
	url	= url+"?mls_num="+ mls_num 
	url	= url+"&sid="+Math.random()
	
	//prompt ("",url)
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{ 
			document.getElementById('dr_change_' + mls_num).innerHTML = '&#10004; <a href="javascript:removedrivingRoute(\''+include_url+'\','+account_system_num+','+mls_num+');">Remove From Driving Route</a>';
			alert("This home has been added to your driving route. \n Click \"Driving Route \" on the left to see comparisons.");
			return;		
		}  
	}   
	xmlHttp.open("POST",url,true);
	xmlHttp.send(null); 
}    
function removedrivingRoute(include_url,account_system_num,mls_num)
{
	xmlHttp = GetXmlHttpObject();

	if(xmlHttp == null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}  
	/*
	if(mls_num != '')
	{
		if (!confirm("Are you sure you want to delete this listing from your driving route?"))
		{
			return;
		}
	}
	*/
	var   url=include_url+"/modules/mls/assets/php/update_driving_route.php" 
	url	= url+"?mls_num="+ mls_num 
	url	= url+"&sid="+Math.random()
	
	//prompt ("",url)
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{  		
			document.getElementById('dr_change_' + mls_num).innerHTML = '&bull; <a href="javascript:drivingRoute(\''+include_url+'\','+account_system_num+','+mls_num+');" >Add to Driving Route</a>';							
		}  
	}   
	xmlHttp.open("POST",url,true);
	xmlHttp.send(null); 
} 


function toggle_map()
{
	if (document.getElementById('mls_map_row').style.display == 'block')
	{
		//This closes
		
		xmlHttp = GetXmlHttpObject();

		if(xmlHttp == null)
		{
			alert("Browser does not support HTTP Request");
			return;
		} 
		
		//var   url="../../listings/includes/mls/ajax_php/session_map.php"
		var   url="../php/session_map.php"
		url	= url+"?type=closed" 
		url	= url+"&sid="+Math.random()
		 
		xmlHttp.onreadystatechange = function()
		{
			if(xmlHttp.readyState == 4)
			{ 
				document.getElementById('mls_map_row').style.display = 'none';
				document.getElementById('mls_map_row_arrow_open').style.display = 'block';
				document.getElementById('mls_map_row_arrow_close').style.display = 'none';
			}  
		}   
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);    
	}
	else
	{	
		//This opens
		xmlHttp = GetXmlHttpObject();

		if(xmlHttp == null)
		{
			alert("Browser does not support HTTP Request");
			return;
		} 
		
		//var   url="../../listings/includes/mls/ajax_php/session_map.php"
		var   url="../php/session_map.php"
		url	= url+"?type=open" 
		url	= url+"&sid="+Math.random()
		 
		xmlHttp.onreadystatechange = function()
		{
			if(xmlHttp.readyState == 4)
			{ 
				document.getElementById('mls_map_row').style.display = 'block';
				document.getElementById('mls_map_row_arrow_open').style.display = 'none';
				document.getElementById('mls_map_row_arrow_close').style.display = 'block';
			}  
		}   
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null); 
		
	} 
} 
function toggle_street_options(thisCheckbox) 
{
 	if (thisCheckbox.checked) 
	{  
		document.getElementById("street_text_field").style.display = 'block';
		document.getElementById("street_select").style.display = 'none';
    }
	else 
	{
		document.getElementById("street_text_field").style.display = 'none';		
		document.getElementById("street_select").style.display = 'block';
	}
}
 
function showMyHome(thisCheckbox) 
{
 	if (thisCheckbox.checked) 
	{  
		document.getElementById("my_home_title").style.display = 'block';
		document.getElementById("my_home_photo").style.display = 'block';
		document.getElementById("my_home_address").style.display = 'block';
		document.getElementById("my_home_mls_num").style.display = 'block';
		document.getElementById("my_home_price").style.display = 'block';
		document.getElementById("my_home_beds").style.display = 'block';
		document.getElementById("my_home_baths").style.display = 'block';
		document.getElementById("my_home_garages").style.display = 'block';
		document.getElementById("my_home_fireplaces").style.display = 'block';
		document.getElementById("my_home_sqft").style.display = 'block';
		document.getElementById("my_home_lot_size").style.display = 'block';
		document.getElementById("my_home_address1").style.display = 'block';
		document.getElementById("my_home_address2").style.display = 'block';
		document.getElementById("my_home_area").style.display = 'block';
		document.getElementById("my_home_landscape").style.display = 'block';
		document.getElementById("my_home_structure").style.display = 'block';
		document.getElementById("my_home_year_built").style.display = 'block';
		document.getElementById("my_home_class").style.display = 'block';
		document.getElementById("my_home_type").style.display = 'block';
		document.getElementById("my_home_style").style.display = 'block';
		document.getElementById("my_home_vt").style.display = 'block';
		document.getElementById("my_home_description").style.display = 'block';
		document.getElementById("my_home_courtesy").style.display = 'block'; 
		
    }
	else 
	{
		document.getElementById("my_home_title").style.display = 'none';
		document.getElementById("my_home_photo").style.display = 'none';
		document.getElementById("my_home_address").style.display = 'none';
		document.getElementById("my_home_mls_num").style.display = 'none';
		document.getElementById("my_home_price").style.display = 'none';
		document.getElementById("my_home_beds").style.display = 'none';
		document.getElementById("my_home_baths").style.display = 'none';
		document.getElementById("my_home_garages").style.display = 'none';
		document.getElementById("my_home_fireplaces").style.display = 'none';
		document.getElementById("my_home_sqft").style.display = 'none';
		document.getElementById("my_home_lot_size").style.display = 'none';
		document.getElementById("my_home_address1").style.display = 'none';
		document.getElementById("my_home_address2").style.display = 'none';
		document.getElementById("my_home_area").style.display = 'none';
		document.getElementById("my_home_landscape").style.display = 'none';
		document.getElementById("my_home_structure").style.display = 'none';
		document.getElementById("my_home_year_built").style.display = 'none';
		document.getElementById("my_home_class").style.display = 'none';
		document.getElementById("my_home_type").style.display = 'none';
		document.getElementById("my_home_style").style.display = 'none';
		document.getElementById("my_home_vt").style.display = 'none';
		document.getElementById("my_home_description").style.display = 'none';
		document.getElementById("my_home_courtesy").style.display = 'none'; 
	}
} 

function addFeature(include_url,account_system_num,mls_num,feature_num,custom_fav_feature_num)
{
	xmlHttp = GetXmlHttpObject();

	if(xmlHttp == null)
	{
		alert("Browser does not support HTTP Request");
		return;
	} 
	if(account_system_num == "")
	{
		alert("Please Login or Create a Home Tracker Account To Save This Home.");
		return;
	} 
	
	if(feature_num)
	{
		var checkBox = document.getElementById("feature_"+mls_num+"_"+feature_num).checked;
	}
	if(custom_fav_feature_num)
	{
		var checkBox = document.getElementById("custom_feature_"+mls_num+"_"+custom_fav_feature_num).checked;
	}
	
	if(checkBox == true)
	{
		var checked = "Yes";
	}
	else
	{
		var checked = "No";
	}
	
	var   url=include_url+"/modules/mls/assets/php/ajax_my_tags_listing.php";
	url	= url+"?account_system_num="+ account_system_num;
	url	= url+"&mls_num="+ mls_num;
	url	= url+"&feature_num="+ feature_num;
	url	= url+"&custom_fav_feature_num="+ custom_fav_feature_num;	
	url	= url+"&checked="+ checked;
	url	= url+"&sid="+Math.random();
	
	//prompt ("",url)
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{ 
			document.getElementById('my_tags_' + mls_num).innerHTML = xmlHttp.responseText;				 
		}  
	}   
	xmlHttp.open("POST",url,true);
	xmlHttp.send(null); 
}



function toggle_text_alert(thisCheckbox)
{

 	if (thisCheckbox.checked) 
	{  
		document.getElementById("cell_number").style.display = 'block';
    }
	else 
	{
		document.getElementById("cell_number").style.display = 'none';		
	}
} 
function activateWindow(url)
{ 
	Shadowbox.open({
		type: 'iframe',
		title: "<b>Steinborn &amp; Associates</b>",
		content: url, 
		width: '520', 
		height: '244' 
	});
}
function activateWindowIndex(url)
{ 
	mShadowbox.open({
		type: 'iframe',
		title: "<b>Steinborn &amp; Associates</b>",
		content: url, 
		width: '500', 
		height: '220' 
	});
}
function activateWindowListing(url,title_listing)
{ 
	Shadowbox.open({
		type: 'iframe',
		title: title_listing,
		content: url, 
		width: '800', 
		height: '525' 
	});
}
function activateWindowCompare(url)
{ 
	Shadowbox.open({
		type: 'iframe',
		title: "<b>Steinborn &amp; Associates</b>",
		content: url, 
		width: '2000', 
		height: '900' 
	});
}
function activateWindowCompareMyHome(url)
{ 
	Shadowbox.open({
	 	type: 'iframe',
		title: "<b>Steinborn &amp; Associates</b>",
		content: url, 
		width: '2000', 
		height: '900' 
	});
}
function activateWindowShareListing(url,account_system_num)
{
	
	Shadowbox.open(
	{
		type: 'iframe',
		title: "<b>Steinborn &amp; Associates</b>",
		content: url, 
		width: '500', 
		height: '485'  
	});
}
function activateWindowRental(url,rental_address)
{ 
	Shadowbox.open({
		type: 'iframe',
		title: rental_address,
		content: url, 
		width: '800', 
		height: '525'  
	});
}
function activateWindowLand(url,land_title)
{ 
	Shadowbox.open({
		type: 'iframe',
		title: land_title,
		content: url, 
		width: '800',  
		height: '525' 
	});
}
function activateWindowCommunity(url,community_title)
{ 
	Shadowbox.open({
		type: 'iframe',
		title: community_title,
		content: url, 
		width: '800',  
		height: '525' 
	});
}
function activateWindowAgent(url,realtor)
{ 
	Shadowbox.open({
		type: 'iframe',
		title: realtor,
		content: url, 
		width: '900', 
		height: '525' 
	});
}
function activateWindowRCpopUp(url)
{ 
	Shadowbox.open({
		type: 'iframe',
		title: "<b>Steinborn &amp; Associates</b>",
		content: url, 
		width: '540', 
		height: '394'  
	});
}
function activateWindowSetUpApptResidential(url,account_system_num)
{ 
	Shadowbox.open({
		type: 'iframe',
		title: account_system_num,
		content: url, 
		width: '800',  
		height: '525' 
	});
}


function load_favorite_features_assoc(site_url,module_id)
{
	xmlHttp=GetXmlHttpObject();
	
	if(xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}  
	
	var num_of_inputs = document.getElementById('num_of_inputs').value; 
	
	var url = site_url+"/modules/mls/assets/php/blank_fav_feature_inputs.php"; 
	url	= url+"?num_of_inputs="+ num_of_inputs;
	url	= url+"&sid="+Math.random();
	//prompt("",url);
  
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{ 
			var result = xmlHttp.responseText;
			document.getElementById('cust_fav_feature_inputs').innerHTML = result;   
			return;
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}



function GetXmlHttpObject(){var xmlHttp=null;try{ xmlHttp=new XMLHttpRequest();}catch (e){ try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}catch (e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}}return xmlHttp;}

function populate_features_field()
{
	var hidden_value = "";
	$('input.custom_feature_checkbox:checked').each(function(index) {
		string_value	= $(this).val();
		hidden_value 	= hidden_value+""+string_value+",";
	});
	if(hidden_value)
	{
		hidden_value 	= hidden_value.substring(0, hidden_value.length - 1);
		$('input#features').val(hidden_value);
	}
}

function friend_request(site_url,account_system_num,account_system_num2,action)
{
	var change_url	= site_url+"/assets/modules/account_system/assets/php/friend_request.php?action="+action+"&account_system_num="+account_system_num+"&account_system_num2="+account_system_num2;
	$.get(change_url, 
	function(data)
	{
		$("div#friend_action").html(data).fadeIn('slow');
	});

}