/* script to turn tab text images on/off */

//if (document.images)
//{
//  history_off= new Image(50,14); 
//  history_off.src="images/nav_ctuhistory.gif";
//  
//  history_on= new Image(50,14); 
//  history_on.src="images/nav_ctuhistory_on.gif";  
//  
//  bachelors_off= new Image(143,14); 
//  bachelors_off.src="images/nav_bachelors.gif";
//  
//  bachelors_on= new Image(143,14); 
//  bachelors_on.src="images/nav_bachelors_on.gif";
//  
//  masters_off= new Image(126,14); 
//  masters_off.src="images/nav_masters.gif";
//  
//  masters_on= new Image(126,14); 
//  masters_on.src="images/nav_masters_on.gif";
//
//}

/************************* show/hide tabs **************************/
//last_tab = "history";
//
//function show(layerName) {
//	document.getElementById(layerName).style.display = "";
//}
//
//function hide(layerName) {
//	document.getElementById(layerName).style.display = "none";
//}
//
//function showImg(layerName) {
//	if (document.images) {
//		document[layerName].src= eval(layerName + "_on.src");
//	}
//}
//
//function hideImg(layerName) {
//	if (document.images) {
//		document[layerName].src= eval(layerName + "_off.src");
//	}	
//}
//
//function show_next(tab_name) {
//	document.getElementById(last_tab).className = "tab";
//	var curr = document.getElementById(tab_name);
//	curr.className="selected";
//	hide(last_tab+"_data");
//	show(tab_name+"_data");
//	if (last_tab!="results") {
//		hideImg(last_tab);
//	}
//	showImg(tab_name);	
//	last_tab=tab_name;
//}


/* popup windows */

function open_desc(URL,name,h) {
	window.open(URL,name,"resizable,width=250,height=" + h + "")
}

function open_degree(URL,name) {
	window.open(URL,name,"resizable,scrollbars=yes,width=480,height=450")
}


