window.addEventListener?window.addEventListener("load",so_init,false):window.attachEvent("onload",so_init);

var d=document, imgs = new Array(), zInterval = null, current=0, pause=false;

function so_init() {
	if(!d.getElementById("imageContainer") || !d.createElement)return;
	css = d.createElement("link");
	css.setAttribute("href","styles.css");
	css.setAttribute("rel","stylesheet");
	css.setAttribute("type","text/css");
	d.getElementsByTagName("head")[0].appendChild(css);

	imgs = d.getElementById("imageContainer").getElementsByTagName("img");
	for(i=1;i<imgs.length;i++) imgs[i].xOpacity = 0;
	imgs[0].style.display = "block";
	imgs[0].xOpacity = .99;
	
	setTimeout(so_xfade,3000);
}

function so_xfade() {
	cOpacity = imgs[current].xOpacity;
	nIndex = imgs[current+1]?current+1:0;

	nOpacity = imgs[nIndex].xOpacity;
	
	cOpacity-=.05; 
	nOpacity+=.05;
	
	imgs[nIndex].style.display = "block";
	imgs[current].xOpacity = cOpacity;
	imgs[nIndex].xOpacity = nOpacity;
	
	setOpacity(imgs[current]); 
	setOpacity(imgs[nIndex]);
	
	if(cOpacity<=0) {
		imgs[current].style.display = "none";
		current = nIndex;
		setTimeout(so_xfade,3000);
	} else {
		setTimeout(so_xfade,50);
	}
	
	function setOpacity(obj) {
		if(obj.xOpacity>.99) {
			obj.xOpacity = .99;
			return;
		}
		obj.style.opacity = obj.xOpacity;
		obj.style.MozOpacity = obj.xOpacity;
		obj.style.filter = "alpha(opacity=" + (obj.xOpacity*100) + ")";
	}
	
}

function fnWindowOpen(url, name, options){
	if(!options) options="resizable=1,scrollbars=1";
	newWindow = window.open(url, name, options);
	newWindow.focus();
}

function BrowserCheck()
{
	var b = navigator.appName;
	if (b=="Netscape") this.b = "ns";
	else if (b=="Microsoft Internet Explorer") this.b = "ie";
	else this.b = b;
	var c = navigator.appVersion;
	this.AOL = (c.indexOf('AOL')>0);
	this.v = parseInt(c);
	this.ns = (this.b=="ns" && this.v>=4);
	this.ns5 = (this.b=="ns" && this.v==5);
	this.ns6 = (this.b=="ns" && this.v==5);
	this.ie = (this.b=="ie" && this.v>=4);
	this.ie5b = (navigator.userAgent.indexOf('MSIE 5.5')>0);
	this.ie6 = (navigator.userAgent.indexOf('MSIE 6')>0);
	this.gecko = (navigator.userAgent.indexOf('Gecko') > 0);
	if (this.ie5) this.v = 5;
	if (this.ie6) this.v = 6;
}

is = new BrowserCheck();

function toggleDisplay (v) {
	var element = (typeof v == "string") ? document.getElementById(v) : v;
	menuToClear = v;
	if (element.style.display == 'block') {
		element.style.display = 'none';
	} else {
		element.style.display = 'block';
	}
	
}

var lastSearch = 'officesSearch';
var lastSearchLink = 'officesLink';

function swapSearch (id, link) {

	var toShow = document.getElementById(id);
	if (toShow.style.display != 'block') {
		document.getElementById(lastSearch).style.display = 'none';
		lastSearch = id;
		
		document.getElementById(lastSearchLink).className = '';
		lastSearchLink = link;
		
		toShow.style.display = 'block';
		document.getElementById(link).className = 'active';
	} 
	
}

var _processingStateToggle = false;
var countryRegistrationCount = 0;
var countryDropdownCollection = null;

function getObject(objectId) { 

	if(document.getElementById && document.getElementById(objectId)) { 
		return document.getElementById(objectId); 
	} 
	else if (document.all && document.all(objectId)) { 
		return document.all(objectId); } 
	else if (document.layers && document.layers[objectId]) { 
		document.layers[objectId]; 
	} 
	else 
	{ 
		return false; 
	} 
} 


var functionIsCityTextboxDefaultLoaded = false;
var countryDataIslandLoaded = false;
function EnableCityControl(citytxtdiv, citycbodiv, countryguid)
{
	var showTextbox = true;
	if(functionIsCityTextboxDefaultLoaded)
	{
		showTextbox = IsCityTextboxDefault();
	}

   if(IsCountryRequireCityTextbox(countryguid))
   {
      showTextbox = true;
   }
   
   if(showTextbox)
   {
	citytxtdiv.style.display = '';
	citytxtdiv.style.visibility = "visible";
	citycbodiv.style.display = 'NONE';
	citycbodiv.style.visibility = "hidden";
   }
   else
   {
	citytxtdiv.style.display = 'NONE';
	citytxtdiv.style.visibility = "hidden";
	citycbodiv.style.display = '';
	citycbodiv.style.visibility = "visible";
   }
}
function IsCountryRequireCityTextbox(countryGuid)
{
	var isFound = false;
	
	if(countryDataIslandLoaded)
	{
		countryGuids.recordset.absoluteposition=1;
		while(!countryGuids.recordset.EOF)
		{
			if(countryGuids.recordset("guid") == countryGuid)
			{
				isFound = true;
			}
			countryGuids.recordset.MoveNext();
		}
	}
	return isFound;
}

var _callToggle = false;

