// Modified: 18.03.2008 // Author: Pavel Pirogov

// Constants
var debug=true;
var isIE=false;	// browser is !IE
var isFire=false;	// browser is !Firefox
var isOpera=false; // browser is !Opera
var isSafari=false;
var browserName=navigator.appName;
var b_version=navigator.appVersion;
var version=parseFloat(b_version);
var hidemask=new Array();
var active=new Array();
var menu_active="null"; //ID of active menu
var menu_loading=false;
var hideAndShow = new Array();
var hideAndShowState = new Array();
var hideAndShowDirection = new Array();
var hideStepsDef=5;
var hideSpeedDef=500;
var showStepsDef=5;
var showSpeedDef=500;
var hideSteps=hideStepsDef;
var hideSpeed=hideSpeedDef;
var showSteps=showStepsDef;
var showSpeed=showSpeedDef;
var xpageWidth2="900px";
var xpageWidth="700px";
// END Constants

// CheckBrowser
function checkBrowser(){
	browserName=navigator.appName;
	b_version=navigator.appVersion;
	version=parseFloat(b_version);
	tmp=b_version.split("Safari");
	if(tmp.length>1){
		isSafari=true;
	}else if (browserName=="Netscape" && version>=4){ // FIREFOX
		isFire=true;
	}else if (browserName=="Opera" && version>=9.1){ // Opara
		isOpera=true;
	}else if (browserName=="Microsoft Internet Explorer" && version>=4){// IE
		isIE=true;
	}else{
		//alert(browserName);
		document.write("<div align=left style='position:absolute;border:0px solid #c0c0c0;width:100%;height:100%;background-color:#ffffff;z-index:100;'><h1>Sorry!<br />The browser "+browserName+" "+version+" is not supported!</h1><br /><br /><b>Supported browsers:</b><br />Microsoft Internet Explorer 6 or higher<br />Mozilla Firefox 1.5 or higher<br />Opera 9.1 or higher</div>");
	}
}
//alert(browserName);
//alert(b_version);
tmp=b_version.split("Safari");
if(tmp.length>1){
		isSafari=true;
}else if (browserName=="Netscape" && version>=4){ // FIREFOX
	isFire=true;
}else if (browserName=="Opera" && version>=9.1){ // Opara
	isOpera=true;
}else if (browserName=="Microsoft Internet Explorer" && version>=4){// IE
	isIE=true;
}else{
	//alert(browserName);
	document.write("<div align=left style='position:absolute;border:1px solid #c0c0c0;width:100%;height:100%;background-color:#ffffff;z-index:100;'><h1>Sorry!<br />Browser "+browserName+" "+version+" is not supported!</h1><br /><br /><b>Supported browsers:</b><br />Microsoft Internet Explorer 6 or higher<br />Mozilla Firefox 1.5 or higher<br />Opera 9.1 or higher</div>");
}
// END CheckBrowser

// SUPPORT OF outerHTML for Firefox
if(!isIE){
	HTMLElement.prototype.__defineSetter__("outerHTML", function (sHTML) {
	   var r = this.ownerDocument.createRange();
	   r.setStartBefore(this);
	   var df = r.createContextualFragment(sHTML);
	   this.parentNode.replaceChild(df, this);
	});

	var _emptyTags = {
	   "IMG":   true,
	   "BR":    true,
	   "INPUT": true,
	   "META":  true,
	   "LINK":  true,
	   "PARAM": true,
	   "HR":    true
	};

	HTMLElement.prototype.__defineGetter__("outerHTML", function () {
	   var attrs = this.attributes;
	   var str = "<" + this.tagName;
	   for (var i = 0; i < attrs.length; i++)
	      str += " " + attrs[i].name + "=\"" + attrs[i].value + "\"";

	   if (_emptyTags[this.tagName])
	      return str + ">";

	   return str + ">" + this.innerHTML + "</" + this.tagName + ">";
	});
}
// END SUPPORT OF outerHTML for Firefox