function open_window(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/*remember form data on refresh*/
function setCookie(name, value, expire) 
	{
	    strCookie = name + "=" + escape(value);
	    if (expire)
	        strCookie += "; expires=" + expire.toGMTString();	
	    document.cookie = strCookie;
	}

function saveValue(txtBox)
	{
		setCookie(txtBox.name,txtBox.value);
	}


/* ---------------------------------------------
expandAll v.1.3.4
http://adipalaz.awardspace.com/experiments/jquery/expand.html
Requires: jQuery v1.3+
Copyright (c) 2009 Adriana Palazova
Dual licensed under the MIT (http://adipalaz.awardspace.com/docs/mit-license.txt) and GPL (http://adipalaz.awardspace.com/docs/gpl-license.txt) licenses.
------------------------------------------------ */
(function($) {
$.fn.expandAll = function(options) {
    var defaults = {
         expTxt : '[Expand All]',
         cllpsTxt : '[Collapse All]',
         cllpsEl : '.collapse', // the collapsible element
         trigger : '.expand', // the elements that contain the trigger of the toggle effect on the individual collapsible sections
         ref : '.expand', // the switch 'Expand All/Collapse All' is inserted before the 'ref'
         showMethod : 'show',
         hideMethod : 'hide',
         state : 'hidden', // the collapsible elements are hidden by default
         speed : 0,
         oneSwitch : true
    };
    var o = $.extend({}, defaults, options);   
    
    var toggleTxt = o.expTxt;
    if (o.state == 'hidden') {
      $(this).find(o.cllpsEl).hide();
      $(this).find(o.trigger + ' > a.open').removeClass('open');
    } else {
      toggleTxt = o.cllpsTxt; 
    }
   
    return this.each(function(index) {
        var referent, $cllps, $tr;
        if (o.ref) {
            var container;
            if (this.id.length) {
              container = '#' + this.id;
            } else if (this.className.length) {
              container = this.tagName.toLowerCase() + '.' + this.className.split(' ').join('.');
            } else {container = this.tagName.toLowerCase();}
            referent = $(this).find("'" + o.ref + ":first'");
            $cllps = $(this).closest(container).find(o.cllpsEl);
            $tr = $(this).closest(container).find(o.trigger + ' > a');
        } else {
            referent = $(this);
            $cllps = $(this).find(o.cllpsEl);
            $tr = $(this).find(o.trigger + ' > a');
        }
        if (o.oneSwitch) {
            referent.before('<p class="switch"><a href="#">' + toggleTxt + '</a></p>');
        } else { 
            referent.before('<p class="switch"><a href="#">' + o.expTxt + '</a>&nbsp;|&nbsp;<a href="#">' + o.cllpsTxt + '</a></p>');
        }

        referent.prev('p').find('a').click(function() {
            if ($(this).text() == o.expTxt) {
              if (o.oneSwitch) {$(this).text(o.cllpsTxt);}
              $tr.addClass('open');
              $cllps[o.showMethod](o.speed);
            } else {
              if (o.oneSwitch) {$(this).text(o.expTxt);}
              $tr.removeClass('open');
              $cllps[o.hideMethod](o.speed);
            }
            return false;
    });
});};
/* ---------------------------------------------
Toggler
http://adipalaz.awardspace.com/experiments/jquery/expand.html
When using this script, please keep the above url intact.
------------------------------------------------ */
$.fn.toggler = function(options) {
    var defaults = {
         cllpsEl : 'div.collapse',
         method : 'slideToggle',
         speed : 'slow',
         container : '', //the common container of all groups with collapsible content (optional)
         initShow : '.shown' //the initially expanded sections (optional)
    };
    var o = $.extend({}, defaults, options);
    
    $(this).wrapInner('<a style="display:block" href="#" title="Expand/Collapse" />');
    return this.each(function() {
      var container;
      (o.container) ? container = o.container : container = 'div';
      if (o.initShow) {
        $(this).closest(container).find(o.initShow).show().prev().find('a').addClass('open');
      }
      $(this).click(function() {
          $(this).find('a').toggleClass('open').end()
          .next(o.cllpsEl)[o.method](o.speed);
          return false;
    });
});};
$.fn.toggleHeight = function(speed, easing, callback) {
    return this.animate({height: 'toggle'}, speed, easing, callback);
};
//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);

$("html").addClass("js");
$(function() {
/* ---
// apply the toggle effect with default options on each item:
    $("h3.expand").toggler();
--- */
    $("h3.expand:eq(0)").toggler({method: "toggle", speed: 0});
    $("h3.expand:eq(1)").toggler({method: "toggle", speed: 0});
    $("h3.expand:eq(2)").toggler({method: "toggle", speed: 0});
    $("h3.expand:eq(3)").toggler({method: "toggle", speed: 0});
    $("h3.expand:eq(4)").toggler({method: "toggle", speed: 0});
    $("h3.expand:eq(5)").toggler({method: "toggle", speed: 0});
    $("h3.expand:eq(6)").toggler({method: "toggle", speed: 0});
    $("h3.expand:eq(7)").toggler({method: "toggle", speed: 0});
    $("h3.expand:eq(8)").toggler({method: "toggle", speed: 0});
    $("h3.expand:eq(9)").toggler({method: "toggle", speed: 0});
    $("h3.expand:eq(10)").toggler({method: "toggle", speed: 0});
    $("h3.expand:eq(11)").toggler({method: "toggle", speed: 0});
    $("h3.expand:eq(12)").toggler({method: "toggle", speed: 0});
    $("h3.expand:eq(13)").toggler({method: "toggle", speed: 0});
    $("h3.expand:eq(14)").toggler({method: "toggle", speed: 0});
    $("h3.expand:eq(15)").toggler({method: "toggle", speed: 0});
    $("h3.expand:eq(16)").toggler({method: "toggle", speed: 0});
    $("h3.expand:eq(17)").toggler({method: "toggle", speed: 0});
    $("h3.expand:eq(18)").toggler({method: "toggle", speed: 0});
    $("h3.expand:eq(19)").toggler({method: "toggle", speed: 0});
	
    $("#canyon").expandAll({trigger: "h3.expand", ref: "div.expandcollapse"});
    $("html").removeClass("js");
});
////////////////////////////
/* ---
Sample usage:
$(function() {
    // Call toggler() with the default options. If we add class="shown" to some of the collapsible elements, they will be expanded when the page loads:
    $("#container  h3.expand").toggler();
    // Call expandAll():
    $("#container").expandAll({showMethod: "slideDown", hideMethod: "slideUp", speed: 400});
});
Sample markup:
<div id="container>
  <h3 class="expand">Title 1</h4>
  <div class="collapse shown">...</div>
  <h3 class="expand">Title 2</h4>
  <div class="collapse">...</div>
</div>

--- */
