var stayFolded=false
/************************************************************************************
Browsercheck
************************************************************************************/
var n = (document.layers) ? 1:0;
var ie = (document.all) ? 1:0;
var ns6 =(document.getElementById && !document.all)?1:0
var browser=((n || ie || ns6) && parseInt(navigator.appVersion)>=4)  
/************************************************************************************
Making cross-browser objects
************************************************************************************/
function makeMenu(obj,nest){
	nest=(!nest) ? '':'document.'+nest+'.'	
	if(ns6)this.evnt=document.getElementById(obj)||ie && document.all[obj]|| (nest?n && document[nest].document[obj]:n && document.layers[obj]);									
	if(n)this.css=eval(nest+'document.'+obj)
	if(ie)this.css=eval('document.all.'+obj+'.style')
	if(ns6)this.css=eval("document.getElementById('"+obj+"').style");
	this.ref=(n) ? eval(nest+'document.'+obj+'.document'):eval('document');
	if(n) this.height=this.ref.height
	if(ie) this.height=eval(obj+'.offsetHeight')
	if(ns6) this.height=this.evnt.offsetHeight||0
	//||this.evnt.offsetHeight||this.css.pixelHeight||0
	if(n) this.width=this.ref.width
	if(ie) this.width=eval(obj+'.offsetWidth')
	if(ns6) this.width=this.ref.width||this.evnt.offsetWidth||this.css.pixelWidth||0
	this.x=(n||ns6)? this.css.left:this.css.pixelLeft;
	this.y=(n||ns6)? this.css.top:this.css.pixelTop;	
	this.hideIt=b_hideIt;	this.showIt=b_showIt; this.vis=b_vis; this.moveIt=b_moveIt;this.moveBy=b_moveBy;this.clipTo=b_clipTo;this.clipBy=b_clipBy
	//Clip values
	this.c=0
	if((ie || ns6) && 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.clipTo=b_clipTo;	this.clipBy=b_clipBy;											
	return this
}
function b_showIt(){this.css.visibility="visible"}
function b_hideIt(){this.css.visibility="hidden"}
function b_vis(){if(this.css.visibility=="hidden" || this.css.visibility=="hide") return true;}
function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x; this.css.top=this.y}
function b_moveBy(x,y){this.moveIt(this.x+x,this.y+y)}
function b_clipTo(t,r,b,l,setwidth){ //Clip to a spesified setting
		this.ct=t; this.cr=r; this.cb=b; this.cl=l
		if(n){
			this.css.clip.top=t;this.css.clip.right=r
			this.css.clip.bottom=b;this.css.clip.left=l
		}else{
			if(t<0)t=0;if(r<0)r=0;if(b<0)b=0;if(b<0)b=0
			this.css.clip="rect("+t+","+r+","+b+","+l+")";
			if(setwidth){this.css.width=r; this.css.height=b}
		}
}
function b_clipBy(t,r,b,l,setwidth){ //Clip by a spesified number of pixels
		this.clipTo(this.ct+t,this.cr+r,this.cb+b,this.cl+l,setwidth)
}
/************************************************************************************
This is the function that changes the sub menus to folded or unfolded state.
************************************************************************************/
function menu(num){
	if(browser){
		if(!stayFolded){
			for(i=0;i<oSub.length;i++){
				if(i!=num){
				   	oSub[i].hideIt()
					oSub[i].clipTo(0,250,0,0);
					if(i<oSub.length-1){
						eval('oTop['+i+'].ref["imgA'+i+'"].src=unImg.src');	
					}	
				}
			}
				
			for(i=1;i<oTop.length;i++){
				oTop[i].moveIt(0,parseInt(oTop[i-1].y+oTop[i-1].height))
			}
		}
		if(oSub[num].vis()){
			oSub[num].showIt()
			oTop[num].ref["imgA"+num].src=exImg.src
		}else{
		    oSub[num].hideIt()
			oTop[num].ref["imgA"+num].src=unImg.src
			
		}
		for(i=1;i<oTop.length;i++){ 
			if(!oSub[i-1].vis()) {oTop[i].moveIt(0,parseInt(parseInt(oTop[i-1].y+oTop[i-1].height)+oSub[i-1].height)); }
			else {oTop[i].moveIt(0,parseInt(oTop[i-1].y+oTop[i-1].height))}
		}
	}
}

function preload(imgObj,imgSrc) {
	if (document.images) {
		eval(imgObj+' = new Image()')
		eval(imgObj+'.src = "'+imgSrc+'"')
	}
}
function changeImage(layer,imgName,imgObj) {
	if (document.images) {
		if (document.layers && layer!=null) eval('document.layers["'+layer+'"].document.images["'+imgName+'"].src = '+imgObj+'.src')
		else document.images[imgName].src = eval(imgObj+".src")
	}
}
function gopressed(imgName,imgObj){
	change(imgObj);
	pressed=imgName;
}	
function LoadImages() { //v3.0
	if (navigator.userAgent.indexOf("Mozilla/2.0") == -1) ver = 1;if (ver == 1)
 	{
	 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   	 var i,j=d.MM_p.length,a=LoadImages.arguments; for(i=0; i<a.length; i++)
   	 if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
}
function doSec(sNum){
  if (document.all){
  	secNum=eval(sNum);
    if (secNum.className=="off"){secNum.className="on"} 
    else{secNum.className="off"}
  }
}

