function SBCoreClass()
{
	this.ImgPath="/pub/front/img/";
	this.MenuItemsBgId='iMbg';
	this.MenuSubContId='iMsub';
	this.MenuSubItemId='iMsubi';
	this.MenuSubAId='iMa';
	this.MenuSubImgId='iMi';
	this.MenuItemsColor_out="#19243f";
	this.MenuItemsColor_over="#df0000";
	this.MenuItemsBgColor_out="";
	this.MenuItemsBgColor_over="";
	this.MenuSubItemsColor_out="#19243f";
	this.MenuSubItemsColor_over="#df0000";
	this.MenuSubItemsBgColor_out="#ffffff";
	this.MenuSubItemsBgColor_over="#e6e8ec";
	this.MenuItemsBgImg_out="w.gif";
	this.MenuItemsBgImg_over="bg-menu-item.gif";
	this.MenuItemsLeftImg_over="menu_left_a.gif";
	this.ImgTransp="t.gif";
	this.MenuItemsRmargin=40;
	this.MenuItemsWfix=2;
	this.MenuItemsYoffset=-2;
	this.MenuSubItemsXoffset=3;
	this.activeItem=null;
	this.tmhide=null;
	this.delay=700;
	
	this.UNKNOWN=false;
	this.IE=(navigator.appName.indexOf("Internet Explorer")!=-1);
	this.NE=(navigator.appName.indexOf("Netscape")!=-1);
	this.GECKO=(navigator.userAgent.indexOf("Gecko")!=-1);
	this.OP=(navigator.userAgent.indexOf("Opera")!=-1);
	this.OP5=(navigator.userAgent.indexOf("Opera 5")!=-1);
	this.OP6=(navigator.userAgent.indexOf("Opera 6")!=-1);
	this.OP7=(navigator.userAgent.indexOf("Opera 7")!=-1);
	this.KO=(navigator.userAgent.indexOf("Konqueror")!=-1);
	if(this.OP) this.IE=false;
	this.isDOM=Boolean(document.getElementById);
	this.isALL=Boolean(document.all);
	this.isOPERA=Boolean(window.opera);
	this.isLAYERS=Boolean(document.layers);
	this.UNKNOWN=!(this.IE||this.NE||this.OP);
	this.Ver=parseFloat(navigator.appVersion);
	this.FullVer=0;
	this.MajorVer=0;
	this.MinorVer=0;
	if(this.GECKO)
	{
		this.FullVer=new String(navigator.userAgent.match(/[0-9.]*$/));
		this.MajorVer=parseInt(this.FullVer);
		var t=this.FullVer.split(".");
		if(t.length>1)
		{
			this.MinorVer="";
			for(var i=1; i<t.length; i++)
			{
				if(i>1) this.MinorVer+=".";
				this.MinorVer+=t[i];
			}
		}
	}
	else if(this.IE)
	{
		this.MajorVer=navigator.appVersion.match(/MSIE (.)/)[1];
		this.MinorVer=navigator.appVersion.match(/MSIE .\.(.)/)[1];
		this.FullVer=this.MajorVer+"."+this.MinorVer;
	}
	else if(this.OP)
	{
		this.MajorVer=navigator.userAgent.match(/Opera (.)/)[1];
		this.MinorVer=navigator.userAgent.match(/Opera .\.(.)/)[1];
		this.FullVer=this.MajorVer+"."+this.MinorVer;
	}
	
	this.init = function()
	{
		window.onload=this.onLoad;
		window.onresize=this.onResize;
	}
	
	this.getE = function(iid)
	{
		return document.getElementById(iid)||null;
	}
	
	this.isE = function(e)
	{
		return ("object"==typeof(e)&&null!=e);
	}
	
	this.getEwidth = function(iid)
	{
		var e=this.getE(iid);
		if(e==null) return null;
		if(e.clientWidth)
		{
			return e.clientWidth;
		}
		else if(e.offsetWidth)
		{
			return e.offsetWidth;
		}
		else if(e.style.width)
		{
			return e.style.width;
		}
	}

	this.getEheight = function(iid)
	{
		var e=this.getE(iid);
		if(e==null) return null;
		if(e.clientHeight)
		{
			return e.clientHeight;
		}
		else if(e.style.height)
		{
			return e.style.height;
		}
	}

	this.getEleft = function(iid)
	{
		var e=this.getE(iid);
		if(e==null) return null;
		if(e.offsetParent)
		{
			x = e.offsetLeft;
			t = e.offsetParent;
			while (t != null)
			{
				x += t.offsetLeft;
				t = t.offsetParent;
			}
	    return x;
		}
		else if(e.style.left)
		{
			return e.style.left;
		}
	}

	this.getEtop = function(iid)
	{
		var e=this.getE(iid);
		if(e==null) return null;
		if(e.offsetParent)
		{
			y = e.offsetTop;
			t = e.offsetParent;
			while (t != null)
			{
				y += t.offsetTop;
				t = t.offsetParent;
			}
	    return y;
		}
		else if(e.style.top)
		{
			return e.style.top;
		}
	}

	this.setEvis = function(iid, s)
	{
		var e=this.getE(iid);
		if(e==null) return null;
		e.style.visibility = s?"visible":"hidden";
	}

	this.setEpos = function(iid, x, y)
	{
		var e=this.getE(iid);
		if(e==null) return null;
		e.style.left = x+"px";
		e.style.top = y+"px";
	}

	this.setEwidth = function(iid, w)
	{
		var e=this.getE(iid);
		if(e==null) return null;
		e.style.width = w;
	}

	this.setEcolor = function(iid, color)
	{
		var e=this.getE(iid);
		if(e!=null)
		{
			e.style.color = color;
			return true;
		}
		return false;
	}

	this.setEbgColor = function(iid, color)
	{
		var e=this.getE(iid);
		if(e!=null)
		{
			e.style.backgroundColor = color;
			return true;
		}
		return false;
	}

	this.fixMpos = function(){}
	
	this.mVis = function(ii, st)
	{
		var iist=ii.split('_');
		var si="";
		var sp="";
		var it=null;
		var ita=null;
		var itp=null;
		for(var i=0; i<iist.length; i++)
		{
			if(i>0){//2+ level
				itp=this.getE(this.MenuSubItemId+si);
				sp=si;
				si+="_";si+=iist[i];
				it=this.getE(this.MenuSubItemId+si);
				if(!this.isE(it)) return;
				it.style.backgroundColor=((st)?this.MenuSubItemsBgColor_over:this.MenuSubItemsBgColor_out);
				it.style.backgroundRepeat="no-repeat";
				it.style.backgroundPosition="right center";
				if (i == 1){
				it.style.backgroundImage="url("+this.ImgPath+((st)?this.MenuItemsBgImg_over:this.MenuItemsBgImg_out)+")";
				}
				
				it=this.getE(this.MenuSubImgId+si);
				if(this.isE(it)){
					it.src=this.ImgPath+((st)?this.MenuItemsLeftImg_over:this.ImgTransp);	
				}
				
				it=this.getE(this.MenuSubAId+si);
				if(!this.isE(it)) return;
				it.style.color=((st)?this.MenuItemsColor_over:this.MenuItemsColor_out);
				it=this.getE(this.MenuSubContId+si);
				if(!this.isE(it)) return;
				it.style.display=((st)?"block":"none");
				if(st){
					var y=parseInt(this.getEtop(this.MenuSubItemId+si))+this.MenuItemsYoffset;
					var x=parseInt(this.getEleft(this.MenuSubItemId+si))+this.MenuSubItemsXoffset;
					var w=parseInt(this.getEwidth(this.MenuSubItemId+si));
					var h=parseInt(this.getEheight(this.MenuSubItemId+si));
					var wp=0;
					var j=0;
					it.style.left=x+w+"px";
					it.style.top=y+"px";
					do{
						j++;
						ita=this.getE(this.MenuSubAId+si+"_"+j);
						if(!this.isE(ita)) break;
						wp=parseInt(this.getEwidth(this.MenuSubAId+si+"_"+j));
						if(wp+this.MenuItemsRmargin>w){w=wp+this.MenuItemsRmargin;}
						if(j>99){ alert("here"); j=0;}
					}while(j>0);
					
					it.style.width=w+"px";
				}
			}else{//1 level
				si+=iist[i];
				it=this.getE(this.MenuItemsBgId+si);
				if(!this.isE(it)) return;
				/*it.style.backgroundColor=(st)?this.MenuItemsBgColor_over:this.MenuItemsBgColor_out;
				it.style.backgroundRepeat="repeat-x";
				it.style.backgroundPosition="center";
				it.style.backgroundImage="url("+this.ImgPath+((st)?this.MenuItemsBgImg_over:this.MenuItemsBgImg_out)+")";
				*/
				it=this.getE(this.MenuSubAId+si);
				if(!this.isE(it)) return;
				it.style.color=((st)?this.MenuItemsColor_over:this.MenuItemsColor_out);
				it=this.getE(this.MenuSubContId+si);
				if(!this.isE(it)) return;
				it.style.display=((st)?"block":"none");
				if(st){
					var y=parseInt(this.getEtop(this.MenuItemsBgId+si));
					var h=parseInt(this.getEheight(this.MenuItemsBgId+si));
					var x=parseInt(this.getEleft(this.MenuItemsBgId+si));
					var w=parseInt(this.getEwidth(this.MenuItemsBgId+si));
					//var w=(x2+w2)-x1-(this.GECKO?this.MenuItemsWfix:0);
					var wp=0;
					var j=0;
					do{
						j++;
						ita=this.getE(this.MenuSubAId+si+"_"+j);
						if(!this.isE(ita)) break;
						wp=parseInt(this.getEwidth(this.MenuSubAId+si+"_"+j));
						if(wp>w){w=wp+this.MenuItemsRmargin;j=0;}
						if(j>99){j=0;}
					}while(j>0);
					it.style.left=x+"px";
					it.style.top=y+h+this.MenuItemsYoffset+"px";
					it.style.width=w+"px";
				}
			}
		}
	}

	this.mHide = function()
	{
		if(this.activeItem)
		{
			this.mVis(this.activeItem,0);
			this.activeItem="";
		}
	}

	this.mOver = function()
	{
		if(!arguments.length) return;
		var ii="";
		for(var i=0; i<arguments.length; i++){if(i>0)ii+="_";ii+=arguments[i];}
		clearTimeout(this.tmhide);
		if(this.activeItem && this.activeItem!=ii){
			this.mHide();
		}
		this.mVis(ii,1);
		this.activeItem=ii;
	}

	this.mOut = function()
	{
		clearTimeout(this.tmhide);
		this.tmhide = setTimeout("SBCore.mHide()", this.delay);
	}


	this.onLoad = function()
	{
	}
	
	this.onResize = function()
	{
		SBCore.fixMpos();
	}

	this.top = function()
	{
		window.scrollTo(0,0);
	}
	
	this.openWindow=function(url,wid,w,h,rs,sc)
	{
		var _x = 0,_y = 0;
		if(screen.width){
			_x=(screen.width-w)/2;
			if(_x<0){_x=0;}
			_y=(screen.height-h)/2;
			if(_y<0){_y=0;}
		}else{_x=0;_y=0;}
		if(wid==""){wid="popup"+Math.round(Math.random()*10000000);}
		_wd = window.open(url,wid,"alwaysRaised=0,top="+_y+",left="+_x+",height="+h+",width="+w+",status=0,menubar=0,resizable="+rs+",scrollbars="+sc);
		_wd.focus();
		return _wind_desc;
	}

	this.test = function()
	{
		alert(this.getEwidth('iMsubi1_1'));
	}
}

var SBCore = new SBCoreClass;

SBCore.init();