//PASSWORD
function disp_prompt()
  {
  var code=prompt("Password","")
  if (code!=null && code!="")
    {
    	document.getElementById('code').value=code;
    }
  }
//END PASSWORD

//SELECT
var active_select=null;
var select_opening=null;
function closeAllSelects(){
//alert (active_select);
	if(active_select!=select_opening){
		document.getElementById(active_select).style.visibility="hidden";
		id=active_select+'_image';
		document.getElementById(id).className='select_area';
	}
	select_opening=null;
}
function unselectSelect(id){
	document.getElementById(id).bgColor='#ffffff';
}
function selectSelect(id){
	document.getElementById(id).bgColor='#6699cc';
}
//END SELECT

// OnStart
function xStart(){
	
	if(isIE){ // IE
		
		dc=document.getElementsByTagName("table");
		for(i=1;i<dc.length;i++){
			//if(dc[i].className=="ieTransClass")
			//	dc[i].className="trans90";
		}
		dc=document.getElementsByTagName("div");
		for(i=1;i<dc.length;i++){
			if(dc[i].className=="dropMenuMain"){
				dc[i].style.width="100%";
			}
		}
		
	}else{ //NOT IE
		dc=document.getElementsByTagName("div");
		for(i=1;i<dc.length;i++){
			if(dc[i].className=="dropMenuMain"){
				dc[i].style.top="210";
			}
		}
	}
	
	refreshSelected();
	/**/
	
}
// END OnStart

// SHOW&HIDE

