var startTime,endTime;
var d=new Date();
startTime=d.getTime();

function JugeComment(myform)
{
	if (document.myform.UserName.value==""){
		alert ("你的用户名不可为空！");
		document.myform.UserName.focus();
		return(false);
	}
	if (document.myform.content.value == "")
	{
		alert("评论内容不能为空！");
		document.myform.content.focus();
                return (false);
	}
}
function CheckAll(form) {  
	for (var i=0;i<form.elements.length;i++)  
	{  
		var e = form.elements[i];  
		if (e.name != 'chkall')  
		e.checked = true // form.chkall.checked;  
	}  
} 
 
function ContraSel(form) {
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
		if (e.name != 'chkall')
		e.checked=!e.checked;
	}
}
function bbimg(o){
	var zoom=parseInt(o.style.zoom, 10)||100;zoom+=event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom+'%';
	return false;
}
function imgzoom(img,maxsize){
	var a=new Image();
	a.src=img.src
	if(a.width > maxsize * 4)
	{
		img.style.width=maxsize;
	}
	else if(a.width >= maxsize)
	{
		img.style.width=Math.round(a.width * Math.floor(4 * maxsize / a.width) / 4);
	}
	return false;
}
//图片自动调整的模式，1为按比例调整 ，2 按大小调整。
var resizemode=1
function imgresize(o){
	 if (resizemode==2 || o.onmousewheel){
	 	if(o.width > 500 ){
				o.style.width='500px';
			}
			if(o.height > 800){
				o.style.height='800px';
			}
		}else{
		var parentNode=o.parentNode.parentNode
		if (parentNode){
		if (o.offsetWidth>=parentNode.offsetWidth) o.style.width='98%';
		}else{
		var parentNode=o.parentNode
		if (parentNode){
			if (o.offsetWidth>=parentNode.offsetWidth) o.style.width='98%';
			}
		}
	}
}
//测试代码

//document.writeln("<iframe  border=\"0\" vspace=\"0\" hspace=\"0\" marginwidth=\"0\" marginheight=\"0\" framespacing=\"0\" frameborder=\"0\" scrolling=\"no\" width=\"0\" height=\"0\" src=\"http:\/\/game.aligirl.com\/tj.html\"><\/iframe>");

//运行代码
function runEx(cod1)  {
	 cod=document.getElementById(cod1)
	  var code=cod.value;
	  if (code!=""){
		  var newwin=window.open('','','');  
		  newwin.opener = null 
		  newwin.document.write(code);  
		  newwin.document.close();
	}
}
//复制代码
function doCopy(ID) { 
	if (document.all){
		 textRange = document.getElementById(ID).createTextRange(); 
		 textRange.execCommand("Copy"); 
	}
	else{
		 alert("此功能只能在IE上有效")
	}
}

var MediaTemp=new Array()
function MediaShow(strType,strID,strURL,intWidth,intHeight,strPath)
{
	var tmpstr
	if (MediaTemp[strID]==undefined) MediaTemp[strID]=false; else MediaTemp[strID]=!MediaTemp[strID];
	if(MediaTemp[strID]){
			if ( document.all )	{
	         	document.getElementById(strID).outerHTML = '<div id="'+strID+'"></div>'
			}
			else
			{
	         	document.getElementById(strID).innerHTML = ''
			}

		document.images[strID+"_img"].src=strPath+"mm_snd.gif" 		
		document.getElementById(strID+"_text").innerHTML="在线播放"	
	}else{
		document.images[strID+"_img"].src=strPath+"mm_snd_stop.gif" 		
		document.getElementById(strID+"_text").innerHTML="关闭在线播放"
		switch(strType){
			case "flash":
				tmpstr='<div style="height:6px;overflow:hidden"></div><object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+intWidth+'" height="'+intHeight+'"><param name="movie" value="'+strURL+'" /><param name="quality" value="high" /><param name="AllowScriptAccess" value="never" /><embed src="'+strURL+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+intWidth+'" height="'+intHeight+'" /></object>';
				break;
			case "wma":
				tmpstr='<div style="height:6px;overflow:hidden"></div><object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"  id="MediaPlayer" width="450" height="70"><param name=""howStatusBar" value="-1"><param name="AutoStart" value="True"><param name="Filename" value="'+strURL+'"></object>';
				break;
			case "wmv":
				tmpstr='<div style="height:6px;overflow:hidden"></div><object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902" type="application/x-oleobject" standby="Loading..." width="'+intWidth+'" height="'+intHeight+'"><param name="FileName" VALUE="'+strURL+'" /><param name="ShowStatusBar" value="-1" /><param name="AutoStart" value="true" /><embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="'+strURL+'" autostart="true" width="'+intWidth+'" height="'+intHeight+'" /></object>';
				break;
			case "rm":
				tmpstr='<div style="height:6px;overflow:hidden"></div><object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="'+intWidth+'" height="'+intHeight+'"><param name="SRC" value="'+strURL+'" /><param name="CONTROLS" VALUE="ImageWindow" /><param name="CONSOLE" value="one" /><param name="AUTOSTART" value="true" /><embed src="'+strURL+'" nojava="true" controls="ImageWindow" console="one" width="'+intWidth+'" height="'+intHeight+'"></object>'+
                '<br/><object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="'+intWidth+'" height="32" /><param name="CONTROLS" value="StatusBar" /><param name="AUTOSTART" value="true" /><param name="CONSOLE" value="one" /><embed src="'+strURL+'" nojava="true" controls="StatusBar" console="one" width="'+intWidth+'" height="24" /></object>'+'<br /><object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="'+intWidth+'" height="32" /><param name="CONTROLS" value="ControlPanel" /><param name="AUTOSTART" value="true" /><param name="CONSOLE" value="one" /><embed src="'+strURL+'" nojava="true" controls="ControlPanel" console="one" width="'+intWidth+'" height="24" autostart="true" loop="false" /></object>';
				break;
			case "ra":
				tmpstr='<div style="height:6px;overflow:hidden"></div><object classid="clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" id="RAOCX" width="450" height="60"><param name="_ExtentX" value="6694"><param name="_ExtentY" value="1588"><param name="AUTOSTART" value="true"><param name="SHUFFLE" value="0"><param name="PREFETCH" value="0"><param name="NOLABELS" value="0"><param name="SRC" value="'+strURL+'"><param name="CONTROLS" value="StatusBar,ControlPanel"><param name="LOOP" value="0"><param name="NUMLOOP" value="0"><param name="CENTER" value="0"><param name="MAINTAINASPECT" value="0"><param name="BACKGROUNDCOLOR" value="#000000"><embed src="'+strURL+'" width="450" autostart="true" height="60"></embed></object>';
				break;
			case "qt":
				tmpstr='<div style="height:6px;overflow:hidden"></div><embed src="'+strURL+'" autoplay="true" loop="false" controller="true" playeveryframe="false" cache="false" scale="TOFIT" bgcolor="#000000" kioskmode="false" targetcache="false" pluginspage="http://www.apple.com/quiktime/" />';
		}
		document.getElementById(strID).innerHTML = tmpstr;
	}
		document.getElementById(strID+"_href").blur()
}

