/**
 * @author liudg
 * mail dongguang@staff.sina.com.cn || ldgmc@126.com
 */
var entityArray=["latest","exprience","about","dream"];
function MenuActive(item){
	this.item=item;
	this.bindEvent();
}
MenuActive.prototype={
	bindEvent:function(){
		var _this=this;
		addEvent(this.item.entity,function(){_this.item.mouseIn()},"mouseover");
		addEvent($(this.item.entity.id+"_s"),function(){_this.item.mouseOut()},"mouseout");
	}
}
function MenuItem(entity){
	this.entity=$(entity);
}
MenuItem.prototype={
	mouseIn:function(){
		for(var i=0;i<entityArray.length;i++){
			if(this.entity.id==entityArray[i]){
				swapDisplay($(this.entity.id+"_s"),this.entity,true);
			}else{
				swapDisplay($(entityArray[i]+"_s"),$(entityArray[i]));
			}
		}
	},
	mouseOut:function(){
		for(var i=0;i<entityArray.length;i++){
			if(page==entityArray[i]){
				swapDisplay($(page + "_s"), $(page),true);
			}else{
				swapDisplay($(entityArray[i]+"_s"),$(entityArray[i]));
			}
		}
	}
}
window.onload = function(){
	if(page!="index")
		swapDisplay($(page + "_s"), $(page),true);
	for(var i=0;i<entityArray.length;i++){
		new MenuActive(new MenuItem(entityArray[i]));
	}
	initArea();
}