var uuzu_USERLEVEL;//全局变量
/**************************菜单显示******************************/
var userAgent = navigator.userAgent.toLowerCase();
var is_opera = userAgent.indexOf('opera') != -1 && opera.version();
var is_moz = (navigator.product == 'Gecko') && userAgent.substr(userAgent.indexOf('firefox') + 8, 3);
var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);
function isUndefined(variable) {
    return typeof variable == 'undefined' ? true : false;
}


function doane(event) {
    e = event ? event : window.event;
    if(!e) return;
    if(is_ie) {
        e.returnValue = false;
        e.cancelBubble = true;
    } else if(e) {
        e.stopPropagation();
        e.preventDefault();
    }
}

var UUZUMENU = new Array();
var ctrlobjclassName;
UUZUMENU['active'] = new Array();
UUZUMENU['timer'] = new Array();


//显示菜单
function showMenu(v) {
    var ctrlid = v['ctrlid']
    var ctrlobj = $(ctrlid);
    if(!ctrlobj) return;
    var posTop = isUndefined(v['posTop']) ? 0 : v['posTop'];
    var posLeft = isUndefined(v['posLeft']) ? 0 : v['posLeft'];
    var timeout = isUndefined(v['timeout']) ? 0 : v['timeout'];
    var layer = 0;
    var showid = isUndefined(v['showid']) ? ctrlid : v['showid'];
    var showobj = $(showid);

    var menuid = isUndefined(v['menuid']) ? showid + '_menu' : v['menuid'];
    var menuobj = $(menuid);
    var ctrlidOnClass = isUndefined(v['ctrlidOnClass']) ? "" : v['ctrlidOnClass'];
    var initMenuFunc =  isUndefined(v['initMenuFunc'])  ? "" : v['initMenuFunc'];
	var mouseoverMenuFunc =  isUndefined(v['mouseoverMenuFunc'])  ? "" : v['mouseoverMenuFunc'];
	var mouseoutMenuFunc = isUndefined(v['mouseoutMenuFunc'])  ? "" : v['mouseoutMenuFunc'];
	var mouseoverCtrlidFunc =  isUndefined(v['mouseoverCtrlidFunc'])  ? "" : v['mouseoverCtrlidFunc'];
	var mouseoutCtrlidFunc =  isUndefined(v['mouseoutCtrlidFunc'])  ? "" : v['mouseoutCtrlidFunc'];
    if(!showobj || !menuobj) return;
    hideMenu(layer);
    var len = UUZUMENU['timer'].length;
    if(len > 0) {
        for(var i=0; i<len; i++) {
            if(UUZUMENU['timer'][i]) clearTimeout(UUZUMENU['timer'][i]);
        }
    }

    if(ctrlobj && !ctrlobj.initialized) {
        ctrlobj.initialized = true;
        ctrlobj.unselectable = true;

        ctrlobj.outfunc = typeof ctrlobj.onmouseout == 'function' ? ctrlobj.onmouseout : null;
        ctrlobj.onmouseout = function() {
            if(this.outfunc) this.outfunc();
			if(mouseoutCtrlidFunc !=""){
				eval(mouseoutCtrlidFunc);
			}
            UUZUMENU['timer'][ctrlobj.id] = setTimeout('hideMenu(' + layer + ')', timeout);
			
			
        }

        ctrlobj.overfunc = typeof ctrlobj.onmouseover == 'function' ? ctrlobj.onmouseover : null;
        ctrlobj.onmouseover = function(e) {
            doane(e);
			
            if(this.overfunc) this.overfunc();
			if(mouseoverCtrlidFunc !=""){
				eval(mouseoverCtrlidFunc);
			}
            for(var id in UUZUMENU['timer']) {
                if(UUZUMENU['timer'][id]) clearTimeout(UUZUMENU['timer'][id]);
            }
			
        }
    }

    ctrlobjclassName = ctrlobj.className;

    if(ctrlidOnClass != ""){
        ctrlobj.className = ctrlidOnClass;
    }
	
	
    if((menuobj && !menuobj.initialized) || menuobj.ctrlkey !=ctrlid) {
        menuobj.initialized = true;
        menuobj.ctrlkey = ctrlid;
        menuobj.style.position = 'absolute';
        menuobj.click = false;
        if(initMenuFunc !=""){
            eval(initMenuFunc);
        }
        menuobj.onmouseover = function() {
			if(mouseoverMenuFunc!=""){
				eval(mouseoverMenuFunc);
			}
            clearTimeout(UUZUMENU['timer'][ctrlid]);
        }
			
        menuobj.onmouseout = function() {
			if(mouseoutMenuFunc!=""){
				eval(mouseoutMenuFunc);
			}
            UUZUMENU['timer'][ctrlid] = setTimeout('hideMenu(' + layer + ')', timeout);
        }
		
		
        menuobj.style.zIndex = 50;
		
    }

    menuobj.style.display = '';

    setMenuPosition(showid, menuid,posTop,posLeft);

    UUZUMENU['active'][layer] = menuobj;
}
//获取设置菜单的位置用 posTop，posLeft，来调整菜单的位置
function setMenuPosition(showid,menuid,posTop,posLeft) {
    var showobj = $(showid);
    var menuobj = $(menuid);
    if(showobj) {
        showobj.pos = fetchOffset(showobj);
        showobj.X = showobj.pos['left'];
        showobj.Y = showobj.pos['top'];
        showobj.w = showobj.offsetWidth;
        showobj.h = showobj.offsetHeight;
        menuobj.w = menuobj.offsetWidth;
        menuobj.h = menuobj.offsetHeight;

        menuobj.style.left = (showobj.X+posLeft) + 'px';
        menuobj.style.top = (showobj.Y +posTop) + 'px';
    }
}


