﻿$(function() {
    $("#myformlogin").submit(function() {
        if ($(this).find("input[name=username]").val() == "") {
            alert("请输入用户名"); $(this).find("input[name=username]").focus(); return false;
        }
        if ($(this).find("input[name=userpwd]").val() == "") {
            alert("请输入密码"); $(this).find("input[name=userpwd]").focus(); return false;
        }
        if ($(this).find("input[name=txt_ccode]").val() == "") {
            alert("请输入验证码"); $(this).find("input[name=txt_ccode]").focus(); return false;
        }
    })
})

//切换

var t = n = 0, count = $("#playShow a").size();
$(function() {
    $("#playShow a:not(:first-child)").hide();
    $("#playText").html($("#playShow a:first-child").find("img").attr('alt'));
    $("#playNum a:first").css({ "background": "#FFD116", 'color': '#A8471C' });
    $("#playText").click(function() { window.open($("#playShow a:first-child").attr('href'), "_blank") });
    $("#playNum a").click(function() {
        var i = $(this).text() - 1;
        n = i;
        if (i >= count) return;
        $("#playText").html($("#playShow a").eq(i).find("img").attr('alt'));
        $("#playText").unbind().click(function() { window.open($("#playShow a").eq(i).attr('href'), "_blank") })
        $("#playShow a").filter(":visible").hide().parent().children().eq(i).fadeIn(1200);
        $(this).css({ "background": "#FFD116", 'color': '#A8471C' }).siblings().css({ "background": "#D7D6D7", 'color': '#000' });
    });
    t = setInterval("showAuto()", 5000);
    $("#play").hover(function() { clearInterval(t) }, function() { t = setInterval("showAuto()", 5000); });
})
function showAuto() {
    n = n >= (count - 1) ? 0 : ++n;
    $("#playNum a").eq(n).trigger('click');
}