﻿//IE6去除png灰色背景
$(document).ready(function() {
    $(document).pngFix();

    //禁用鼠标右键
    $(document).bind("contextmenu", function (e) {
    return false;
    });

    //禁止选择页面内容
    document.onselectstart = new Function("event.returnValue=false");

    SetSecondMenuHeight();
    SetThreeMenuHeight();

    $(".firstItem").hover(function () {
        $(this).find(".secondMenu").show();
    }, function () {
        $(this).find(".secondMenu").hide();
    })

    $(".secondLI").hover(function () {
        $(this).find(".threeMenu").show();
    }, function () {
        $(this).find(".threeMenu").hide();
    })
})

//动态设置二级下拉菜单高度
function SetSecondMenuHeight() {
    $(".secondMenu").each(function (i) {
        $(this).find(".secondBG").css("height", (($(this).find(".secondLI").length * 25) + 2) + "px");
        $(this).find(".secondDIV").css("margin-top", ((($(this).find(".secondLI").length * 25) + 2) * -1) + "px");
    })
}

//动态设置三级下拉菜单高度
function SetThreeMenuHeight() {
    $(".threeMenu").each(function (i) {
        $(this).find(".threeBG").css("height", (($(this).find("a").length * 25) + 2) + "px");
        $(this).find(".threeDIV").css("margin-top", ((($(this).find("a").length * 25) + 2) * -1) + "px");
    })
}

function JHshNumberText() {
    if (!(((window.event.keyCode >= 48) && (window.event.keyCode <= 57))
	|| (window.event.keyCode == 13) || (window.event.keyCode == 46)
	|| (window.event.keyCode == 45))) {
        window.event.keyCode = 0;
    }
}


//验证
function checkReg() {
    if ($("#ctl00_ContentPlaceHolder1_TextBox1").val() == "") {
        alert("请输入公司名称!");
        return false;
    }
    if ($("#ctl00_ContentPlaceHolder1_TextBox2").val() == "") {
        alert("请输入所在城市!");
        return false;
    }
    if ($("#ctl00_ContentPlaceHolder1_TextBox3").val() == "") {
        alert("请输入公司地址!");
        return false;
    }
    if ($("#ctl00_ContentPlaceHolder1_TextBox4").val() == "") {
        alert("请输入联系人!");
        return false;
    }
    if ($("#ctl00_ContentPlaceHolder1_TextBox5").val() == "") {
        alert("请输入联系电话!");
        return false;
    }
    if ($("#ctl00_ContentPlaceHolder1_Verfity").val() == "") {
        alert("请输入验证码!");
        return false;
    }
    return true;
}

function chgYZM() {
    setTimeout(refreshimg, 1);
}
function refreshimg() {
    var s = "/Controller/ValidateCode.aspx?" + Math.random();
    $("#yzm").attr("src", s);
}

