/**
 * @author The Graphic Design School
 */

$( function() {
	
	// Flash stuff 
	
	swfobject.embedSWF("content/f/logos2.swf", "logos2", "120", "120", "9.0.0", false, {}, { wmode: "transparent" });
	
	// - 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() {
		
		if($(this).hasClass("opened")) {
			$("#login_link").hide();
			$("#formx").stop().animate({height:"0"},300);
			$("#footx").stop().animate({height:"10px"},300);
			$(this).removeClass("opened");
		}
		else {
			$("#formx").stop().animate({height:"100px"},300);
			$("#footx").stop().animate({height:"0"},300);
			$("#login_link").show();
			$(this).addClass("opened");
		}
	});
	
});