//隐藏菜单
function hideMenu(layer) {
    if(isUndefined(layer)) layer = 0;

    if(UUZUMENU['active'][layer]) {
        try{
				
            if(UUZUMENU['active'][layer].click == true){
                return;
            }
			
        }catch(e){}
        try {
            $(UUZUMENU['active'][layer].ctrlkey).className = ctrlobjclassName;
        } catch(e) {}
        clearTimeout(UUZUMENU['timer'][UUZUMENU['active'][layer].ctrlkey]);
        UUZUMENU['active'][layer].style.display = 'none';
        UUZUMENU['active'][layer] = null;
    }
}
/**************************菜单显示结束******************************/

//获取元素的位置
function fetchOffset(obj) {
    var left_offset = obj.offsetLeft;
    var top_offset = obj.offsetTop;
    while((obj = obj.offsetParent) != null) {
        left_offset += obj.offsetLeft;
        top_offset += obj.offsetTop;
    }
    return {
        'left' : left_offset,
        'top' : top_offset
    };
}

function FillIconPanel()
{
if(typeof(uuzu_USERLEVEL) != 'undefined' && uuzu_USERLEVEL != null)
{

	var user_level = document.getElementById('span_user_level');
	var user_level_pic = document.getElementById('td_user_level_pic');
	if(user_level)
	{
		user_level.innerHTML= "Lv"+uuzu_USERLEVEL;
	}
	if(user_level_pic)
	{
		user_level_pic.innerHTML = getLevel(uuzu_USERLEVEL, 1);
	}
}
else
{
	setTimeout("FillIconPanel()", 100);
}
}

