/***Hover菜单类*/
var dohover = {
	overed : [],
 	empty:function(v){if(v==undefined){return true;}if(v==''||v==null) {return true;}return false;},
	E:function(i){return document.getElementById(i);},
	hover : function( o ){
		if ( !this.empty(this.overed[o.ssid]) ){
			$('#'+this.overed[o.ssid]).removeClass(o.clsname);
		}
		$('#'+o.c).addClass(o.clsname);
		if (o.func!=undefined){
			o.func(o.c , this.overed[o.ssid]);
		}
		this.overed[o.ssid] = o.c;
		//alert(o.c);
	},
	/**
	 ** 绑定一个一组元素实现菜单切换
	    o [object] { 	id : [array] 数组，是一个字符串（元素ID）组成的数组或者一个可以遍历的元素数组，例如 object.childNodes
					 	func	: [function] 获得事件焦点时发生的函数， function ( c , o ) c是当前获得焦点的元素ID，o是上一个获得焦点的元素ID
						method : [string] 获得事件焦点的时间类型，例如 click,mouseover 等
		 }
	 **/
	bind : function(o){
		if (Empty(o.id))return;
		o.clsname = o.clsname || 'h';
		o.method = o.method || 'mouseover';
		var ssid = ('H'+Math.random()).substr(0,8);
		for(var x in o.id){
			var e={};
			if (typeof(o.id[x])=='object') {
				if (o.id[x].tagName==null)continue;
				e=o.id[x];
				//alert(e + '...' + o.id[x].tagName);
			}else{
				e=E(o.id[x]);
			}
			if (e==null) continue;
			e.id = e.id || ('Do_H_'+Math.random()).replace('.','_');
			eval( "e.on"+o.method+" =  function(){dohover.hover( arguments.callee.callers ); }" );
			eval( "e.on"+o.method+".callers = {ssid : ssid , c : e.id , clsname : o.clsname , func : o.func};");
		}
		if (!Empty(o.hovered)){ this.overed[ssid] = o.hovered }
		return ssid;
	}
}