function manageCountryBoundStateCity(state, citytxt, citycbo, country)
{
	if (_callToggle == false)
	{
		_callToggle = true;
		toggleStateDropdown(state,country);
		_callToggle = false;
	}
	
	var stateDiv = getObject(state);
	var countrySelect = getObject(country);
	var cityTxtDiv = getObject(citytxt);
	var cityCboDiv = getObject(citycbo);
	var selectedIndex = -1;
	
	if ((stateDiv != false) && (countrySelect != false) && (cityTxtDiv != false) && (cityCboDiv != false))
	{
		selectedIndex = countrySelect.selectedIndex;
		
		if ((selectedIndex != -1) && (countrySelect.options[selectedIndex].value == '25439b47-af53-46f4-bca8-6a8a2a854b07'))
			stateDiv.style.display = '';	
		else
			stateDiv.style.display = 'NONE';	
			
		if (selectedIndex != -1)
			EnableCityControl(cityTxtDiv, cityCboDiv, countrySelect.options[selectedIndex].value);
	}
		
	return true;	
}
function toggleStateDropdown(state,country)
{
	
	var stateDiv = getObject(state);
	var countrySelect = getObject(country);
	var selectedIndex = -1;

	if ((stateDiv != false) && (countrySelect != false))
	{
		selectedIndex = countrySelect.selectedIndex;
		
		if ((selectedIndex != -1) && (countrySelect.options[selectedIndex].value == '25439b47-af53-46f4-bca8-6a8a2a854b07'))
			stateDiv.style.display = '';	
		else
			stateDiv.style.display = 'NONE';	
	}
	else
	{
		return true;
	}

	if (_processingStateToggle == false)
	{
		if (typeof countryDropdownCollection == 'undefined')
		{
			return true;
		}
		
		_processingStateToggle = true;
		if ((countryDropdownCollection != null) && (countryRegistrationCount != null))
		{
			var updateCountrySelect;
			
			for(var i=0; i<countryRegistrationCount; i++)
			{
				if (countryDropdownCollection[i] != country)
				{
					updateCountrySelect = getObject(countryDropdownCollection[i]);
					if (updateCountrySelect != false)
					{
						var _selectedIndex = false;
						var _us_index = -1;
						
						for(var x=0;x<updateCountrySelect.options.length;x++)
						{
							if (updateCountrySelect.options[x].value == '25439b47-af53-46f4-bca8-6a8a2a854b07')
							{
								_us_index = x;
							}
							if (updateCountrySelect.options[x].value == countrySelect.options[selectedIndex].value)
							{
								updateCountrySelect.selectedIndex = x;
								_selectedIndex = true;
							}

						}
						
						if (_selectedIndex == true)
						{
						}
						else
						{
							updateCountrySelect.onchange();	
						}
					}
				}
			}
		}
		_processingStateToggle = false;
	}
	return true;	
}
function getSelectedSearchTab()
{
	var tabs = new Array('officesSearch','meetingRoomsSearch','virtualOfficesSearch');
	for(var c=0;c<tabs.length;c++){if( document.getElementById(tabs[c]).style.display==('block'))return tabs[c];}
	return '';
}

var pLastSearch = 'quickFindSearch';
var pLastSearchLink = 'quickFindLink';

function pSwapSearch (id, link) {

	var toShow = document.getElementById(id);
	if (toShow.style.display != 'block') {
		document.getElementById(pLastSearch).style.display = 'none';
		pLastSearch = id;
		
		document.getElementById(pLastSearchLink).className = '';
		pLastSearchLink = link;
		
		toShow.style.display = 'block';
		document.getElementById(link).className = 'active';
	}
}

function pGetSelectedSearchTab()
{
	var tabs = new Array('quickFindSearch','addressSearch','POISearch','centerSearch');
	for(var c=0;c<tabs.length;c++){if( document.getElementById(tabs[c]).style.display==('block'))return tabs[c];}
	return '';
}

var lastParent = 'oList';
var lastGridImage = 'offices';

function swapgrid (id, parent) {
	document.getElementById(lastParent).className = 'productList';
	lastParent = parent;
	document.getElementById(parent).className = 'productList activeList';
	document.getElementById(lastGridImage + '2x4grid').style.display = 'none';
	lastGridImage = id;
	document.getElementById(id + '2x4grid').style.display = 'block';
}

function enableDisableSiblings(source,siblingIds,enable)
{
	var prefix=source.id.substr(0,source.id.lastIndexOf('_')+1);
	var ids=siblingIds.split('|');
	for(var c=0;c<ids.length;c++) document.getElementById(prefix+ids[c]).disabled=(!enable);
}


/* sml addition: 
	without replacing or adding a function, 
	allow function to accept objects in addition to objects' id
	v:variant - argument with unknown type
*/
function getAbsoluteLeft(v) {
	var o = (typeof v == "string") ? document.getElementById(v) : v;
	oLeft = o.offsetLeft            
	while(o.offsetParent!=null) {   
		oParent = o.offsetParent    
		oLeft += oParent.offsetLeft 
		o = oParent;
	}
	return oLeft
}

function getAbsoluteTop(v) {
	var o = (typeof v == "string") ? document.getElementById(v) : v;
	oTop = o.offsetTop; 			
	while(o.offsetParent!=null) {   
		oParent = o.offsetParent    
		oTop += oParent.offsetTop 	
		o = oParent;
	}
	return oTop;
}



/* widgets on location details page */
function switchWidget(id) {
	document.getElementById('photoGal').className = "";
	document.getElementById('virtualTour').className = "";
	document.getElementById('floorPlan').className = "";
	
	document.getElementById(id).className = "active";
}

