<!--
//<![CDATA[
var disableSend = false;

$(document).ready(function() {
	
	//PRINT PAGE
	$(".printpage").click(function() { window.print(); return false; });
	$(".bookmark").click(function() { BookmarkCurrentPage(); return false; });
	
	//SEARCH BOX
	$("#txtSearch, .clearonfocus").focus( function() { $(this).val(""); });
	
	//NAVIGATION MENU
	$("#navigationmenu").jdMenu();	
	
	// SITEMAP				   
	$("#sitemap_control").click(function() {
			
			if($("#sitemap").is(":hidden")) {
				
				// Get sitemap data
				$.ajax({
				  url: "/ajax/sitemap.asp",
				  cache: true,
				  success: function(html){
					
						$("#sitemap").html(html).show('slow');
						
						$("#sitemap_control a").addClass("on");
						$("#sitemap_control").find("span").html("Close Sitemap");  
						
					  }
				  });
				
			}
			else {
				
				// Hide Sitemap
				$("#sitemap").hide('slow');
				
				$("#sitemap_control a").removeClass("on");
				$("#sitemap_control").find("span").html("Open Sitemap");
			}			
			
			return false;
	});
	
	// COURSE NAVIGATION
	$("#coursenav a").click(function() {
		
		// Clear panel
		$("#course_data").html('').hide();
		$(".jScrollPaneContainer").hide();
		
		// Reset link
		$("#coursenav a").removeClass("on");		
			
		// Get title from link
		var title = $(this).attr("rel");
		
		//Show container with laoding text
		$("#course_container").show();
		
		// Show loading text
		$("#couse_loading_text").show();
		
		//Get ID for category
		var cat = $(this).attr("id");
		cat = cat.replace("cd_tab", "");
		
		// Get course data
		if(!disableSend) {
		
			$.ajax({
				 
					beforeSend: function() {
						$("#coursenav a").click(function() {disableSend = true;});
					},
					afterFinish: function() {
						$("#coursenav a").click(function() {disableSend = false; });
					},
	
				  url: "/ajax/course_data.asp?cat=" + cat,
				  cache: true,
				  success: function(html) {			
					
					// Plug in data and display panel
					$("#course_category_title h3").html(title);					
					$(".jScrollPaneContainer").show();
					
					// Hide loading text
					$("#couse_loading_text").hide();				
					
					//Show panel and scroller
					$("#course_data").html(html).show().jScrollPane();	
					
					disableSend = false;
	
				  }
			});	
		
			// Apply on class to pressed button
			$(this).addClass("on");
		}
		
		
		
		return false;
	});
	
	// COUSE NAVIGATION CLOSE BUTTON
	$("#course_control").click(function() {
		$("#course_container").hide();
		$("#coursenav a").removeClass("on");
		return false;
	});
	
	// External link styling
	//-----------------------------------------
	$("a[@target=_blank]").each( function(i) {
		var t = $(this).attr("href")
		$(this).addClass("external").attr("title", "This link will open "+t+" in a new window");
	});	
						   
});

function BookmarkCurrentPage() {
	
	var ua=navigator.userAgent.toLowerCase();
	var isKonq=(ua.indexOf('konqueror')!=-1);
	var isSafari=(ua.indexOf('webkit')!=-1);
	var isMac=(ua.indexOf('mac')!=-1);
	var buttonStr=isMac?'Command/Cmd':'CTRL';
	
	if(window.external && (!document.createTextNode ||(typeof(window.external.AddFavorite) == 'unknown'))) {
		window.external.AddFavorite(document.location.href, document.title); // IE/Win
	}
	else if(isKonq) {
		alert('You need to press CTRL + B to bookmark our site.');
	} 
	else if(window.opera) {
		void(0); // do nothing here (Opera 7+)
	}
	else if(window.home || isSafari) { // Firefox, Netscape, Safari, iCab
		alert('You need to press '+buttonStr+' + D to bookmark our site.');
	}
	else if(!window.print || isMac) { // IE5/Mac and Safari 1.0
		alert('You need to press Command/Cmd + D to bookmark our site.');    
	}
	else {
		alert('In order to bookmark this site you need to do so manually '+
	'through your browser.');
	}
}


//]]>
-->	