/********************************************************************************
Here's the lib_doc_size object, see www.bratta.com/dhtml for tutorial on how it works.
********************************************************************************/
//Document size object ********
function lib_doc_size(){ 
	this.x=0;this.x2=bw.ie && document.body.offsetWidth-20||innerWidth||0;
	this.y=0;this.y2=bw.ie && document.body.offsetHeight-5||innerHeight||0;
	this.y2=(bw.ie)?this.y2+1:this.y2
	if (this.y2<540) {this.y2=540}
	if (this.x2<770) {this.x2=770}
	if(!this.x2||!this.y2) return message('Document has no width or height') 
	this.x2=this.x2-16;
	this.x50=this.x2/2;this.y50=this.y2/2;
	return this;
}
/********************************************************************************
Div object functions
********************************************************************************/
bw=new lib_bwcheck() //Browsercheck object

sPrevDelta=0;

function ScrollContent(e) {
   var skeyCode = 0;
        
   skeyCode = bw.ie?event.keyCode:e.keyCode;
          
   try {
        switch (skeyCode){
		 case 38 : //Up Arrow
			//Scroll Up
			scroll(0, 3);
			if (!bw.ie) {return false;}
			break;
		 case 40 : //Down Arrow
			//Scroll Down
			scroll(0, -3);
			if (!bw.ie) {return false;}
			break;
		 case 33 : //Page Up
			//Jump Up
			scroll(0, 100);
			noScroll();
			if (!bw.ie) {return false;}
			break;
		case 34 : //Page Down
			//Jump Down
			scroll(0, -100);
			noScroll();
			if (!bw.ie) {return false;}
			break;
		}
   }
   catch (eRR) {
   // Dont display any error
   }
}

function ScrollWithWheel(e) {
   var sDelta = 0;
        
   sDelta = event.wheelDelta;
   try {
     if (sDelta>=120){ //Scroll Down
	  scroll(0, 10);
	  noScroll();
     }
     if (sDelta<=-120){ //Scroll Down
	  scroll(0, -10);
	  noScroll();
     }
   }
   catch (eRR) {
   // Dont display any error
   }
   sPrevDelta = sDelta;
}

function StopScroll(e) {
   var skeyCode = 0;
        
   skeyCode = bw.ie?event.keyCode:e.keyCode;
          
   try {
        switch (skeyCode){
		 case 38 : //Up Arrow
			//Scroll Up
			noScroll();
			if (!bw.ie) {return false;}
			break;
		 case 40 : //Down Arrow
			//Scroll Down
			noScroll();
			if (!bw.ie) {return false;}
			break;
		}
   }
   catch (eRR) {
   // Dont display any error
   }
}

//Debug function ******************
function lib_message(txt){alert(txt); return false} 

//Lib objects  ********************
function lib_obj(obj,nest,o){ 
	if(!bw.bw) return lib_message('Old browser')
	nest=(!nest) ? '':'document.'+nest+'.'										
   	if(o&&bw.ns4) this.evnt=o; 
	else this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+"document.layers." +obj):0;	
	if(!this.evnt) return lib_message('The layer does not exist ('+obj+') - \nIf your using Netscape please check the nesting of your tags!')
	this.css=bw.dom||bw.ie4?this.evnt.style:this.evnt; this.ref=bw.dom||bw.ie4?document:this.css.document;
	this.x=this.css.left||this.css.pixelLeft||this.evnt.offsetLeft||0; this.y=this.css.top||this.css.pixelTop||this.evnt.offsetTop||0
	this.w=this.evnt.offsetWidth||this.css.clip.width||this.ref.width||this.css.pixelWidth||0; this.h=this.evnt.offsetHeight||this.css.clip.height||this.ref.height||this.css.pixelHeight||0
	this.c=0 //Clip values
	if((bw.dom || bw.ie4) && this.css.clip) {
		this.c=this.css.clip; this.c=this.c.slice(5,this.c.length-1); 
		this.c=this.c.split(' '); for(var i=0;i<4;i++){this.c[i]=parseInt(this.c[i])}
	}
	this.ct=this.css.clip.top||this.c[0]||0; this.cr=this.css.clip.right||this.c[1]||this.w||0
	this.cb=this.css.clip.bottom||this.c[2]||this.h||0; this.cl=this.css.clip.left||this.c[3]||0
	this.obj = obj + "Object"; 	eval(this.obj + "=this")
	return this
}
//Moving object to **************
lib_obj.prototype.moveIt = function(x,y){this.x=x;this.y=y; this.css.left=x;this.css.top=y} 