/* tab info area on details page */
function switchTab(id) {
	var tabs = new Array('about','pricing','maps','amenities','nearby');
	
	for(i=0;i<tabs.length;i++) {
		document.getElementById(tabs[i]).style.display = "none";
	}
	document.getElementById(id).style.display = "block";
	
	for(i=0;i<tabsCollection.length;i++) {
		document.getElementById(tabsCollection[i]).className = "";
		
	}
	
	for(i=0;i<tabs.length;i++) {
		if(tabs[i] == id) {
			document.getElementById(tabsCollection[i]).className = "active";
		}
	}
	var activeIndex=-1;
	for(i=0;i<tabs.length;i++) {
		if(tabs[i] == id) {
			activeIndex = i;
		}
	}
	if((activeIndex != -1) && (activeIndex != tabs.length-1)) {
		document.getElementById(tabsCollection[activeIndex+1]).className = "pastActive";
	}
	var j;
	for(i=0;i<tabsCollection.length;i++) {
		if (document.getElementById(tabsCollection[i]).style.display != "none")
		{
			j = i;
		}	
	}
	document.getElementById(tabsCollection[j]).className += " last";
}

function switchPackage(side) {
	if(side=="left") {
		document.getElementById('tr').className="";
		document.getElementById('br').className="";
		document.getElementById('tl').className="active";
		document.getElementById('bl').className="active";
	}
	if(side=="right") {
		document.getElementById('tr').className="active";
		document.getElementById('br').className="active";
		document.getElementById('tl').className="";
		document.getElementById('bl').className="";
	}
}


function switchCard(which) {
	if(which=="left") {
		document.getElementById('tr').className="";
		document.getElementById('br').className="";
		document.getElementById('tc').className="";
		document.getElementById('bc').className="";
		document.getElementById('tl').className="active";
		document.getElementById('bl').className="active";
	}
	if(which=="right") {
		document.getElementById('tr').className="active";
		document.getElementById('br').className="active";
		document.getElementById('tl').className="";
		document.getElementById('bl').className="";
		document.getElementById('tc').className="";
		document.getElementById('bc').className="";
	}
	if(which=="center") {
		document.getElementById('tr').className="";
		document.getElementById('br').className="";
		document.getElementById('tl').className="";
		document.getElementById('bl').className="";
		document.getElementById('tc').className="active";
		document.getElementById('bc').className="active";
	}
}

function sml_easing_Regular_easeOut(t,b,c,d)
{ 
	return -c *(t/=d)*(t-2) + b; 
}

function sml_domApi_initDepths()
{
	sml.domApi.__z = 1000;
}
function sml_domApi_getNextHighestDepth()
{
	return ++sml.domApi.__z;
}
function sml_domApi_moveToHighest(v)
{
	var o = (typeof(v)== "string") ? document.getElementById(v) : v;
	if (document.body.style)
		o.style.zIndex = sml.domApi.getNextHighestDepth();
}
var sml = {};
sml.easing = {};
sml.easing.Regular = {};
sml.easing.Regular.easeOut = sml_easing_Regular_easeOut;
sml.domApi = {};

sml.domApi.__z=0;
sml.domApi.__depthInited=false;
sml.domApi.initDepths          = sml_domApi_initDepths;
sml.domApi.getNextHighestDepth = sml_domApi_getNextHighestDepth;
sml.domApi.moveToHighest       = sml_domApi_moveToHighest;

function RecentLoc(o) 
{
	this.dropDownId   = o.dropDownId;
	this.toggleLinkId = o.toggleLinkId;
	
	
	this.id    = o.id; 
	
	this.borderStyle = "";
	this.state = RecentLoc.STATE_OFF;
	this.tween = {interval:null, t:0, b:null, c:null, d:20};
	
	this.dropDown = null;
	this.toggleLink = null;
	
	this.boxHeight = null;
	this.boxPos = {x0:null, y0:null, x1:null, y1:null};
	this.affectedSelectBoxArray = null;
}

function RecentLoc_toggleLinkHandler()
{
	var rlc = RecentLocCollection.instance;
	var i = rlc.rl_arr.length;
	while (i--)
	{
		if (this==rlc.rl_arr[i].toggleLink)
		{
			rlc.rl_arr[i].toggleDropDown();
			RecentLocCollection.activeRL = rlc.rl_arr[i];
			break;
		}
	}
	return false;
}
function RecentLoc_animateActiveRL()
{
	var activeRL = RecentLocCollection.activeRL;
	var dd = activeRL.dropDown;
	
	with (activeRL.tween)
	{
		dd.style.height = Math.floor(sml.easing.Regular.easeOut(t, b, c, d))+"px";
		if (t==0) 
		{
			clearInterval(activeRL.tween.interval);
			activeRL.tween.interval = setInterval(RecentLoc.animateActiveRL, 20);
		}
		else if (t==d)
		{
			clearInterval(activeRL.tween.interval);
			
			activeRL.state = (activeRL.state == RecentLoc.STATE_TO_ON) ? RecentLoc.STATE_ON : RecentLoc.STATE_OFF;
			if (activeRL.state == RecentLoc.STATE_ON)
			{
				dd.style.visibility =  "visible";
			}
			else
			{
				if (activeRL.affectedSelectBoxArray)
					for (var i=0; i<activeRL.affectedSelectBoxArray.length; i++)
						activeRL.affectedSelectBoxArray[i].style.visibility = "visible";
				dd.style.visibility =  "hidden";
				RecentLocCollection.activeRL = null;
			}
		}
		t++;
	}
};
RecentLoc.mouseoutTO = 0;

function RecentLoc_mouseOutHandler(e)
{
	if (RecentLocCollection.activeRL)
		RecentLoc.mouseoutTO = setTimeout(RecentLoc.mouseOutLimiter, 500);
}
function RecentLoc_mouseOutLimiter()
{
	if (RecentLocCollection.activeRL)
		RecentLocCollection.activeRL.toggleDropDown();
}
function RecentLoc_mouseOverHandler(e)
{
	if (RecentLocCollection.activeRL)
		clearTimeout(RecentLoc.mouseoutTO);;
}

function RecentLoc_p_init()
{


	var dropDown   = document.getElementById(this.dropDownId);
	var toggleLink = document.getElementById(this.toggleLinkId);
	
	if (dropDown && toggleLink)
	{
		this.dropDown = dropDown;
		this.toggleLink = toggleLink;
		this.toggleLink.onclick = RecentLoc.toggleLinkHandler;
		return true;
	}
	return false;	
}