function lockScreen(){
	try{
		objex=document.getElementById("screenLocker").id;
		slow_show("screenLocker");
	}catch(e){
		//var sizes=getPageSizeWithScroll();
		document.body.innerHTML=document.body.innerHTML+"<div id='screenLocker' style='z-index:10;visibility:hidden;filter:alpha(opacity=0); -moz-opacity:0.0; opacity:0.0;position:absolute;top:0px;left:0px;width:100%;height:100%;'><div style='width:100%;height:100%;background-color:#000000;filter:alpha(opacity=50); -moz-opacity:0.5; opacity:0.5;'><br></div></div>";
		slow_show("screenLocker");
	}
}
function unlockScreen(){
	try{
		objex=document.getElementById("screenLocker").id;
		slow_hide("screenLocker");
	}catch(e){
		
	}
}
function getPageSizeWithScroll(){
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
	return arrayPageSizeWithScroll;
}
function showImage(id,real){
	if(!isOpera){
		document.getElementById('disable_scroll').className='noScrollDiv';
		lockScreen();
	}
	try{
		objex=document.getElementById("galleryImage_"+id).id;
		slow_show("galleryImage_"+id);
	}catch(e){
		try{
			if(isOpera){
				var sizes=getPageSizeWithScroll();
				var image_x = new Image();
	   				image_x.src = real;
	   			var iheight=image_x.height;
	   				//alert(sizes[1]+" "+mouseY+" "+iheight);
	   				position=mouseY-(iheight/2);
	   			if((sizes[1]-(position+100)) < iheight){
	   				position=sizes[1]-(iheight+100);
	   			}
	   			if(position<50)
	   				position=50;
				document.body.innerHTML="<div id='galleryImage_"+id+"' onclick='hideImage("+id+");' style='z-index:11;visibility:hidden;filter:alpha(opacity=100); -moz-opacity:1.0; opacity:1.0;position:absolute;top:0px;left:0px;width:100%;height:"+sizes[1]+";horisontal-align:center;'><table border=0 cellspacing=0 cellpadding=0 width=100% style='position:relative;top:"+position+";left:0;'><tr><td style='vertical-allign:middle;' align=center><img title='Close' border=5 style='cursor:pointer;' onclick='hideImage("+id+");' src='"+real+"'></td></tr></table></div>"+document.body.innerHTML;
				slow_show("galleryImage_"+id);
			}else{
				var sizes=getPageSizeWithScroll();
				var image_x = new Image();
	   				image_x.src = real;
	   			var iheight=image_x.height;
	   			var position=mouseY-(iheight/2);
	   			
	   			if((sizes[1]-(position+100)) < iheight){
	   				position=sizes[1]-(iheight+100);
	   			}
	   			if(position<50)
	   				position=50;
	   			//alert(position);
				document.body.innerHTML="<div id='galleryImage_"+id+"' onclick='hideImage("+id+");' style='z-index:11;visibility:hidden;filter:alpha(opacity=100); -moz-opacity:1.0; opacity:1.0;position:absolute;top:0px;left:0px;width:100%;height:"+sizes[1]+";horisontal-align:center;'><table border=0 cellspacing=0 cellpadding=0 width=100% style='position:relative;top:"+position+";left:0;'><tr><td style='vertical-allign:middle;' align=center><img title='Close' border=5 style='cursor:pointer;' onclick='hideImage("+id+");' src='"+real+"'></td></tr></table></div>"+document.body.innerHTML;
				slow_show("galleryImage_"+id);
			}
		}catch(e){
		}
	}
}
function hideImage(id){
	if(!isOpera){
		unlockScreen();
		document.getElementById('disable_scroll').className='scrollDiv';
	}
	try{
		objex=document.getElementById("galleryImage_"+id).id;
		slow_hide("galleryImage_"+id);
		//document.location.href="#gallery_item_"+id;
	}catch(e){
		
	}
}
function changeOpacity(id,xopacity,direction){
	if(direction==hideAndShowDirection[id] || direction==null){
		try{
			if(!hideAndShowState[id])
				hideAndShowState[id]=xopacity;
		}catch(e){
			hideAndShowState[id]=xopacity;
		}
		if((hideAndShowState[id]<xopacity && direction==1) || (hideAndShowState[id]>xopacity && direction==2) || direction==null){
			var object1=document.getElementById(id);
			object1.style.visibility='visible';
			hideAndShowState[id]=xopacity;
			if(isIE){
				object1.style.filter="alpha(opacity=" + xopacity + ")";
			}else if(isFire){
				object1.style.MozOpacity= xopacity/100;
			}else if(isOpera){
				object1.style.opacity= xopacity/100;
			}
			
			if(xopacity<=0){
				hidden(id);
			}else if(xopacity>=100){
				shown(id);
			}
		}
	}
}
/*function echo(text){
	try{
		document.getElementById('echo_textarea').value=text+"\n"+document.getElementById('echo_textarea').value;
	}catch(e){
	}
}*/
function hidden(id){
	hideAndShow[id]=null;
	var object1=document.getElementById(id);
	object1.style.visibility="hidden";
}
function shown(id){
	hideAndShow[id]=null;
	var object1=document.getElementById(id);
}
function changeVars(){
	if(!hideSteps)
		hideSteps=hideStepsDef;
	if(!hideSpeed)
		hideSpeed=hideSpeedDef;
	if(!showSteps)
		showSteps=showStepsDef;
	if(!showSpeed)
		showSpeed=showSpeedDef;
}
function slow_hide(id){
	changeVars();
	hideAndShowDirection[id]=2;
	var object1=document.getElementById(id);
	if(visual_effects){
		try{
			if(hideAndShow[id][0]!=null){
				hideAndShow[id]=new Array();
				var j=1;
				for(var i=0;i<hideSteps;i++){
					var newop=(100-(100/hideSteps)*(i+1));
					if(newop<0)
						newop=0;
					hideAndShow[id][i]=setTimeout("changeOpacity('"+id+"',"+newop+",2);",(hideSpeed/hideSteps)*j++);
					//echo(id+" "+newop+" "+hideAndShowDirection[id]);
				}
			}
		}catch(e){
			hideAndShow[id]=new Array();
			for(var i=0;i<hideSteps;i++){
				hideAndShow[id][i]=setTimeout("changeOpacity('"+id+"',"+(100-(100/hideSteps)*(i+1))+",2);",(hideSpeed/hideSteps)*(i+1));
				//echo(id+" "+(100-(100/hideSteps)*(i+1))+" "+hideAndShowDirection[id]);
			}
		}
	}else{
		object1.style.visibility="hidden";
	}
}
function slow_show(id){
	changeVars();
	hideAndShowDirection[id]=1;
	var object1=document.getElementById(id);
	if(visual_effects){
		try{
			if(hideAndShow[id][0]!=null){
				hideAndShow[id]=new Array();
				var j=1;
				for(var i=0;i<showSteps;i++){
					var newop=((100/showSteps)*(i+1));
					if(newop>100)
						newop=100;
					hideAndShow[id][i]=setTimeout("changeOpacity('"+id+"',"+newop+",1);",(showSpeed/showSteps)*j++);
					//echo(id+" "+newop+" "+hideAndShowDirection[id]);
				}
			}
		}catch(e){
			hideAndShow[id]=new Array();
			for(var i=0;i<showSteps;i++){
				hideAndShow[id][i]=setTimeout("changeOpacity('"+id+"',"+((100/showSteps)*(i+1))+",1);",(showSpeed/showSteps)*(i+1));
				//echo(id+" "+((100/showSteps)*(i+1))+" "+hideAndShowDirection[id]);
			}
		}
	}else{
		object1.style.visibility="visible";
	}
}

