function getElementById(id) {
	if(document.getElementById) 
		return document.getElementById(id) ;
	else if(document.all)
		return document.all[id] ; 
	else 
		return null ; 
}
//Method for Hikso.Presentation.WebControls.TextBox
function checkLength(id, len) {
	var obj		= getElementById(id) ;
	var objSpan	= getElementById(id + '_span') ;
	
	if (obj.value.length > len) 
		obj.value = obj.value.substring(0, len);
		
	//Update text.
	if(obj.value.length == len)
		objSpan.innerHTML	= 'No characters remaining' ;
	else if(obj.value.length == (len - 1))
		objSpan.innerHTML	= '1 character remaining' ;
	else
		objSpan.innerHTML	= (len - obj.value.length) + ' characters remaining' ;
}
//Methods for Hikso.Presentation.WebControls.OnceClickButton
function changeButton(obj) {
    setTimeout('document.getElementById(\'' + obj.id + '\').style.display = \'none\';document.getElementById(\'' + obj.id + '_Img\').style.display = \'\'', 50) ;    
}

//function to list or hide room fixtures
function swapPanel(s)
{
try{

    var input = getElementById('PanelDisplay_' + s);
    var link = getElementById(s + '_link' );
           
    if(input.value == '')
    {
        getElementById(s).style.display = 'none';
        input.value = "display:none";
        link.innerText = '+';
    }
    else
    {
        getElementById(s).style.display = '';
        input.value = "";
         link.innerText = '-';
    }
    getElementById('nav-sup').style.display = 'none' ;
    getElementById('siteinfo').style.display = 'none' ;
   }
 catch(e)
 {
    alert (s + "error" + e.message);  
 }
 
}


function ShowGenericOther(cbo, ctl)
{
    try
        { 
           
           if (cbo.options[cbo.selectedIndex].text == 'Other') { getElementById(ctl).style.display = ''; }
            else { getElementById(ctl).style.display = 'none'; }
            setTall() ;                     
        }
    catch(e)
    {
    }
}

//<--
//James Isherwood - for use with the property advert
function showImage(src) 
{
        var img;
        var imageID = src.substr(src.indexOf("&id=") + 4);
        window.open('/ShowImage/' + imageID, '', 'width=1024,height=800,resizable=1') ;
    
}
function showImageByID(id)
{	
	window.open('/ShowImage/' + id, '', 'height=640,width=480,resizable=1;') ;
}

function formatNumber(tb)
{
    //  ok, take out the commas first
    var value = tb.value.replace(/,/g, "");
    
    if(isNaN(value))   //  is Not a Number
    {
        return;
    }
    else
    {
        //  format number
        tb.value = addCommas(value);
    }
}

function setFocusTo(controlId, keepTrying)
{
    try
    {
        if(keepTrying)
        {
            var element = document.getElementById(controlId);
            if(element == null)
            {
                window.setTimeout("setFocusTo('" + controlId + "', true)", 10);
            }
            else
                element.focus();
        }
        else
            document.getElementById(controlId).focus();
    }
    catch(e)  
    {
        alert(e);
    }

    
}

//-->


function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

//
//  Date Values
//
var MONTH_NAMES=new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
var DAY_NAMES=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat');
function LZ(x) {return(x<0||x>9?"":"0")+x}


