<!--
// Common functions for third place pages
// Includes element positioning
// Jonny Garrett 17/12/2000
var isReception = false;
var loaded=false;
var ns = (document.layers);
var ns6=((navigator.appName == "Netscape") && (navigator.appVersion.substring(0,1)>=5));
var ie = (document.all) || ns6;
var ie3=(ie ? 0:((navigator.userAgent.indexOf("MSIE")>=0) ? 1:0));
var ie4= (navigator.appVersion.indexOf("IE 4")  > -1);
var mac= (navigator.appVersion.indexOf("Mac") != -1);

if (ns6) {
  if (document.getElementsByTagName("*")) { 
	document.all = document.getElementsByTagName("*"); }
}



// Standard functions for image rollovers
function swapImgRestore() { //v3.0
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function OLD_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document); return x;
}

function findObj(n, d) { //v3 Modified to work with Netscape 6
   var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length)
   {d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
   if(!(x=d[n])&&d.all) x=d.all[n]; if(!(x=d[n])&&d.getElementById) x=d.getElementById(n);
   for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
   for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
   return x;
}

function swapImage() { //v3.0
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function swapImage2() { //v3.0
  var i,j=0,x,a=swapImage2.arguments; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function deactivate(id)
{
	if (ie){if (!ns6){var temp = findObj(id); temp.blur();}}
}

function openPop(strFile,nWidth,nHeight,bStatus,bscroll,btoolbar,blocation,bresize,bdirectories,bmenubar,leftpos,toppos){
	window.open(strFile, 
				"_blank",
				"toolbar=" + btoolbar + 
				",location=" + blocation + 
				",directories=" + bdirectories + 
				",menubar=" + bmenubar + 
				",status=" + bStatus + 
				",scrollbars=" + bscroll + 
				",resizable=" + bresize + 
				",width=" + nWidth + 
				",height=" + nHeight + 
				",left=" + leftpos + 
				",top=" + toppos);
}

function start()
{	// function is run on page load
	resizeEvent();
	setupClock();
	loaded=true;
}

function putElements()
{	// function that is run when the browser is resized 	

	var newLayerMidTop;
	var newLayerMidHeight;
	var newLayerMidWidth;
	var newLayerPageInfoTop;
	var newLayerBtnSearchLeft;
	var newLayerDropTop;
	
	if (ie)
	{
		if (!ns6)
		{
			innerWidth = document.body.clientWidth;
			innerHeight = document.body.clientHeight;
		}

		newLayerMidTop = parseInt(innerHeight * 0.46);
		if (newLayerMidTop < 188) newLayerMidTop = 188;
		document.all['LayerMid'].style.top = newLayerMidTop;

		newLayerMidWidth  = parseInt(innerWidth);
		if (newLayerMidWidth < 720) newLayerMidWidth = 720;
		document.all['LayerMid'].style.width = newLayerMidWidth;

		newLayerMidHeight  = parseInt(innerHeight - (innerHeight * 0.46) - 20);
		if (newLayerMidHeight < 199) newLayerMidHeight = 199;
		document.all['LayerMid'].style.height = newLayerMidHeight;

		newLayerPageInfoTop = (innerHeight * 0.46) - 60;
		if (newLayerPageInfoTop < 128) newLayerPageInfoTop = 128;
		document.all['LayerPageInfo'].style.top = newLayerPageInfoTop;

		if (mac && ie4)
		{
		  document.all['form1'].style.top = newLayerPageInfoTop + 23;
		  document.all['LayerNavInput'].style.top = newLayerPageInfoTop + 23;
		  document.all['LayerDrop'].style.top = newLayerMidTop - 10;
		}else
		{
		  document.all['LayerNavInput'].style.top = newLayerPageInfoTop + 35;
		  document.all['LayerDrop'].style.top = newLayerMidTop + 2;
		}
		
		newLayerBtnSearchLeft = (innerWidth /2) - 19;
		if (newLayerBtnSearchLeft < 341) newLayerBtnSearchLeft = 341;
		document.all['LayerBtnSearch'].style.left = newLayerBtnSearchLeft;
		
		document.all['imgMidBackgnd'].style.width = newLayerMidWidth;
		document.all['imgMidBackgnd'].style.height = newLayerMidHeight;
		
		document.all['LayerCurrTime'].style.left = newLayerMidWidth - 50;
		document.all['LayerLogTime'].style.left = newLayerMidWidth - 50;
		document.all['LayerSpentTime'].style.left = newLayerMidWidth - 50;
		document.all['LayerTimeInfo'].style.left = newLayerMidWidth - 120;

		document.all['LayerContent'].style.top = parseInt((newLayerMidHeight/2) - 80);
		document.all['LayerContent'].style.left = parseInt((newLayerMidWidth/2) - 360);
		
		document.all['LayerTimeInfo'].style.visibility = 'visible';
		document.all['LayerPageInfo'].style.visibility = 'visible';
		document.all['LayerNavInput'].style.visibility = 'visible';
		document.all['LayerMid'].style.visibility = 'visible';
		document.all['LayerDrop'].style.visibility = 'visible';
	}
	
	if (ns)
	{
		newLayerMidTop = parseInt(innerHeight * 0.46);
		if (newLayerMidTop < 188) newLayerMidTop = 188;
		document.layers['LayerMid'].top = newLayerMidTop;

		newLayerMidWidth  = parseInt(innerWidth);
		if (newLayerMidWidth < 720) newLayerMidWidth = 720;
		document.layers['LayerMid'].clip.width = newLayerMidWidth;

		newLayerMidHeight  = parseInt(innerHeight - (innerHeight * 0.46) - 20);
		if (mac) newLayerMidHeight +=2;
		if (newLayerMidHeight < 199) newLayerMidHeight = 199;
		document.layers['LayerMid'].clip.height = newLayerMidHeight;

		newLayerPageInfoTop = (innerHeight * 0.46) - 60;
		if (newLayerPageInfoTop < 128) newLayerPageInfoTop = 128;
		document.layers['LayerPageInfo'].top = newLayerPageInfoTop;
		document.layers['LayerNavInput'].top = newLayerPageInfoTop + 35;
		document.layers['LayerDrop'].top = newLayerMidTop + 2;
		
		newLayerBtnSearchLeft = (innerWidth /2) - 19;
		if (newLayerBtnSearchLeft < 341) newLayerBtnSearchLeft = 341;
		document.layers['LayerBtnSearch'].left = newLayerBtnSearchLeft;
		
		document.layers['LayerCurrTime'].left = newLayerMidWidth - 50;
		document.layers['LayerLogTime'].left = newLayerMidWidth - 50;
		document.layers['LayerSpentTime'].left = newLayerMidWidth - 50;
		document.layers['LayerTimeInfo'].left = newLayerMidWidth - 120;

		document.layers['LayerMid'].document.layers['LayerContent'].top = parseInt((newLayerMidHeight/2) - 80);
		document.layers['LayerMid'].document.layers['LayerContent'].left = parseInt((newLayerMidWidth/2) - 360);
		
		document.layers['LayerTimeInfo'].visibility = 'visible';
		document.layers['LayerPageInfo'].visibility = 'visible';
		document.layers['LayerNavInput'].visibility = 'visible';
		document.layers['LayerMid'].visibility = 'visible';
		document.layers['LayerDrop'].visibility = 'visible';
	}
	putOtherElements(newLayerMidTop,newLayerMidWidth,newLayerMidHeight);
}

function resizeEvent()
{
	if (ns)
	{
		onresize=function(){location.reload();}
	}
	if (ie)
	{
		onresize=function(){setTimeout('putElements()',100);}
	}
}
