function loadFct(){
	// Add the switch font size fonctionality
	if($("#content_header").is("DIV")){
		$("#content_header").switchSize();
	}
	
	// Google Analytics
	_uacct = "UA-796315-6";
	urchinTracker();
	
	// Title attribute on value
	$("input[@type*='text'][@title][@value='']").val($(this).attr("title"));
	
	// Hover, Focus and Blur effects on fields 
	$("input, select, textarea")
	    .bind("focus", function(){
		    if($(this).is(".mandatory")) 
		        $("label[@for=" + this.id + "]").removeClass("error");
		    $(this).addClass("focus");
		   if(!$(this).is('.no_focus') && $(this).val()==$(this).attr("title")){ $(this).val(""); };
	    })
	    .bind("mouseover", function(){ $(this).addClass("hover"); })
	    .bind("mouseout", function(){ $(this).removeClass("hover"); })
	    .bind("blur", function(){
		    $(this).removeClass("focus");
		    if($(this).attr("title")!="" && $(this).val()==""){	$(this).val($(this).attr("title"));	}
	    });
	
	// Table Stripe
	$("tbody tr:even", "table.tb_listing").addClass("odd");
		
	// External Link    
	var allowedDomains = [location.hostname, "http://loyalistcollege", "www.loyalistcollege"];
	$(function() {
		$("a[@href^=http]:not(.internal)")
		.filter(function(el){
		for ( var i=0; i < allowedDomains.length; i++ )
			if ( this.href.indexOf(allowedDomains[i])>-1 ) return false;
				return true;
			})
		.bind("click", function(){ return !window.open(this.href); });
	});
	
	var quicklinks, removeQuicklinks;
	$("#quickLinks")
	.hover(
	    function(){ 
	        if(!$('div', this).is('div'))
	            $('#div-quickLinks').removeAttr("id").appendTo(this);
	        window.clearTimeout(removeQuicklinks); addQuicklinks = window.setTimeout("showQuickLinks();",300); },
	    function(){ window.clearTimeout(addQuicklinks); removeQuicklinks = window.setTimeout("hideQuickLinks();",300); }
	)
	
	// Semester's Toggler
	$(".toggler").click(function() {
		span = $(this).children("span");
		span.html((span.html()=="[+]") ? "[&ndash;]" : "[+]");
        $(this.hash).slideToggle(200);
        return false;
    });
	$(".toggler span").html("[+]");
    $(".more").hide();
	$("#toggleall").show();
	$("#semesters div.details").hide();
	
		// Start Rotator
		if ($('#rotator').size() && !$('.emergency').is("DIV"))
		$('#rotator').rotator();
};


/* ---------------------------------------------------
   Quick Links  ------------------------------------- */

    function showQuickLinks(){
        $("div", "#quickLinks").show();
    };
    
    function hideQuickLinks(){
        $("div", "#quickLinks").hide();
    };

/* ---------------------------------------------------
   Bookmark Site ------------------------------------- */

    function bookmarksite(title,url){
        if (window.sidebar) // firefox
    	    window.sidebar.addPanel(title, url, "");
	    else if(window.opera && window.print){ // opera
		    var elem = document.createElement('a');
		    elem.setAttribute('href',url);
		    elem.setAttribute('title',title);
		    elem.setAttribute('rel','sidebar');
		    elem.click();
        } 
	    else if(document.all)// ie
    	    window.external.AddFavorite(url, title);
    };