//#####################333

function hide(id, index){
	
	if(isIE){
		filter=document.getElementById(id).style.filter;
		y=90;
			x=filter.split("alpha(opacity=");
			x=x[1];
			x=parseInt(x);
		
		if(x>=0 && x<100){
			if(x<y)
				y=x;
		}
	}else if(isFire){
		x=document.getElementById(id).style.MozOpacity;
		y=0.9;
		x+=y;
		x-=y;
		x-=0.1;
		if(x>=0 && x<1){
			if(x<y)
				y=x+0.1;
		}
	}else if(isOpera){
		x=document.getElementById(id).style.opacity;
		y=0.9;
		x+=y;
		x-=y;
		x-=0.1;
		if(x>=0 && x<1){
			if(x<y)
				y=x+0.1;
		}
	}else{
		y=0;
	}
	//alert(y);
	hidex(id, y, index);
}
function hidex(id, per, index){
	//alert(index+" "+per);
	//echo(index);
	var object1=document.getElementById(id);
	if(visual_effects){
		if(isIE){
			if(active[index]){
				if(per < 10){
					object1.style.visibility="hidden";
					//alert(x);
				}else{
					if(hidemask[id]){
						filter=document.getElementById(id).style.filter;
						x=filter.split("alpha(opacity=");
						x=x[1];
						//alert(x);
						per=parseInt(x)-1;
						if(!(per>0 && per<100))
							per=100;
						per= per - 30;
						object1.style.filter="alpha(opacity=" + per + ")";
						setTimeout("hidex('"+ id +"',"+ per+ ","+ index +")",100);
					
					}
				}
			}
		}else if(isFire){
			if(active[index]){
				if(per < 0.1){
					object1.style.visibility="hidden";
				}else{
					if(hidemask[id]){
						per=document.getElementById(id).style.MozOpacity - 0.05;
						if(!(per>0 && per<1))
							per=1-0.3;
						object1.style.MozOpacity= per;
						setTimeout("hidex('"+ id +"',"+ per+ ","+ index +")",100);
					}
				}
			}
		}else if(isOpera){
			if(active[index]){
				if(per < 0.1){
					object1.style.visibility="hidden";
				}else{
					if(hidemask[id]){
						per=document.getElementById(id).style.opacity - 0.05;
						if(!(per>0 && per<1))
							per=1-0.3;
						object1.style.opacity= per;
						setTimeout("hidex('"+ id +"',"+ per+ ","+ index +")",100);
					}
				}
			}
		}else{
			object1.style.visibility="hidden";
		}
	}else{
		object1.style.visibility="hidden";
	}
}
function show(id, index){
	//echo(index);
		if(isIE){
			if(active[index]){
				filter=document.getElementById(id).style.filter;
				y=10;
				
					x=filter.split("alpha(opacity=");
					x=x[1];
					x=parseInt(x);
				
				if(x>=0 && x<=100){
					if(x>y)
						y=x;
				}
			}
		}else if(isFire){
			if(active[index]){
				x=document.getElementById(id).style.MozOpacity;
				//alert(x);
				y=0.1;
				//x+=y;
				//x-=y;
				//x+=0.1;
				if(x>=0 && x<=1){
					if(x>y)
						y=x-0.1;
				}
			}
		}else if(isOpera){
			if(active[index]){
				x=document.getElementById(id).style.opacity;
				//alert(x);
				y=0.1;
				//x+=y;
				//x-=y;
				//x+=0.1;
				if(x>=0 && x<=1){
					if(x>y)
						y=x-0.1;
				}
			}
		}
		//alert(y);
		showx(id, y, index);
}
function showx(id, per, index){
	//echo(index);
	if(!hidemask[id]){
			var object1=document.getElementById(id);
			object1.style.visibility="visible";
			if(visual_effects){
				if(isIE){
					if(active[index]){
						if(per >= 90){
							object1.style.filter="alpha(opacity=100)";
						}else{
							
							object1.style.filter="alpha(opacity=" + per + ")";
							per= per + 30;
							setTimeout("showx('"+ id +"',"+ per+ ","+ index +")",100);
						
						}
					}
				}else if(isFire){
					if(active[index]){
						if(per >= 0.9){
							object1.style.MozOpacity=1;
						}else{
							
							object1.style.MozOpacity= per;
							per= per + 0.3;
							setTimeout("showx('"+ id +"',"+ per+ ","+ index +")",100);
						
						}
					}
				}else if(isOpera){
					if(active[index]){
						if(per >= 0.9){
							object1.style.opacity=1;
						}else{
							//alert(object1.style.opacity);
							object1.style.opacity= per;
							per= per + 0.3;
							setTimeout("showx('"+ id +"',"+ per+ ","+ index +")",100);
						
						}
					}
				}else{
					
				}
			}
	}
}
function visible(id){
	object = document.getElementById(id);
	object.style.visibility='visible';
}
function hidden(id){
	object = document.getElementById(id);
	object.style.visibility='hidden';
}
function hideMenu(){
	dc=document.getElementsByTagName("div");
	for(i=1;i<dc.length;i++){
		tmp=dc[i].id.split("menu_button_drop_");
		tmp=parseInt(tmp[1]);
		if(tmp>0){
			dc[i].style.visibility="hidden";
		}
	}
}
function blurSelect(){
	if(isIE){
		//hideSelect();
	}else{
		dc=document.getElementsByTagName("select");
		for(i=1;i<dc.length;i++){
			dc[i].blur();
		}
	}
}
function unBlurSelect(){
	if(isIE){
		showSelect();
	}
}
function hideSelect(){
	dc=document.getElementsByTagName("select");
	for(i=1;i<dc.length;i++){
		dc[i].style.visibility="hidden";
	}
}
function showSelect(){
	dc=document.getElementsByTagName("select");
	for(i=1;i<dc.length;i++){
		dc[i].style.visibility="visible";
	}
}
// END SHOW&HIDE