//左边登录
var LeftLogin = {
    lUrl:window.location.href,
    checkFrm:function() {
        var errMsg = "";
		
        if(document.loginFrm.username.value == "" || document.loginFrm.username.value == "用户名") {
            errMsg += "请填写您的用户名!\n";
        }
        if(document.loginFrm.password.value == "" ) {
            errMsg += "请填写您的密码!\n";
        }
	
        if(errMsg == "") {
            document.loginFrm.submit();
        } else {
            alert(errMsg);
        }
    },
	
    checkLogin:function() {
        var UNICKNAME = Cookie.get("uuzu_UNICKNAME");
        var USERLPIC = Cookie.get("uuzu_USERPIC");
        USERLPIC = decodeURIComponent(USERLPIC);
        if(USERLPIC == "") USERLPIC = "http://www.uuzu.com/images/default.gif";
        var html ="";
        if(typeof(UNICKNAME) != "undefined" && UNICKNAME != null && UNICKNAME != ""){
            html +=" <dl style=''>";
            html +=" <dd class='logend'>";
            html +=" <div class='headimg' id='leftUserCardPic'><a href='https://passport.uuzu.com/member/my.php' target='_blank'  onMouseover='showMenu({\"ctrlid\":\"leftUserCardPic\",\"menuid\":\"userCard0\",\"posTop\":52,\"posLeft\":0,\"timeout\":30,\"initMenuFunc\":\"hideGameinfo()\"})'><img src='"+USERLPIC+"' width='48' height='48'></a></div>";
            html +=" <div class='userinfo'>";
            html +=" <table width='100%' border='0' cellspacing='0' cellpadding='0'>";
            html +=" <tr>";
            html +=" <td colspan='2'  height='18' ><a href='https://passport.uuzu.com/member/my.php' target='_blank' id='leftUserCard' onMouseover='showMenu({\"ctrlid\":\"leftUserCard\",\"menuid\":\"userCard0\",\"posTop\":18,\"posLeft\":0,\"timeout\":30,\"initMenuFunc\":\"hideGameinfo()\"})'>"+UNICKNAME+"</a></td>";
            html +=" </tr>";
            html +=" <tr>";
            html +=" <td valign='bottom' style='padding-bottom:4px; padding-right:4px;'><span id = 'span_user_level' style='color:#AB0617; font-weight:bold;'>Lv"+(typeof uuzu_USERLEVEL == "undefined" ? "0" : uuzu_USERLEVEL)+"</span></td>";
            html +="   <td style='padding-top:5px' id='td_user_level_pic'>"+getLevel(uuzu_USERLEVEL,1)+"</td>";
            html +=" </tr>";
            //				html +=" <tr>";
            //				html +="   <td align='right'><a href='#' onclick='LeftLogin.logout(); return false;'><img src='http://pic.uuzu.com/uuzuhttp://www.uuzu.com/images/btn_zhuxiao.gif'></a></td>";
            //				html +="  </tr>";
            html +=" </table>";
            html +="           </div>";
            html +="         </dd>";
            html +="      </dl>";
            html +="    <p>";
            html +="<input type='button' class='input01' value='立即充值' onclick='window.location.href=\"https://passport.uuzu.com/payment/index.php\";' style='cursor:pointer;'>";
            html +="<input type='button' class='input01' value='注销' style='margin-left:2px;cursor:pointer;'onclick='LeftLogin.logout();'>";
            html +=" </p> ";
				
				
        } else {
            html = "<form id='loginFrm' name='loginFrm' action='https://passport.uuzu.com/login.php' method='post' onsubmit='LeftLogin.checkFrm();return false;'>";
            html +="<input type='hidden' id='act' name='act' value='login'>";
            html +="<input type='hidden' id='rurl' name='rurl' value='"+LeftLogin.lUrl+"'>";
            html +=" <dl>";
            html +=" <dd>";
            html +="<p>通行证：";
            html +="<input type='text' name='username' id='username'>";
            html +="</p>";
            html +="<p>密码：";
            html +="&nbsp;&nbsp;&nbsp;<input type='password' name='password' id='password'>";
            html +="</p>";
            html +="</dd>";
            html +="<dt><input type='image'  src='http://www.uuzu.com/images/btn_log.gif' tabindex='3' alt='登录' title='登录'></dt>";
            html +="</dl>";
            html +="</form>";
            html +="    <p>";
            html +="<input type='button' class='input01' value='立即注册' onclick='window.location.href=\"https://passport.uuzu.com/member/register.php\";' style='cursor:pointer;'>";
            html +="<input type='button' class='input01' value='忘记密码 ' style='margin-left:2px;cursor:pointer;'onclick='window.location.href=\"https://passport.uuzu.com/service/getpwd.php#temail\";'>";
            html +=" </p> ";

        }
		
        document.write(html);

		if(typeof(uuzu_USERLEVEL) == 'undefined' || uuzu_USERLEVEL == null)
		{
			setTimeout("FillIconPanel()", 100);
		}
    },
			
    logout:function(){
        window.location.href="https://passport.uuzu.com/logout.php?rurl=http://www.uuzu.com";
    }
}

//头部登录