/* ---------------------------------------------------
   Send to a friend ---------------------------------- */
   
    function displayStf (state) {
		
	    if(state=="form"){
		    if($("#stf").is("div")){
			    if($("#stf").css("display")=="none"){
				    $("#stf_form").show().next("div").hide();
				    $("#stf").show();
			    }
		    }else{
		        var stf="";				
			        stf += '<div id="stf" class="popup">\n';
			        stf += '		<div id="headerblock">\n';
			        stf += '			<p class="closebox"><a href="javascript:displayStf(\'remove\');">CLOSE X</a></p>\n';
			        stf += '			<h1>Tell a Friend About Loyalist</h1>\n';
			        stf += '		</div>\n';
			        stf += '		<div id="bodyblock">\n';
			        stf += '			<form id="stf_form" action="/mail/send-to-a-friend/" onsubmit="return submitForm($(this));" method="post" class="stf_hide" >\n';
			        stf += '			<p>Found something cool? Complete the form below to share it with a friend!</p>\n';
			        stf += '				<table cellspacing="0" cellpadding="0" border="0">\n';
			        stf += '					<tr>\n';
			        stf += '						<td colspan="3">\n';
			        stf += '							<p style="font-size:10px; text-align:right; margin:0;">* required information</p>\n';
			        stf += '						</td>\n';
			        stf += '					</tr>\n';
			        stf += '					<tr>\n';
			        stf += '						<td>\n';
			        stf += '							<label for="stfname">Your name *</label>\n';
			        stf += '							<input name="stfname" id="stfname" type="text" size="26" class="mandatory" tabindex="20">\n';
			        stf += '						</td>\n';
			        stf += '						<td>&nbsp;</td>\n';
			        stf += '						<td>\n';
			        stf += '							<label for="stfemail">Your email *</label>\n';
			        stf += '							<input name="stfemail" id="stfemail" type="text" size="27" class="mandatory v_email" tabindex="21">\n';
			        stf += '						</td>\n';
			        stf += '					</tr>\n';
			        stf += '					<tr>\n';
			        stf += '						<td>\n';
			        stf += '							<label for="stffriendsname">Your friend\'s name *</label>\n';
			        stf += '							<input name="stffriendsname" id="stffriendsname" type="text" size="26" class="mandatory" tabindex="22">\n';
			        stf += '						</td>\n';
			        stf += '						<td>&nbsp;</td>\n';
			        stf += '						<td>\n';
			        stf += '							<label for="stffriendsemail">Your friend\'s email *</label>\n';
		 	        stf += '							<input name="stffriendsemail" id="stffriendsemail" type="text" size="27" class="mandatory v_email" tabindex="23" \/>\n';
		 	        stf += '							<input name="stfpath" id="stfpath" type="hidden" value="' + location.href + '" \/>\n';
			        stf += '						</td>\n';
			        stf += '					</tr>\n';
			        stf += '					<tr>\n';
			        stf += '						<td colspan="3">\n';
			        stf += '							<label for="stfcomments">Your message</p>\n';
			        stf += '							<textarea name="stfcomments" id="stfcomments" cols="50" rows="5" tabindex="24"></textarea>\n';
			        stf += '						</td>\n';
			        stf += '					</tr>\n';
			        stf += '				</table>\n';
			        stf += '				<p class="send"><a href="javascript:;" onclick="$(\'#stf_form\').submit();" tabindex="25">Send</a></p>\n';
			        stf += '			</form>\n';
			        stf += '		    <div style="display:none;">\n';
			        stf += '			    <p>Thank you!</p>\n';
			        stf += '			    <p>Your friend will receive an email shortly.</p>\n';
			        stf += '		    </div>\n';
			        stf += '		</div>\n';
			        stf += '	</div>\n';
			        stf += '</div>\n';
			        $("div#mainbody").append(stf);
			        $(".popup").hide(); $("#stf").show();
			    }
	    }else{
		    $("#stf").hide();
	    }
    };
	
	