// ------------------------------------------------------------------
// formatDate (date_object, format)
// Returns a date in the output format specified.
// The format string uses the same abbreviations as in getDateFromFormat()
// ------------------------------------------------------------------
function formatDate(date,format) {
	format=format+"";
	var result="";
	var i_format=0;
	var c="";
	var token="";
	var y=date.getYear()+"";
	var M=date.getMonth()+1;
	var d=date.getDate();
	var E=date.getDay();
	var H=date.getHours();
	var m=date.getMinutes();
	var s=date.getSeconds();
	var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;
	// Convert real date parts into formatted versions
	var value=new Object();
	if (y.length < 4) {y=""+(y-0+1900);}
	value["y"]=""+y;
	value["yyyy"]=y;
	value["yy"]=y.substring(2,4);
	value["M"]=M;
	value["MM"]=LZ(M);
	value["MMM"]=MONTH_NAMES[M-1];
	value["NNN"]=MONTH_NAMES[M+11];
	value["d"]=d;
	value["dd"]=LZ(d);
	value["E"]=DAY_NAMES[E+7];
	value["EE"]=DAY_NAMES[E];
	value["H"]=H;
	value["HH"]=LZ(H);
	if (H==0){value["h"]=12;}
	else if (H>12){value["h"]=H-12;}
	else {value["h"]=H;}
	value["hh"]=LZ(value["h"]);
	if (H>11){value["K"]=H-12;} else {value["K"]=H;}
	value["k"]=H+1;
	value["KK"]=LZ(value["K"]);
	value["kk"]=LZ(value["k"]);
	if (H > 11) { value["a"]="PM"; }
	else { value["a"]="AM"; }
	value["m"]=m;
	value["mm"]=LZ(m);
	value["s"]=s;
	value["ss"]=LZ(s);
	while (i_format < format.length) {
		c=format.charAt(i_format);
		token="";
		while ((format.charAt(i_format)==c) && (i_format < format.length)) {
			token += format.charAt(i_format++);
			}
		if (value[token] != null) { result=result + value[token]; }
		else { result=result + token; }
		}
	return result;
	}


//
//  start the clock ticker
var clockTimeout = window.setTimeout("updateClock()", 1100);

function updateClock()
{
    var clockTime = document.getElementById("clockTime");
    var clockDate = document.getElementById("clockDate");
    
    if(clockTime != null)
    {
        clockTime.innerText = formatDate(new Date(), "HH:mm");
        clockDate.innerText = formatDate(new Date(), "EE d MMM yyyy");
        
        clockTimeout = window.setTimeout("updateClock()", 1100);
    }
}

function ClearTextBox(me, defaultValueToClear) {
    if(me.value == defaultValueToClear)
        me.value = '' ;
}

//mf add rounder corner images


function addLoadListener(fn)
{
	if (typeof window.addEventListener != 'undefined')
	{
		window.addEventListener('load', fn, false);
	}
	else if (typeof document.addEventListener != 'undefined')
	{
		document.addEventListener('load', fn, false);
	}
	else if (typeof window.attachEvent != 'undefined')
	{
		window.attachEvent('onload', fn);
	}
	else
	{
		return false;
	}
	
	return true;
};




function attachEventListener(target, eventType, functionRef, capture)
{
    if (typeof target.addEventListener != "undefined")
    {
        target.addEventListener(eventType, functionRef, capture);
    }
    else if (typeof target.attachEvent != "undefined")
    {
        target.attachEvent("on" + eventType, functionRef);
    }
    else
    {
        return false;
    }

    return true;
};

addLoadListener(doCorners);
			function doCorners () {
			
				var span = document.createElement('span');
				span.setAttribute('id', 'branding-image1');
				span.appendChild(document.createTextNode(' '));
				document.getElementById('branding').appendChild(span);
				var span = document.createElement('span');
				span.setAttribute('id', 'branding-image2');
				span.appendChild(document.createTextNode(' '));
				document.getElementById('branding').appendChild(span);
				var span = document.createElement('span');
				span.setAttribute('id', 'nav-image1');
				span.appendChild(document.createTextNode(' '));
				document.getElementById('nav').appendChild(span);
		
				}

