// global education namespace
var EDU = { }

EDU.print = function() {
    $('.print a').click(function() {
        window.print();
        return false;
    });
}

EDU.initialize = function() {
    EDU.print();
}

$(document).ready(function() {
    EDU.initialize();
});

// university-101 "everything you need" to know tabs
$(function() {
    $('#need-to-know > ul').tabs();
});

// university-101 "everything you need" right pannel tabs 
$(function() {
    // loop through available tabs and find the one that is supposed to be selected
    start_value = 0
    if ($("#need-to-know-right")){
      $('#need-to-know-right > ul > li').each(function(c){
        if ($(this).attr("class").indexOf("selected")>0){
          start_value = c
        }else{
          start_value = 0
        }
      })
      // start the tabs with the selected one
      $('#need-to-know-right > ul').tabs({ selected: start_value });
    }
});

// university-101 coverflow flash embed
$(function() {
    var flashvars = {
    	xmlpath: "/podcasts/coverflow/"
    };
    var params = {
        allowscriptaccess: "always"
    };
    swfobject.embedSWF("http://static.globecampus.ca/flash/photoflow/swf/photoflow.swf", "video-player", "533", "362", "8.0.0", "", flashvars, params);
});

// home coverflow flash embed
$(function() {
    var flashvars = {
    	xmlpath: "/homeNav/coverflow/"
    };
    var params = {
        allowscriptaccess: "always"
    };
    swfobject.embedSWF("http://static.globecampus.ca/flash/photoflow/swf/photoflow_home.swf", "video-player-home", "533", "342", "8.0.0", "", flashvars, params);
});

// methodology tabs
$(function() {
    $('ul#topics-covered').tabs({ selected: 0 });
    
    $('a.additional-indicators-link').click(function() {
        $('ul#topics-covered').tabs('select', 3);
        return false;
    });
    
});

function toggle(e){
  $(e).parent("h2").siblings("div").eq(0).slideToggle("normal");
  if ($(e).html().indexOf('open_icon') > -1){
    $(e).html('<img src="/media/images/icons/close_icon.png"/>');
  } else {
    $(e).html('<img src="/media/images/icons/open_icon.png"/>');
  }
  return false;
}


function addLoadScreen(e){
  $(e).html('<div class="load" style="width: 100%; text-align: center; padding: 1em 0; border:1px solid #DBDBDB;"><img src="/media/images/ajax-loader.gif"/></div>');
}   
