var picpath = "http://pic.wanyouxi.com/";
function getClass(val)
{
	var b = new Array("","双人类","角色类","策略类","休闲类","测试类","儿童类","搞怪类","棋牌类","装扮类","美女类","赛车类","冒险类","体育类","益智类","射击类","动作类");
	return b[val];
} 
function $(obj)
{
	return document.getElementById(obj);
}
function reload()
{
	location.reload();
}
function addfav()
{
	window.external.AddFavorite(document.URL,document.title);
}

function getCookieVal(offset) {   
    var endstr = document.cookie.indexOf (";", offset);   
    if(endstr == -1) {   
        endstr = document.cookie.length;   
    }   
    return unescape(document.cookie.substring(offset, endstr));   
}   
function getCookie(name) {   
    var arg = name + "=";   
    var alen = arg.length;   
    var clen = document.cookie.length;   
    var i = 0;   
    var j = 0;   
    while(i < clen) {   
        j = i + alen;       
        if(document.cookie.substring(i, j) == arg)   
            return getCookieVal(j);   
        i = document.cookie.indexOf(" ", i) + 1;   
        if(i == 0)   
            break;   
    }     
    return null;   
}   
function deleteCookie(name) {   
    var exp = new Date();     
    var cval = getCookie(name);     
    exp.setTime(exp.getTime() - 1);     
    document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();   
}   
var gCookieExpDays = 80;   
function setCookie(name, value) {   
    var argv = setCookie.arguments;   
    var argc = setCookie.arguments.length;   
    var exp = (argc > 2) ? argv[2] : gCookieExpDays;   
    var path = (argc > 3) ? argv[3] : null;   
    var domain = (argc > 4) ? argv[4] : null;   
    var secure = (argc > 5) ? argv[5] : false;   
    var expires = new Date();   
    deleteCookie(name);
    path = "/";   
    expires.setTime(expires.getTime() + (exp*24*60*60*1000));   
    document.cookie = name + "=" + value +   
        "; expires=" + expires.toGMTString() +   
        ((domain == null) ? "" : ("; domain=" + domain)) +   
        ((path == null) ? "" : ("; path=" + path)) +   
        ((secure == true) ? "; secure" : "");   
} 

function setMyGame(vstr)
{
	var str = getCookie("mygame");
	if (str==null || str.indexOf(vstr)<0)
	{
		str = vstr + "^^" + str;
		setCookie("mygame", str,1)
	}
	//alert(getCookie("mygame"));
}
var dwsSearch = {
	hoverBtn	: function(o,s){
		dwsElement.addClassName(o,s);
		o.onmouseout = function(){
			dwsElement.delClassName(this,s);
		}
	},
	doInput	: function(o){
		if (o.value==o.defaultValue) {
			o.value="";
		}
		o.onblur = function(){
			o.value==""?o.value=o.defaultValue:"";
		}
	}
}

function socheck(obj) {
	if(document.search.keywords.value=='') { 
		alert('请输入关键字');
		document.search.keywords.focus();
		return false;
	} 

	obj.disabled=true; 
	document.search.submit();
}