var now_text = 0;
var total_text = 0;


Ext.onReady(function(){
	/*
	var menu = Ext.get('menu').select('ul', true);
	
	//alert(menu.elements.length);
	if (menu.elements.length>0){
		var id = menu.elements[0].id;
		if (menu.elements[0].id==""){
			menu.elements[0].id = Ext.id();
		}
		
		if (Ext.get('menu').dom.parentNode.id==""){
			Ext.get('menu').dom.parentNode.id=Ext.id();
		}
		var td = Ext.get('menu').dom.parentNode.id;
		 if (Ext.isOpera){
			var width = (Ext.get(td).getWidth(true)/2.5);
		}
		else {
			 var width = (Ext.get(td).getWidth(true)/2)+1;
		 }
		
		 var width1 = Ext.get('sep3').getWidth()/2;
		 var width2 = Ext.get(td).getWidth();
		 var width3 = Ext.get('sep4').getWidth()/2;
		 var allWidth = width1+width2+width3;
		
		 
		 
		var li = Ext.get('drop_menu').select('li.flevel', true);
		var plus = 1;
		if (Ext.isIE){
			plus=1;
		}
		else if (Ext.isOpera){
			plus=2;
		}
		var toWidth= allWidth+plus;
	
		if (toWidth<169){
			toWidth=169;
		}
		var toSub = toWidth-10;
		
		for (i=0; i<li.elements.length;i++){
			var el = li.elements[i];
			
			Ext.get(el.id).setWidth(toWidth);
		}
		
	
	
		Ext.DomHelper.append(Ext.getBody(), {
			tag:'style',
			html:'ul.menu ul ul {left:'+toWidth+'px; top:-1px; } ul.menu .sub {background:#5899cb url(template/default/images/arrow.gif) '+toSub+'px 8px no-repeat; height:auto;}'
		});
		 
		var xy = Ext.get('sep3').getXY();
		var xy2 = Ext.get(td).getXY();	
	    var minus = toWidth-169;
	    if (minus<0){
	    	minus = 0;
	    }
	    if (Ext.isIE){
	    	
	    	if (allWidth>169){
	    		minus=minus-((allWidth-169))-2;
	    	}
	    	else {
	    		minus = minus-1;
	    	}
	    }
	    else if (Ext.isOpera){
	    	minus=minus-1;
	    }
	    else {
	    	if (allWidth<174){
	   // 	minus=minus-1;
	    	}
	    	if (allWidth==155){
	    //		minus = minus+1;
	    	}
	    	if (allWidth==142){
	    	//	minus = minus+1;
	    	}
	    	
	    	
	    }
	    if (Ext.isIE){
		var left = ((xy[0]-xy2[0])/2)+(minus);
	    }
	    else if (Ext.isOpera){
	    	var left = ((xy[0]-xy2[0])/2)+(minus);
	    }
	    else {
	    	if (allWidth>169){
	    	var left = ((xy[0]-xy2[0])/2)+(minus);
	    	}
	    	else {
	    		minus = toWidth/100;
	    		//alert(allWidth);
	    		var left = ((xy[0]-xy2[0])/2)-(minus/2);
	    	}
	    }
	    //Ext.get('glLink').dom.innerHTML += '('+allWidth+')';
		//console.log(toWidth/100);
		Ext.get('drop_menu').setStyle('left', left+'px');
		
	}
	*/
	var updateClock = function(){
		var about = Ext.get('about_wdg');
		var next = now_text+1;
		if (next>=total_text){
			next=0;
		}
		if (about){
			about.select('.about_wdg', true).setStyle('display', 'none');
			var text = about.select('.about_wdg');
			if (!text.elements[next]){
				next=0;
			}
			Ext.get(text.elements[next].id).setStyle('display', 'block');
				
		}
		now_text = next;
	}; 
	var about = Ext.get('about_wdg');
	if (about){
		var text = about.select('.about_wdg');
		if (text.elements.length>1){
			total_text = text.elements.length;
		
			var task = {
			    run: updateClock,
			    interval: 15000 //1 second
			};
			var runner = new Ext.util.TaskRunner();
			runner.start(task);

		}
		
	}
	
});

/*
var menu=function(){
	var t=15,z=50,s=6,a;
	function dd(n){this.n=n; this.h=[]; this.c=[]}
	dd.prototype.init=function(p,c){
		a=c; var w=document.getElementById(p), s=w.getElementsByTagName('ul'), l=s.length, i=0;
		for(i;i<l;i++){
			var h=s[i].parentNode; this.h[i]=h; this.c[i]=s[i];
			h.onmouseover=new Function(this.n+'.st('+i+',true)');
			h.onmouseout=new Function(this.n+'.st('+i+')');
		}
	}
	dd.prototype.st=function(x,f){
		var c=this.c[x], h=this.h[x], p=h.getElementsByTagName('a')[0];
		clearInterval(c.t); c.style.overflow='hidden';
		if(f){
			p.className+=' '+a;
			if(!c.mh){c.style.display='block'; c.style.height=''; c.mh=c.offsetHeight; c.style.height=0}
			if(c.mh==c.offsetHeight){c.style.overflow='visible'}
			else{c.style.zIndex=z; z++; c.t=setInterval(function(){sl(c,1)},t)}
		}else{p.className=p.className.replace(a,''); c.t=setInterval(function(){sl(c,-1)},t)}
	}
	function sl(c,f){
		var h=c.offsetHeight;
		if((h<=0&&f!=1)||(h>=c.mh&&f==1)){
			if(f==1){c.style.filter=''; c.style.opacity=1; c.style.overflow='visible'}
			clearInterval(c.t); return
		}
		var d=(f==1)?Math.ceil((c.mh-h)/s):Math.ceil(h/s), o=h/c.mh;
		c.style.opacity=o; c.style.filter='alpha(opacity='+(o*100)+')';
		c.style.height=h+(d*f)+'px'
	}
	return{dd:dd}
}();
*/