function TopLogin (){
    var UNICKNAME = Cookie.get("uuzu_UNICKNAME");
    var html ="";

	var host = window.location.host;
    var flag = 0;
    if (host == "www.uuzu.com") {
        flag = 2;
    }
    if(typeof(UNICKNAME) != "undefined" && UNICKNAME != null && UNICKNAME != ""){
        html ="<div class='menu_titleNew'>";
        html +="   <dl class='wholenew'>";
        html +="    <dd class='Info'  onclick='window.open(\"https://passport.uuzu.com/member/my.php\");' style='cursor:pointer;'>| <b id='userCard' onMouseover='showMenu({\"ctrlid\":\"userCard\",\"menuid\":\"userCard0\",\"posTop\":23,\"posLeft\":-20,\"timeout\":500,\"initMenuFunc\":\"hideGameinfo()\"})'>"+UNICKNAME+"</b> |</dd>";
        html +="<dd style='cursor:pointer;'><dl id='dayMsg' onMouseover='showMenu({\"ctrlid\":\"dayMsg\",\"menuid\":\"levelDay\",\"posTop\":20,\"posLeft\":-20})'></dl></dd>";
        html +="  <dd class='exit' style='margin:0px; padding:0px; float:right;'><a href='javascript:void(0);' onclick='syslogout(); return false;'>注销</a></dd>";
        html +=" </dl>";
        html +=" <div class='time' style='cursor:pointer;'><span id='timer'></span></div><div id='tipMsg' style='position:absolute; overflow:hidden;z-index:999;display:none;'></div><div id='levelDay' style='position:absolute; overflow:hidden;z-index:999;display:none;background:url(http://www.uuzu.com/images/time_bg.gif) center top no-repeat; width:228px; height:28px; padding-top:7px;padding-top:9px\9; *padding-top:8px;padding-left:32px;text-align:left;'></div></div>";
        document.write(html);
        eval('startTime()');
		eval('levelMsg()');
    }
    else{
        html ="<div class='menu_title' id='Login'><a href='https://passport.uuzu.com/login.php' onMouseover=\"showMenu({'ctrlid':'Login','posTop':1,'posLeft':95,'timeout':30});\" class='bold'>登录</a> | <a href='https://passport.uuzu.com/member/register.php'>注册</a> | ";
		html +="<a href='http://pic.uuzu.com/shortcut.php?flag=" + flag + "' title=\"点击右键，选择\“另存为...\”，将此快捷方式保存桌面即可\">设为桌面图标</a></div>";
        document.write(html);
    }

}

//退出登录
var uuzu_clearTimeOut;
function syslogout(){
    var sUrl = window.location.href;
    window.location.href="https://passport.uuzu.com/logout.php?rurl="+sUrl;	
}
/**
    *获取用户的等级
    *
    **/
function getLevel(level,isTitle) {
    var strHtml = "";
    var step = level%10;
    var grade = parseInt(level/10);

    for(var i=5;i>0;i--){
        if(i == grade){
            if(isTitle == 0){
                strHtml +='<dd class="step'+step+'"></dd><dd class="grade'+i+'"></dd>';
            }
            else{
                strHtml += '<img src="http://www.uuzu.com/images/level/step'+step+'.gif"><img src="http://www.uuzu.com/images/level/grade'+i+'.gif">';
            }
        
        }
        else if(i < grade){
            if(isTitle == 0){
                strHtml +='<dd class="grade'+i+'"></dd>';
            }
            else{
                strHtml += '<img src="http://www.uuzu.com/images/level/grade'+i+'.gif">';
            }
         
        }
        else{
            if(isTitle == 0){
                strHtml +='<dd class="grade'+i+'uc"></dd>';
            }
            else{
                strHtml += '<img src="http://www.uuzu.com/images/level/grade'+i+'uc.gif">';
            }
         
        }
    }
    if(grade == 0){
        if(isTitle == 0){
            strHtml +='<dd class="step'+step+'"></dd>';
        }
        else{
            strHtml += '<img src="http://www.uuzu.com/images/level/step'+step+'.gif">';
        }
        
    }

    if(isTitle==0){
        return '<dd class="lv">Lv'+level+'</dd>'+strHtml;
    }
    else{
        return "<p title='等级:"+level+"' onclick='window.open(\"http://cs.uuzu.com/service/index/index.html#A_dengji\")' style='cursor:pointer;white-space:nowrap;'>"+strHtml+"</p>";
    }

}


