// JavaScript Document

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

///////////////////////////////////////////////////////////////////////////////////////////////////

function SD_AutoOffSetFirstLayer( axis, left, top ) // Parameter for var axis: 1 == only Width, 2 == only Height, 3 == both
{
            //var firstLayer = document.getElementsByTagName("div")[0].firstChild;
            var firstLayer = document.getElementsByTagName("div")[0];
            //alert( firstLayer.data);
           
            //var mainDivWidth = document.getElementById('mainLayer').offsetWidth;
            var mainDivWidth = firstLayer.offsetWidth;
            var mainDivHeight = firstLayer.offsetHeight;
 
            var bodyWidth, bodyHeight;
            if ( self.innerHeight ) // all except Explorer
            {
                        bodyWidth = self.innerWidth;
                        bodyHeight = self.innerHeight;
            }
            else if ( document.documentElement && document.documentElement.clientHeight )
                        // Explorer 6 Strict Mode
            {
                        bodyWidth = document.documentElement.clientWidth;
                        bodyHeight = document.documentElement.clientHeight;
            }
            else if ( document.body ) // other Explorers
            {
                        bodyWidth = document.body.clientWidth;
                        bodyHeight = document.body.clientHeight;
            }
            //alert( 'bodyWidth: ' +  bodyWidth + ', bodyHeight: ' + bodyHeight + ' // mainDivWidth: ' + mainDivWidth + ', mainDivHeight: ' + mainDivHeight );


            //if( document.body.offsetWidth < mainDivWidth  )
            if( ( axis == 1 ) || ( axis == 3 ) ) {
				if( bodyWidth < mainDivWidth  )
				{
							//alert('bodyWidth: ' +  bodyWidth);
							firstLayer.style.left = left + 'px';
							firstLayer.style.marginLeft = 0 + 'px';
				} 
				else
				{
							//alert(document.body.offsetWidth);
							firstLayer.style.left = '50%';
							firstLayer.style.marginLeft = - ( mainDivWidth / 2 ) + 'px';
				}
			}
			
			if( ( axis == 2 ) || ( axis == 3 ) ) {
				if( bodyHeight < mainDivHeight  )
				{
							//alert('bodyHeight: ' + bodyHeight);
							firstLayer.style.top = top + 'px';
							firstLayer.style.marginTop = 0 +'px';
				} 
				else
				{
							firstLayer.style.top = '50%';
							firstLayer.style.marginTop = - ( mainDivHeight / 2 ) + 'px';
				}
			}
}

function SD_TheOnLoad() {
	//SD_SetFooter( 'contentDiv', 'footerDiv', 20, 20 ); 
	SD_AutoOffSetFirstLayer( 1, 0, 0 ); 
}

function SD_TheOnResize() {
	SD_AutoOffSetFirstLayer( 1, 0, 0 ); 
}