// OVER&OUT MENU
var dhide=new Array();
var shide=new Array();

function btnDropOver(id){
	dhide[id]=false;
	document.getElementById("menu_button_left_"+id).className="dropmenu_button_left_over";
	document.getElementById("menu_button_"+id).className="dropmenu_button_over";
	document.getElementById("menu_button_right_"+id).className="dropmenu_button_right_over";
	drop = document.getElementById("menu_button_drop_"+id);
	drop.style.visibility='visible';
	blurSelect();
}
function btnDropOutx(id){
	dhide[id]=true;
	setTimeout("btnDropOut("+id+")",100);
}
function btnDropOut(id){
	if (dhide[id]){
		if(menu[id]){
			document.getElementById("menu_button_left_"+id).className="menu_button_left_active";
			document.getElementById("menu_button_"+id).className="menu_button_active";
			document.getElementById("menu_button_right_"+id).className="menu_button_right_active";
		}else{
			document.getElementById("menu_button_left_"+id).className="menu_button_left";
			document.getElementById("menu_button_"+id).className="menu_button";
			document.getElementById("menu_button_right_"+id).className="menu_button_right";
		}
		drop = document.getElementById("menu_button_drop_"+id);
		drop.style.visibility='hidden';
		unBlurSelect();
		dhide[id]=false;
	}
}
function btnOver(id){
	dhide[id]=false;
	document.getElementById("menu_button_left_"+id).className="menu_button_left_over";
	document.getElementById("menu_button_"+id).className="menu_button_over";
	document.getElementById("menu_button_right_"+id).className="menu_button_right_over";
	//document.getElementById("menu_title_"+id).className="menu_title_over";
}
function btnOutx(id){
	dhide[id]=true;
	setTimeout("btnOut("+id+")",100);
}
function btnOut(id){
	if (dhide[id]){
		if(menu[id]){
			document.getElementById("menu_button_left_"+id).className="menu_button_left_active";
			document.getElementById("menu_button_"+id).className="menu_button_active";
			document.getElementById("menu_button_right_"+id).className="menu_button_right_active";
			//document.getElementById("menu_title_"+id).className="menu_title_active";
		}else{
			document.getElementById("menu_button_left_"+id).className="menu_button_left";
			document.getElementById("menu_button_"+id).className="menu_button";
			document.getElementById("menu_button_right_"+id).className="menu_button_right";
			//document.getElementById("menu_title_"+id).className="menu_title";
		}
		dhide[id]=false;
	}
}
function dropOver(id){
	dhide[id]=false;
	document.getElementById("menu_button_"+id).className="dropmenu_punkt_over";
	document.getElementById("menu_title_"+id).className="menu_title_over";
	drop = document.getElementById("menu_button_drop_"+id);
	drop.style.visibility='visible';
}
function dropOutx(id){
	dhide[id]=true;
	setTimeout("dropOut("+id+")",100);
}
function dropOut(id){
	if(dhide[id]){
		document.getElementById("menu_button_"+id).className="dropmenu_punkt";
		document.getElementById("menu_title_"+id).className="menu_title";
		drop = document.getElementById("menu_button_drop_"+id);
		drop.style.visibility='hidden';
		dhide[id]=false;
	}
}
function dropClickableOver(object){
	object.className="dropmenu_punkt_over";
}
function dropClickableOut(object){
	object.className="dropmenu_punkt";
}
/*
function submenuOver(object){
	object.className="submenu_over";
}
function submenuOut(object){
	if(menu2[object.id]){
		object.className="submenu_active";
	}else{
		object.className="submenu";
	}
}
*/
function submenuOver(object){
	id=object.id;
	shide[id]=false;
	object.className="submenu_over";
}
function submenuOutx(object){
	id=object.id;
	shide[id]=true;
	setTimeout("submenuOut("+id+")",100);
}
function submenuOut(id){
	if (shide[id]){
		object = document.getElementById(id);
		if(menu2[id]){
			object.className="submenu_active";
		}else{
			object.className="submenu";
		}
		shide[id]=false;
	}
}
// END OVER&OUT MENU

