function AttachOnload(MyFunction) {
	if (window.attachEvent) { window.attachEvent("onload",MyFunction); }
	else if (window.addEventListener) { window.addEventListener("load",MyFunction,false); }
}

// attach functions to run on an object's (OBJ) event (EVT)
function AttachEvent(obj, evt, MyFunction) 
{
	if (typeof(obj) == "string") obj = document.getElementById(obj); 

	evt = evt.replace(/^on/i,"");

	if (obj.attachEvent)
		obj.attachEvent("on" + evt, MyFunction);
	else if (obj.addEventListener)
		obj.addEventListener(evt, MyFunction, false);
}

function showStaff(id)
{
	document.getElementById('photo-info-'+id).style.visibility = "visible";
	document.getElementById('photo-highlight-'+id).style.border = "5px solid #99CC66";
	document.getElementById('team-member-name'+id).style.borderBottomColor = "#FFFFFF";
	
	last_photo_id = id;
}

function hideStaff(id)
{
	document.getElementById('photo-highlight-'+id).style.borderWidth = "0px";
	document.getElementById('photo-info-'+id).style.visibility = "hidden";
	document.getElementById('team-member-name'+id).style.borderBottom = "5px solid #99CC66";
	last_photo_id = id;
}

function showLocation(id)
{
	document.getElementById('region-location-'+id).style.border = "5px solid #99CC66";

}

function hideLocation(id)
{
	document.getElementById('region-location-'+id).style.border = "none";

}

function showProperty(id, top, left)
{
	
	document.getElementById('location-property-'+id).style.border = "5px solid #99CC66";
	document.getElementById('location-property-info-'+id).style.height = "300px";
	document.getElementById('location-property-info-'+id).style.width = "200px";
	document.getElementById('location-property-info-'+id).style.top = top+"px";
	document.getElementById('location-property-info-'+id).style.left = left+"px";
	//Effect.Fade('location-property-info-'+id,  {duration: 0.1});
	document.getElementById('location-property-info-'+id).style.visibility = "visible";
	Effect.Appear('location-property-info-'+id,  {duration: 0.5});
	//setTimeout('alert(\'test\')',10);
	
}

function hideProperty(id)
{
	document.getElementById('location-property-'+id).style.border = "none";
	Effect.Fade('location-property-info-'+id, {duration: 0.5});
	//document.getElementById('location-property-info-'+id).style.visibility = "hidden";

}

function loadProperty(id)
{
	Effect.Fade('location-property-info-'+id,  {duration: 0.1});
	setTimeout('document.getElementById(\'location-property-info-\'+id).style.visibility = \"visible\"',100);
}

function openURL(address)
{
	location.href=address;
}

function changePropImage(url) {
	document.getElementById('propertyimageviewer').innerHTML = '<img src="'+url+'" alt="" >';


}

function hoverMapProperty(id)
{
	document.getElementById('propertyinfocontent').innerHTML = propinfo[id];
	document.getElementById('propertyinfobox').style.visibility = "visible";
}

var propinfotext = "Use the mouse to hover over the property to wish look at to get more information.";

function unhoverMapProperty()
{
	document.getElementById('propertyinfocontent').innerHTML = propinfotext;
	document.getElementById('propertyinfobox').style.visibility = "hidden";
}

var last_name;
var last_room;

function expandRoom(id)
{
	//alert("123");
		if (last_room != undefined)
		{
		  document.getElementById('roominfozone'+last_room).style.visibility = "hidden";
		}
	
	document.getElementById('roominfozone'+id).style.visibility = "visible";
	document.getElementById('roominfozone'+id).style.display = "block";
	last_room = id;
}

function hideRoom(id)
{
	/*alert("123");*/
	document.getElementById('roominfozone'+id).style.visibility = "hidden";
	

}



var last_photo_id = 1;

 AttachOnload(function ()
 {
  
  if (homepage == 1)
  {
  var so = new SWFObject('images/ad.swf','housemates_ad','162','146','9');
  so.addParam("wmode","transparent"); // this is important (allows HTML content to "float" over flash content)
  so.addVariable("autostart","true");
  so.addVariable("repeat", "true");
  so.write('advert');
  }
 });
 
