var currImg, imgCnt, delay;

$(function () {

    if (scripts_isIE6) $(document).pngFix();

    $("a.ro").mbRollover();

    $("#lNav > div").hover(function () {
        if ($(this).attr("class") != "navArrowLock") $(this).toggleClass("navArrow");

    }, function () {
        if ($(this).attr("class") != "navArrowLock") $(this).toggleClass("navArrow");
    });

    $('.alumniMore > a').click(function () {

        var divid = $(this).attr("rel");
        var toshow = $('#' + divid).children('td.alumInner').children('div').css("display");

        if (toshow == "none") {
            $('#' + divid).children('td').children('div').show("normal");
            $(this).children("img").attr("src", "/images/showMore2.gif");
        } else {
            $('#' + divid).children('td').children('div').hide("normal");
            $(this).children("img").attr("src", "/images/showMore.gif");
        }
        return false;
    });

    $("a[rel^='lightbox']").prettyPhoto({
        animationSpeed: 'slow',
        padding: 40,
        opacity: 0.85,
        showTitle: false,
        allowresize: true,
        counter_separator_label: '/',
        theme: 'light_square'
    });

    $("a[rel^='printable']").click(function () {
        var href = $(this).attr("href");
        popWindowMenus(href, 'PrintableWin', '770', '680');
        return false;
    });

    $("#useShipForBill1").click(function () {
        $("#regBillingForm").hide();
    });

    $("#useShipForBill2").click(function () {
        $("#regBillingForm").show();
    });

    $(".payType").click(function () {
        if ($(this).attr("value") == "Credit Card") {
            with(document.form1) {
                enableField(cc);
                enableField(ccType);
                enableField(expMonth);
                enableField(expYear);
                enableField(cvv);
            }
            $("#ccForm").show();
        } else {
            with(document.form1) {
                disableField(cc);
                disableField(ccType);
                disableField(expMonth);
                disableField(expYear);
                disableField(cvv);
            }
            $("#ccForm").hide();
        }
    });

    $("#clearForm").click(function () {
        clearForm(document.form1);
        $("#regBillingForm").hide();
        $("#ccForm").show();
        with(document.form1) {
            useShipForBill[0].checked = true;
            customerAmount[0].checked = true;
            paymentType[0].checked = true;
            enableField(cc);
            enableField(ccType);
            enableField(expMonth);
            enableField(expYear);
            enableField(cvv);
        }
    });

    if ($("#main-bg").length>0) {
        currImg = 1;
        imgCnt = 6;
        delay = 5000;
	$("#main-bg-img2").fadeOut("fast");
	$("#main-bg-img3").fadeOut("fast");
	$("#main-bg-img4").fadeOut("fast");
	$("#main-bg-img5").fadeOut("fast");
	$("#main-bg-img6").fadeOut("fast");
        setTimeout("changeImage()", delay);
    }

});

function changeImage(){
    var nextImg = currImg+1;
    if (nextImg>imgCnt) {
        nextImg = 1;
    }
    $("#main-bg-img"+currImg).fadeOut(1000, function() {
	//callback
    });
    $("#main-bg-img"+nextImg).fadeIn(1500, function() {
        currImg = nextImg;
        setTimeout("changeImage()", delay);
    });
}

