﻿$(function () {
    $("#listUL>li:has(ul)").click(function (event) {
        if ($("ul", $(this)).is(":hidden")) {
            $("#listUL>li:has(ul)").each(function (i) {
                $("ul", $(this)).slideUp();
                $(this).attr("class", "arrow_close");
            });
            $(this).attr("class", "arrow_open");
            $("ul", $(this)).slideDown();
        } else {
            $(this).attr("class", "arrow_close");
            $("ul", $(this)).slideUp();
        }
    })
    $("#listUL2>li:has(ul)").click(function (event) {
        if ($("ul", $(this)).is(":hidden")) {
            $("#listUL2>li:has(ul)").each(function (i) {
                $("ul", $(this)).slideUp();
                $(this).attr("class", "arrow_close");
            });
            $(this).attr("class", "arrow_open");
            $("ul", $(this)).slideDown();
        } else {
            $(this).attr("class", "arrow_close");
            $("ul", $(this)).slideUp();
        }
    })
    /*
    $("#nav li").mouseover(function(){
    $("ul",$(this).css("background","#a90000")).css("display","block");						
    })
    .mouseout(function(){
    $("ul",$(this).css("background","gray")).css("display","none");
    $("li",$(this)).css("background","url(../images/jpg/subMenu_bg.jpg)");
    })

	
	
	
    $("#colRight a").attr("target","_blank");
	
    $(".w159 li a").each(function(){
    //alert($(this).text()=="高才学员影集");
    if($(this).text()=="高才学员影集"){
    $(this).attr("target","_blank");
    }
    if($(this).text()=="CMA讲师"){
    $(this).attr("target","_blank");
    }
    if($(this).text()=="美国CPA讲师"){
    $(this).attr("target","_blank");
    }
    });
	
    $("#AD div a").each(function(){
    //alert($(this).text()=="高才学员影集");
    if($(this).text()=="权威教材"){
    $(this).attr("target","_blank");
    }
    if($(this).text()=="课程视听"){
    $(this).attr("target","_blank");
    }
    if($(this).text()=="在线模拟考试"){
    $(this).attr("target","_blank");
    }
    });
    */
    $("#CMA_SReport li a").each(function (i) {
        if (i < 3) {
            $(this).addClass("red");
        }
    })
    $("#CMA_Subject li a").each(function (i) {
        if (i < 3) {
            $(this).addClass("red");
        }
    })
    $("#new_News li a").each(function (i) {
        if (i < 3) {
            $(this).addClass("red");
        }
    })
    $("#CimaReport p a").each(function (i) {
        if (i < 1) {
            $(this).addClass("red");
        }
    })
    var n = 1;
    for (n = 1; n <= 6; n++) {
        var str = "#CMAAndAICPA" + n + " p a";
        $(str).each(function (i) {
            if (i < 3) {
                $(this).addClass("red");
            }
        })
    }

    /*
    if($("#colRight").children().eq(2).attr("style")=="border: 1px solid rgb(153, 153, 153);"){
    var dom=$("#colRight").children().eq(2);
    //dom.attr("style","border-top:0px; border-bottom:0px;")
    dom.attr("style"," margin-bottom:0px; padding-bottom:0px;").addClass("b d1");
    dom.prepend("<b class='b1'></b><b class='b2 d1'></b><b class='b3 d1'></b><b class='b4 d1'></b>");
    dom.append("<b class='b4b d1'></b><b class='b3b d1'></b><b class='b2b d1'></b><b class='b1b'></b>");
    dom.html( "<div><b class='b1'></b><b class='b2 d1'></b><b class='b3 d1'></b><b class='b4 d1'></b>"+dom.html()+"<b class='b4b d1'></b><b class='b3b d1'></b><b class='b2b d1'></b><b class='b1b'></b></div>" ); 
    }
    */
    var url = $("#selectStates option[@selected]").attr("value") + ".htm";
    $("#selectStates").change(function () {
        url = $("option[@selected]", this).attr("value") + ".htm";
        //alert(url);
    });
    $("#search").click(function () { window.location.href = url; });




    $("input[type=button]").click(function () {
        var length = $(this).parent().prevAll(":checked").length;
        //alert(length);
        var flag = "F";
        flag = $(this).parent().prevAll(":checked").slice(0, 1).attr("value");
        if (flag == "T") {
            var text = "text:" + $(this).attr("name");
            dialog("Correct Answer:", text, "500px", "auto", "text");
        } else {
            var text = "text:" + "The answer you selected for this question is incorrect. Please try again."
            dialog("Incorrect Answer ", text, "500px", "auto", "text");
        }
    });
})
