//底部版权
function footer(){
document.writeln("<div class=\"footer_link\"><a href=\"http:\/\/www.yunceng.com\/about\/aboutus.shtml\" target=\"_blank\" >云层<\/a><a href=\"http:\/\/www.yunceng.com\" target=\"_blank\" >欢迎来搞<\/a><a href=\"http:\/\/www.yunceng.com\/about\/contactus.shtml\" target=\"_blank\" >联系我们<\/a><a href=\"http:\/\/www.yunceng.com\/about\/sitemap.shtml\" target=\"_blank\" >站点地图<\/a><a href=\"http:\/\/www.yunceng.com\/list\/rss.shtml\" target=\"_blank\" class=\"noborder\" >RSS<\/a><\/div>");

document.writeln("<div class=\"footer_copyright\" style=\"width:360px;\">Copyright 2009-2010 <span class=\"footer_copy\">&copy;<\/span> <a href=\"http:\/\/www.yunceng.com\" target=\"_blank\">www.yunceng.com<\/a> All rights reserved. <\/div>");
document.writeln("<div class=\"icp\"><a href=\"http:\/\/www.miibeian.gov.cn\" target=\"_blank\"><img src=\"images\/yunceng\/icp.gif\" /><br \/>湘ICP备<br \/>06010748号<\/a><\/div>");
document.writeln("<div class=\"barcodes\"><\/div>");
}


