//browser detection
var ns = (navigator.appName == "Netscape");//Netscape browser
var ns6 = false;
var ua = navigator.userAgent;
if (document.getElementById) ns6 = true; //Netscape 6 or above

if (!ns || ns6) document.write('<LINK rel="stylesheet" href="a1_ie.css">');
else document.write('<LINK rel="stylesheet" href="a1_ns.css">');

//images arrays
var imgNamesOff = new Array("images/mnu_0_off.gif", "images/mnu_1_off.gif", "images/mnu_2_off.gif", "images/mnu_3_off.gif", "images/mnu_4_off.gif", "images/mnu_5_off.gif", "images/smnu_0_off.gif", "images/smnu_1_off.gif", "images/smnu_2_off.gif", "images/scr_up_off.gif", "images/scr_down_off.gif", "images/btn_left_off.gif", "images/btn_right_off.gif");
var imgNamesOn = new Array("images/mnu_0_on.gif", "images/mnu_1_on.gif", "images/mnu_2_on.gif", "images/mnu_3_on.gif", "images/mnu_4_on.gif", "images/mnu_5_on.gif", "images/smnu_0_on.gif", "images/smnu_1_on.gif", "images/smnu_2_on.gif", "images/scr_up_on.gif", "images/scr_down_on.gif", "images/btn_left_on.gif", "images/btn_right_on.gif");
var imgOff = new Array(imgNamesOff.length);
var imgOn = new Array(imgNamesOn.length);

//preload images
for (i=0; i<imgNamesOff.length; i++){
	imgOff[i] = new Image();
	imgOff[i].src = imgNamesOff[i];
	imgOn[i] = new Image();
	imgOn[i].src = imgNamesOn[i];
}

//mouseover
function swapIn(objName){
	var obj = eval("document." + objName);
	for(i=0; i<imgNamesOff.length; i++)
		if (obj.src == imgOff[i].src){
			obj.src = imgOn[i].src;
			break;
		}
}

//mouseout
function swapOut(objName){
	var obj = eval("document." + objName);
	for(i=0; i<imgNamesOn.length; i++)
		if (obj.src == imgOn[i].src){
			obj.src = imgOff[i].src;
			break;
		}
}

// START: fixing the page content on resize >>>
FixNSWindow();
function FixNSWindow() {
	if (ns6 || ns && (parseInt(navigator.appVersion) == 4)) {
		if (typeof document.NS == 'undefined') document.NS = new Object;
		if (typeof document.NS.NS_scaleFont == 'undefined') {
			document.NS.FixCssInNS = new Object;
			document.NS.FixCssInNS.initWindowWidth = window.innerWidth;
			document.NS.FixCssInNS.initWindowHeight = window.innerHeight;
		}
		window.onresize = FixCssInNS;
	}
}
function FixCssInNS() {
	if (document.NS.FixCssInNS.initWindowWidth != window.innerWidth || document.NS.FixCssInNS.initWindowHeight != window.innerHeight) document.location = document.location;
}
// <<< END: fixing the page content on resize


//Functions for scrolling Terms content
var timer;

function scrollDown(){
	if (!ns) { //Explorer
		if(document.all.scroller.style.pixelTop<0){
		   document.all.scroller.style.pixelTop+=5;
		   //position scroll bar
		   if (Math.round( (340/(document.all.scroller.offsetHeight-406))*Math.abs(document.all.scroller.style.pixelTop) ) > 340)
		   		document.all.scrLine.style.pixelTop = 341;
		   else 
		   		document.all.scrLine.style.pixelTop = Math.round( (340/(document.all.scroller.offsetHeight-406))*Math.abs(document.all.scroller.style.pixelTop) ); 
		}	
	   }
	   else { //Netscape
	    if (!ns6) {
			if(document.tata.document.scroller.top<0){
		   	   document.tata.document.scroller.top+=5;
			   //position scroll bar
			   if (Math.round( (340/(document.tata.document.scroller.clip.height-406))*Math.abs(document.tata.document.scroller.top) ) > 340)
			   		document.scrollBar.document.scrLine.top = 341;
			   else 
			   		document.scrollBar.document.scrLine.top = Math.round( (340/(document.tata.document.scroller.clip.height-406))*Math.abs(document.tata.document.scroller.top) );
			  }
		   }
		   else { //Netscape 6
		    obj = document.getElementById("scroller");
			if(parseInt(obj.style.top)<0){
			   obj.style.top = parseInt(obj.style.top)+10;
			   //position scroll bar
			   if (Math.round((340/(document.getElementById("scroller").offsetHeight-406)*Math.abs(parseInt(document.getElementById("scroller").style.top)))) > 340)
			   		document.getElementById("scrLine").style.top = "0px;"
				else
					document.getElementById("scrLine").style.top=Math.round((340/(document.getElementById("scroller").offsetHeight-406)*Math.abs(parseInt(document.getElementById("scroller").style.top)))) + "px";
			  }	  
		   }
	   }
	timer = setTimeout("scrollDown()", 20);
  }
  
  function scrollUp(){
  	if (!ns) { //Explorer
		if(document.all.scroller.style.pixelTop>-(document.all.scroller.offsetHeight-398))
		   document.all.scroller.style.pixelTop-=5;
		   //position scroll bar
		   if (Math.round( (340/(document.all.scroller.offsetHeight-406))*Math.abs(document.all.scroller.style.pixelTop) ) > 340)
		   		document.all.scrLine.style.pixelTop = 341;
		   else 
		   		document.all.scrLine.style.pixelTop = Math.round( (340/(document.all.scroller.offsetHeight-406))*Math.abs(document.all.scroller.style.pixelTop) ); 
	   }
	   else { //Netscape
	   	if (!ns6) {
			if(document.tata.document.scroller.top>-(document.tata.document.scroller.clip.height-398)){
			   document.tata.document.scroller.top-=5;
			   //position scroll bar
			   if (Math.round( (340/(document.tata.document.scroller.clip.height-406))*Math.abs(document.tata.document.scroller.top) ) > 340)
			   		document.scrollBar.document.scrLine.top = 341;
			   else 
			   		document.scrollBar.document.scrLine.top = Math.round( (340/(document.tata.document.scroller.clip.height-406))*Math.abs(document.tata.document.scroller.top) );
			  } 
		   }
		   else { //Netscape 6
		    obj = document.getElementById("scroller");
			if(parseInt(obj.style.top)>-(obj.offsetHeight-398)){
			   obj.style.top = parseInt(obj.style.top)-10;
			   //position scroll bar
			   if (Math.round((340/(document.getElementById("scroller").offsetHeight-406)*Math.abs(parseInt(document.getElementById("scroller").style.top)))) > 340)
			   		document.getElementById("scrLine").style.top = "341px;"
				else
					document.getElementById("scrLine").style.top=Math.round((340/(document.getElementById("scroller").offsetHeight-406)*Math.abs(parseInt(document.getElementById("scroller").style.top)))) + "px";
			  }
		   }
	   }
	timer = setTimeout("scrollUp()", 20);
  }
  
  function doneScrolling(){
  	clearTimeout(timer);
  }
