dText=nel=wel=loading=ael=0;
agent=navigator.userAgent.toLowerCase(); mac=agent.match(/mac/); ie=agent.match(/msie/); ie5=agent.match(/msie\s5/); saf=agent.match(/safari/i); osx=saf||mac&&agent.match(/5\.2[23]+|os\s?x/i); ns=agent.match(/gecko/)&&agent.match(/netscape/); ns6=agent.match(/netscape\D?6/); fox=agent.match(/firefox/i);
function get(el){ return document.getElementById(el); }
function px(nr){ return nr+"px"; }
function make(el){ return document.createElement(el); }
function getWinSize(){
	if(typeof(window.innerWidth)=='number'){ winX=window.innerWidth; winY=window.innerHeight; }else if(dd&&(dd.clientWidth || dd.clientHeight)){ winX=dd.clientWidth; winY=dd.clientHeight; }else if(db&&(db.clientWidth || db.clientHeight)){ winX=db.clientWidth; winY=db.clientHeight; }
}
function center(winx,winy){
	x=((window.screen.width*0.95-winx)/2);  y=((window.screen.height*0.95-winy)/2);
	return 'width='+ winx +',height='+ winy + (ie?',left='+ x +',top='+ y:',screenX='+ x +',screenY='+ y);
}
function showDIV(){ a=arguments; al=a.length-1; tp=a[al]?"visible":"hidden"; for(i=0;i<al;i++)a[i].style.visibility=tp; return tp; };
function popNews(elhref){
	wnews=window.open(elhref,"NEWS",center(320,320)+",scrollbars=yes,resizable");
}
function loaded(img,th,tt){
	if(!iIcon)return false; chIcon(img);
	dcH=th; ntext=tt; chSize(1); loading=0;
}
function chIcon(ihtm){
	if(ihtm!=""){
		h=ihtm.match(/height=\W?(\d+)/i); w=ihtm.match(/width=\W?(\d+)/i);
		iIcon.style.top=px(91+(145-parseInt(h[1]))/2); iIcon.style.width=px(w[1]); iIcon.style.height=px(h[1]);
	}
	if(ie&&!mac&&!ie5)iIcon.filters.blendTrans.Apply(); iIcon.innerHTML=ihtm; if(ie&&!mac&&!ie5)iIcon.filters.blendTrans.Play();
}
function chSize(tp,el){
	if(!tp && loading){ load.location.replace("about:blank"); loading=0; }
	nelh=parseInt(nel.style.height);
	if(!_Vi){
		reltop=nel.pos*30+_VcT;
		if(el)el.onclick=function(){showNews(this); return false};
	}
	if(tp && nelh<dcH+30 || !tp && nelh>30){
		if(!tp && !_Vi){ contH=cheight; getXY(); follow=(reltop<0); }
		_Vi++; step=_Vi*_Vi/(ns6?(tp?1:-1):(tp?20:-(ns?2:20)));
		nh=(mac&&!osx||reltop>dheight||!tp&&reltop<0)?(tp?dcH+30:30):nelh+step; 
		nel.style.height=nh>0?nh:0;
		if(!tp&&follow){ _VcT+=nelh-30; moveTo(); }
		setTimeout("chSize("+tp+")",10);
	}else{
		_Vi=0;
		if(tp){
			nel.style.height=dcH+30;
			dText.innerHTML=ntext; nel.style.fontWeight="bold"; contH+=dcH+30; getXY();
			if(reltop+nelh>dheight)correct(-(nel.pos*30+(nelh>dheight?0:(nelh-dheight))),-1);
			else if(reltop<0)correct(-nel.pos*30,1); else moveTo();
		}else{
			if(!wel && -_VcT>contH-dheight)correct(-contH+dheight,1); if(_VcT>0)correct(0,-1); else if(!wel) moveTo();
			nel.removeChild(dText); nel.style.fontWeight="normal"; nel.style.height=30; ael.className='link'; ael=dText=0; 
			if(!wel)chIcon(""); else setTimeout("wel.onclick(); wel=0;",10);
		}
	}
}
function correct(newpos,tp){
	step=speed*9*tp;
	if(tp>0 && _VcT<newpos || tp<0 && _VcT>newpos && _VcT>-contH){ _VcT+=step; setTimeout("correct("+newpos+","+tp+")",10); }
	else _VcT=newpos; _VbT=-_VcT*_Vrel; moveTo();
}
function chkSel(e){ tel=e?e.target:window.event.srcElement; return tel==dText; }
function lover(el,tp){
	if(!el.onmouseout){
		el.onmouseout=new Function("lover(this,0)");
		el.onfocus=new Function("this.blur()");
		el.onclick=new Function((mac&&ie?"pop":"show")+"News2(this); return false");
	}
	if(tp&&!loading || !tp&&ael!=el)el.className="link"+(tp?" linko":"");
}
function showNews(el){
	if(mac&&ie){ popNews(el.href); return false; }
	if(loading)return false; el.blur();
	if(dText){ wel=el; ael.onclick(); return false; }
	nel=el.parentNode; ael=el; ael.className="linkon"; nel.style.height=px(70);
	dText=make(saf?"SPAN":"DIV"); dText.className="text"; dText.style.height=px(20);
	dText.innerHTML=(ie?"<p>":"")+"...loading..."+(ie?"</p>":""); nel.appendChild(dText);
	el.onclick=function(){ dText.innerHTML=''; chSize(0,this); return false; };
	load.location.replace(el.href); loading=1;
}
function init(){
	if(window.parent.openNews)showDIV(document.images['close'],1); db=document.body; dd=document.documentElement; db.onselectstart=chkSel; getWinSize();
	iIcon=get('DIVicon'); _VDcont=get('content1'); _VDclips=get('contentClip1').style; _VDclips.top=px(0); _VDbar=get('drag1'); newsl=_VDcont.childNodes;
	newsreg=window.parent.loadnews?new RegExp(window.parent.loadnews+".html"):0; openel=0;
	for(i=0;i<newsl.length;i++){
		if(newsl[i].className=="news")newsl[i].pos=i;
		if(i==0 || newsreg && newsl[i].lastChild.href.match(newsreg))openel=newsl[i].lastChild;
	}
	get('down1').style.top=px(winY-19); dheight=winY-254-20; _VDclips.height=get('scroller1').style.height=px(dheight);
	contH=cheight=parseInt(_VDcont.offsetHeight);
	scrollInit(1); if(openel)openel.onclick();
}

