﻿$(document).ready(function () {
	if (typeof $('#myurl').attr('href')!='undefined'){
		$("#newer_guide_ctn #reg").hide();
		$("#newer_guide_ctn #login").hide();
		$("#newer_guide_ctn #my_space").css('display','block');
		$("#newer_guide_ctn #my_space").attr('href',$('#myurl').attr('href'));
	}
    $("#withdrawl_rank_scroll").Scroll({line:1,speed:500,timer:4000,up:"btn1",down:"btn2"});//文字滚动
    $("#latest_action_scroll").Scroll({line:1,speed:500,timer:4000,up:"btn3",down:"btn4"});//文字滚动
	$('.home_overlay_text').hover(function(){
		//鼠标移上按钮事件
		$("#home_overlay_ad_"+$(this).attr('btnid')).show();
//		$("#home_overlay_ad_"+$(this).attr('btnid')).css('filter','progid:DXImageTransform.Microsoft.Alpha(style=4,opacity=80)');
//		$("#home_overlay_ad_"+$(this).attr('btnid')).css('opacity',0.8);
		$("#home_overlay_btn_"+$(this).attr('btnid')).show();
		$("#home_overlay_text_"+$(this).attr('btnid')).addClass('c');
		$("#home_search_ctn select").css('visibility','hidden');
		$('.home_overlay_text a').addClass('u');
		$('#home_overlay_text_'+$(this).attr('btnid')+' a').removeClass('u');
		for (i=1;i<=3;i++){
			if ($(this).attr('btnid')!=i){
				$("#home_overlay_ad_"+i).hide();
				setTimeout('$("#home_overlay_ad_'+i+'").fadeOut(50);$("#home_overlay_btn_'+i+'").fadeOut(50);$("#home_overlay_text_'+i+'").removeClass("c");',0);
			}
		}
	},function(){
	});
	$('.home_overlay_ad').hover(function(){},function(){
		//鼠标移出内容事件
		setTimeout('$("#home_overlay_ad_'+$(this).attr("btnid")+'").fadeOut(50);$("#home_overlay_btn_'+$(this).attr("btnid")+'").fadeOut(50);$("#home_overlay_text_'+$(this).attr('btnid')+'").removeClass("c");$("#home_search_ctn select").css("visibility","visible");',0);
		$('.home_overlay_text a').removeClass('u');
	});
	$('#index_sc1').hover(function(){},function(){
		//鼠标移出内容事件
		for (i=1;i<=3;i++){
			setTimeout('$("#home_overlay_ad_'+i+'").fadeOut(50);$("#home_overlay_btn_'+i+'").fadeOut(50);$("#home_overlay_text_'+i+'").removeClass("c");',0);
		}
		$("#home_search_ctn select").css("visibility","visible");
		$('.home_overlay_text a').removeClass('u');
	});
});

(function($){
	$.fn.extend({
	        Scroll:function(opt,callback){
	                //参数初始化
	                if(!opt) var opt={};
	                var _btnUp = $("#"+ opt.up);//Shawphy:向上按钮
	                var _btnDown = $("#"+ opt.down);//Shawphy:向下按钮
	                var timerID;
	                var _this=this.eq(0).find("ul:first");
	                var     lineH=_this.find("li:first").height(), //获取行高
	                        line=opt.line?parseInt(opt.line,10):parseInt(this.height()/lineH,10), //每次滚动的行数，默认为一屏，即父容器高度
	                        speed=opt.speed?parseInt(opt.speed,10):500; //卷动速度，数值越大，速度越慢（毫秒）
	                        timer=opt.timer; //?parseInt(opt.timer,10):3000; //滚动的时间间隔（毫秒）
	                if(line==0) line=1;
	                var upHeight=0-line*lineH;
	                //滚动函数
	                var scrollUp=function(){
	                        _btnUp.unbind("click",scrollUp); //Shawphy:取消向上按钮的函数绑定
	                        _this.animate({
	                                marginTop:upHeight
	                        },speed,function(){
	                                for(i=1;i<=line;i++){
	                                        _this.find("li:first").appendTo(_this);
	                                }
	                                _this.css({marginTop:0});
	                                _btnUp.bind("click",scrollUp); //Shawphy:绑定向上按钮的点击事件
	                        });
	                }
	                //Shawphy:向下翻页函数
	                var scrollDown=function(){
	                        _btnDown.unbind("click",scrollDown);
	                        for(i=1;i<=line;i++){
	                                _this.find("li:last").show().prependTo(_this);
	                        }
	                        _this.css({marginTop:upHeight});
	                        _this.animate({
	                                marginTop:0
	                        },speed,function(){
	                                _btnDown.bind("click",scrollDown);
	                        });
	                }
	               //Shawphy:自动播放
	                var autoPlay = function(){
	                        if(timer)timerID = window.setInterval(scrollUp,timer);
	                };
	                var autoStop = function(){
	                        if(timer)window.clearInterval(timerID);
	                };
	                 //鼠标事件绑定
	                _this.hover(autoStop,autoPlay).mouseout();
	                _btnUp.css("cursor","pointer").click( scrollUp ).hover(autoStop,autoPlay);//Shawphy:向上向下鼠标事件绑定
	                _btnDown.css("cursor","pointer").click( scrollDown ).hover(autoStop,autoPlay);

	        }       
	});
})(jQuery);

function showMore(id) {
    var tools = document.getElementById(id);
    tools.style.display = "block";
    tools.parentNode.onmouseout = function ()
	{
        tools.style.display = "none";
    }
	 tools.onmouseover = function () 
	 {
        tools.style.display = "block";
    }
}

//Enter 提交
    function doClick(buttonName, e) {
        var key;
        if (window.event) {
            key = window.event.keyCode;
            //IE
        }
        else {
            key = e.which;
            //firefox
        }
        if (key == 13) {
            //Get the button the user wants to have clicked
            var btn = document.getElementById(buttonName);
            if (btn != null) {
                btn.onclick();
                //event.keyCode = 0;
            }
        }
    }
    function so(n) {
        var soTxt = document.getElementById("seach_text_ft").value;
        var soItem = document.getElementsByName("soItems" + n);
        //alert(soItem.length);

        if (soTxt == "") {
            alert("请输入关键字！");
            return false;
        }
        for (var i = 0; i < soItem.length; i++) {
            if (soItem[i].checked) {
                var itval = soItem[i].value;
            }
        }
        if (itval == "gt") {
            window.open("http://www.gaitu.com/so/?cd=0&wd=" + encodeURI(soTxt).toLowerCase(), "_blank");
        }
        else if (itval == "hy") {
            window.open("http://www.gaitu.com/so/i/?wd=" + encodeURI(soTxt).toLowerCase(), "_blank");
        }
        else if (itval == "xg") {
            window.open("http://p.gaitu.com/so.aspx?wd=" + encodeURI(soTxt).toLowerCase(), "_blank");
        }
        return true;
    }
    function closenotice()
    {
	    document.getElementById("gtnotice").style.display = "none";
    }
    
    
    
