//滑动窗口
function setTab(name,cursel,n){
	 for(i=1;i<=n;i++){
		  var menu=document.getElementById(name+i);
		  var con=document.getElementById("con_"+name+"_"+i);
		  menu.className=i==cursel?"hover":"";
		  con.style.display=i==cursel?"block":"none";
	 }
}


$(function(){  
		   
    $(".top ul li:gt(4)").addClass("gt4");
	
	$(".sort21 ul:odd").css("backgroundColor","#F3F9FF");
	
	$(".sort21 ul:even").each(function(){
		$('li',this).eq(0).addClass("ul_even_first");
	});
	
	$(".sort21 ul:odd").each(function(){
		$('li',this).eq(0).addClass("ul_odd_first"); //odd为奇数
	});
	
	$(".sort21 ul li:last-child").addClass("ul_li_last");
	
	$(".linkBottomCon ul:last").addClass("ul_last");
	
	$(".linkBottomCon ul li:first-child").addClass("li_first");
	
	$(".linkBottomCon ul li:last-child").addClass("li_last");
	
	//$('.likeWebCon table tr ').each(function() {
		//$('input', this).eq(1).val("http://");			   
	//});	
	
	$(".con_two_4_Title ul li:eq(2)").addClass("li3");
	
	$(".con_two_4_Con table:eq(0)").addClass("tabGap");
	
	$(".linksCon ul li:nth-child(4n+1) ").css("borderLeft","1px solid #f8e0c9");
    
});

//google
function redirectForm(which){    
	var whichRadio= document.getElementById('Radio1');
	var textName= document.getElementById('text1');
	if(whichRadio.checked==true){
		which.action = " http://www.baidu.com/s?cl=3&wd=%D3%C0%BF%B5%BD%D6%B1%A8&ie=utf-8";
		textName.name='word';
		which.target="_blank";
	}
	else{
		which.action = "http://www.google.cn/search";
		textName.name ='q';
		which.target="_blank";
	}  
}   



function editTitle(aid)
{
   var show = document.getElementById("show_news");
  
   var myajax = new DedeAjax(show,false,false,"","","");
   myajax.SendGet2("ajax.php?id="+aid);
   DedeXHTTP = null;
}

//触发函数
function AlertMsg(title,id){
	var msgw,msgh,msgbg,msgcolor,bordercolor,titlecolor,titlebg,content; 
	//弹出窗口设置
	msgw = 690;		//窗口宽度 
	msgh = 60;		//窗口高度 
	msgbg = "#FFF";			//内容背景
	msgcolor = "#000";		//内容颜色
	bordercolor = "#aaa"; 	//边框颜色 
	titlecolor = "#254015";	//标题颜色
	titlebg = "#fdf5f5 url(img/tbg.gif)";		//标题背景
	//遮罩背景设置 
	var contents = 	document.getElementById("tex").value;
	content = "<div id=show_news>对不起，载入失败</div>";
		
	var sWidth,sHeight; 
	sWidth = screen.availWidth; 
	if(screen.availHeight > document.body.scrollHeight){
		sHeight = screen.availHeight;	//少于一屏
	}else{
		sHeight = document.body.scrollHeight;	//多于一屏 
	}

	//创建弹出窗口
	var msgObj = document.createElement("div") 
	msgObj.setAttribute("id","msgdiv"); 
	msgObj.style.position ="absolute";
	//msgObj.style.top = (screen.availHeight - msgh) / 2 + "px";
	msgObj.style.left = (screen.availWidth - msgw) / 2 + "px";
	msgObj.style.top = "150px";
	//msgObj.style.left = "100px";
	msgObj.style.width = msgw + "px";
	msgObj.style.height = msgh + "px";
	msgObj.style.fontSize = "12px";
	msgObj.style.background = msgbg;
	msgObj.style.border = "1px solid " + bordercolor; 
	msgObj.style.zIndex = "10001"; 
	//创建标题
	var thObj = document.createElement("div");
	thObj.setAttribute("id","msgth"); 
	thObj.className = "DragAble";
	thObj.style.color = titlecolor;
	thObj.style.fontWeight = 'bold';
	thObj.style.background = titlebg;
	var titleStr = "<a class='close' title='关闭' onclick='CloseMsg()'>关闭</a>"+"<span>"+ title +"</span>";
	thObj.innerHTML = titleStr;
	//创建内容
	var bodyObj = document.createElement("div");
	bodyObj.setAttribute("id","msgbody"); 
	bodyObj.style.padding = "0px";
	bodyObj.style.lineHeight = "18px";
	bodyObj.style.background = "#fff";
	var txt = document.createTextNode(content);
	bodyObj.appendChild(txt);
	bodyObj.innerHTML = content;
	//生成窗口
	document.body.appendChild(msgObj);
	document.getElementById("msgdiv").appendChild(thObj);
	document.getElementById("msgdiv").appendChild(bodyObj);
	editTitle(contents);
}
function CloseMsg(){
	//移除对象
	//document.body.removeChild($("maskdiv")); 
	document.getElementById("msgdiv").removeChild(document.getElementById("msgth")); 
	document.getElementById("msgdiv").removeChild(document.getElementById("msgbody")); 
	document.body.removeChild(document.getElementById("msgdiv")); 
}