/* ---------------------------------------------------
   Send to a friend Contest -------------------------- */
   
    function displayStfContest (state) {
	    if(state=="form"){
		    if($("#stf").is("div")){
			    if($("#stf").css("display")=="none"){
				    $("#stf_form").show().next("div").hide();
				    $("#stf").show();
			    }
		    }else{
		        var stf="";	
			        stf += '<div id="stf" class="popup">\n';
					stf += '<p class="closebox"><a href="javascript:displayStf(\'remove\');">CLOSE X</a></p>\n';
					stf += '<iframe src ="http://ui.constantcontact.com/roving/sa/emailpage.jsp?&Merchant.ID=rpy6ojcab&Merchant.Name=Loyalist+College&ref=http%3A%2F%2Fwww.loyalistcollege.com%2Fcontest" width="655" height="685" style="overflow:hidden; border:none;"></iframe>\n';
			        /* stf += '		<div id="headerblock">\n';
			        stf += '			<p class="closebox"><a href="javascript:displayStf(\'remove\');">CLOSE X</a></p>\n';
			        stf += '			<h1>Send to a Friend</h1>\n';
			        stf += '		</div>\n';
			        stf += '		<div id="bodyblock">\n';
			        stf += '			<form id="stf_form" action="/mail/invite-a-friend/" onsubmit="return submitForm($(this));" method="post" class="stf_hide" >\n';
			        stf += '			<p>Spread the word about the Discover Loyalist Contest. </p>\n';
			        stf += '				<table cellspacing="0" cellpadding="0" border="0">\n';
			        stf += '					<tr>\n';
			        stf += '						<td colspan="3">\n';
			        stf += '							<p style="font-size:10px; text-align:right; margin:0;">* required information</p>\n';
			        stf += '						</td>\n';
			        stf += '					</tr>\n';
			        stf += '					<tr>\n';
			        stf += '						<td>\n';
			        stf += '							<label for="stfname">Your name *</label>\n';
			        stf += '							<input name="stfname" id="stfname" type="text" size="26" class="mandatory" tabindex="20">\n';
			        stf += '						</td>\n';
			        stf += '						<td>&nbsp;</td>\n';
			        stf += '						<td>\n';
			        stf += '							<label for="stfemail">Your email *</label>\n';
			        stf += '							<input name="stfemail" id="stfemail" type="text" size="27" class="mandatory v_email" tabindex="21">\n';
			        stf += '						</td>\n';
			        stf += '					</tr>\n';
			        stf += '					<tr>\n';
			        stf += '						<td>\n';
			        stf += '							<label for="stffriendsname">Your friend\'s name *</label>\n';
			        stf += '							<input name="stffriendsname" id="stffriendsname" type="text" size="26" class="mandatory" tabindex="22">\n';
			        stf += '						</td>\n';
			        stf += '						<td>&nbsp;</td>\n';
			        stf += '						<td>\n';
			        stf += '							<label for="stffriendsemail">Your friend\'s email *</label>\n';
		 	        stf += '							<input name="stffriendsemail" id="stffriendsemail" type="text" size="27" class="mandatory v_email" tabindex="23" \/>\n';
		 	        stf += '							<input name="stfpath" id="stfpath" type="hidden" value="' + location.href + '" \/>\n';
			        stf += '						</td>\n';
			        stf += '					</tr>\n';
			        stf += '					<tr>\n';
			        stf += '						<td colspan="3">\n';
			        stf += '							<label for="stfcomments">Your message</p>\n';
			        stf += '							<textarea name="stfcomments" id="stfcomments" cols="50" rows="5" tabindex="24"></textarea>\n';
			        stf += '						</td>\n';
			        stf += '					</tr>\n';
			        stf += '				</table>\n';
			        stf += '				<p class="send"><a href="javascript:;" onclick="$(\'#stf_form\').submit();" tabindex="25">Send</a></p>\n';
			        stf += '			</form>\n';
			        stf += '		    <div style="display:none;">\n';
			        stf += '			    <p>Thanks, your friend will receive an email soon.</p>\n';
			        stf += '		    </div>\n';
			        stf += '		</div>\n';
			        stf += '	</div>\n';*/
			        stf += '</div>\n';
			        $("div#mainbody").append(stf);
			        $(".popup").hide(); $("#stf").show();
			    }
	    }else{
		    $("#stf").hide();
	    }
    };