//定时器
var timer= {h:0,i:0,s:0,
    init:function(nowtime){
        if(nowtime == "-1"){
            $("timer").innerHTML = "两小时+";
            return;
        }
        var tmpTime = nowtime.split(":");
        timer.h = tmpTime[0];
        timer.i = tmpTime[1];
        timer.s = tmpTime[2];
        timer.start();
    },
    start:function(){
        if(timer.s>=59){
            timer.s =0;
            timer.i++;
        }
        else{
            timer.s++;
        }
        
        if(timer.i>=59){
            timer.i = 0;
            timer.h++;
        }

        if(timer.h>=2){
            $("timer").innerHTML = "两小时+";
        }
        else{
            $("timer").innerHTML = timer.h+":"+timer.format(timer.i)+":"+timer.format(timer.s);
            uuzu_clearTimeOut = setTimeout("timer.start();",1000);
        }			
    },
    format:function(i){
        //i = i<0 ? 59 : i;
        var str="";
        if(parseInt(i)<10)
        {
            str = "0"+i;
        }
        else{
            str = i;
        }
				
        return str;
    }
		
}

function timerOption(type){
    var objDate = new Date();
    var url = "/timer.php?action="+type+"&v="+objDate.getTime();
    new Ajax.Request(url, {
        method: 'get',
        asynchronous: true,
        onSuccess: function(transport) {
            var result = transport.responseJSON;
            if(result.time_temp != "" && result.time_temp!=null){
                Cookie.set('uuzu_TIMER',result.time_temp,0,'/','uuzu.com');
				   clearTimeout(uuzu_clearTimeOut);
                   timer.init(result.time_temp);
            }		
        }
    });
}

//启动计时器函数
function startTime(){
    var UNICKNAME = Cookie.get("uuzu_UNICKNAME");
    if(typeof(UNICKNAME) != "undefined" && UNICKNAME != null && UNICKNAME != ""){
         var pageUrl = window.location.href.toLowerCase();
		if(pageUrl == 'http://www.uuzu.com/' || pageUrl == 'http://www.uuzu.com/index.html'){
			timerOption('changetimer');
		}
		else{
			var uuzu_TIMER = Cookie.get("uuzu_TIMER");
			if(uuzu_TIMER == 'undefined' || uuzu_TIMER == null || uuzu_TIMER == ''){
				timerOption('changetimer');
			}
			else{
				clearTimeout(uuzu_clearTimeOut);
				timer.init(unescape(uuzu_TIMER));
			}
		}
        
    }
}

//启动记时器
Event.observe(window,"load",function(){
    var UNICKNAME = Cookie.get("uuzu_UNICKNAME");
    if(typeof(UNICKNAME) != "undefined" && UNICKNAME != null && UNICKNAME != ""){
        var pageUrl = window.location.href.toLowerCase();
        if(pageUrl == 'http://www.uuzu.com/' || pageUrl == 'http://www.uuzu.com/index.html'){
            setInterval("timerOption('changetimer')",300000);//5分钟执行一次
        }
    }
},false);

/*****************等级提示信息*********************/
function levelMsg(){
	var UNICKNAME = Cookie.get("uuzu_UNICKNAME");
	if(typeof(UNICKNAME) != "undefined" && UNICKNAME != null && UNICKNAME != ""){
		var objDate = new Date();
		var url = "/timer.php?action=getLevelInfo&v="+objDate.getTime();
		new Ajax.Request(url, { 
			method: 'get',
			asynchronous: true,
			onSuccess: function(transport) {
				var result = transport.responseJSON;
				if(typeof(result ) == "undefined" && result == null) return;
				
				if(result.level != "" && result.level!=null){
					var dayMsg = $('dayMsg');
					uuzu_USERLEVEL = result.level;
					//uuzu_USERLEVEL = result.level;
					dayMsg.innerHTML = getLevel(result.level,0);
					$("tipMsg").innerHTML = "<div style='background:url(http://www.uuzu.com/images/time_bg.gif) center top no-repeat; width:228px; height:28px; padding-top:7px;padding-top:9px\9; *padding-top:8px;padding-left:32px;text-align:left;'>"+result.alldaytime+"</div>";
					$("levelDay").innerHTML = "还有"+result.diffDay+"天就到"+(parseInt(result.level)+1)+"级.";
					
					Event.observe(dayMsg,"click",function(){
					window.open("http://cs.uuzu.com/service/index/index.html#A_dengji");
					},false);	

			}
				
		}
	}); 
  }	
}

