var issend = 0;
var boolclick = true;
    
//解决回调函数中，this引用无效的问题
this.bind = function(instance, method)
{
    return function()
    {
	    method.apply(instance, arguments);
    }
}

this.GetBestSkyList = function()
{
    Request.sendPOST("NewSkyList.aspx?n=1", "",
    this.bind(this, this.ReturnBestList), null, null);
}

this.ReturnBestList = function(req)
{
    $("#BESTSKY").html(req.responseText);
     $('#BESTSKY').cycle({ 
            fx:     'scrollUp', 
            timeout: 5000
        }); 
}

this.ReturnSend = function(req)//用户投票回调函数
{
    issend = 0;
    if(req.responseText == "")
    {
        $("#mes").html('用户名密码有误,请重新输入');
        return;
    }
    $("#LoginArea").html(req.responseText);
}

this.UserLogin = function()
{
    
    if($("#txbUserName").val() == "")
    {
        $("#mes").html('请填写用户名');
        return;
    }
    if($("#txbPwd").val() == "")
    {
        $("#mes").html('请填写密码');
        return;
    }
    if(issend == 1)
    {
        $("#mes").html('登录中……请稍候……');
        return;
    }
    issend=1;
    Request.sendPOST("AjaxLogin.aspx", "d="+new Date+"&n=1&un="+escape($("#txbUserName").val())+"&pw="+escape($("#txbPwd").val()),
    this.bind(this, this.ReturnSend), null, null); 
}

this.gourl = function(mainurl,seconurl)
{
  window.open(mainurl+'&url='+escape(seconurl));
}

 $(document).ready(function() {
        
        GetBestSkyList();
        $('#s1').cycle({ 
            fx:    'fade', 
            pause:  1 ,
            speed:  2500 
        });
        
        $('#BESTSKY').cycle({ 
            fx:     'scrollUp', 
            timeout: 6000,
            delay:  -2000
        });
        
        $('#aclist').cycle({ 
            fx:     'scrollRight', 
            timeout: 4000,
            delay:  3000,
            after:onAfter 
        });      
        
        $("span").map(function(){
            if($(this).html().indexOf("进") > 0)
            {
                $(this).css("color","#FF5400");
            }
            else
            {
                $(this).css("color","#333333");
            }
        });
});



this.onAfter = function()
{
    if(boolclick)
    {
        var topid = $(this).attr("id");
        $("img[name='acxing']").map(function(){
            $(this).attr("src","images/addefault_07.jpg");
        });
        $("#x"+topid+"").attr("src","images/addefault_05.jpg")
    }
}

this.showimgto = function(v,obj)
{
    
    $("img[name='acxing']").map(function(){
            $(this).attr("src","images/addefault_07.jpg");
     });
    boolclick = false;
    $("#aclist").hide();
    $("#oneacimg").show();
    $("#oneacimg").html($("#"+v+"").html());
    $(obj).attr("src","images/addefault_05.jpg")
    setTimeout(function(){
       dongoto();
    },10000);
}

this.dongoto=function()
{
    $("#aclist").show();
    $("#oneacimg").hide();
    boolclick = true;
}

this.changeimg = function(src)
{
   $("#s1").hide();
   $("#imgss").remove();
   $("#s1").after("<img id=\"imgss\" src="+src+">"); 
   setTimeout(function(){
       $("#imgss").remove();
       $("#s1").show(); 
   },30000);
}