/*  -----------------------------------------------------------------------
    Validation ------------------------------------------------------------ */

    function checkEmail(to_check) {
	    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,5})+$/.test(to_check)){
	        return true;
		}
    };

    function checkPhone(to_check) {
	    return to_check.match(/^((1)?(\s)?(\+)?(\s)?(\()?\d{3}(\))?\s?-?\d{3}\s?-?\d{4}((\s)+(ext|x|extension|#)?(\s)?(\d)+)?)?$/i);
    };

/*  -----------------------------------------------------------------------
    Submit Form ----------------------------------------------------------- */
    
    function checkFields(objForm){
        var error = 0;
        $(".mandatory", objForm).each( function(){
            if(!$(this).val()){	error++; $("label[@for=" + this.id + "]").addClass("error"); }
            else{ $("label[@for=" + this.id + "]").removeClass("error"); }	
		});
		$(".mandatory.v_email", objForm).each( function(){
            if(!checkEmail($(this).val())){	error++; $("label[@for=" + this.id + "]").addClass("error"); }
            else{ $("label[@for=" + this.id + "]").removeClass("error"); }	
		});

		$(".mandatory.v_phone", objForm).each( function(){
            if(!$(this).val() || !checkPhone($(this).val())){	error++; $("label[@for=" + this.id + "]").addClass("error"); }
            else{ $("label[@for=" + this.id + "]").removeClass("error"); }	
		});
		
		$(".v_optionalPhone", objForm).each( function(){
            if(!checkPhone($(this).val())){	error++; $("label[@for=" + this.id + "]").addClass("error"); }
            else{ $("label[@for=" + this.id + "]").removeClass("error"); }	
		});

		if (error == 0)
		    return true;
		else
		    return false;
    };
    
    function ajaxSubmit(objForm){
        var name = $(objForm).attr("id").split("_")[0] + "_";
				  
		var params = {};
		$(":input", objForm).not(":image").each( function(){
			params[ name + this.name ] = this.value;
		});
		
		$.post(	
			$(objForm).attr("action"), 
			params, 
			function(resp){ 
				$("." + name + "hide").hide();
				$(objForm).next("div").show();
				$(":input:visible").val("");
			}
		); 		
		
		/*var data_params = '';
		$(":input", objForm).not(":image").each( function(){
		   var value = encodeURI(this.value).replace(/&/g,"%26");				
			data_params += name + this.name + "=" + value + "&" ;
		});

		$.ajax({
			type: "POST",
			url: $(objForm).attr("action"),
			data: data_params,
			success: function(resp){
					$("." + name + "hide").hide();
					$(objForm).next("div").show();
					//$(objForm).hide();
					$(":input:visible").val("");
			},
			error: function(req) { alert('error:' +req.status + ' - response:' + req.responseText ); }
		});*/
    };
    
    
    function submitForm(objForm){
        if(checkFields(objForm))
		    ajaxSubmit(objForm);
		
		return false;
	};
    

/*  -----------------------------------------------------------------------
    Search action on click ------------------------------------------------ */
	
	function submitSearch(obj){
		var key = $("input:text", $(obj)).val();
		if(key != $("input:text", $(obj)).attr("title") && key != ''){
			$(obj).attr("action", $(obj).attr("action") + "/" + encodeURI(key));
		}else{
			return false;	
		}
	};    
	
/*  -----------------------------------------------------------------------
    Semesters Toggle ------------------------------------------------------ */
	function toggleall() { 
		if( $("#toggleall a").html() == "Expand all") {
			$(".semester .details").show();
			$(".semester .toggler span").html("[&ndash;]");
			$("#toggleall a").html("Collapse all");
		} else {
			$(".semester .details").hide();
			$(".semester .toggler span").html("[+]");
			$("#toggleall a").html("Expand all");
		}
	}