function RecentLoc_p_animate()
{
	if (RecentLocCollection.activeRL != null && RecentLocCollection.activeRL != this)
		RecentLocCollection.activeRL.stopAnimate();
	RecentLocCollection.activeRL = this;
	RecentLoc.animateActiveRL();
}
function RecentLoc_p_stopAnimate()
{
	clearInterval(this.tween.interval);
	this.state = RecentLoc.STATE_OFF;
	if (this.affectedSelectBoxArray)
		for (var i=0; i<this.affectedSelectBoxArray.length; i++)
			this.affectedSelectBoxArray[i].style.visibility = "visible";
	this.dropDown.style.height = "0px";
	this.dropDown.style.visibility = "hidden";
}
function RecentLoc_p_toggleDropDown()
{
	if (this.state != RecentLoc.STATE_OFF && this.state != RecentLoc.STATE_ON)
		return;
	
	clearTimeout(RecentLoc.mouseoutTO);
	var dd = this.dropDown;
	if (this.boxHeight == null)
	{
		dd.style.visibility = "hidden";
		dd.style.display = "block";
		this.boxHeight = dd.offsetHeight;
		dd.style.height = "0";
	
	}
	
	dd.style.visibility = "visible";
	sml.domApi.moveToHighest(dd);
	
	if (!this.affectedSelectBoxArray)
		this.initAffectedSelectBoxArray();

	if (this.affectedSelectBoxArray)
	{	
		if (this.state == RecentLoc.STATE_TO_ON || this.state == RecentLoc.STATE_OFF)
		{
			this.state = RecentLoc.STATE_TO_ON;
			this.tween = {t:0, b:parseInt(dd.style.height), c:this.boxHeight-parseInt(dd.style.height), d:10};
			for (var i=0; i<this.affectedSelectBoxArray.length; i++)
				this.affectedSelectBoxArray[i].style.visibility = "hidden";
			this.trackMouseOut(true);
		}	
		else
		{
			this.state = RecentLoc.STATE_TO_OFF;
			this.tween = {t:0, b:parseInt(dd.style.height), c:-parseInt(dd.style.height), d:10};
			this.trackMouseOut(false);
		}
	}
	this.animate();
	
	
}
function RecentLoc_p_initAffectedSelectBoxArray()
{
	var box = this.dropDown;
	var boxPos_y = getAbsoluteTop(box);

	var return_arr = new Array();
	var arr = document.getElementsByTagName("select");

	
	for (var i=0; i<arr.length; i++)
	{
		var selObj = arr[i];
		var selObj_y = getAbsoluteTop(selObj);
		
		var fail = Math.abs(selObj_y-boxPos_y) < this.boxHeight;
		
		if (fail)
			return_arr.push(arr[i]);
	}
	
	this.affectedSelectBoxArray = return_arr
}
function RecentLoc_p_trackMouseOut(track)
{
	if (RecentLocCollection.activeRL)
	{
		clearTimeout(RecentLoc.mouseoutTO);
		this.dropDown.onmouseout  = track ? RecentLoc.mouseOutHandler  : null;
		this.dropDown.onmouseover = track ? RecentLoc.mouseOverHandler : null;
	}
}

RecentLoc.STATE_OFF = 0;
RecentLoc.STATE_TO_ON = 1;
RecentLoc.STATE_ON = 2;
RecentLoc.STATE_TO_OFF = 3;

RecentLoc.animateActiveRL  = RecentLoc_animateActiveRL;
RecentLoc.mouseOverHandler = RecentLoc_mouseOverHandler;
RecentLoc.mouseOutHandler  = RecentLoc_mouseOutHandler;
RecentLoc.mouseOutLimiter  = RecentLoc_mouseOutLimiter;
RecentLoc.toggleLinkHandler = RecentLoc_toggleLinkHandler;

RecentLoc.prototype.init            = RecentLoc_p_init;
RecentLoc.prototype.animate         = RecentLoc_p_animate;
RecentLoc.prototype.stopAnimate     = RecentLoc_p_stopAnimate;
RecentLoc.prototype.toggleDropDown  = RecentLoc_p_toggleDropDown;
RecentLoc.prototype.trackMouseOut   = RecentLoc_p_trackMouseOut;
RecentLoc.prototype.initAffectedSelectBoxArray = RecentLoc_p_initAffectedSelectBoxArray;


function RecentLocCollection()
{
	this.rl_arr = new Array();
	this.className = "RecentLocCollection";
	RecentLocCollection.instance = this;
}
function RecentLocCollection_p_addItem(o)
{
	var rl = new RecentLoc(o);
	if (rl.init())
	{
		this.rl_arr.push(rl);
	}
}

RecentLocCollection.instance = null;
RecentLocCollection.activeRL = null;
RecentLocCollection.prototype.addItem = RecentLocCollection_p_addItem;



function ContextHelpItem(o)
{
	this.id      = o.id;      
	this.linkId  = o.linkId;  
	this.blockId = o.blockId; 
	this.closeId = o.closeId; 
	this.oLink  = null;
	this.oBlock = null;
	this.oClose = null;
}
function ContextHelpItem_p_init()
{
	
	if (document.getElementById)
	{
		var oLink  = document.getElementById(this.linkId);
		var oBlock = document.getElementById(this.blockId);
		var oClose = document.getElementById(this.closeId);
	}
	
	if (!(oLink && oBlock && oClose))
 	{
 		return false;
 	}
	
	this.oLink  = oLink;
	this.oBlock = oBlock;
	this.oClose = oClose; 	

 	this.oLink.onclick  = ContextHelp.linkHandler;
	this.oClose.onclick = ContextHelp.closeHandler;
	
 	return true;
 }
