// 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 ); 
}

function FP_getObjectByID(id,o) {//v1.0
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}

function FP_changeProp() {//v1.0
 var args=arguments,d=document,i,j,id=args[0],o=FP_getObjectByID(id),s,ao,v,x;
 d.$cpe=new Array(); if(o) for(i=2; i<args.length; i+=2) { v=args[i+1]; s="o"; 
 ao=args[i].split("."); for(j=0; j<ao.length; j++) { s+="."+ao[j]; if(null==eval(s)) { 
  s=null; break; } } x=new Object; x.o=o; x.n=new Array(); x.v=new Array();
 x.n[x.n.length]=s; eval("x.v[x.v.length]="+s); d.$cpe[d.$cpe.length]=x;
 if(s) eval(s+"=v"); }
}

function FP_changePropRestore() {//v1.0
 var d=document,x; if(d.$cpe) { for(i=0; i<d.$cpe.length; i++) { x=d.$cpe[i];
 if(x.v=="") x.v=""; eval("x."+x.n+"=x.v"); } d.$cpe=null; }
}