//=============================================================================================================
//=======================================================================================================scroller
//================================================================================================================

speed=mac&&!saf?10:(ns?6:4); _V=[];
_s=_Vup=_Vdown=_Vdrag=iIcon=_VstartX=_Vi=0;

function scrollInit(s){
	_s=s; _VDcont.style.top=px(0); _VDbar.style.backgroundPosition="0px 0px";
	if(!_V[_s])_V[_s]=[dheight,45,parseInt(get('up1').width),parseInt(_VDbar.style.width)-47];
	_VoffT=246; _VoffL=100; getXY(); _VbT=_VcT=0;
	_on=isFinite(_Vrel)&&_Vrel>0&&_Vrel<10;
	_VDbar['onmousedown']=_on?down:up;
	showDIV(get('nav1'),get('down1'),1);
}
function scrollUp(tp){
	_VcT+=speed; if(_VcT>0)_VcT=0; if(tp)moveTo();
	if(!_Vup || tp)_Vup=setTimeout('scrollUp(1)',25);
	return false;
}
function scrollDown(tp){
	if(_VcT>_V[_s][0]-contH){ _VcT-=speed; moveTo(); }
	if(!_Vdown || tp)_Vdown=setTimeout('scrollDown(1)',25);
	return false;
}
function moveTo(){ _VDcont.style.top=px(_VcT); _VbT=-_VcT*_Vrel; _VDbar.style.backgroundPosition=px(_VbT)+" 0px";  }
function down(e){
	getMouse(e); _VstartX=(mouseX-_VbT);
	if(mouseY>=-10&&mouseY<=10){
		if(mouseX>=_VbT&&mouseX<=(_VbT+_V[_s][1])){
			document.onmousemove=move; document.onmouseup=up; _Vdrag=true; return false;
		}else{
			if(mouseX<_V[_s][1])mouseX=_V[_s][1]/2; else if(mouseX>_V[_s][3])mouseX=_V[_s][3]+_V[_s][1]/2;
			_VbT=mouseX-_V[_s][1]/2; _VcT=-_VbT*(1/_Vrel); moveTo();
		}
	}else return true;
}
function move(e){
	if(_Vdrag&&contH>_V[_s][0]){
		getMouse(e); _VbT=(mouseX-_VstartX);
		if(_VbT>_V[_s][3])_VbT=_V[_s][3]; if(_VbT<0)_VbT=0;
		_VcT=_VbT*(1/_Vrel); _VcT=eval('-'+_VcT); moveTo(); if(document.all)return false;
	}
}
function up(){ document.onmousemove=document.onmouseup=''; clearTimeout(_Vup?_Vup:_Vdown); _Vup=_Vdown=_Vdrag=false; return true; }
function getXY(){ _Vrel=_V[_s][3]/(contH-_V[_s][0]); }
getMouse=new Function("e","mouseY=("+(document.all?"event.clientY+db.scrollTop":"e.pageY")+")-_VoffT; mouseX=("+(document.all?"event.clientX+db.scrollLeft":"e.pageX")+")-_VoffL");
function loadPDF(loc){ pdf=window.open(loc,'PDF','width=600,height=450,resizable'); pdf.focus(); }
function wheelIt(){
	if(event.wheelDelta>=120){ nt=_VcT+20; _VcT=(nt<0)?nt:1; }
	else if(event.wheelDelta<=-120){ nt=_VcT-20; _VcT=nt>(_V[_s][0]-contH)?nt:(_V[_s][0]-contH); }
	moveTo();
	return false;
}