function ContextHelpItem_p_activate(x,y)
{
	if (this.oBlock.style)
	{
		this.oBlock.style.display = "block";
		this.oBlock.style.left = x + "px";
		this.oBlock.style.top  = y + "px";
	}
}
function ContextHelpItem_p_deactivate()
{
	this.oBlock.style.display = "none";
}
ContextHelpItem.prototype.init       = ContextHelpItem_p_init;
ContextHelpItem.prototype.activate   = ContextHelpItem_p_activate;
ContextHelpItem.prototype.deactivate = ContextHelpItem_p_deactivate;

function ContextHelp()
{
	this.chiArray   = new Array();
	this.activeItem = undefined;
	ContextHelp.instance = this;
}
ContextHelp.instance = undefined;
function ContextHelp_linkHandler(e)
{
	ContextHelp.instance.onItemLink(this);
	return false;
}
function ContextHelp_closeHandler(e)
{
	ContextHelp.instance.onItemClose(this);
	return false;
}
function ContextHelp_getOffendingContainer()
{
	var divTwoCol = document.getElementById("quickSearchTwoCol");
	var divOneCol = document.getElementById("quickSearchOneCol");
	return (divTwoCol || divOneCol);
}
function ContextHelp_p_onItemLink(o)
{
	for (var i=0; i<this.chiArray.length; i++)
	{
		if (this.chiArray[i].oLink==o)
		{
			if (typeof(this.activeItem)!='undefined')
			{
				this.activeItem.deactivate();
			}
			this.activeItem = this.chiArray[i];
			var x = getAbsoluteLeft(o)-2;
			var y = getAbsoluteTop(o) -2;
			
			var offendingDiv = ContextHelp.getOffendingContainer();
			if (offendingDiv)
			{
				x -= getAbsoluteLeft(offendingDiv);
				y -= getAbsoluteTop (offendingDiv);
			}
			this.activeItem.activate(x,y);
		}
	}
}
function ContextHelp_p_onItemClose(o)
{
	for (var i=0; i<this.chiArray.length; i++)
	{
		if (typeof(this.activeItem)!='undefined')
		{
			this.activeItem.deactivate();
			this.activeItem = undefined;
		}

	}
}
function ContextHelp_p_addItem(o)
{
	if (document.getElementById)
	{
		o.id = this.chiArray.length;
		var item = new ContextHelpItem(o);
		if (item.init())
		{
			this.chiArray.push(item);
		}
	}
}


ContextHelp.linkHandler           = ContextHelp_linkHandler;
ContextHelp.closeHandler          = ContextHelp_closeHandler;
ContextHelp.getOffendingContainer = ContextHelp_getOffendingContainer;

ContextHelp.prototype.onItemLink  = ContextHelp_p_onItemLink;
ContextHelp.prototype.onItemClose = ContextHelp_p_onItemClose;
ContextHelp.prototype.addItem     = ContextHelp_p_addItem;

if(!Array.prototype.push) 
{
	Array.prototype.push = function()
	{
		for (var i=0; i<arguments.length; i++)
		{
			this[this.length] = arguments[i];
		}
		return this.length;
	}
}

window.onload = function()
{
	sml.domApi.initDepths();
}


/* jeff stuff */

function setGLTimeout() {
	document.getElementById('globalList').timeout = setTimeout(toggleGL,1000);
}

function killGLTimeout() {
	clearTimeout(document.getElementById('globalList').timeout);
}

function toggleGL() {
	toggleDisplay('globalList');
}


function profilerLink() 
	{ document.cookie = "profilerCookie=true;path=/"; }

function readCookie() { 
	var nameEQ = "profilerCookie="; 
	var ca = document.cookie.split(';'); 
		for(var i=0;i < ca.length;i++) 
			{ var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); 
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } 
	return "END"; }



function profilerLink() 
	{ document.cookie = "profilerCookie=true;path=/"; }

function readCookie() { 
	var nameEQ = "profilerCookie="; 
	var ca = document.cookie.split(';'); 
		for(var i=0;i < ca.length;i++) 
			{ var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); 
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } 
	return "END"; }



function isCoDotUK() {return "false"; } 

function getmetaContents(mn) {
	var m = document.getElementsByTagName('meta');   
	for(var i in m){    if(m[i].name == mn){      return m[i].content;    }   } }

if(isCoDotUK() == "true") {

var profSearchRef = "";
var profLocation = document.location + "";
if (profLocation.match("search/results.htm")) {
	var profCity = getmetaContents("DCSext.search_city");
	var profCountry = getmetaContents("DCSext.search_country");
	profSearchRef = "&city=" + profCity + "&country=" + profCountry; }


var profilerCookieValue = "FALSE";
profilerCookieValue = readCookie();
document.cookie = "profilerCookie=false;path=/";

document.write("<s" + "cript language='javascript' src='http://www.profilertracking.com/regus/recordClicks_inside.asp?HREF=" +  document.location.href + 
profSearchRef + "&TITLE=" + document.title + "&PLINK=" + profilerCookieValue + "'></sc" + "ript>"); }