// Click Menu
function dropClick(id,div){
	document.getElementById("menu_button_drop_"+div).style.visibility="hidden";
	hideMenu();
	makeSelected(div);
	markSelected(div);
	refreshSelected();
	MenuClickEvent(id);
}
function btnClick(id){
	unselectAll2(id);
	makeSelected(id);
	refreshSelected();
	MenuClickEvent(id);
}

function btn2Click(id){
	try{
		unselectAll2(id);
		try{
			markSelected2(id);
		}catch(e){}
		menu2[id]=true;
		MenuClickEvent2(id);
	}catch(e){}
}
function btnClick2(id,parent){
	menu_loading=true;
	btnClick(parent);
	
	setTimeout("menuLoaded("+id+")",100);
	
}
function menuLoaded(id){
	if(!menu_loading){
			btn2Click(id);
			//alert(1);
			menu2x=document.getElementById("menu2");
			//alert(menu2);
			if(isIE){
				menu2x.style.filter="alpha(opacity=100)";
			}else if(isFire){
				menu2x.style.MozOpacity=1;
			}else if(isOpera){
				menu2x.style.opacity=1;
			}
			//alert(2);
	}else
		setTimeout("menuLoaded("+id+")",100);
}
function MenuClickEvent(id){
	hidemask["main"]=true;
	hidemask["menu2"]=true;
	for(i=0;i<active.length;i++)
		active[i]=false;
	index=active.length;
	active[active.length]=true;
	slow_hide("main",index);
	slow_hide("menu2",index);
	
	if(sajax_enable){
		user_type=getUserType();
			params=new Array();
			params[0]=id;
			params[1]=index;
			params[2]=user_type;
			x_getDIV(params,renewDiv2);
			//x_getMenu(params,renewMenu);
	}else{
		document.location.href="?m="+id;
	}
}
function MenuClickEvent2(id){
	hidemask["main"]=true;
	for(i=0;i<active.length;i++)
		active[i]=false;
	index=active.length;
	active[active.length]=true;
	slow_hide("main",index);
	
	if(sajax_enable){
		user_type=getUserType();
			params=new Array();
			params[0]=id;
			params[1]=index;
			params[2]=user_type;
			x_getDIV(params,renewDiv);
	}else{
		document.location.href="?m="+id;
	}
}
function getUserType(){
	try{
		return document.getElementById("select_hidden_user_type_select_x").value;
	}catch (e){
		return 0;
	}
}
// END Click Menu

