﻿var cur_big_img_index = 2;
var imgfolder = "/images/hd/";
var img_id_perfix = "hd_img_";
var big_img_perfix = "_big.jpg";
var sml_img_perfix = "_sml.jpg";
var change_opacity_speed = 50;
var auto_run_cnt = 0;

function big_img_nav(idx)
{
    if (idx == cur_big_img_index)
    {
        if (idx == 1)
        {
            window.location = "/hpuser/startgames.aspx";
        }
        else if (idx == 2)
        {
            window.location = "/site-information/jingxiandoudizhu-bisai-shiyunying-24976.html";
        }
        else if (idx == 3)
        {
            window.location = "/hpuser/tuiguang.aspx";
        }
    }
}

function change_big(idx)
{
    if (idx != cur_big_img_index) 
    {
        var cur_big_img = img_id_perfix + cur_big_img_index;
        var cur_op_img = img_id_perfix + idx;

        $(cur_big_img).src = imgfolder + cur_big_img_index + sml_img_perfix;

        if (idx == 2)
        {
            $(cur_op_img).src = imgfolder + idx + "_big.gif";
        }
        else
        {
            $(cur_op_img).src = imgfolder + idx + big_img_perfix;
        }

        cur_big_img_index = idx;
        auto_run_cnt = 0;

        $(cur_big_img).filters[0].opacity = 90;
        //
        $(cur_op_img).filters[0].opacity = 10;
        change_opacity(idx);
    }
}
//
function change_opacity(idx)
{
    var cur_op_img = img_id_perfix + idx;
    $(cur_op_img).filters[0].opacity += 10;
    if ($(cur_op_img).filters[0].opacity < 100)
    {
        setTimeout("change_opacity(" + idx + ")", change_opacity_speed);
    }
    else
    {
        $(cur_op_img).filters[0].opacity = 100;
    }
}
function change_this_opacity(idx, vlu)
{
    if (idx != cur_big_img_index)
    {
        var cur_op_img = img_id_perfix + idx;
        $(cur_op_img).filters[0].opacity = vlu;
        if (vlu == 100)
        {
            setTimeout("change_big(" + idx + ")", 600);
        }
    }
}
function auto_change_big()
{
    auto_run_cnt++;
    if (auto_run_cnt > 5)
    {
        var temp = cur_big_img_index + 1;
        if (temp > 3)
            temp = 1;
        change_big(temp);
        auto_run_cnt = 0;
    }
}
setInterval(auto_change_big, 1200);