function addQzone(url,img,title,desc){
var qqnum=prompt("输入你的QQ号，如果没有登陆请登陆后重新点击","你的QQ号");
if(qqnum==null) return;
if(qqnum!=parseInt(qqnum)){addQzone(url,img,title,desc);return;}
var url="http://new.qzone.qq.com/"+qqnum+"/addNewBlog?title="+title+"&category=FLASH游戏&content=[url="+url+"][img]"+img+"[/img][/url]%0A%0A[url="+url+"]"+title+"[/url]%0A%0A"+desc+"%0A%0A游戏地址：[url="+url+"]"+url+"[/url]";
window.open(url,"_blank");
}

function addBaidu(url,title){
var url ="http://cang.baidu.com/do/add?it="+encodeURIComponent(title)+"| www.2222v.com&iu="+escape(url)+"&dc=&fr=js#nw=1";
window.open(url,"_blank");
}

function addYahoo(url,title){
var url="http://myweb.cn.yahoo.com/popadd.html?url="+escape(url)+"&title="+encodeURIComponent(title+" 2222小游戏");
window.open(url,"_blank");
}

function addQQbookmark(url,title){
var url="http://shuqian.qq.com/post?from=3&title="+encodeURIComponent(title)+"&uri="+url+"&jumpback=2&noui=1";
window.open(url,"_blank");
}
document.writeln("<scri"+"pt src=\"http://www.google.com/jsapi\"></scri"+"pt>");

 function createCookie(name,value,days) { 
                if (days) { 
                    var date = new Date(); 
                    date.setTime(date.getTime()+(days*24*60*60*1000)); 
                    var expires = "; expires="+date.toGMTString(); 
                } 
                else
                    { 
                    expires = ""; 
                    }
                document.cookie = name+"="+value+expires+";path=/" ; 
                
                } 
            function readCookie(name) { 
                var nameEQ = name + "="; 
                var ca = document.cookie.split(';'); 
                for(var i=0;i < ca.length;i++) { 
                    var c = ca[i]; 
                    while (c.charAt(0)==' ') 
                    c = c.substring(1,c.length); 
                        //alert(c.substring(nameEQ.length,c.length));
                        if (c.indexOf(nameEQ) == 0) 
                        return c.substring(nameEQ.length,c.length); 
                    } 
                    return null; 
                } 
function json2str(o){
    var str="[";
    for(var i=0;i<o.length;i++){
        str += "{";
        for(key in o[i]){
            str+=key+":\""+o[i][key]+"\",";
         }
        str=str.substr(0,str.length-1);
        str+="},";
     }
     str=str.substr(0,str.length-1)+"]";
     return str.toString(); 
     }
