/**
 * 顶部导航菜单
 * @author kui.jiang
 */
function top_Image(url, clickurl, isClick) {
	this.url = url;  // 初始化图片URL
	this.clickurl = clickurl;  // 鼠标放上以及点击后的图片URL
	this.isClick = isClick;  // 状态,是否点击
}

var top_maplist = new Map();

top_maplist.put('topmenu1', new top_Image(contentPath+'/res/sites/images/menu1.gif', contentPath+'/res/sites/images/menu1b.gif', false));
top_maplist.put('topmenu2', new top_Image(contentPath+'/res/sites/images/menu2.gif', contentPath+'/res/sites/images/menu2b.gif', false));
top_maplist.put('topmenu3', new top_Image(contentPath+'/res/sites/images/menu3.gif', contentPath+'/res/sites/images/menu3b.gif', false));
top_maplist.put('topmenu4', new top_Image(contentPath+'/res/sites/images/menu4.gif', contentPath+'/res/sites/images/menu4b.gif', false));
top_maplist.put('topmenu5', new top_Image(contentPath+'/res/sites/images/menu5.gif', contentPath+'/res/sites/images/menu5b.gif', false));
top_maplist.put('topmenu6', new top_Image(contentPath+'/res/sites/images/menu6.gif', contentPath+'/res/sites/images/menu6b.gif', false));

/*
 * 鼠标放上
 */
function top_ImageOnMouseOver(entity) {
	if (!top_maplist.get(entity.id).isClick) {
		entity.src = top_maplist.get(entity.id).clickurl;
	}
}

/*
 * 鼠标离开
 */
function top_ImageOnMouseOut(entity) {
	if (!top_maplist.get(entity.id).isClick) {
		entity.src = top_maplist.get(entity.id).url;
	}
}

/*
 * 点击图片
 */
function top_ImageOnClick(entity) {
	// 处于点击状态的不作处理
	if (!top_maplist.get(entity.id).isClick) {
		var prev = top_maplist.get('prev');
		
		// 设置点击状态
		if (prev != null) {
			top_maplist.get(prev).isClick = false;
		}
		top_maplist.get(entity.id).isClick = true;
		
		// 处理背景图片
		if (prev != null) {
			document.getElementById(prev).src = top_maplist.get(prev).url;
		}
		entity.src = top_maplist.get(entity.id).clickurl;
		
		// 将当前ID设置为上一次访问ID
		top_maplist.put('prev', entity.id);
	}
}


// top select
function selectLink(targ, selectObj, restore) {
	eval(targ + ".location='" + selectObj.options[selectObj.selectedIndex].value + "'");
	if (restore) {
		selectObj.selectedIndex = 0;
	}
}
