  var myWidth = 0, myHeight = 0;


//set this variable to 1 if you wish the URLs of the highlighted menu to be displayed in the status bar
var display_url=1

var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all
if (ie5||ns6)
var menuobj=document.getElementById("ie5menu")


function showmenuie5(e){
//Find out how close the mouse is to the corner of the window
var rightedge=ie5? document.body.clientWidth-event.clientX : window.innerWidth-e.clientX
var bottomedge=ie5? document.body.clientHeight-event.clientY : window.innerHeight-e.clientY


//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<menuobj.offsetWidth)
{
//move the horizontal position of the menu to the left by it's width
menuobj.style.left=ie5? document.body.scrollLeft+event.clientX-(menuobj.offsetWidth-'40') : window.pageXOffset+e.clientX-(menuobj.offsetWidth-'40')
}
else
{
//position the horizontal position of the menu where the mouse was clicked
menuobj.style.left=ie5? document.body.scrollLeft+event.clientX-'40' : window.pageXOffset+e.clientX-'40'
}

//same concept with the vertical position
if (bottomedge<menuobj.offsetHeight)
{
menuobj.style.top=ie5? document.body.scrollTop+event.clientY-(menuobj.offsetHeight-'40') : window.pageYOffset+e.clientY-(menuobj.offsetHeight-'40')
}
else
{
menuobj.style.top=ie5? document.body.scrollTop+event.clientY-'40' : window.pageYOffset+e.clientY-'40'
}
menuobj.style.visibility="visible"
return false
}

function hidemenuie5(e){
menuobj.style.visibility="hidden"
menuobj.style.top='0';
menuobj.style.left='0';
}



if (ie5||ns6){
menuobj.style.display=''
document.oncontextmenu=showmenuie5
document.onclick=hidemenuie5
}


function docSize() 
{

  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
	return myHeight;

}

function sizemain() {

docloaded = true;
var winhei= docSize();
winhei = myHeight;
//Have height of window. From this can calculate the scale of the background
//based on it being 768 high natively. The scale can be applied to the native
//height of the document area (500 pixels) to find the allowed height for the
//content area.
var szratio = (winhei/768) // Picture is natively 768, so ratio works out height from visible screen height
var mainheight = parseInt(szratio*500); // main body area is 500 high if background is full size
mainheight = mainheight - 20; // reduce by top margin
var mainwidth = parseInt(szratio*610); // main body width is 610 wide if background is full size
var backwidth = parseInt(szratio*1024); // calculate background image width
//alert (winhei + " "+  szratio + " " + mainheight);
var margoffs = 0;
//var margleft = parseInt((myWidth - mainwidth)/2)
margleft = parseInt(szratio*200); 
if ( backwidth < myWidth ) {
  margoffs = parseInt(( myWidth - backwidth ) /2 );
//  alert(margoffs) 
  }

// 200 is start of box at optimum resolution - add borders if back < width
margleft = margleft + margoffs;

mainheight=mainheight+'px';
mainwidth=mainwidth+'px';
margleft=margleft+'px';
var dyniframe = ""
dyniframe  = document.getElementById("content");
dyniframe.style.visibility = "hidden";
dyniframe.height=mainheight;
dyniframe.style.height=mainheight;
dyniframe.width=mainwidth;
dyniframe.style.width=mainwidth;
dyniframe.left=margleft;
dyniframe.style.left=margleft;

dyniframe.style.visibility = "visible";

var menuframe = ""
menuframe = document.getElementById("topmenu");
//menuframe.style.visibility = "hidden";

//var margleft = parseInt((szratio*(1024/2)))-100;
margleft = parseInt(szratio*512)-100;
//alert(myWidth + ' : ' + szratio + ' : ' + margoffs);
//var margleft = parseInt(myWidth / 2) - 130;
//if ( typeof ie6_or_less == "undefined") 
margleft = margleft + margoffs;
//else
margleft = margleft + 90
//if ( typeof ie6_or_less == "number" ) {
if ( typeof ieversion != "undefined" ) {
margleft = margleft - 180;
//if ( typeof ie6_or_less == "undefined" ) {
//margleft = margleft + 90 
//}
}
//margleft = 0;

menuframe.left=margleft;
menuframe.style.left=margleft;

menuframe.style.visibility = "visible";


if( navigator.platform == 'Mac' )
{
// Set the background image width dimension manually
// as for some reason when the height is set to 100% the width doesn't set automatically. Apparently.
  var bgimg = "";
  var bgheight = 0;
  var bgwidth = 0;
  bgimg = document.getElementById("backimg");
  bgwidth = parseInt(szratio*980);
  bgwidth = bgwidth + 'px';
  bgimg.width = bgwidth;
  bgimg.style.width = bgwidth;
}

}