//Sizing object to **************
lib_obj.prototype.sizeIt = function(w,h){this.css.width=w;this.css.height=h} 

//Setting width to **************
lib_obj.prototype.setWidth = function(w){this.css.width=w} 

function DivExists(divName, nest) {
	nest=(!nest) ? '':'document.'+nest+'.'
	bExists = bw.dom? document.getElementById(divName):bw.ie4?document.all[divName]:bw.ns4?eval(nest+"document.layers." +divName):0
	return bExists;
}

/********************************************************************************
Here we call the object constructor to make objects, then we move
them to a choosen place on the page.
********************************************************************************/
function pageInit(){
	page=new lib_doc_size()
	
	LGWidth=199+30
	RGWidth=199
	
	if (DivExists('divLeft')) {
	oLeft=new lib_obj('divLeft')
	oLeft.moveIt(page.x,page.y)
	oLeft.sizeIt(145, page.y2)
	oLeft.css.visibility="visible"}

	if (DivExists('divCenter')) {
	oCenter=new lib_obj('divCenter')
	oCenter.moveIt(145,page.y)
	oCenter.sizeIt(page.x2-319,page.y2)
	oCenter.css.visibility="visible"}
	
	if (DivExists('divLeftShade')) {
	oLeftShade=new lib_obj('divLeftShade')
	oLeftShade.moveIt(146,page.y+1)
	if (bw.ie5||bw.ie6|bw.ns6){
	//Resize images
	document.iLSTop1.width=page.x50-58-145
	document.iLSTop1.height=57
	document.iLSTop2.width=page.x50-58-145
	document.iLSTop2.height=57
	for (var iDInit = 0; iDInit < 24; iDInit++) {
		document.iLSBottom[iDInit].width=page.x50-58-145
		document.iLSBottom[iDInit].height=57
	}
	LGWidth=page.x50-58-145
	}
	oLeftShade.sizeIt(LGWidth, page.y2-3)
	oLeftShade.css.visibility="visible"
	}
	
	if (DivExists('divRightShade')) {
	oRightShade=new lib_obj('divRightShade')
	if (bw.ie5||bw.ie6||bw.ns6){
	//Resize images
	document.iRSTop1.width=page.x50-28-175
	document.iRSTop1.height=57
	document.iRSTop2.width=page.x50-28-175
	document.iRSTop2.height=57
	for (var iDInit = 0; iDInit < 24; iDInit++) {
		document.iRSBottom[iDInit].width=page.x50-28-175
		document.iRSBottom[iDInit].height=57
	}
	RGWidth=page.x50-28-175
	}
	oRightShade.moveIt(page.x2-RGWidth-175,page.y+1)
	oRightShade.sizeIt(RGWidth, page.y2-3)
	oRightShade.css.visibility="visible"
	}
	
	if (DivExists('divLeftGate')) {
	oLeftGate=new lib_obj('divLeftGate')
	oLeftGate.moveIt(146,page.y+60)
	if (bw.ie5||bw.ie6|bw.ns6){
	//Resize images
	document.iLGTop.width=page.x50-58-145
	document.iLGTop.height=44
	for (var iDInit = 0; iDInit < 18; iDInit++) {
		document.iLGBox[iDInit].width=page.x50-58-145
		document.iLGBox[iDInit].height=21
	}
	document.iLGBottom.width=page.x50-58-145
	document.iLGBottom.height=43
	LGWidth=page.x50-58-145
	}
	oLeftGate.sizeIt(LGWidth, page.y2-3)
	oLeftGate.css.visibility="visible"
	}
	
	if (DivExists('divRightGate')) {
	oRightGate=new lib_obj('divRightGate')
	if (bw.ie5||bw.ie6||bw.ns6){
	//Resize images
	document.iRGTop.width=page.x50-28-175
	document.iRGTop.height=44
	for (var iDInit = 0; iDInit < 18; iDInit++) {
		document.iRGBox[iDInit].width=page.x50-28-175
		document.iRGBox[iDInit].height=21
	}
	document.iRGBottom.width=page.x50-28-175
	document.iRGBottom.height=43
	RGWidth=page.x50-28-175
	}
	oRightGate.moveIt(page.x2-RGWidth-175,page.y+60)
	oRightGate.sizeIt(RGWidth, page.y2-3)
	oRightGate.css.visibility="visible"
	}
	
	if (DivExists('divExecSummaryTitle')) {
	oExecSummaryTitle=new lib_obj('divExecSummaryTitle')
	oExecSummaryTitle.moveIt(156,page.y+128)
	oExecSummaryTitle.sizeIt(LGWidth-40, 18)
	oExecSummaryTitle.css.visibility="visible"}
	
	if (DivExists('divExecSummary')) {
	oExecSummary=new lib_obj('divExecSummary')
	oExecSummary.moveIt(156,page.y+146)
	oExecSummary.sizeIt(LGWidth-30,338)
	oExecSummary.css.visibility="visible"
	
	if (DivExists('divExecSummaryText', 'divExecSummary')) {
	oExecSummaryText=new lib_obj('divExecSummaryText', 'divExecSummary')
	if (LGWidth!=199){
	oExecSummaryText.setWidth(LGWidth-50)}
	oExecSummaryText.css.visibility="visible"}}
	
	if (DivExists('divNewsTitle')) {
	oNewsTitle=new lib_obj('divNewsTitle')
	oNewsTitle.moveIt(page.x2-RGWidth-175+10,page.y+124)
	oNewsTitle.sizeIt(RGWidth-20,20)
	oNewsTitle.css.visibility="visible"}
	
	if (DivExists('divNews')) {
	oNews=new lib_obj('divNews')
	oNews.moveIt(page.x2-RGWidth-175+10,page.y+140)
	oNews.sizeIt(RGWidth-20,338)
	oNews.css.visibility="visible"
	
	if (DivExists('divNewsText', 'divNews')) {
	oNewsText=new lib_obj('divNewsText', 'divNews')
	if (RGWidth!=199){
	oNewsText.setWidth(RGWidth-35)}
	oNewsText.css.visibility="visible"}}

	if (DivExists('divRight')) {
	oRight=new lib_obj('divRight')
	oRight.moveIt(page.x2-175,page.y)
	oRight.sizeIt(174, page.y2)
	oRight.css.visibility="visible"}

	if (DivExists('divContentHeader')) {
	oContentHeader=new lib_obj('divContentHeader')
	oContentHeader.moveIt(60+145,page.y+1)
	oContentHeader.sizeIt(250,112)
	oContentHeader.css.visibility="visible"}

	if (DivExists('divContentMenu')) {
	oContentMenu=new lib_obj('divContentMenu')
	oContentMenu.moveIt(60+145,page.y+5)
	oContentMenu.sizeIt(page.x2-464-150,30)
	oContentMenu.css.visibility="visible"}

	if (DivExists('divFlipImages')) {
	oFlipImages=new lib_obj('divFlipImages')
	oFlipImages.moveIt(page.x2-542+142,page.y+1)
	oFlipImages.sizeIt(225,168)
	oFlipImages.css.visibility="visible"}

	if (DivExists('divContent')) {
	oContent=new lib_obj('divContent')
	oContent.moveIt(207,page.y+124)
	oContent.sizeIt(page.x2-462,page.y2-126)
	oContent.css.visibility="visible"

	if (DivExists('divContentText', 'divContent')) {
	oContentText=new lib_obj('divContentText', 'divContent')
	oContentText.css.visibility="visible"}
	
	document.onkeydown = ScrollContent;
	document.onkeyup = StopScroll;
	try{
	document.onmousewheel = ScrollWithWheel}
	catch(eRR123){}}

	if (DivExists('divScrCRight')) {
	oScrCright=new lib_obj('divScrCRight')
	oScrCright.moveIt(page.x2-394+145,page.y+174)
	oScrCright.sizeIt(75,page.y2-175)
	oScrCright.css.visibility="visible"}

	if (DivExists('divRandom')) {
	oRandom=new lib_obj('divRandom')
	oRandom.moveIt(page.x2-173,page.y+188)
	oRandom.sizeIt(160,167)}
}

function divs_resized(){
	page2=new lib_doc_size()
	if(page2.x2!=page.x2 || page2.y2!=page.y2){
		if(bw.ns4) location.reload()
		else pageInit()
	}
}

onload=pageInit;