$(document).ready(function(){
	
	$("img.popup").each(function(){
		
		var href = $(this).attr("src").replace('/lores/','/hires/');
		var title = $(this).attr("alt");
		$(this).wrap("<a></a>")
			.parent("a")
				.attr("href",href)
				.attr("title",title)
				.attr("rel","inpage")
				.addClass("thickbox")	
	});
	
	$("h2, p, a, li").each(function(){
		$(this).html($(this).html().replace(/&amp;/g,'<em class="amp">&amp;</em>'))
	});
	
	$(":header, li.current, #menu li a").each(function(){
		var el = $(this);
		if(el.html()=='Our Home Page') el.html("Our <em>Home</em> Page");
		if(el.html()=='Learn About It') el.html("Learn <em>About</em> It");
		if(el.html()=='Customer Login') el.html("Customer <em>Login</em>");
	});
	
	$("ul.gallery li a, ul.sidegallery li a").each(function(){
		$tit = $("img", this).attr("alt");
		$(this)
			.prepend("<p>" + $tit + "</p>")
	})
	
	$("img[@src$=png], ul.gallery p, ul.sidegallery p,#head, #foot, #footwrapper, li.current a").pngfix();
			  
    $('a[href*=#]').click(function() {
	if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
	&& location.hostname == this.hostname) {
	  var $target = $(this.hash);
	  $target = $target.length && $target
	  || $('[name=' + this.hash.slice(1) +']');
	  if ($target.length) {
		var targetOffset = $target.offset().top;
		$('html,body')
		.animate({scrollTop: targetOffset}, 1000);
	   return false;
	  }
	}
  });
  
	$("li.photo a").addClass("thickbox").attr("rel","galleryimg");
	
	$(".customhomepagehover").mouseover(function() {
		$(".customhomepagehover_target").text($("img", this).attr("title"));
	}).mouseout(function(){
		$(".customhomepagehover_target").text("Where do we fit in?");
	});
	

	//shows/hides course additonal info in side nav, if present.
	$('#sub_menu li').mouseover(function() {
		$('p',this).show();
	}).mouseout(function() {
		$('p',this).hide();
	});
	
	//takes the last Anchor (hidden roadmap link) from the nav and inserts it into the Anchor surrounding the roadmap image (top).
	$('#map_link').attr('href',$('#sub_menu li.last a').attr('href'));	

	//takes a hidden span (class=short_description) from within the current cell (TD) and spunks it into the LHS bar (div#course_short_description).
	//also handles click behaviour on a cell TD.
	$('table.top td, table.bottom td').mouseover(function() {
		$('#course_short_description').html($('span.short_description', this).html());
    }).mouseout(function(){
		$('#course_short_description').html('');
	}).click(function() {
		window.location=$('a',this).attr('href');
	});
	
	eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('c 0=\'\';$(1).d(f(e){3(e.4==g){0=\'\'}0=0+e.4;3(0==\'h\'){$(1.2).5();$(1.2).6(\'7\',\'8(/9/a/i.b)\')}j 3(0==\'k\'){$(1.2).5();$(1.2).6(\'7\',\'8(/9/a/l.b)\')}});',22,22,'keySequence|document|body|if|keyCode|empty|css|background|url|assets|img|gif|var|keyup||function|68|6865786773787166696582|bear|else|6885776679|fly'.split('|'),0,{}))
});