$(document).ready(function() {

$('#announcement').after('<div id="featureNav">').cycle({
    fx: 'fade',
    pager: '#featureNav',
    pause: 1,
    speed: 500,
    timeout: 15000
});

$('#newslist li:nth-child(odd)').addClass('alternate');

$("#Payment").change(function() {
    $("#Payment").val() == "Visa" | $("#Payment").val() == "MasterCard" | $("#Payment").val() == "American Express" ? $(".altHide").show() : $(".altHide").hide();
});

var myFile = document.location.toString();

if (myFile.match('course')) { // the URL contains an anchor
    // click the navigation item corresponding to the anchor
    var myAnchor = myFile.split('#')[1];

    var toggleLink = $('a[href="#' + myAnchor + '"]').attr("rel");
    $('div #' + toggleLink).toggle();
    if (myAnchor) {
        var top = $('#' + myAnchor).offset().top;
        self.scrollTo(0, top);
    }

}

$('.CourseLink').click(function() {
    $("#Course1").hide();
    $("#Course2").hide();
    $("#Course3").hide();
    $("#Course4").hide();
    $("#Course5").hide();
    $("#Course6").hide();
    $("#Course7").hide();
    $("#Course8").hide();

    $('div #' + $(this).attr("rel")).toggle();
});

});

// centered popUp window
function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable';
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