/***************等级提示信息***********************/


/*********玩家身份证**********/

function loadUserCard(id){
    var UNICKNAME = Cookie.get("uuzu_UNICKNAME");
    if(typeof(UNICKNAME) != "undefined" && UNICKNAME != null && UNICKNAME != ""){
        var objEl = $(id);
	 
        var objDate = new Date();
        var url = "/cards.php?v="+objDate.getTime();
        new Ajax.Request(url, {
            method: 'get',
            asynchronous: false,
            onSuccess: function(transport) {
                objEl.innerHTML = transport.responseText;
            }
        });
    }
	 
}
function hideCard(){
    $("userCard0").style.display = "none";
    if($('userCard0')!='undefined'){
        $('userCard0').click = false;
    }
    loadUserCard("userCard0");
}
function showCard(id){
    var objEl = $(id);
    objEl.style.display = "";
}

function showGameInfo() {
    $('userCardGameServer').style.display = "";
    $('cardDown').style.display = "";
    $('cardClose').style.display = "";
    $('li36ji').className = "game36on";
    getusercardGameInfo(1);
    var card = $("userCard0");
    var dim_cardh = card.offsetHeight;
    card.style.height = (dim_cardh+120)+"px";
    if($('userCard0')!='undefined'){
        $('userCard0').click = true;
    }
	
	
}
function hideGameinfo() {
    $('userCardGameServer').style.display = "none";
    $('cardDown').style.display = "none";
    $('cardClose').style.display = "none";
	
    if(typeof $('cardText') != 'undefined' && $('cardText') != null){
        $('downMenu').style.display = "none";
    }
    else{
        $('downMenu').style.display = "";
    }
    $('li36ji').className = "game36";

    if($('userCard0')!='undefined'){
        $('userCard0').click = false;
    }
}
function getusercardGameInfo(index) {
    var countNum = 0;
    var len = $("userCardGame").childElements().length;
    for(var i=0;i<len;i++){
        var ref = $("userCardGame").childElements()[i].getAttribute('ref');
        if( ref == "gameInfo"){
            countNum++;
        }
    }
    switch(countNum){
        case 0:
            $('userCardCount').innerHTML = "0/"+countNum;
            $('usercardImgRight').src = "http://www.uuzu.com/images/disable_right.gif";
            $('usercardImgLeft').src = "http://www.uuzu.com/images/disable_left.gif";
            break;
        case 1:
            $('userCardCount').innerHTML = "1/"+countNum;
            $('usercardImgRight').src = "http://www.uuzu.com/images/disable_right.gif";
            $('usercardImgLeft').src = "http://www.uuzu.com/images/disable_left.gif";
            break;
        default:
            if(index == 0) index = 1;
            $('userCardCount').innerHTML = index+"/"+countNum;
            break;
    }
    return countNum;
}
 

