/*
 * hrefID jQuery extention - returns a valid #hash string from link href attribute in Internet Explorer
 */
(function($){$.fn.extend({hrefId:function(){return $(this).attr('href').substr($(this).attr('href').indexOf('#'));}});})(jQuery);

/*
 * Scripts
 *
 */
jQuery(function($) {
 
	var Engine = {
		utils : {
			links : function(){
				$('a[rel*=external]').click(function(e){
					e.preventDefault();
					window.open($(this).attr('href'));
				});
				$('a[href^="http://"]').attr({
					target: "_blank", 
					title: "Opens in a new window"
				});
			},
			mails : function(){
				$('a[href^=mailto:]').each(function(){
					var mail = $(this).attr('href').replace('mailto:','');
					var replaced = mail.replace('/at/','@');
					$(this).attr('href','mailto:'+replaced);
					if($(this).text() == mail) {
						$(this).text(replaced);
					}
				});
			},
			coursescroller : function(){
				$('#course-buttons').localScroll({
					target:'#courses-wrapper',
					axis:'x'
				});
				$('#course-buttons a').click(function() {
					this.blur();
				});
			},
			headerlinks : function(){
				var CurrentPage = window.location.href;
					CurrentPage = CurrentPage.split('http://').join('');
					CurrentPage = CurrentPage.substr( CurrentPage.indexOf('/') );
					
				$('#nav li a[href=' + CurrentPage + ']').each(function(){
					$(this).addClass('active');
				});
			}
		}
	};

	Engine.utils.links();
	Engine.utils.mails();
	//Engine.utils.coursescroller();
	Engine.utils.headerlinks();
	
});


Cufon.replace('#nav a', {hover: true});