var dhtmlwindow={
imagefiles:['zsys/windowfiles/min.gif', 'zsys/windowfiles/close.gif', 'zsys/windowfiles/restore.gif', 'zsys/windowfiles/resize.gif'], 
ajaxbustcache: true, 

minimizeorder: 0,
tobjects: [], 

init:function(t){
	var domwindow=document.createElement("div") 
	domwindow.id=t
	domwindow.className="dhtmlwindow"
	var domwindowdata=''
	domwindowdata='<div class="drag-handle">'
	domwindowdata+='DHTML Window <div class="drag-controls"><img src="'+this.imagefiles[0]+'" title="Minimize" /><img src="'+this.imagefiles[1]+'" title="Close" /></div>'
	domwindowdata+='</div>'
	domwindowdata+='<div class="drag-contentarea"></div>'
	domwindowdata+='<div class="drag-statusarea"><div class="drag-resizearea" style="background: transparent url('+this.imagefiles[3]+') top right no-repeat;">&nbsp;</div></div>'
	domwindowdata+='</div>'
	domwindow.innerHTML=domwindowdata
	document.getElementById("dhtmlwindowholder").appendChild(domwindow)
	this.zIndexvalue=(this.zIndexvalue)? this.zIndexvalue+1 : 100 
	var t=document.getElementById(t)
	var divs=t.getElementsByTagName("div")
	for (var i=0; i<divs.length; i++){ 
		if (/drag-/.test(divs[i].className))
			t[divs[i].className.replace(/drag-/, "")]=divs[i] 
	}
	t.style.zIndex=this.zIndexvalue 
	t.handle._parent=t 
	t.resizearea._parent=t 
	t.controls._parent=t 
	t.onclose=function(){return true} 
	t.onmousedown=function(){dhtmlwindow.zIndexvalue++; this.style.zIndex=dhtmlwindow.zIndexvalue} 
	t.handle.onmousedown=dhtmlwindow.setupdrag 
	t.resizearea.onmousedown=dhtmlwindow.setupdrag 
	t.controls.onclick=dhtmlwindow.enablecontrols
	t.show=function(){dhtmlwindow.show(this)} 
	t.hide=function(){dhtmlwindow.close(this)} 
	t.setSize=function(w, h){dhtmlwindow.setSize(this, w, h)} 
	t.moveTo=function(x, y){dhtmlwindow.moveTo(this, x, y)} 
	t.isResize=function(bol){dhtmlwindow.isResize(this, bol)} 
	t.isScrolling=function(bol){dhtmlwindow.isScrolling(this, bol)} 
	t.load=function(contenttype, contentsource, title){dhtmlwindow.load(this, contenttype, contentsource, title)} 
	this.tobjects[this.tobjects.length]=t
	return t 
},

open:function(t, contenttype, contentsource, title, attr, recalonload){
	var d=dhtmlwindow 
	function getValue(Name){
		var config=new RegExp(Name+"=([^,]+)", "i") 
		return (config.test(attr))? parseInt(RegExp.$1) : 0 
	}
	if (document.getElementById(t)==null) 
		t=this.init(t) 
	else
		t=document.getElementById(t)
	t.setSize(getValue(("width")), (getValue("height"))) 
	var xpos=getValue("center")? "middle" : getValue("left") 
	var ypos=getValue("center")? "middle" : getValue("top") 
	if (typeof recalonload!="undefined" && recalonload=="recal" && this.scroll_top==0){ 
		if (window.attachEvent && !window.opera) 
			this.addEvent(window, function(){setTimeout(function(){t.moveTo(xpos, ypos)}, 400)}, "load")
		else
			this.addEvent(window, function(){t.moveTo(xpos, ypos)}, "load")
	}
	t.isResize(getValue("resize")) 
	t.isScrolling(getValue("scrolling")) 
	t.style.visibility="visible"
	t.style.display="block"
	t.contentarea.style.display="block"
	t.moveTo(xpos, ypos) 
	t.load(contenttype, contentsource, title)
	if (t.state=="minimized" && t.controls.firstChild.title=="Restore"){ 
		t.controls.firstChild.setAttribute("src", dhtmlwindow.imagefiles[0]) 
		t.controls.firstChild.setAttribute("title", "Minimize")
		t.state="fullview" 
	}
	return t
},

setSize:function(t, w, h){ 
	t.style.width=Math.max(parseInt(w), 150)+"px"
	t.contentarea.style.height=Math.max(parseInt(h), 100)+"px"
},

moveTo:function(t, x, y){ 
	this.getviewpoint() 
	t.style.left=(x=="middle")? this.scroll_left+(this.docwidth-t.offsetWidth)/2+"px" : this.scroll_left+parseInt(x)+"px"
	t.style.top=(y=="middle")? this.scroll_top+(this.docheight-t.offsetHeight)/2+"px" : this.scroll_top+parseInt(y)+"px"
},

isResize:function(t, bol){ 
	t.statusarea.style.display=(bol)? "block" : "none"
	t.resizeBool=(bol)? 1 : 0
},

isScrolling:function(t, bol){ 
	t.contentarea.style.overflow=(bol)? "auto" : "hidden"
},

load:function(t, contenttype, contentsource, title){ 
	var contenttype=contenttype.toLowerCase() 
	if (typeof title!="undefined")
		t.handle.firstChild.nodeValue=title
	if (contenttype=="inline")
		t.contentarea.innerHTML=contentsource
	else if (contenttype=="div"){
		t.contentarea.innerHTML=document.getElementById(contentsource).innerHTML 
		document.getElementById(contentsource).style.display="none" 
	}
	else if (contenttype=="iframe"){
		t.contentarea.style.overflow="hidden" 
		if (!t.contentarea.firstChild || t.contentarea.firstChild.tagName!="IFRAME") 
			t.contentarea.innerHTML='<iframe src="" style="margin:0; padding:0; width:100%; height: 100%" name="_iframe-'+t.id+'"></iframe>'
		window.frames["_iframe-"+t.id].location.replace(contentsource) 
		}
	else if (contenttype=="ajax"){
		this.ajax_connect(contentsource, t) 
	}
	t.contentarea.datatype=contenttype 
},

setupdrag:function(e){
	var d=dhtmlwindow 
	var t=this._parent 
	d.etarget=this 
	var e=window.event || e
	d.initmousex=e.clientX 
	d.initmousey=e.clientY
	d.initx=parseInt(t.offsetLeft) 
	d.inity=parseInt(t.offsetTop)
	d.width=parseInt(t.offsetWidth) 
	d.contentheight=parseInt(t.contentarea.offsetHeight) 
	if (t.contentarea.datatype=="iframe"){ 
		t.style.backgroundColor="#F8F8F8" 
		t.contentarea.style.visibility="hidden"
	}
	document.onmousemove=d.getdistance 
	document.onmouseup=function(){
		if (t.contentarea.datatype=="iframe"){ 
			t.contentarea.style.backgroundColor="white"
			t.contentarea.style.visibility="visible"
		}
		d.stop()
	}
	return false
},

getdistance:function(e){
	var d=dhtmlwindow
	var etarget=d.etarget
	var e=window.event || e
	d.distancex=e.clientX-d.initmousex 
	d.distancey=e.clientY-d.initmousey
	if (etarget.className=="drag-handle") 
		d.move(etarget._parent, e)
	else if (etarget.className=="drag-resizearea") 
		d.resize(etarget._parent, e)
	return false 
},

getviewpoint:function(){ 
	var ie=document.all && !window.opera
	var domclientWidth=document.documentElement && parseInt(document.documentElement.clientWidth) || 100000 
	this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body 
	this.scroll_top=(ie)? this.standardbody.scrollTop : window.pageYOffset
	this.scroll_left=(ie)? this.standardbody.scrollLeft : window.pageXOffset
	this.docwidth=(ie)? this.standardbody.clientWidth : (/Safari/i.test(navigator.userAgent))? window.innerWidth : Math.min(domclientWidth, window.innerWidth-16)
	this.docheight=(ie)? this.standardbody.clientHeight: window.innerHeight
},

rememberattrs:function(t){ 
	this.getviewpoint() 
	t.lastx=parseInt((t.style.left || t.offsetLeft))-dhtmlwindow.scroll_left 
	t.lasty=parseInt((t.style.top || t.offsetTop))-dhtmlwindow.scroll_top
	t.lastwidth=parseInt(t.style.width) 
},

move:function(t, e){
	t.style.left=dhtmlwindow.distancex+dhtmlwindow.initx+"px"
	t.style.top=dhtmlwindow.distancey+dhtmlwindow.inity+"px"
},

resize:function(t, e){
	t.style.width=Math.max(dhtmlwindow.width+dhtmlwindow.distancex, 150)+"px"
	t.contentarea.style.height=Math.max(dhtmlwindow.contentheight+dhtmlwindow.distancey, 100)+"px"
},

enablecontrols:function(e){
	var d=dhtmlwindow
	var sourceobj=window.event? window.event.srcElement : e.target 
	if (/Minimize/i.test(sourceobj.getAttribute("title"))) 
		d.minimize(sourceobj, this._parent)
	else if (/Restore/i.test(sourceobj.getAttribute("title"))) 
		d.restore(sourceobj, this._parent)
	else if (/Close/i.test(sourceobj.getAttribute("title"))) 
		d.close(this._parent)
	return false
},

minimize:function(button, t){
	dhtmlwindow.rememberattrs(t)
	button.setAttribute("src", dhtmlwindow.imagefiles[2])
	button.setAttribute("title", "Restore")
	t.state="minimized" 
	t.contentarea.style.display="none"
	t.statusarea.style.display="none"
	if (typeof t.minimizeorder=="undefined"){ 
		dhtmlwindow.minimizeorder++ 
		t.minimizeorder=dhtmlwindow.minimizeorder
	}
	t.style.left="10px" 
	t.style.width="200px"
	var windowspacing=t.minimizeorder*10 
	t.style.top=dhtmlwindow.scroll_top+dhtmlwindow.docheight-(t.handle.offsetHeight*t.minimizeorder)-windowspacing+"px"
},

restore:function(button, t){
	dhtmlwindow.getviewpoint()
	button.setAttribute("src", dhtmlwindow.imagefiles[0])
	button.setAttribute("title", "Minimize")
	t.state="fullview" 
	t.style.display="block"
	t.contentarea.style.display="block"
	if (t.resizeBool) 
		t.statusarea.style.display="block"
	t.style.left=parseInt(t.lastx)+dhtmlwindow.scroll_left+"px" 
	t.style.top=parseInt(t.lasty)+dhtmlwindow.scroll_top+"px"
	t.style.width=parseInt(t.lastwidth)+"px"
},


close:function(t){
	try{
		var closewinbol=t.onclose()
	}
	catch(err){ 
		var closewinbol=true
 }
	finally{ 
		if (typeof closewinbol=="undefined"){
			alert("An error has occured somwhere inside your \"onclose\" event handler")
			var closewinbol=true
		}
	}
	if (closewinbol){ 
		if (t.state!="minimized") 
			dhtmlwindow.rememberattrs(t) 
		t.style.display="none"
	}
	return closewinbol
},

show:function(t){
	if (t.lastx) 
		dhtmlwindow.restore(t.controls.firstChild, t) 
	else
		t.style.display="block"
	t.state="fullview" 
},

ajax_connect:function(url, t){
	var page_request = false
	var bustcacheparameter=""
	if (window.XMLHttpRequest) 
		page_request = new XMLHttpRequest()
	else if (window.ActiveXObject){ 
		try {
		page_request = new ActiveXObject("Msxml2.XMLHTTP")
		} 
		catch (e){
			try{
			page_request = new ActiveXObject("Microsoft.XMLHTTP")
			}
			catch (e){}
		}
	}
	else
		return false
	page_request.onreadystatechange=function(){dhtmlwindow.ajax_loadpage(page_request, t)}
	if (this.ajaxbustcache) 
		bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
	page_request.open('GET', url+bustcacheparameter, true)
	page_request.send(null)
},

ajax_loadpage:function(page_request, t){
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
	t.contentarea.innerHTML=page_request.responseText
	}
},


