brw='ie';
tag_instances = new Array();


if(navigator.userAgent.indexOf('Opera')>-1)	{
		brw='opera';	
	}
	
if(navigator.userAgent.indexOf('Gecko')>-1)
	{
		brw='ff';
	}
if(navigator.userAgent.indexOf('MSIE 6.0')>-1)
	{
		brw='ie6';
	}	
function Init(str){
	
	myRoot=str;
	sw=screen.width;
	sh=screen.height;
	if(brw.indexOf('ie')>-1){
		dw=document.body.clientWidth;
		dh=document.body.clientHeight;
		}
	else{
		dw=window.innerWidth;
		dh=window.innerHeight;
	}
	
}
window.addEvent('domready',function(){

	//tip();
	//document.onkeyup = onKey;
	//document.onclick = onGlobalClick;
	window.onresize = onResize;
	//onResize();
	setTimeout(getMenu,100);

	//getMenu();
});
function onResize(){
	getMenu();	
}
function getMenu(){
	//alert($('all').offsetLeft)
	for(i=1;i<20;i++){
		if($('one'+i)){
			i1x=$('one'+i).offsetLeft;
			if(i1x<$('all').offsetLeft){
				i1x=i1x+$('all').offsetLeft;
			}
			if($('two'+i)){
				$('two'+i).setStyle('display','none');
				$('two'+i).setStyle('left',(i1x)+'px');
				if(brw=='ie6'){
				//	alert($('all').offsetLeft);
				}
			}
		}
	}
}
current=0;
ihere=false;
ih2=0;
function MenuOver(i){
	if($('two'+i)){
		if(current>0&current!=i){
			MenuHide(current);
		}
		/*$('two'+i).setStyle('opacity', '0.5');
		var myEffect = new Fx.Morph('two'+i, {duration: 300, transition: Fx.Transitions.Sine.easeOut});
		myEffect.start({
		    'opacity': 1
		});*/
	//	new Fx.Style($('two'+i), 'opacity', {duration: 1000} ).start(1); 
		$('two'+i).setStyle('display','block');
		$('one'+i).setProperty('class','mainmenuOver');
		current=i;
		ihere=true;
	}
}
function MenuOut(i){
	setTimeout(MenuOutEnd,1000);
	ihere=false;
}
function m2o(i,i2){
	ihere=true;
	if(ih2!=i2&&$('two'+i+'three'+ih2)){
			$('two'+i+'three'+ih2).setStyle('display','none');
			ih2=0;
		}
	if($('two'+i+'three'+i2)){
		if(ih2!=i2&&$('two'+i+'three'+ih2)){
			$('two'+i+'three'+ih2).setStyle('display','none');
		}
		//$('two'+i+'three'+i2).setStyle('opacity', '0.5');
	//	$('two'+i+'three'+i2).fade(1);
		$('two'+i+'three'+i2).setStyle('display','block');
		i2x=$("two"+i).offsetLeft;
		i2t=$("i"+i+"t"+i2).offsetTop;
		i2w=$("two"+i).getStyle('width');
		$('two'+i+'three'+i2).setStyle('left',i2x+Number(i2w.substr(0,i2w.length-2)*1));
		$('two'+i+'three'+i2).setStyle('top',i2t+$('allmenu').offsetTop+19); 
		$("i"+i+"t"+i2).setProperty('class','submenuOver3');
		ih2=i2;
	}
	else{
		$("i"+i+"t"+i2).setProperty('class','submenuOver');
	}
}

function m2t(i,i2){
	ihere=false;
	if($('two'+i+'three'+i2)&&$("i"+i+"t"+i2)){
		//$('three'+i2).setStyle('display','none');
		$("i"+i+"t"+i2).setProperty('class','submenuOut3');
	}
	else{
		$("i"+i+"t"+i2).setProperty('class','submenuOut');
	}
}
function m3o(i,i2,i3){
	ihere=true;
	$("i"+i+"t"+i2+"z"+i3).setProperty('class','submenuOver');
}
function m3t(i,i2,i3){
	ihere=false;
	$("i"+i+"t"+i2+"z"+i3).setProperty('class','submenuOut');
}
function MenuOutEnd(){
	if(!ihere){
		MenuHide(current);
	}
	else{
		setTimeout(MenuOutEnd,1000);
	}
}
function Opn(str){
	window.open(str,"_self");	
}
function MenuHide(i){
	$('two'+i).setStyle('display','none');
	$('one'+i).setProperty('class','mainmenuOut');
	if(ih2!=0){
		$('two'+i+'three'+ih2)?$('two'+i+'three'+ih2).setStyle('display','none'):'';
		ih2=0;
	}
}
