var onGoingAjaxCall = false;  		// To test if an AJAX request is currently executing
var ajaxResponse = new Array();		// To cache the AJAX queries so that repeat requests to the server is avoided.

$(document).ready(function(){

/*** auto tables styles ***/
	$("table tr:even").addClass("altrow");
	$("table tr").hover(
		function(){
			$(this).addClass("highlight");
		},
		function(){
			$(this).removeClass("highlight");
		}
	);

/*** toggle timetables ***/
		$("#maincontent table#nexttimetable").hide();
		$("#maincontent table.timetable caption a.toggle").click(function () {
		$("#maincontent table.timetable").toggle();
		return false;
	});


/*** auto tables styles ***/
	$("div#photoinfo a").click(function () {
		$(this).siblings("div").toggle('fast');
		return false;
	});



/*** faq show and hide ***/
   	   $(".faqlist dd").addClass('hide');
       $(".faqlist dt").click(function () {
                $(this).toggleClass('active');
                $(this).next().toggle();
                return false;
        });
	    $(".faqlistexpandall span#collapseall").addClass('hide');

		var expandall = false;
        $(".faqlistexpandall").click(function () {

				$(".faqlistexpandall span#collapseall").toggle();
				$(".faqlistexpandall span#expandall").toggle();
				
                if(expandall == false) {
					$(this).addClass('active');
					$(".faqlist dd").each( 
								  	 function(){    
								  		 		$(this).css("display", "none");
								  	 			$(this).prev().addClass('active');
								  	 			$(this).toggle(); 
								  	 } 
					);
							    	expandall = true;
			    }
				else {
					$(".faqlist dd").each( 
								 	 function() {    	  
								 	 			 $(this).css("display", "none"); 
								 	 			 $(this).prev().removeClass('active');
								 	 } 
					);
					$(this).removeClass('active');
					expandall = false;
				}
       return false;
      });

/*** interactive map ***/
	$("#map ul > li .point").hover(
		function () {
			var li = $(this).parent();
			displayTimeout = setTimeout( function () {
				 $("#map ul > li").removeClass('active');
			   	 li.addClass("active");			
			}, 400);
		}, 
		function () {
			clearTimeout(displayTimeout);
		}
	);



});
