﻿        $(document).ready(function() { 
            $('ul.sf-menu').superfish({ 
                delay:       500,                            // one second delay on mouseout 
                animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
                speed:       'slow',                          // faster animation speed 
                autoArrows:  false,                           // disable generation of arrow mark-up 
                dropShadows: false                            // disable drop shadows 
            }); 
        }); 
        
        
        (function($) {
$.fn.expandAll = function(options) {
    var defaults = {
         trigger1 : '',
         trigger2 : '',
         cllps : 'div.collapse',
         exp : 'span.expand',
         container : '#' + this.attr("id") + ' ',
         ref : 'div',
         showMethod : 'show',
         hideMethod : 'hide',
         speed : ''
    };
    var o = $.extend({}, defaults, options);   
    return this.each(function() {
        $(this).find('#switch a').click(function() {
        var $cllps = $(this).closest(o.container).find(o.cllps),
            $exp = $(this).closest(o.container).find(o.exp);
        if ($(this).text() == o.trigger1) {
          $(this).text(o.trigger2);
          $exp.addClass('open');
          $cllps[o.showMethod](o.speed);
        } else {
          $(this).text(o.trigger1);
          $exp.removeClass('open');
          $cllps[o.hideMethod](o.speed);
        }
        return false;
    });
});};

//http://www.learningjquery.com/2008/02/simple-effects-plugins:
$.fn.fadeToggle = function(speed, easing, callback) {
    return this.animate({opacity: 'toggle'}, speed, easing, callback);
};
$.fn.slideFadeToggle = function(speed, easing, callback) {
    return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback);
};
})(jQuery);
////////////////////////////
var div1Opened = false;
var div2Opened = false;

    
function toggleDiv1()
{   
        $('#footer div.demo:eq(1) span.expand').toggleClass('open')
        .next('#footer div.demo:eq(1) div.collapse').slideFadeToggle('slow','linear');
}

function toggleDiv2()
{
    $('#footer div.demo:eq(0) span.expand').toggleClass('open')
    .next('#footer div.demo:eq(0) div.collapse').slideFadeToggle('slow','linear');
}

$(function() {
    $('#footer').expandAll().find('div.collapse').hide().end()
    .find('span.expand').wrapInner('<a href="#" class="arrow" title="Expand/Collapse" />');
    
    $('#footer div.demo:eq(0) span.expand').click(function() {
        
        if (div1Opened == true)
        {
            div1Opened = false
        }
        else
        {
            div1Opened = true
        }
        
        if (div2Opened == true)
        {
            div2Opened = false;      
            $('#footer div.demo:eq(1) span.expand').toggleClass('open')
            .next('#footer div.demo:eq(1) div.collapse').slideFadeToggle('slow','linear');
            setTimeout("toggleDiv2()", 800);
        }  
        else
        {
            toggleDiv2();
        }
        
        return false;
    });
    
    $('#footer div.demo:eq(1) span.expand').click(function() {        
        
        if (div2Opened == true)
        {
            div2Opened = false
        }
        else
        {
            div2Opened = true
        }
        
        if (div1Opened == true)
        {
            div1Opened = false;
            $('#footer div.demo:eq(0) span.expand').toggleClass('open')
            .next('#footer div.demo:eq(0) div.collapse').slideFadeToggle('slow','linear');
            setTimeout("toggleDiv1()", 800);
        }
        else
        {
            toggleDiv1();    
        }
        
        
        return false;
    });


});


$(document).ready(function () {
    $('.session .row .details label a').click(function () {
        $('.session .row .details .desc').slideUp('slow');
        $('.session .row .details label a').html('more details');
        var lnkID = $(this).attr("id");
        var strID = $(this).attr("rel");
        if ($(strID).is(':hidden')) {
            $(strID).slideDown("slow", function () {
                $('#' + lnkID).html('hide details');
            });

        }
        else {
            $(strID).slideUp("slow", function () {
                $('#' + lnkID).html('more details');
            });
        }



    });
});

// course outline

//tabs friday
$(document).ready(function () {
    $('#divPreliminaryProgramme ul.tabs li a.friday').click(function () {
        $('#saturdayProgramme').fadeOut('500', function () {
            $('#fridayProgramme').fadeIn('500', function () {
                $('#divPreliminaryProgramme ul.tabs li a.friday').addClass('sel');
                $('#divPreliminaryProgramme ul.tabs li a.saturday').removeClass('sel');
            });
        });
    });
});

//tabs saturday
$(document).ready(function () {
    $('#divPreliminaryProgramme ul.tabs li a.saturday').click(function () {
        $('#fridayProgramme').fadeOut('500', function () {
            $('#saturdayProgramme').fadeIn('500', function () {
                $('#divPreliminaryProgramme ul.tabs li a.saturday').addClass('sel');
                $('#divPreliminaryProgramme ul.tabs li a.friday').removeClass('sel');
            });
        });
    });
});