addLoadListener(externalLinks);
// add target="_blank" to external, non html & help links
function externalLinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
  var anchor = anchors[i];
  if (anchor.getAttribute("href") &&
      anchor.getAttribute("rel") == "external")
    anchor.target = "_blank";
}
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
  var anchor = anchors[i];
  if (anchor.getAttribute("href") &&
      anchor.getAttribute("rel") == "nonhtml")
    anchor.target = "_blank";
}
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
  var anchor = anchors[i];
  if (anchor.getAttribute("href") &&
      anchor.getAttribute("rel") == "help")
    anchor.target = "_blank";
}
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
  var anchor = anchors[i];
  if (anchor.getAttribute("href") &&
      anchor.getAttribute("rel") == "magazine")
    anchor.target = "_blank";
}
}

if( document.implementation.hasFeature("XPath", "3.0") )
{
	XMLDocument.prototype.selectNodes = function(xPathString, xNode)
	{
		if( !xNode ) { xNode = this; } 

		var nsResolver = this.createNSResolver(this.documentElement)
		var items = this.evaluate(xPathString, xNode, nsResolver, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
		var result = [];
		for( var i = 0; i < items.snapshotLength; i++)
		{
			result[i] =  items.snapshotItem(i);
		}
		
		return result;
	}
	
	XMLDocument.prototype.selectSingleNode = function(xPathString, xNode)
	{
		if( !xNode ) { xNode = this; } 

		var items = this.selectNodes(xPathString, xNode);
		if( items.length > 0 )
		{
			return items[0];
		}
		else
		{
			return null;
		}
	}

	Element.prototype.selectNodes = function(xPathString)
	{
		if(this.ownerDocument.selectNodes)
		{
			return this.ownerDocument.selectNodes(xPathString, this);
		}
		else{throw "For XML Elements Only";}
	}

	Element.prototype.selectSingleNode = function(xPathString)
	{	
		if(this.ownerDocument.selectSingleNode)
		{
			return this.ownerDocument.selectSingleNode(xPathString, this);
		}
		else{throw "For XML Elements Only";}
	}
}

// add replaces the the content of hyperlinks when opened in a static window
function staticLinkReplacement() {
    if (!document.getElementsByTagName) return;
    var anchors = document.getElementsByTagName("a");
    for (var i=0; i<anchors.length; i++) {
      var anchor = anchors[i];
      var oldUrl = anchor.getAttribute("href") ;
      oldUrl = oldUrl.toLowerCase() ;
      
      if(oldUrl != '') {
          var newUrl = oldUrl.replace("/magazine", "/magazine/static") ;      
          anchor.setAttribute("href", newUrl) ;
      }
    }
}

function serializeNode (node) {
  if (typeof XMLSerializer != 'undefined') {
    return new XMLSerializer().serializeToString(node);
  }
  else if (typeof node.xml != 'undefined') {
    return node.xml;
  }
  else {
    return '';
  }
}

function loadXMLFromString (markup) {
  var xmldoc = null;
  if (window.ActiveXObject)
  {
      xmldoc = new ActiveXObject("Microsoft.XMLDOM"); 
      xmldoc.async = false; 
      xmldoc.loadXML(markup); 
  }
  else
  {
      var parser = new DOMParser();
      xmldoc = parser.parseFromString(markup, "text/xml");
  }
  
  return xmldoc;
}
/* 
        by Paul@YellowPencil.com and Scott@YellowPencil.com
        feel free to delete all comments except for the above credit
*/

// Initialize Scripts - is this a browser that understands DOM?

function scriptInit() {
if (!document.getElementById) {
        return;
        }
}

// Set up Event Listener - the script that allows us to use the addEvent call below

function addEvent(elm, evType, fn, useCapture) {
        if (elm.addEventListener) {
        elm.addEventListener(evType, fn, useCapture);
        return true;
        } else if (elm.attachEvent) {
        var r = elm.attachEvent('on' + evType, fn);
        return r;
        } else {
        elm['on' + evType] = fn;
        }
}

// Start Column Script

function setTall() {
	try
	{
        if (document.getElementById) 
        {
            var divs = new Array(
                document.getElementById('actionareas'),
                document.getElementById('maincontent'), 
                document.getElementById('adTower')); 
               
            // Let's determine the maximum height out of all columns specified
            var maxHeight = 0;
            for (var i = 0; i < divs.length; i++) 
            {
                if(divs[i]!=null && divs[i].offsetHeight != 0) 
                {
                    if (divs[i].offsetHeight > maxHeight) maxHeight = divs[i].offsetHeight;   
                }
            }

            // Let's set all columns to that maximum height
            for (var i = 0; i < divs.length; i++) 
            {
                if(divs[i]!=null) 
                {
                   divs[i].style.height = maxHeight + 'px';
                   // Now, if the browser's in standards-compliant mode, the height property
                   // sets the height excluding padding, so we figure the padding out by subtracting the
                   // old maxHeight from the new offsetHeight, and compensate!  So it works in Safari AND in IE 5.x
                   if (divs[i].offsetHeight > maxHeight) {
                           divs[i].style.height = (maxHeight - (divs[i].offsetHeight - maxHeight)) + 'px';
                           
                   }
                }
            }
        }
	}
	catch (e){
	}   
}
addEvent(window, 'load', setTall, false);
addEvent(window, 'resize', setTall, false);
//window.onload = externalLinks;

// JS to add flash content
/**
 * FlashObject v1.2.3: Flash detection and embed - http://blog.deconcept.com/flashobject/
 *
 * FlashObject is (c) 2005 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof com == "undefined") var com = new Object();
if(typeof com.deconcept == "undefined") com.deconcept = new Object();
if(typeof com.deconcept.util == "undefined") com.deconcept.util = new Object();
if(typeof com.deconcept.FlashObjectUtil == "undefined") com.deconcept.FlashObjectUtil = new Object();
com.deconcept.FlashObject = function(swf, id, w, h, ver, c, useExpressInstall, quality, redirectUrl, detectKey){
   this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
   this.skipDetect = com.deconcept.util.getRequestParameter(this.DETECT_KEY);
   this.params = new Object();
   this.variables = new Object();
   this.attributes = new Array();

   if(swf) this.setAttribute('swf', swf);
   if(id) this.setAttribute('id', id);
   if(w) this.setAttribute('width', w);
   if(h) this.setAttribute('height', h);
   if(ver) this.setAttribute('version', new com.deconcept.PlayerVersion(ver.toString().split(".")));
   if(c) this.addParam('bgcolor', c);
   var q = quality ? quality : 'high';
   this.addParam('quality', q);
   this.setAttribute('redirectUrl', '');
   if(redirectUrl) this.setAttribute('redirectUrl', redirectUrl);
   if(useExpressInstall) {
   // check to see if we need to do an express install
   var expressInstallReqVer = new com.deconcept.PlayerVersion([6,0,65]);
   var installedVer = com.deconcept.FlashObjectUtil.getPlayerVersion();
      if (installedVer.versionIsValid(expressInstallReqVer) && !installedVer.versionIsValid(this.getAttribute('version'))) {
         this.setAttribute('doExpressInstall', true);
      }
   } else {
      this.setAttribute('doExpressInstall', false);
   }
}
com.deconcept.FlashObject.prototype.setAttribute = function(name, value){
	this.attributes[name] = value;
}
com.deconcept.FlashObject.prototype.getAttribute = function(name){
	return this.attributes[name];
}
com.deconcept.FlashObject.prototype.getAttributes = function(){
	return this.attributes;
}
com.deconcept.FlashObject.prototype.addParam = function(name, value){
	this.params[name] = value;
}
com.deconcept.FlashObject.prototype.getParams = function(){
	return this.params;
}
com.deconcept.FlashObject.prototype.getParam = function(name){
	return this.params[name];
}
com.deconcept.FlashObject.prototype.addVariable = function(name, value){
	this.variables[name] = value;
}
com.deconcept.FlashObject.prototype.getVariable = function(name){
	return this.variables[name];
}
com.deconcept.FlashObject.prototype.getVariables = function(){
	return this.variables;
}
com.deconcept.FlashObject.prototype.getParamTags = function(){
   var paramTags = ""; var key; var params = this.getParams();
   for(key in params) {
        paramTags += '<param name="' + key + '" value="' + params[key] + '" />';
    }
   return paramTags;
}
com.deconcept.FlashObject.prototype.getVariablePairs = function(){
	var variablePairs = new Array();
	var key;
	var variables = this.getVariables();
	for(key in variables){
		variablePairs.push(key +"="+ variables[key]);
	}
	return variablePairs;
}
com.deconcept.FlashObject.prototype.getHTML = function() {
    var flashHTML = "";
    if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
        if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "PlugIn"); }
        flashHTML += '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" id="'+ this.getAttribute('id') + '" name="'+ this.getAttribute('id') +'" wmode="transparent"';
		var params = this.getParams();
        for(var key in params){ flashHTML += ' '+ key +'="'+ params[key] +'"'; }
		pairs = this.getVariablePairs().join("&");
        if (pairs.length > 0){ flashHTML += ' flashvars="'+ pairs +'"'; }
        flashHTML += '></embed>';
    } else { // PC IE
        if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "ActiveX"); }
        flashHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" id="'+ this.getAttribute('id') +'">';
        flashHTML += '<param name="movie" value="' + this.getAttribute('swf') + '" />';
		flashHTML += '<param name="wmode" value="transparent" />';
		var tags = this.getParamTags();
        if(tags.length > 0){ flashHTML += tags; }
		var pairs = this.getVariablePairs().join("&");
        if(pairs.length > 0){ flashHTML += '<param name="flashvars" value="'+ pairs +'" />'; }
        flashHTML += '</object>';
    }
    return flashHTML;
}
com.deconcept.FlashObject.prototype.write = function(elementId){
	if(this.skipDetect || this.getAttribute('doExpressInstall') || com.deconcept.FlashObjectUtil.getPlayerVersion().versionIsValid(this.getAttribute('version'))){
		if(document.getElementById){
		   if (this.getAttribute('doExpressInstall')) {
		      this.addVariable("MMredirectURL", escape(window.location));
		      document.title = document.title.slice(0, 47) + " - Flash Player Installation";
		      this.addVariable("MMdoctitle", document.title);
		   }
			document.getElementById(elementId).innerHTML = this.getHTML();
		}
	}else{
		if(this.getAttribute('redirectUrl') != "") {
			document.location.replace(this.getAttribute('redirectUrl'));
		}
	}
}
/* ---- detection functions ---- */
com.deconcept.FlashObjectUtil.getPlayerVersion = function(){
   var PlayerVersion = new com.deconcept.PlayerVersion(0,0,0);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new com.deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else if (window.ActiveXObject){
	   try {
   	   var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
   		PlayerVersion = new com.deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
	   } catch (e) {}
	}
	return PlayerVersion;
}
com.deconcept.PlayerVersion = function(arrVersion){
	this.major = parseInt(arrVersion[0]) || 0;
	this.minor = parseInt(arrVersion[1]) || 0;
	this.rev = parseInt(arrVersion[2]) || 0;
}
com.deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
}
/* ---- get value of query string param ---- */
com.deconcept.util.getRequestParameter = function(param){
	var q = document.location.search || document.location.href.hash;
	if(q){
		var startIndex = q.indexOf(param +"=");
		var endIndex = (q.indexOf("&", startIndex) > -1) ? q.indexOf("&", startIndex) : q.length;
		if (q.length > 1 && startIndex > -1) {
			return q.substring(q.indexOf("=", startIndex)+1, endIndex);
		}
	}
	return "";
}

/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* add some aliases for ease of use / backwards compatibility */
var getQueryParamValue = com.deconcept.util.getRequestParameter;
var FlashObject = com.deconcept.FlashObject;