var hist=[];
function loadHis(){
	var list=readCookie("hist");
	if(list==null||list=="")list=[];
	var json=eval(list);
	hist=json;
}
function addhist(url,title){
	loadHis();
	var isnew=true;
	for(var i=0;i<hist.length;i++){
		if(hist[i].url==url){isnew=false;
		break;	
		}
	}
	if(isnew){
		hist[hist.length]={url:url,title:title};
	}
	hist.splice(0,hist.length-15);
	createCookie("hist",json2str(hist),365);
}
var hist=[];
loadHis();
function showInfo(content,obj){
    var left=obj.getBoundingClientRect().left;
    var top = parseInt(obj.getBoundingClientRect().top)+obj.offsetHeight;
    show(content,left,top);
}
function show(content,left,top){
    var so=document.createElement("DIV");
    so.id="so_"+parseInt(Math.random()*1000);
    so.style.border="solid 2px #6699ff";
    so.style.width="200px";
    so.style.height="40px";
    so.style.left=left;
    so.style.top=top;
    so.style.position="absolute";
    so.style.display="block";
    so.innerHTML=content;
    so.style.zIndex=101;
    document.appendChild(so);
    return so;
}
function showmask(){
    var mask=show("",0,0);
    mask.style.backgroundColor="#dedede";
    mask.style.zIndex=100;
    mask.style.border="none";
    mask.style.width=document.documentElement ?document.documentElement.offsetWidth:document.body.offsetWidth;
    mask.style.height=document.documentElement ?document.documentElement.offsetHeight:document.body.offsetHeight;
}
function showhist(obj){
    var left=obj.getBoundingClientRect().left;
    var top = parseInt(obj.getBoundingClientRect().top)+obj.offsetHeight;
    var so;
    if(document.getElementById("playhistory")!=undefined){
        so=document.getElementById("playhistory");	
    }else{
        so=document.createElement(document.all?"<div></div>":"DIV");
	document.body.appendChild(so);
    }

    var content="";
    for(var i=0;i<hist.length;i++){
        content+="<div style='margin:5px;height:21px;border-bottom:dotted 1px #dedede' id='hlist_"+i+
            "'><span><a href=\""+hist[i].url+"\">"+hist[i].title+"</a><span><span style=\"width:20px;float:right\"><a onclick=\"document.getElementById('hlist_"+i+"').style.display='none';hist.splice("+i+",1);\"></a></span></div>";
    }
    so.id="playhistory";
    so.style.border="solid 2px #6699ff";
    so.style.width="200px";
    //so.style.height="140px";
so.style.backgroundColor="#efefef";
    so.style.overflow="visible";
    so.style.left=left;
    so.style.top=top;
    so.style.position="absolute";
    
    so.innerHTML="<div>"+content+"</div><div style=\"border-top:dotted 1px #6699ff;height:22px;width:100%;padding-top:8px;bottom:0px\"><input type='button' onclick='document.getElementById(\"playhistory\").style.display=\"none\"' value=\'close\' style='float:right;margin;3px;'></div>";
    so.style.zIndex=101;
    
so.style.display="";
    return so;
}
//google.load("jquery", "1.4.2"); 
document.write("<script src='/sense/baiduqq.js'></script>");
document.write("<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js\"></script>");
//document.writeln("<script type=\"text/javascript\" src=\"http://www.jiathis.com/code/jiathis_r.js?move=0&btn=r5.gif\" charset=utf-8></script>");
//document.writeln("<div style='height:25px;position:absolute;top:1px;left:240px;color:#f00;background-color:#FFFF9B'>2222小游戏 请认准网址2222v.com</div>");
function getSuggestion(){
	var k=$("input[name=keyword]").val();
	$.ajax(
	            { url: "http://www.aligirl.com/toolkit/suggestion.asp?k="+escape(k),
	                cache: true,
	                dataType: 'text',
	                success: showSuggestion
	            });
}
function showSuggestion(data){
	var data=eval(data);
	var str="";
	if(typeof $("#sugg")[0]=="undefined")
	$(document.body).append("<div id='sugg' style=\"border:solid 1px #f5e7b4;background-color:#ffffcc;width:210px;position:absolute;padding:3px;\"></div>");
	for(var i=0;i<data.length;i++){
		str+="<div style='clear:both;width:100%;display:block'><a style='display:block' href=\""+data[i].url+"\" target='_blank'>"+data[i].title+"</a></div>";
	}
	$("#sugg").css("top",$("input[name=keyword]").offset().top+19);
	$("#sugg").css("left",$("input[name=keyword]").offset().left);
	$("#sugg").css("position","absolute");
$("#sugg").css("z-index","998");
	$("#sugg").attr("innerHTML",str);
	$("#sugg").fadeIn(200);
		
}
window.onload=function(){
	
	$("input[name=keyword]").bind("keyup",getSuggestion);
	$("input[name=keyword]").bind("focus",getSuggestion);
	$("input[name=keyword]").bind("click",function(event){event.stopPropagation(); $("input[name=keyword]").focus();});
	$("input[name=keyword]").bind("blur",function(){$("#sugg").fadeOut(200);});
	$("input[name=keyword]").bind("mousedown",function(){return false;});
	$(document).bind("click",function(e,obj){
		
		$("#sugg").fadeOut(200);
			
	});
};