////box friday Blue
$(document).ready(function () {
    $('#divPreliminaryProgramme .boxes a').click(function () {

        var strDivId = $(this).attr("rel");
        var strIndex = $(this).attr("class");

        if ($('#divPreliminaryProgramme ' + strDivId + ' div.' + strIndex).is(':hidden')) {


            $('#divPreliminaryProgramme ' + strDivId.toString().replace("Details", "") + ' a').removeClass('open');

            var booHasDiv = false;

            $('#divPreliminaryProgramme ' + strDivId + ' div:visible').slideUp('1000', function () {
                booHasDiv = true;
                $('#divPreliminaryProgramme ' + strDivId + ' div.' + strIndex).slideDown('1000');
            });

            if (booHasDiv == false) {
                $('#divPreliminaryProgramme ' + strDivId + ' div.' + strIndex).slideDown('1000');
            }

            $(this).addClass('open');
        }
        else {
            $(this).removeClass('open');
            strIndex = $(this).attr("class");
            $('#divPreliminaryProgramme ' + strDivId + ' div.' + strIndex).slideUp('1000');
        }

    });
});

//$(document).ready(function () {
//    $('#divPreliminaryProgramme #fridayBoxes a.blue').click(function () {
//        if ($('#divPreliminaryProgramme .hidden div#fridayBlueDetails').is(':hidden')) {
//            $('#divPreliminaryProgramme .hidden div:not(#fridayBlueDetails)').slideUp('1000', function () {
//                $('#divPreliminaryProgramme .hidden div#fridayBlueDetails').slideDown('1000', function () {
//                    $('#divPreliminaryProgramme #fridayBoxes a').removeClass('open');
//                    $('#divPreliminaryProgramme #fridayBoxes a.blue').addClass('open');
//                });
//            });
//        }
//        else {
//            $('#divPreliminaryProgramme .hidden div#fridayBlueDetails').slideUp('1000', function () {
//                $('#divPreliminaryProgramme #fridayBoxes a.blue').removeClass('open');
//            });            
//        }
//    });
//});

////box friday Red
//$(document).ready(function () {
//    $('#divPreliminaryProgramme #fridayBoxes a.red').click(function () {
//        if ($('#divPreliminaryProgramme .hidden div#fridayRedDetails').is(':hidden')) {
//            $('#divPreliminaryProgramme .hidden div:not(#fridayRedDetails)').slideUp('1000', function () {
//                $('#divPreliminaryProgramme .hidden div#fridayRedDetails').slideDown('1000', function () {
//                    $('#divPreliminaryProgramme #fridayBoxes a').removeClass('open');
//                    $('#divPreliminaryProgramme #fridayBoxes a.red').addClass('open');
//                });
//            });
//        }
//        else {
//            $('#divPreliminaryProgramme .hidden div#fridayRedDetails').slideUp('1000', function () {
//                $('#divPreliminaryProgramme #fridayBoxes a.red').removeClass('open');
//            });
//        }
//    });
//});




	    function showCourseOutline(CourseNum) {
	        hideCourseOutlines();
	        document.getElementById("divCourseOutline" + CourseNum).style.display = "block";

	        if (CourseNum == 1) {
	            document.getElementById("lnkPrev").className = "disabled";
	            document.getElementById("lnkPrev2").className = "disabled";
	            document.getElementById("lnkNext").className = "";
	            document.getElementById("lnkNext2").className = "";
	        } else if (CourseNum == 2) {
	            document.getElementById("lnkPrev").className = "";
	            document.getElementById("lnkPrev2").className = "";
	            document.getElementById("lnkNext").className = "";
	            document.getElementById("lnkNext2").className = "";
	        } else if (CourseNum == 3) {
	            document.getElementById("lnkPrev").className = "";
	            document.getElementById("lnkPrev2").className = "";
	            document.getElementById("lnkNext").className = "disabled";
	            document.getElementById("lnkNext2").className = "disabled";
	        }
	    }
	    function hideCourseOutlines() {
	        document.getElementById("divCourseOutline1").style.display = "none";
	        document.getElementById("divCourseOutline2").style.display = "none";
	        document.getElementById("divCourseOutline3").style.display = "none";
	    }
	    function CourseOutlinePrev() {
	        if (document.getElementById("divCourseOutline2").style.display == "block") {
	            showCourseOutline(1);
	        } else if (document.getElementById("divCourseOutline3").style.display == "block") {
	            showCourseOutline(2);
	        }
	    }
	    function CourseOutlineNext() {
	        if (document.getElementById("divCourseOutline1").style.display == "block" || document.getElementById("divCourseOutline1").style.display == "") {
	            showCourseOutline(2);
	        } else if (document.getElementById("divCourseOutline2").style.display == "block") {
	            showCourseOutline(3);
	        }
	    }
	    

        function OnSpecialityChange() {
            if ( document.getElementById("ddlSpeciality").selectedIndex == 4){
                document.getElementById("divSpecialityOther").style.display = 'block';
            }
            else {
                document.getElementById("divSpecialityOther").style.display = 'none';	        
            }    
        }	        