var changeUserGameInfo={
    currentInfo:0,
    allInfo:[],
    prevInfo:function(){
        changeUserGameInfo.getElements();
        var perindex = changeUserGameInfo.currentInfo-1;
        if(perindex <0){
            perindex = changeUserGameInfo.currentInfo;
        }

        if($("userCardGame").childElements()[changeUserGameInfo.allInfo[perindex-1]]==null){
            $('usercardImgRight').src = "http://www.uuzu.com/images/btn_right.gif";
            $('usercardImgLeft').src = "http://www.uuzu.com/images/disable_left.gif";
            getusercardGameInfo(1);
        }
        else{
            $('usercardImgRight').src = "http://www.uuzu.com/images/btn_right.gif";
            $('usercardImgLeft').src = "http://www.uuzu.com/images/btn_left.gif";
            getusercardGameInfo(changeUserGameInfo.currentInfo);
        }
        if($("userCardGame").childElements()[changeUserGameInfo.allInfo[perindex]]!=null){
            getusercardGameInfo(changeUserGameInfo.currentInfo);
            $("userCardGame").childElements()[changeUserGameInfo.allInfo[perindex]].show();
            changeUserGameInfo.currentInfo = perindex;
        }
		

    },
    nextInfo:function(){
        changeUserGameInfo.getElements();
        var perindex = changeUserGameInfo.currentInfo+1;
        if(perindex >(changeUserGameInfo.allInfo.length-1)){
            perindex = changeUserGameInfo.currentInfo;
        }
        if($("userCardGame").childElements()[changeUserGameInfo.allInfo[perindex+1]]==null){
            $('usercardImgRight').src = "http://www.uuzu.com/images/disable_right.gif";
            $('usercardImgLeft').src = "http://www.uuzu.com/images/btn_left.gif";
        }
        else{
            $('usercardImgRight').src = "http://www.uuzu.com/images/btn_right.gif";
            $('usercardImgLeft').src = "http://www.uuzu.com/images/btn_left.gif";
        }
        if($("userCardGame").childElements()[changeUserGameInfo.allInfo[perindex]]!=null){
            $("userCardGame").childElements()[changeUserGameInfo.allInfo[perindex]].show();
            getusercardGameInfo(perindex+1);
            changeUserGameInfo.currentInfo = perindex;
        }
		
		
    },
    getElements:function(){
        var arrCardGame = new Array();
        var len = $("userCardGame").childElements().length;
        var j = 0;
        for(var i=0;i<len;i++){
            var ref = $("userCardGame").childElements()[i].getAttribute('ref');
            if( ref == "gameInfo"){
                $("userCardGame").childElements()[i].hide();
                arrCardGame[j] = i;
                j++;
            }
        }
        changeUserGameInfo.allInfo = arrCardGame;
    }
}
/*******结束******/

//样式变换
var ElementHover = {
    initialize: function(obj,tag,overCName,outCName) {
        var objChild	= null;
        var strTagName	= "";
	
        for (var i = obj.children.length -1; i >= 0;i--) {
            objChild	= obj.children[i];
            strTagName	= objChild.tagName;
            if(strTagName.toLowerCase() == tag) {
                ElementHover.onItemOver(objChild,overCName);
                ElementHover.onItemOut(objChild,outCName);
            }
			
        }
    },
    onItemOver: function(obj,className) {
        Event.observe(obj, 'mouseover', function() {
            Element.addClassName(obj, className);
        });
    },
    onItemOut: function(obj,className) {
        Event.observe(obj, 'mouseout', function() {
            Element.removeClassName(obj, className);
        });
    }
}

//论坛消息模块
var bbsOption = {
	initialize:function(){
		var objEl = $('bbsHostNews').getElementsByTagName('dl');
		var len = objEl.length;
		for(var i = 0;i<len;i++){
			Event.observe(objEl[i], 'mouseover', function() {
				bbsOption.MouseOver(this);
			});
		}
	},
    MouseOver:function(Objbbs){
		var index = Objbbs.id.substring(3);
		var ref = $('bbsHostNews').getAttribute('ref');
		var b   = "bbs"+ref;
	
		$(b).className = '';
		var objB = $(b).getElementsByTagName('dd');
		objB[0].className='no'+ref;
		objB[1].style.display = 'none';

		Objbbs.className = 'on';
		var objObjbbs = Objbbs.getElementsByTagName('dd');
		objObjbbs[0].className='no'+index+'on';
		objObjbbs[1].style.display = '';
		$('bbsHostNews').setAttribute('ref',index);
    }
}

//图片交换
var swapImage = {
    initialize:function(o,overImg,outImg){
        var obj = $(o);
        Event.observe(obj, 'mouseover', function() {
            obj.src=overImg;
        });
        Event.observe(obj, 'mouseout', function() {
            obj.src=outImg;
        });
    }
}


//添加收藏
function funAddFavorite(strUrl,strName){
    if (document.all){
        window.external.addFavorite(strUrl,strName);
    }else if (window.sidebar){
        window.sidebar.addPanel(strName, strUrl, "");
    }
}




