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

function getColor(cid) {
	switch(cid) {
		case 1: return "#EF4135";
		case 2: return "#F5A01A";
		default: return "#ccc";
	}
}

$(document).ready( 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");
	$("#formx").css("background-position","0px -100px");
	$("#footx").css("background-position","0px -20px");
	$("#handx").css("background-position","0px -30px");
	$("#handx:hover").css("background-position","0px -70px").css("background-position-y","-70px");
	$("#headx, #formx, #footx, #handx").stop().animate({opacity:"1"},400);

	// signup button
	
	$("signupButton").css("color",getColor(cid));
	
	// submenu
	
//	$("span.controlTab").css("border-bottom","1px solid #fff");
//	$("span.controlTab:hover").css("border-bottom","1px solid "+getColor(cid));
	
	// - Student Login
	
	$("#login_link").hide();
	$("#formx").animate({height:"0px"},300);
	
	$("#handx").click(function() {
		
		if($(this).hasClass("opened")) {
			$("#login_link").hide();
			$("#formx").stop().animate({height:"0px"},300);
			$("#footx").stop().animate({height:"10px"},300);
			$(this).removeClass("opened");
		}
		else {
			$("#formx").stop().animate({height:"100px"},300);
			$("#footx").stop().animate({height:"0px"},300);
			$("#login_link").show();
			$(this).addClass("opened");
		}
	});
  
	// - Tooltips
	$(".c_social a").attr("title","");
	$(".c_social").tooltip({
		effect:'slide',
		offset:[0,-6]
	});
});
