﻿// the config for the main innerfade piece
function getParameterByName( name )
{  
    name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");  
    var regexS = "[\\?&]"+name+"=([^&#]*)";  
    var regex = new RegExp( regexS );  
    var results = regex.exec( window.location.href );  
    if( results == null )    
    return "";  
    else    
    return decodeURIComponent(results[1].replace(/\+/g, " "));
}

var urlValue = getParameterByName('id');

$(document).ready(function() {

    
    // accordion for programs and degrees
    $("#accordion").accordion({
        header: "h3",
        autoHeight: false,
        collapsible: true,
        active: parseFloat(urlValue)

    });

    $(".acc_event0").click(function(event) {
        window.location = '?id=0';
    });
    $(".acc_event1").click(function(event) {
        window.location = '?id=1';
    });
    $(".acc_event2").click(function(event) {
        window.location = '?id=2';
    });
    $(".acc_event3").click(function(event) {
        window.location = '?id=3';
    });
    $(".acc_event4").click(function(event) {
        window.location = '?id=4';
    });


    // accordion for homepage
    $("#acc_hp").accordion({
        active: 2,
        autoHeight: false
    });

    // innerfade (cect)
    $('#portfolio').innerfade({
        speed: 'slow',
        timeout: 6000,
        type: 'sequence',
        containerheight: '220px'
    });

    // innerfade (computer center)
    $('#compcenter').innerfade({
        speed: 'slow',
        timeout: 10000,
        type: 'sequence',
        containerheight: '225px'
    });

    //	initialize popup box				
    $("#popup_full").fancybox({
        'width': 750,
        'height': 550,
        'autoScale': false,
        'transitionIn': 'fade',
        'transitionOut': 'none',
        'type': 'iframe'
    });
    $(".popup_full_class").fancybox({
        'width': 750,
        'height': 550,
        'autoScale': false,
        'transitionIn': 'fade',
        'transitionOut': 'none',
        'type': 'iframe'
    });
    $(".popup_library").fancybox({
        'width': 480,
        'height': 410,
        'autoScale': true,
        'transitionIn': 'fade',
        'transitionOut': 'none',
        'titlePosition': 'outside',
        'type': 'iframe'
    });
    $("#popup_web").fancybox({
        'width': 1050,
        'height': 775,
        'transitionIn': 'fade',
        'transitionOut': 'none',
        'type': 'iframe'
    });

    $("#popup_gallery").fancybox({
        'width': 470,
        'height': 420,
        'autoScale': false,
        'transitionIn': 'fade',
        'transitionOut': 'none',
        'type': 'iframe'
    });

    $("#popup_swf").fancybox({
        'width': 750,
        'height': 550,
        'autoScale': true,
        'transitionIn': 'fade',
        'transitionOut': 'none',
        'type': 'swf'
    });


    // initialize dropdown menus
    jQuery(function() {
        jQuery('ul.sf-menu').superfish({
            delay: 400,
            animation: {		// fade-in and slide-down animation 
                height: 'show'
            },
            speed: 275
        });
    });

    $.localScroll({
        hash: true,
        duration: 200,
        filter: ':not(.library_tabs)'
    });

});