//通用导航
function Top(num){
	num = (num > 5) ? 5 : num;
	var li_cook, inform, adv_con;	
	var inform_on, adv_on, adv_link, adv_name, adv_img;
	inform_on = 0;	//公告控制 (1开启,其他关闭)
	inform = "";//公告词
	adv_on = 0;	//顶部广告(220x43)控制 (1开启,其他关闭)	
	adv_link = "http://www.yunceng.com/";//顶部广告(220x43)地址
	adv_name = "云层网祝福您";	//顶部广告(220x43)标题
	adv_img = "";//顶部广告(220x43)图片地址	
	//主菜单链接
	var menu_link = [
		"http://www.yunceng.com/",
		"http://www.yunceng.com/",
		"http://www.yunceng.com/",
		"http://www.yunceng.com/",
		"http://www.yunceng.com/",
		"http://bbs.yunceng.com/"
	]
	
	//菜单选中样式
	function mouseoverHandle(){
		obj_lis[li_cook].className = "";
		this.className = "on";		
		showMenu(this.id);
		li_cook = this.id;
	}
	
	//菜单内容显示
	function showMenu(mid){
		clearTimeout(oTime);
		if(mid > 0)$E("menu" + mid).style.display = "block";	
		if(mid != li_cook)$E("menu" + li_cook).style.display = "none";
	}
	
	//隐藏菜单
	function mouseoutHandle(){
		oTime = setTimeout(function(){$E("menu" + li_cook).style.display = "none"},500);
	}
	inform = (inform_on == 1) ? "<div class=\"top_v3_bar\"><div class=\"v3_bar_con\">" + inform +"</div></div>" : "";
	adv_con = (adv_on == 1) ? "<a href=\"" + adv_link + "\" target=\"_blank\" title=\"" + adv_name + "\"><img src=\"" + adv_img + "\" alt=\"" + adv_name + "\" title=\"" + adv_name + "\" /></a>" : "";
	var info = "<style>\n.top_v3{ width:100%; height:45px; background:url(images/yunceng/top_v3_wbg.jpg) repeat-x; }\n.top_v3, .top_v3 *{ font:normal 12px  \"宋体\"; color:#ccc; text-align:center; line-height:20px; border:0; padding:0; list-style-type:none; float:none; margin:0 auto; }\n.top_v3_bg{ width:980px; height:45px; background:url(images/yunceng/top_v3_wbg1.jpg) no-repeat; }\n.top_v3_bg div{ float:left;}\n.top_v3_bg a{ color:#313131; text-decoration:none; }\n.top_v3_bg a:hover{ color:#900; text-decoration:underline; }\n.top_v3_bg .v3_logo{ width:30px; height:39px; margin:2px 0 0 5px;float:left;}\n.top_v3_bg ul{ width:521px; margin-top:7px; float:left;}\n.top_v3_bg ul li{ float:left; height:32px; display:block; cursor:pointer;}\n.top_v3_bg ul li span{ height:32px; margin-left:12px; padding-right:12px; line-height:32px; color:#000; font-size:13px;}\n.top_v3_bg ul li.on{ float:left; height:32px; background:url(images/yunceng/top_v3_sprites.jpg) no-repeat left 0; display:block;}\n.top_v3_bg ul li.on span{ color:#fff; background:url(images/yunceng/top_v3_sprites.jpg) no-repeat right 0; float:left; font-size:13px;}\n.top_v3_bg ul li.on .sp2{background-position:0 -128px; }\n.top_v3_bg ul li.on .sp3{background-position:0 -128px; }\n.top_v3_bg ul li.on .sp4{background-position:-120px -128px; }\n.top_v3_bg ul li.on .sp5{background-position:0 -128px; }\n.top_v3_bg ul li.on .sp6{background-position:0 -128px; }\n.top_v3_menu{ width:0px; height:0px; position:relative; float:left; z-index:999;}\n.top_v3_menu .menu1, .top_v3_menu .menu2, .top_v3_menu .menu3, .top_v3_menu .menu4{ height:25px; position:absolute; background:url(images/yunceng/top_v3_sprites.jpg) no-repeat 0 -102px;}\n.top_v3_menu a{ line-height:25px;}\n.top_v3_menu span{ height:25px; margin:0 0 0 45px; padding-right:20px; background:url(images/yunceng/top_v3_sprites.jpg) no-repeat right -102px; display:block;}\n.top_v3_menu .menu1{ width:430px; top:45px; left:-455px; display:none; }\n.top_v3_menu .menu2{ width:400px; top:45px; left:-420px; display:none; }\n.top_v3_menu .menu3{ width:330px; top:45px; left:-280px; display:none; }\n.top_v3_menu .menu4{ width:700px; height:64px; top:45px; left:-350px; background-position:0 -38px; display:none; }\n.top_v3_menu .menu4 span{ height:64px; text-align:left; background-position:right -38px; }\n.top_v3_menu .menu4 span ul{ width:auto; margin:2px 0 0; }\n.top_v3_menu .menu4 span ul li{ float:left; line-height:10px; padding:0; cursor:auto; text-align:left; margin:0 10px 0 0; }\n.top_v3_menu .menu4 span ul li a{ line-height:20px; }\n.top_v3_bg .top_v3_year{ width:220px; height:43px; float:left; overflow:hidden;}\n.top_v3_bg .top_v3_fun{ float:right;width:155px; margin:13px 7px 0 0;}\n.top_v3_bg .top_v3_fun a{ height:25px; line-height:20px; margin-right:13px; padding-left:20px; background:url(images/yunceng/v3_ico.gif) no-repeat; display:block; float:left;}\n.top_v3_bg .top_v3_fun a.l2{ margin-right:0; padding-left:25px; background-position:0 -26px;}\n.top_v3_bar{ width:100%; height:28px; line-height:28px; margin:0 auto; color:#952A32; background-color:#EFEFEF; font-weight:bold; clear:both;}\n.v3_bar_con{ width:980px; margin:0 auto;}\n</style>";
	
	info += "<div class=\"top_v3\"><div class=\"top_v3_bg\">\n	<div class=\"v3_logo\"></div>\n	<ul id=\"top_v3_nav\">\n<li><span>首页</span></li>\n<li><span class=\"sp2\">网游世界</span></li>\n<li><span class=\"sp3\">娱乐国度</span></li>\n<li><span class=\"sp4\">视频照片</span></li>\n <li><span class=\"sp5\">网游专区</span></li>\n <li class=\"sp6\"><span><a target=\"blank\" href=\"http://home.yunceng.com\">云层家园</a></span></li>\n <li><span \"sp7\"><a target=\"blank\" href=\"http://bbs.yunceng.com\">云层论坛</a></span></li>\n </ul>\n	<div class=\"top_v3_menu\">\n<div id=\"menu0\"></div>\n<div class=\"menu1\" id=\"menu1\">\n	<span>\n<a href=\"http://www.yunceng.com/game/html/netgame/\" target=\"_blank\">网络游戏　</a>\n<a href=\"http://www.yunceng.com/game/html/webgame/\"target=\"_blank\">网页游戏</a>　\n<a href=\"http://www.yunceng.com/game/html/youxifahao/\" target=\"_blank\">新游发号</a>　\n<a href=\"http://www.yunceng.com/game/html/pingce/\" target=\"_blank\">游戏评测</a>　\n<a href=\"http://www.yunceng.com/game/html/video/\" target=\"_blank\">游戏视频</a>　\n </span>\n</div>\n<div class=\"menu2\" id=\"menu2\">\n	<span>\n<a href=\"http://www.yunceng.com/game/html/yule/\" target=\"_blank\">娱乐八卦</a>　\n<a href=\"http://www.yunceng.com/game/html/web/JSjiaoben/\" target=\"_blank\">电脑技术</a>　\n<a href=\"http://www.yunceng.com/game/html/web/video/\" target=\"_blank\">视频制作</a>　\n<a href=\"http://www.yunceng.com/game/html/web/photoshop/\" target=\"_blank\">图片制作</a>　\n<a href=\"http://www.yunceng.com/\" target=\"_blank\">电影动漫</a>　\n</span>\n</div>\n<div class=\"menu3\" id=\"menu3\">\n	<span>\n<a href=\"http://www.yunceng.com/list/crct.shtml\" target=\"_blank\">潮人潮图</a>　\n<a href=\"http://www.yunceng.com/list/nyxnr.shtml\" target=\"_blank\">那游戏那人</a>　\n<a href=\"http://www.yunceng.com/list/gqcj.shtml\" target=\"_blank\">高清冲击</a>　\n<a href=\"http://www.yunceng.com/list/nzny.shtml\" target=\"_blank\">男左女右</a>\n	</span>\n</div>\n<div class=\"menu4\" id=\"menu4\">\n	<span>\n	<ul>\n<li>\n	[C] <a href=\"http://www.yunceng.com/game/mhzx/\" target=\"_blank\">梦幻诛仙</a></li>\n	</ul>\n	</span>\n</div>\n	</div>\n	<div class=\"top_v3_year\">" + adv_con +"</div>\n	<div class=\"top_v3_fun\"><a href=\"javascript:Fun.$fav('yunceng.com云层网,享受游戏，享受娱乐','http://www.yunceng.com/');\">加入收藏</a><a href=\"javascript:createShortCut();\" class=\"l2\">桌面</a></div>\n</div></div>\n" + inform;
	document.write(info);	
	var v3_nav = $E("top_v3_nav"), oTime;
	var obj_lis = $E("top_v3_nav").getElementsByTagName("li");
	if(isNaN(num))num = 1;
	obj_lis[num-1].className = "on";
	li_cook = num-1;	
	for(var i = 0; i < obj_lis.length; i++){		
		if(i>=5){
			break;
			}
//		alert("i=" + i);
		obj_lis[i].id = i;
		obj_lis[i].onmouseover = mouseoverHandle;
		obj_lis[i].onclick = function(){window.location = menu_link[this.id]; };        
		$E("menu" + i).onmouseover = function(){ clearTimeout(oTime);};
		$E("menu" + i).onmouseout = mouseoutHandle;
	}
	v3_nav.onmouseout = mouseoutHandle;	
}

