// Various script associated with the Housing Act Guide

var haGraphicsPath = "/graphics/housing_act_guide/";

/* Preloads the highlighted property type images
 *
 */
function preloadPropertyIm() {
    var types = ['singleproperty', 'flats', 'sharedhouse', 'mixedaccommodation', 'hostel', 'bedsit', 'selfnonself'];
	for(var n=0; n<types.length; n++) {
	  var im = new Image();
	  im.src = haGraphicsPath + "3Dmodels/" + types[n] + "_small_hl.gif";
	}
}

preloadPropertyIm();

/* Hightlights or un-hightlights a property type box
 * Fired by mouseover and mouseout
 *
 */
function hlPropertyType(prop, highlight) {
	
	var propbox = document.getElementById(prop);
	var propicon = document.getElementById(prop+"Icon");
	if(highlight) {
	  propbox.className = "property_type_selected";
	  propicon.src = haGraphicsPath + "3Dmodels/" + prop + "_small_hl.gif";
	}
	else {
	  propbox.className = "property_type";
	  propicon.src = haGraphicsPath + "3Dmodels/" + prop + "_small.gif";
	}
}



/* Shows the Glossary popup, and anchors to the supplied term
 * Usage: <a href="javascript:popGlossary('owneroccupied'); void 0;">Glossary</a>
 */
function popGlossary(term) {
  var popupwidth = 400;
  var popupheight = 300;
  var popupx = 100; var popupy = 100;
  
  if(screen.width) {
    //if browser supports screen res detection, then centre file upload popup
	popupx = Math.ceil((screen.width - popupwidth) / 2);
	popupy = Math.ceil((screen.height - popupheight) / 2);
  }
  
  window.open('/landlord/guides/housing_act/glossary/#'+term,'Glossary','left='+popupx+',top='+popupy+',width='+popupwidth+',height='+popupheight+',scrollbars=yes');	
}