// DIV functions
function renewDiv2(content,params){
	document.getElementById("main_div").innerHTML=content;
	hidemask["main"]=false;
	slow_show("main");//, params[1]);
	i=0;
	while(content.indexOf("<script",i)){
		i=content.indexOf("<script",i);
		if(i>0){
			l=content.indexOf(">",i+1);
			l++;
			r=content.indexOf("</script>",l);
			i=r;
			eval(content.substring(l,r));
		}else{
			break;
		}
	}
	x_getMenu(params,renewMenu);
}
function renewDiv(content,params){
	document.getElementById("main_div").innerHTML=content;
	hidemask["main"]=false;
	slow_show("main");//, params[1]);
	i=0;
	while(content.indexOf("<script",i)){
		i=content.indexOf("<script",i);
		if(i>0){
			l=content.indexOf(">",i+1);
			l++;
			r=content.indexOf("</script>",l);
			i=r;
			eval(content.substring(l,r));
		}else{
			break;
		}
	}
}
function renewMenu(content,params){
	if(content!=false){
		document.getElementById("menu_2div").innerHTML=document.getElementById("menu2_tmp").innerHTML;
		document.getElementById("main_div").style.width=xpageWidth;
		document.getElementById("loading").style.width=xpageWidth;
		document.getElementById("menu_vertical").innerHTML=content;
		hidemask["menu2"]=false;
		slow_show("menu2");//, params[1]);
	}else{
		document.getElementById("menu_2div").innerHTML="";
		document.getElementById("main_div").style.width=xpageWidth2;
		document.getElementById("loading").style.width=xpageWidth2;
	}
	menu_loading=false;
}
/*function echo(text){
	if(debug)
		document.getElementById("debug").innerHTML=document.getElementById("debug").innerHTML+text;
}*/
// END DIV functions