function Top2(num){
	var inform_on, adv_on, li_cook, oTime, oTime1;
	inform_on = 0;	//公告控制 (1开启,其他关闭)
	adv_on = 0;	//顶部广告(220x43)控制 (1开启,其他关闭)	
	$E("v4_menu").style.backgroundPosition = "0 30px";	
	function bg_move(mleft, mtop){
		var memu_left;
		memu_left = $E("v4_menu").style.backgroundPosition.split(" ")[0];
		memu_left = parseInt(memu_left.substring(0, memu_left.length - 2));
		if(Math.abs(mleft - memu_left) > 20){
			memu_left = (memu_left > mleft) ? (memu_left - 20) : (memu_left + 20);
			$E("v4_menu").style.backgroundPosition = memu_left + "px " + mtop +"px";
			oTime1 = setTimeout(function(){bg_move(mleft, mtop)}, 10);			
		}
		else{clearTimeout(oTime1); $E("v4_menu").style.backgroundPosition = mleft + "px " + mtop +"px";}		
	}	
	function setbg_size(set1, set_left){
		var set_bgtop = "";
		set_left = (num == 1) ? set_left + 13 : set_left + 2;
		if(set1.innerHTML == "SHOW首页") set_bgtop = "-56";
		if(set1.innerHTML == "话题pk") set_bgtop = "-28";
		if(set_bgtop == ""){
			switch(parseInt(set1.innerHTML.length)){
				case 1 : set_bgtop = "-140"; break; 
				case 2 : set_bgtop = "0"; break;
				case 3 : set_bgtop = "-28"; break;
				case 4 : set_bgtop = "-56"; break;
				case 5 : set_bgtop = "-84"; break;
				case 6 : set_bgtop = "-84"; break;
				default: set_bgtop = "-112"; break;
			}
		}
		bg_move(parseInt(set_left), parseInt(set_bgtop));
	}	
	function mouseover_on(mouseH){
		var menu_var = (!mouseH) ? this : mouseH, menu_oleft;
		menu_oleft = (document.all) ? menu_var.offsetParent.offsetLeft : menu_var.offsetLeft - $E("v4_menu").offsetLeft;
		menu_oleft = (!menu_oleft) ? 0 : menu_oleft;		
		setbg_size(menu_var, menu_oleft);
	}
	
	
	function mouseoverHandle(){
		clearTimeout(oTime);	
		showMenu(this.id.substring(3, this.id.length));
		//this.style.fontWeight = "bold";
		li_cook = this.id;
		mouseover_on(this);
	}
	
	//菜单内容显示
	function showMenu(mid){
		if(mid > 0 && $E("v4_menu" + mid) != null && mid != "")$E("v4_menu" + mid).style.display = "block";
		if(li_cook != "" && li_cook.substring(3, li_cook.length) != mid && $E("v4_menu" + li_cook.substring(3, li_cook.length)))$E("v4_menu" + li_cook.substring(3, li_cook.length)).style.display = "none";
	}
	//隐藏菜单
	function mouseoutHandle(){
		oTime = setTimeout(function(){$E("v4_menu"+li_cook.substring(3, li_cook.length)).style.display = "none"},500);
	}
	var obj_lis = $E("v4_menu").getElementsByTagName("a");
	li_cook = 0;
	if(!inform_on && $E("v4_cont")){$E("v4_cont").style.display = "none";}  
	for(var i = 0; i < obj_lis.length; i++){
		obj_lis[i].id = "v4_" + i;
		if(i>0 && $E("v4_menu" + i)){			
			obj_lis[i].onmouseover = mouseoverHandle;
			obj_lis[i].onmouseout = mouseoutHandle;
			$E("v4_menu" + i).onmouseover = function(){ clearTimeout(oTime);};
			$E("v4_menu" + i).onmouseout = mouseoutHandle;
		}
		if(obj_lis[i].onmouseover == null){
			obj_lis[i].onmouseover = mouseoverHandle;
		}		
	}
}

