/**
 *
 * @author The Graphic Design School
 *
 */
jQuery( function() {
	
	// - Colouring
	
	var cid = $("div.p-header h1").attr("class").substr(1);
	
	// logo, blink
	
	$("#logo img, #blink img").stop().animate({opacity:"0"},200);
	$("#logo img").attr("src","content/i/logo-"+cid+".gif");
	$("#blink img").attr("src","content/i/b-"+cid+".gif");
	$("#logo img, #blink img").stop().animate({opacity:"1"},600);
	
	// sky
	
	$("#headx, #formx, #footx, #handx").stop().animate({opacity:"0"},200);
	$("#headx, #formx, #footx, #handx").css("background","transparent url(content/i/e-"+cid+".gif) no-repeat scroll 0 0");
	
	if( $.browser.msie ) {
		$("#formx").css("background-position-y","-100px");
		$("#footx").css("background-position-y","-20px");

		$("#handx").css("background-position-y","-30px");
		$("#handx:hover").css("background-position-y","-70px"); //  PS: ie doesn't like :hover on non-a elements
	}
	else {
		$("#formx").css("background-position","0 -100px");
		$("#footx").css("background-position","0 -20px");

		$("#handx").css("background-position","0 -30px");
		$("#handx:hover").css("background-position","0 -70px");
	}
	
	$("#headx, #formx, #footx, #handx").stop().animate({opacity:"1"},400);

	// signup button
    
    var color = $(".p-header h1").css("color");
	
	$("dt").css("color",color);
	$(".bl dt").css("color","#fff");
	
	// - Student Login
	
	$("#login_link").hide();
	$("#formx").animate({height:"0px"},300);
	
	$("#handx").click(function() {
		
		var t=$(this);
		
		if(t.hasClass("opened")) {
			$("#login_link").hide();
			$("#formx").stop().animate({height:"0"},300);
			$("#footx").stop().animate({height:"10px"},300);
			t.removeClass("opened");
		}
		else {
			$("#formx").stop().animate({height:"100px"},300);
			$("#footx").stop().animate({height:"0"},300);
			$("#login_link").show();
			t.addClass("opened");
		}
	});
	
	$("#menu a").click(function() { $(this).css("padding","5px"); });
	$("#social .c_social")
		.mouseenter(function() { var t = $(this); t.parent().find("p.smaller").html( t.find("a").attr("title") ); })
		.mouseleave(function() { var t = $(this); t.parent().find("p.smaller").html("&laquo;"); });

	$("#logo2 a").mouseover(function () {
		$(this).find("img").fadeTo(300, 0);
	});
});

