﻿/// <reference path="jquery-1.4.1.min.js" />

function closeMenu() {
    for (k = 1; k < 6; k++) {
        $("#menu" + k).hide();
    }
}

$(document).ready(function () {
    $(".header>ul>li").each(function (i) {
        $(this).hover(function () {
            $("#menu" + i).show();
            for (k = 1; k < 6; k++) {
                if (k != i) {
                    $("#menu" + k).hide();
                }
            }
        }, function () {
            $("#menu" + i).show();
        });
    });
    //小板块失去焦点后隐藏
    for (j = 1; j < 6; j++) {
        $("#menu" + j).hover(null, function () {
            $(this).hide();
        });
    }
});

function SwapTab(name, cls_show, cls_hide, cnt, cur) {
    for (i = 1; i <= cnt; i++) {
        if (i == cur) {
            $('#div_' + name + '_' + i).show();
            $('#tab_' + name + '_' + i).attr('class', cls_show);
        } else {
            $('#div_' + name + '_' + i).hide();
            $('#tab_' + name + '_' + i).attr('class', cls_hide);
        }
    }
}

$(function () {

    $("#btnsubmit").click(function () {
        if ($("#Email").val() == "") {
            alert("请输入您的邮箱");
            return false;
        } else if ($("#Phone").val() == "") {
            alert("请输入您的手机号码");
            return false;
        } else if ($("#Address").val() == "") {
            alert("请输入您的邮寄地址");
            return false;
        } else if ($("#PostCode").val() == "") {
            alert("请输入您的邮政编码");
            return false;
        } else {
            return true;
        }

    });


    $("#linksqtj").hover(function () {
        $("#ul_child_1").show();
    });
    $("#linkxmlc").hover(function () {
        $("#ul_child_2").show();
    });

    $(".date").each(function () {
        $(this).datepicker({
            showMonthAfterYear: true, // 月在年之后显示        
            changeMonth: true,   // 允许选择月份        
            changeYear: true,   // 允许选择年份        
            dateFormat: 'yy-mm-dd',  // 设置日期格式        
            closeText: '关闭',   // 只有showButtonPanel: true才会显示出来           duration: 'fast',        
            showAnim: 'fold',
            showOtherMonths: true,
            showButtonPanel: true,
            minDate: '-50y',
            maxDate: '+1y',
            onSelect: function (dateText, inst) {
                if ($(this).attr("id") == "T_BeginDate") {
                    var dates = new Date(dateText)
                    var dateend = new Date("2017-03-09")
                    if (dates.getTime() > dateend.getTime()) {
                        $("#HLXX").hide();
                        $('#Pre_EndDate').val("");
                        $('#Pre_BeginDate').val("");
                        $('#Pre_Treatment').attr("disabled", "disabled");
                        $('#Pre_EndDate').attr("disabled", "disabled");
                        $('#Pre_BeginDate').attr("disabled", "disabled");
                        $('#Pre_OtherDrugDelivery').attr("disabled", "disabled");


                        $("#TRHLFA").show();
                    } else {
                        $("#HLXX").show();
                        $("#TRHLFA").hide();

                        $('#Pre_Treatment').removeAttr("disabled");
                        $('#Pre_EndDate').removeAttr("disabled");
                        $('#Pre_BeginDate').removeAttr("disabled");
                        $('#Pre_OtherDrugDelivery').removeAttr("disabled");                   
                    }

                }
            }
        });
        //$(this).attr("readonly", "true").datepicker();
    });
});