stop:function(){
	dhtmlwindow.etarget=null 
	document.onmousemove=null
	document.onmouseup=null
},

addEvent:function(target, functionref, tasktype){ 
	var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
	if (target.addEventListener)
		target.addEventListener(tasktype, functionref, false)
	else if (target.attachEvent)
		target.attachEvent(tasktype, functionref)
},

cleanup:function(){
	for (var i=0; i<dhtmlwindow.tobjects.length; i++){
		dhtmlwindow.tobjects[i].handle._parent=dhtmlwindow.tobjects[i].resizearea._parent=dhtmlwindow.tobjects[i].controls._parent=null
	}
	window.onload=null
}

} 

document.write('<div id="dhtmlwindowholder"><span style="display:none">.</span></div>') 
window.onunload=dhtmlwindow.cleanup

function getElementsByClassName(classname) {
  var rl = new Array();
  var re = new RegExp('(^| )'+classname+'( |$)');
  var ael = document.getElementsByTagName('*');
  var op = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
  if (document.all && !op) ael = document.all;
  for (i=0, j=0; i<ael.length; i++) {
    if (re.test(ael[i].className)) {
      rl[j]=ael[i];
      j++;
    }
  }
  return rl;
}

function attachExternals() {
  if (document.getElementsByTagName('a')) {
    as = document.getElementsByTagName('a');
    for (var i=0; i<as.length; i++) {
      if (as[i].className.indexOf('external') >= 0) {
        as[i].target = '_blank';
      }
    }
  }
}

