function class_TopMenu(element)
{
	var box=$(element);
	var menus=box.find("[menu]");

	this.Init=function()
	{
		menus.each(function(){
			this.menu=$("#"+$(this).attr("menu"));
			this.menu[0].box=this;
			this.menu.hover(popmenu_MouseOver,popmenu_MouseOut);
		});
		menus.hover(menu_MouseOver,menu_MouseOut);
		$("#site_language").change(function(){
		    var language=$("#site_language").val();
		    if(language=="english")
		    {
		        document.location.href="http://www.easyseosolution.com/";
		    }
		    else if(language=="chinese")
		    {
		        document.location.href="http://www.easyseosolution.com/zh-cn/";
		    }
        });
	}

	function menu_MouseOver()
	{
		this.hold=true;
		var menu=this.menu;
		var p=$(this).offset();
		if($.boxModel==false)	//IE
		{
			menu.css("left",(p.left-2)+"px");
			menu.css("top",(p.top+$(this).height()-1)+"px");
		}
		else
		{
			menu.css("left",(p.left)+"px");
			menu.css("top",(p.top+$(this).height()+1)+"px");
		}
		menu.show();
	}

	function menu_MouseOut()
	{
		this.hold=null;
		delayHide(this,this.menu);
	}

	function delayHide(sender,obj)
	{
		window.setTimeout(function(){if(sender.hold==null)$(obj).hide();},100);
	}
	
	function popmenu_MouseOver()
	{
		this.box.hold=true;
	}

	function popmenu_MouseOut()
	{
		this.box.hold=null;
		delayHide(this.box,this);
	}
}

(new class_TopMenu("#pageTopMenu")).Init();
