//Smart Folding Menu tree- 

function Browser() {
		var b=navigator.appName;
		if (b=="Netscape") this.b="ns";
		else if ((b=="Opera") || (navigator.userAgent.indexOf("Opera")>0)) this.b = "opera";
		else if (b=="Microsoft Internet Explorer") this.b="ie";
		if (!b) alert('Unidentified browser./nThis browser is not supported,');
		this.version=navigator.appVersion;
		this.v=parseInt(this.version);
		this.ns=(this.b=="ns" && this.v>=4);
		this.ns4=(this.b=="ns" && this.v==4);
		this.ns6=(this.b=="ns" && this.v==5);
		this.ie=(this.b=="ie" && this.v>=4);
		this.ie4=(this.version.indexOf('MSIE 4')>0);
		this.ie5=(this.version.indexOf('MSIE 5')>0);
		this.ie55=(this.version.indexOf('MSIE 5.5')>0);
		this.ie6=(this.version.indexOf('MSIE 6')>0);
		this.opera=(this.b=="opera");
		this.dom=(document.createElement && document.appendChild && document.getElementsByTagName)?true:false;
		this.def=(this.ie||this.dom); // most used browsers, for faster if loops
		var ua=navigator.userAgent.toLowerCase();
		if (ua.indexOf("win")>-1) this.platform="win32";
			else if (ua.indexOf("mac")>-1) this.platform="mac";
		else this.platform="other";
	}
	is = new Browser();

var head="display:''"
img1=new Image()
img1.src="fold.gif"
img2=new Image()
img2.src="open.gif"

var ns6=document.getElementById&&!document.all
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1

function checkcontained(e){
var iscontained=0
cur=ns6? e.target : event.srcElement
i=0
if (cur.id=="foldheader")
iscontained=1
else
while (ns6&&cur.parentNode||(ie4&&cur.parentElement)){
if (cur.id=="foldheader"||cur.id=="foldinglist"){
iscontained=(cur.id=="foldheader")? 1 : 0
break
}
cur=ns6? cur.parentNode : cur.parentElement
}

if (iscontained){
var foldercontent=ns6? cur.nextSibling.nextSibling : cur.all.tags("DIV")[0]
if (foldercontent.style.display=="none"){
foldercontent.style.display=""
cur.style.listStyleImage="url(img/open.gif)"
}
else{
foldercontent.style.display="none"
cur.style.listStyleImage="url(img/fold.gif)"
}
}
}

if (ie4||ns6)
document.onclick=checkcontained

//
function MagiCScroller(nm) {
		this.NewsArray=new Array();
		this.name=nm;
		this.Speed=10;
		this.Pause=3.5;
		this.Width;
		this.Height;
		this.pos='absolute';
		this.l='0px';
		this.t='0px';
		this.Initiated=false;
		this.newsIndex=0;
		this.stX=0;
}
	
	MagiCScroller.prototype.run=function() {
		slideLayer(this.name+'Sub1',this.stX,this.name+'Main');
		slideLayer(this.name+'Sub2',this.stX+this.Height,this.name+'Main');
		
		this.stX+=-this.Speed;
		
		if (this.stX<-this.Height) {
			
			this.stX=0;
			this.fN++;
			if (this.fN>this.nL) {
				this.fN=0;
			}
			
			this.sN=this.fN+1;
		
		
			if (this.sN>this.nL) {
				this.sN=0;
			}
			
			writeLayer(this.name+'Sub1',this.name+'Main',this.NewsArray[this.fN]);
			writeLayer(this.name+'Sub2',this.name+'Main',this.NewsArray[this.sN]);
			
			slideLayer(this.name+'Sub1',this.stX,this.name+'Main');
			slideLayer(this.name+'Sub2',this.stX+this.Height,this.name+'Main');
			setTimeout(this.name+'.run()',this.Pause*1000);
		} else {
			setTimeout(this.name+'.run()',100);
		}
		
		
	}
	
	MagiCScroller.prototype.init=function() {
		//style'ý yaz...
		t='';
		t+='<style>\n'
		
		t+='#'+this.name+'Main { position:'+this.pos+'; left:'+this.l+'; top:'+this.t+'; overflow:hidden; width:'+this.Width+'px; height:'+this.Height+'px;}\n';
		t+='#'+this.name+'Sub1 { position:absolute; left:0px; top:0px; width:'+this.Width+'px; height:'+this.Height+'px;}\n';
		t+='#'+this.name+'Sub2 { position:absolute; left:0px; top:0px; width:'+this.Width+'px; height:'+this.Height+'px;}\n';
		
		t+='</style>\n';
		
		//layer'larý yaz...
		
		
		document.write(t);
		t='';
		
		
		this.nL=(this.NewsArray).length-1;
		this.newsIndex=0;
		this.fN=0;
		this.sN=this.fN+1;
		if (this.sN>this.nL) {
			this.sN=0;
		}
		
		t+='<div id="'+this.name+'Main">';
		t+='<div id="'+this.name+'Sub1">'+this.NewsArray[this.fN]+'</div>';
		t+='<div id="'+this.name+'Sub2">'+this.NewsArray[this.sN]+'</div>';
		t+='</div>';
		
		document.write(t);
		
		slideLayer(this.name+'Sub1',this.stX,this.name+'Main');
		slideLayer(this.name+'Sub2',this.stX+this.Height,this.name+'Main');
		
		
		setTimeout(this.name+'.run()',this.Pause*1000);
		
	}
	
	//dom utilities
	
	function slideLayer(lyr,t,pr) {
		
		if (is.ie) {
			
			document.all[lyr].style.top=t;
		} else if (is.ns6) {
			document.getElementById(lyr).style.top=t+'px';
		} else if (is.ns4) {
			document.layers[pr].document.layers[lyr].top=t;
		}
	}
	
	function writeLayer(lyr,pr,cont) {
		if (is.ie) {
			document.all[lyr].innerHTML=cont;
		} else if (is.ns6) {
			document.getElementById(lyr).innerHTML=cont;
		} else if (is.ns4) {
			
			document.layers[pr].document.layers[lyr].document.open();
			document.layers[pr].document.layers[lyr].document.write(cont);
			document.layers[pr].document.layers[lyr].document.close();
		}
	}
	
	