//document.onmousedown = initDrag;   
document.onmouseup = new Function("isdrag=false");  

function editTitle(aid)
{
   var show = document.getElementById("show_news");
  
   var myajax = new DedeAjax(show,false,false,"","","");
   myajax.SendGet2("ajax.php?id="+aid);
   DedeXHTTP = null;
}

//触发函数
function AlertMsg(title,id){
	var msgw,msgh,msgbg,msgcolor,bordercolor,titlecolor,titlebg,content; 
	//弹出窗口设置
	msgw = 690;		//窗口宽度 
	msgh = 60;		//窗口高度 
	msgbg = "#FFF";			//内容背景
	msgcolor = "#000";		//内容颜色
	bordercolor = "#aaa"; 	//边框颜色 
	titlecolor = "#254015";	//标题颜色
	titlebg = "#fdf5f5 url(img/tbg.gif)";		//标题背景
	//遮罩背景设置 
	var contents = 	document.getElementById("tex").value;
	if(contents=="" || contents=="请输入你要查找的游戏名"){
	 alert("请输入游戏名进行搜索!");
	 return false;
	}
	content = "<div id=show_news>对不起，载入失败</div>";
		
	var sWidth,sHeight; 
	sWidth = screen.availWidth; 
	if(screen.availHeight > document.body.scrollHeight){
		sHeight = screen.availHeight;	//少于一屏
	}else{
		sHeight = document.body.scrollHeight;	//多于一屏 
	}
	
	//mask遮罩层
    var newMask = document.createElement("div");
    newMask.id = "mask";
    newMask.style.position = "absolute";
    newMask.style.zIndex = "1";
    _scrollWidth = Math.max(document.body.scrollWidth,document.documentElement.scrollWidth);
    _scrollHeight = Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);
    newMask.style.width = _scrollWidth + "px";
    newMask.style.height = _scrollHeight + "px";
    newMask.style.top = "0px";
    newMask.style.left = "0px";
    newMask.style.background = "#33393C";
    newMask.style.filter = "alpha(opacity=40)";
    newMask.style.opacity = "0.40";
    document.body.appendChild(newMask);

	//创建弹出窗口
	var msgObj = document.createElement("div") 
	msgObj.setAttribute("id","msgdiv"); 
	msgObj.style.position ="absolute";
	//msgObj.style.top = (screen.availHeight - msgh) / 2 + "px";
	msgObj.style.left = (screen.availWidth - msgw) / 2 + "px";
	msgObj.style.top = "150px";
	//msgObj.style.left = "100px";
	msgObj.style.width = msgw + "px";
	msgObj.style.height = msgh + "px";
	msgObj.style.fontSize = "12px";
	msgObj.style.background = msgbg;
	//msgObj.style.border = "1px solid " + bordercolor; 
	msgObj.style.zIndex = "10001"; 
	//创建标题
	var thObj = document.createElement("div");
	thObj.setAttribute("id","msgth"); 
	thObj.className = "DragAble";
	thObj.style.color = titlecolor;
	thObj.style.fontWeight = 'bold';
	var titleStr = "<a class='close' title='关闭' onclick='CloseMsg()'>关闭</a>"+"<span>"+ title +"</span>";
	thObj.innerHTML = titleStr;
	//创建内容
	var bodyObj = document.createElement("div");
	bodyObj.setAttribute("id","msgbody"); 
	bodyObj.style.padding = "0px";
	bodyObj.style.lineHeight = "18px";
	var txt = document.createTextNode(content);
	bodyObj.appendChild(txt);
	bodyObj.innerHTML = content;
	//生成窗口
	document.body.appendChild(msgObj);
	document.getElementById("msgdiv").appendChild(thObj);
	document.getElementById("msgdiv").appendChild(bodyObj);
	editTitle(contents);
}
function CloseMsg(){
	//移除对象
	//document.body.removeChild($("maskdiv")); 
	document.getElementById("msgdiv").removeChild(document.getElementById("msgth")); 
	document.getElementById("msgdiv").removeChild(document.getElementById("msgbody")); 
	document.body.removeChild(document.getElementById("msgdiv")); 
	document.body.removeChild(document.getElementById("mask")); 
}

//document.onmousedown = initDrag;   
document.onmouseup = new Function("isdrag=false");  