function attachExpands() {
  if (document.getElementsByTagName('span')) {
    var spans = document.getElementsByTagName('span');
    for (var i=0; i<spans.length; i++) {
      if (spans[i].className == 'expander') {
        spans[i].onmouseover = function() {
          expands = this.parentNode.getElementsByTagName('div');
          for (var j=0; j<expands.length; j++) {
            if (expands[j].className == 'expand') expands[j].style.display = 'block';
          }
        }
        spans[i].onmouseout = function() {
          expands = this.parentNode.getElementsByTagName('div');
          for (var j=0; j<expands.length; j++) {
            if (expands[j].className == 'expand') expands[j].style.display = 'none';
          }
        }
      }
    }
  }
}

function showButtonBusy(btnE)
{
    return showButtonBusyStyle(btnE, "url(_images/_project_images/back-button_grey.gif)");
}
function showButtonBusyLarge(btnE)
{
    return showButtonBusyStyle(btnE, "url(_images/_project_images/back-largebutton_grey.gif)");
}
function showButtonBusyStyle(btnE,imgurl)
{
    if(btnE)
    {
        btnE.style.backgroundColor="#666666";
        btnE.style.backgroundImage=imgurl;
        btnE.style.border = "1px solid #999999";
    }
    return true;
}
function checkValidSetBusy(btnE,validationGroupName)
{
    var retVal=false;
    Page_ClientValidate(validationGroupName)
    if(Page_IsValid)
    {
        showButtonBusy(btnE);
        retVal=true;
    }
    return retVal;
}
function checkValidSetBusyLarge(btnE,validationGroupName)
{
    var retVal=false;
    Page_ClientValidate(validationGroupName)
    if(Page_IsValid)
    {
        showButtonBusyLarge(btnE);
        retVal=true;
    }
    return retVal;
}

function attachCalendars() {
  if (document.getElementById('sidesearchdate')) {
    var now = new Date();
    var dd = (now.getDate()<10) ? ('0'+now.getDate()) : (now.getDate());
    var mm = ((now.getMonth()+1)<10) ? ('0'+(now.getMonth()+1)) : (now.getMonth()+1);
    var yyyy = (now.getFullYear());
    document.getElementById('sidesearchdate').value = dd+'/'+mm+'/'+yyyy;
  }
  alldivs = document.getElementsByTagName('div');
  for (var i=0; i<alldivs.length; i++) {
    if (alldivs[i].className.indexOf('calendar')>=0) {
      alldivs[i].style.display = 'block';
    }
  }
}

function attachClickPopups() {
  var alldivs = document.getElementsByTagName('div');
  for (var i=0; i<alldivs.length; i++) {
    if (alldivs[i].className.indexOf('clickpopup')>=0) {
      alldivs[i].style.display = 'block';
      
      alldivs[i].getElementsByTagName('div')[0].onclick = function() {
		if(this.parentNode.getElementsByTagName('div') && this.parentNode.getElementsByTagName('div')[1]){
        	this.parentNode.getElementsByTagName('div')[1].style.display = 'block';
        	if (document.getElementById('homemouse'))
        	{        	
        	  document.getElementById('homemouse').style.display = 'none';
      	  }
      	  if(this.associateIF)
      	  {
      	    document.getElementById(this.associateIF).style.display="block";
      	  }
		}
        return false;
      };
      alldivs[i].getElementsByTagName('a')[0].onclick = function() {
        this.parentNode.style.display = 'none';
        if (document.getElementById('homemouse'))
      	{        	
      	  document.getElementById('homemouse').style.display = 'block';
    	}
    	
	    if(this.associateIF)
  	    {
  	      document.getElementById(this.associateIF).style.display="none";
  	    }

        return false;
      };
    }
  }
}

function attachPopup(el) {
  el.onclick = function() {
    if (el.className.indexOf('size') != -1) {
      dimensions = (((el.className.replace('popup','')).replace('size','')).replace(' ','')).split('x');
      elwidth = dimensions[0];
      elheight = dimensions[1];
	} else {
      elwidth = '640';
      elheight = '480';
	}
    popup = window.open(el.href,'popup','width='+elwidth+',height='+elheight+',resizable=yes,scrollbars=yes,toolbar=no,status=no,directories=no');
	if (window.focus) popup.focus();
	return false;
  }
}
function attachPopups() {
  if (document.getElementsByTagName) {
    var links = document.getElementsByTagName('a');
    for (var i=0; i<links.length; i++) {
      if (links[i].className.indexOf('popup') != -1) {
        attachPopup(links[i]);
      }
    }
  }
}

onload = function() {
  //attachCalendars();
  attachClickPopups();
  attachPopups();
};