// SELECT&UNSELECT
function markRow(object){
	dc=object.getElementsByTagName("td");
	for(i=0;i<dc.length;i++){
		if(dc[i].className=="cell")
			dc[i].className="cell_over";
	}
}
function unmarkRow(object){
	dc=object.getElementsByTagName("td");
	for(i=0;i<dc.length;i++){
		if(dc[i].className=="cell_over")
			dc[i].className="cell";
	}
}
function markTreeRow(object){
	if( object.className=="active_cell"){
		hidemask['active_cell']=object.id;
	}else
	object.className="cell_over";
}
function unmarkTreeRow(object){
		if(hidemask['active_cell']==object.id){
			object.className="active_cell";
		}else{
			object.className="cell"
		}
}
function unselectAll2(id){
	try{
		for (var i = 0; i < menu2.length; i++){
			menu2[i]=false;
			try{
				if(i!=id){
					object = document.getElementById(i);
					if(object!=null)
						object.className="submenu";
				}
			}catch (e){
				
			}
		}
	}catch (e){
			
	}
}
function refreshSelected(){
	try{
tbl=document.getElementById("MenuTable");
	
dx=tbl.getElementsByTagName("b");
		for(i=0;i<dx.length;i++){
			if(dx[i].className=="menu_title_active")
				dx[i].className="menu_title";
		}
dc=tbl.getElementsByTagName("td");
		for(i=0;i<dc.length;i++){
			tmp1=dc[i].id.split("menu_button_left_");
			tmp1=parseInt(tmp1[1]);
			if(tmp1>0){
				if(dc[i].className=="menu_button_left" || dc[i].className=="menu_button_left_active"){
					if(menu[tmp1]){
						
						dc[i].className="menu_button_left_active"
					}else
						dc[i].className="menu_button_left";
				}
			}
			tmp2=dc[i].id.split("menu_button_");
			tmp2=parseInt(tmp2[1]);
			if(tmp2>0){
				if(dc[i].className=="menu_button" || dc[i].className=="menu_button_active"){
					if(menu[tmp2]){
						document.getElementById("menu_title_"+tmp2).className="menu_title_active";
						dc[i].className="menu_button_active"
					}else
						dc[i].className="menu_button";
				}
			}
			tmp3=dc[i].id.split("menu_button_right_");
			tmp3=parseInt(tmp3[1]);
			if(tmp3>0){
				if(dc[i].className=="menu_button_right" || dc[i].className=="menu_button_right_active"){
					if(menu[tmp3])
						dc[i].className="menu_button_right_active"
					else
						dc[i].className="menu_button_right";
				}
			}
		}
	}catch(e){}
}
function markSelected(id){
	left=document.getElementById("menu_button_left_"+id);
	center=document.getElementById("menu_button_"+id);
	right=document.getElementById("menu_button_right_"+id);
	left.className="menu_button_left_active";
	center.className="menu_button_active";
	right.className="menu_button_right_active";
	for (var i = 0; i < menu.length; i++){
		menu[i]=false;
	}
	menu[id]=true;
}
function markSelected2(id){
	//left=document.getElementById(id);
	center=document.getElementById(id);
	//right=document.getElementById(id);
	//left.className="menu_button_left_active";
	center.className="submenu_active";
	//right.className="menu_button_right_active";
	for (var i = 0; i < menu.length; i++){
		menu[i]=false;
	}
	menu[id]=true;
}
function makeSelected(id){
	for (var i = 0; i < menu.length; i++){
		menu[i]=false;
	}
	menu[id]=true;
}
// END SELECT&UNSELECT

// changeLanguage
function changeLanguage(select){
	//alert(select.value);
	document.language.submit();
}
// END changeLanguage
// changeInterface
function changeInterface(select){
	//alert(select.value);
	document.user_type.submit();
}
// END changeInterface

