// Code and all web content for coastmountainspas.com is copyright G.Bartram (c) 2006

onload=initialize   // call initialize() when page loads
onresize=rePos      // call rePos() whenever page is resized

// Opera doesn't have an onresize event so you have to call rePos all the time.
if (OPA)
{
	setInterval("rePos()",500);
}

// Detect browser type and call reposition 
// Params:  none
// Returns: none
function initialize() 
{
	if (NN4) 
	{
		myObj=document.totalcontainer;
	}
	else 
	{
		myObj=document.getElementById("totalcontainer").style;
	}
	rePos()
}

w=900   // width of the div

// Reposition the page so its central
// Params:  none
// Returns: none
function rePos() 
{
	// compute center coordinate
	if (NN4 || NN6) 
	{
		xc=Math.round((window.innerWidth/2)-(w/2));
	} 
	else 
	{
		xc=Math.round((document.body.clientWidth/2)-(w/2));
	}
	// reposition div
	if (this.NN4) 
	{
		myObj.moveTo(xc,0);
	} 
	else 
	{
		myObj.left = xc + "px";
	}
	document.getElementById('totalcontainer').style.visibility = 'visible';
	//document.body.style.visibility = 'visible';
}

// Calculate the required height of the iFrame
// Params:  none
// Returns: none
function calcHeight()
{
  //find the height of the internal page
  var the_height=document.getElementById('mainsection').contentWindow.document.body.scrollHeight;

  //change the height of the iframe
  document.getElementById('mainsection').height=the_height;
}