//公共功能模块
function Fun(){
	Fun.IEVerPattern = /MSIE( )(\d+(\.\d+)?)/;
	Fun.$ie = (document.all) ? true : false; //判断是否IE
	Fun.$IEVer = (Fun.IEVerPattern.test(window.navigator.userAgent)) ? parseFloat(RegExp.$2) : null; //获取IE版本号
	Fun.$id = function(id){ return document.getElementById(id); } //获取ID对象值：（对象ID名）
	//获取tag对象名集合：（对象Tag标签名）[父对象限定]
	Fun.$tag = function(tagName, parent){ return (parent) ? parent.getElementsByTagName(tagName) : document.getElementsByTagName(tagName) ; }
	//获取Class样式名对象集合：（class样式名），[Tag标签限定]，[父对象限定]
	Fun.$cl = function(cl, objName, parentNodeObj){
		var retnode = [], myclass = new RegExp('\\b' + cl + '\\b'), elem = (parentNodeObj == null) ? document.getElementsByTagName(objName) : parentNodeObj.getElementsByTagName(objName), classes;
		for (var j = 0; j < elem.length; j++) { classes = elem[j].className; if (myclass.test(classes)) retnode.push(elem[j]); }
		return retnode;
	}
	//设置链接文本：（待设置的文本），[链接目标地址]，[链接目标窗口]，[样式]
	Fun.$link = function(txt, url, target, style){ return (url) ? "<a href=\"" + url + "\" " + ((style) ? "style=\"" + style + "\"" : "") + ((target) ? " target=\"" + target + "\"" : "") + ">" + txt + "<\/a>" : txt; }
	//设置对象集合事件：（待设置的对象集合），[鼠标覆盖事件]，[鼠标移开事件]，[鼠标点击事件]，
	Fun.$action = function(objArray, mouseoverHandle, mouseoutHandle, mouseclickHandle){
		if(!objArray || objArray.length < 1) return;
		for(var i = 0; i < objArray.length; i++){
			if(mouseoverHandle) objArray[i].onmouseover = mouseoverHandle;
			if(mouseoutHandle) objArray[i].onmouseout = mouseoutHandle;
			if(mouseclickHandle) objArray[i].onclick = mouseclickHandle;
		}
	}
	//设置目标相对浮动：（对比源对象），（待设置目标对象），[左偏移量]，[上偏移量]
	Fun.$position = function(obj, targetObj, leftOffset, topOffset){
		var temp = obj.offsetParent, left = obj.offsetLeft, top = obj.offsetTop;
		while(temp){ left += temp.offsetLeft; top += temp.offsetTop; temp = temp.offsetParent; }
		targetObj.style.left = (left + leftOffset) + "px";targetObj.style.top = (top + topOffset) + "px";
	}
	//获取URL参数函数（参数名）
	Fun.$url = function(name){
		var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"), r = window.location.search.substr(1).match(reg);
		if (r != null) return unescape(r[2]); return null;
	}
	//设置添加收藏效果：（收藏地址），（收藏标题）
	Fun.$fav = function(url, title){ try{ (Fun.$ie) ? window.external.addFavorite(url, title) : window.sidebar.addPanel(url, title, ""); }catch(e){ alert("收藏失败！请手动操作"); } }
	//设置设为首页效果：（触发源对象），（首页地址）
	Fun.$home = function(obj, url){ try{ obj.style.behavior = "url(#default#homepage)"; obj.setHomePage(url); }catch(e){ if(window.netscape) try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); }catch(e){ alert("您的浏览器不支持此功能！"); } } }
	//获取地址栏中域名
	Fun.$domain = function(url){ return (url.indexOf("http") > -1) ? url.split("/")[2] : url.split("/")[0]; }
}Fun();