// JavaScript Document

$(document).ready(function() {
	// Expand Panel
	$("#open").click(function(){
		$("div#panel").slideDown("slow");
	});
	// Collapse Panel
	$("#close").click(function(){
		$("div#panel").slideUp("slow");
	});
	// Switch buttons from "Log In | Register" to "Close Panel" on click
	$("#toggle a").click(function () {
		$("#toggle a").toggle();
	});

		$(".teaser").corner("10px");
		$("h5").corner("10px");
		$(".quiz").corner("10px");
		$("h3").corner("5px");
		
	$("a.fancy").fancybox({'overlayOpacity' : 0.8,
						  'overlayColor': '#000',
						  'easingIn': 'swing',
						  'transitionIn' : 'elastic',
						  'speedIn': 700});
	


if($('#slideshow').length){$('#slideshow').cycle({ 
    fx: 'scrollDown',
	speed: 2000,
    timeout:  5000,
	pause:1
});
}
});






$(document).ready(function(){

	$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)

	$("ul.topnav li span").click(function() { //When trigger is clicked...

		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() {
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});
	

});


var active_color = '#000'; // Colour of user provided text
var inactive_color = '#ccc'; // Colour of default text

/**
* No need to modify anything below this line
*/

$(document).ready(function() {
  $('#searchform input[type="text"]').css("color", inactive_color);
  var default_values = new Array();
  $('#searchform input[type="text"]').focus(function() {
    if (!default_values[this.id]) {
      default_values[this.id] = this.value;
    }
    if (this.value == default_values[this.id]) {
      this.value = '';
      this.style.color = active_color;
    }
    $(this).blur(function() {
      if (this.value == '') {
        this.style.color = inactive_color;
        this.value = default_values[this.id];
      }
    });
  });
});
