/*
 *
 * jquery.lib.js
 * requires juery.js (written on version 1.3.2)
 */
 
	var $j = jQuery.noConflict();
 
	$j(document).ready(function() {
		initNavLinks()
		styleCmsOutput();
		removeEmptyParagraphs();
		initTimetableConsole();
	});

/* */
	function initTimetableConsole() {
		$j('.timetable_console_row_2 div').removeAttr("style");
		$j('.timetable_console_row_2 div:first').addClass("first");
		
		var fromField = $j('div#TimetableSearchControl1_txtFrom_results');
		var toField = $j('div#TimetableSearchControl1_txtTo_results');
		
		//fromField.hide();
		//toField.hide();
		
		//setTimetableConsoleListeners(fromField, toField);
	}

/* Adds first or last class to navigation list items */
	function initNavLinks() {
		$j('div.footerLinks li:first').addClass("first");
		$j('div#topNavigation li:last').addClass("last");
	}	

/* Removes empty paragraphs to reduce unwanted whitespace */
	function removeEmptyParagraphs() {
		$j('p:empty').remove();
	}

/* */
	function setTimetableConsoleListeners(fromField, toField) {
		$j('#TimetableSearchControl1_txtFrom').click(function() {
			$j(fromField).show();
		});

		$j('#TimetableSearchControl1_txtTo').click(function() {
			$j(toField).show();
		});
	}

/* Adds class cms_output to areas of content pulled from CMS */
	function styleCmsOutput() {
		var cmsOutput = $j('div[xmlns]:not(div.floatnone)');
		
		cmsOutput.each(function() {
			$j(this).addClass("cms_output");
		});
	}