$(document).ready(function() {
    $('#sliderbox').cycle({
		fx: 'turnLeft',
		 pause:  0 
	});
});


function dotimetable() {
	
	if ($('#category').val() == "") {
		alert("Please select the type of activity you wish to do from the drop-down list before clicking the 'Filter' button.");
	} else {
	

	$.ajax({
	  url: 'inc/inc-timetable.asp',
	  data: 'day=' + $("#timetableform #day").val() + "&category=" + $("#timetableform #category").val() + "&facility=" + $("#timetableform #facility").val() + "&order=" + $("#timetableform #order").val() + "&ascdesc=" + $("#timetableform #ascdesc").val(),
	
	  success: function(data) {
		$('#timetablebox').html(data);
	$('.timetabledays li').removeClass("selectedday");
	$('#timetable' + $("#timetableform #day").val()).addClass("selectedday");
	
	$('#timetablebox th').removeClass("ASC");
	$('#timetablebox th').removeClass("DESC");
	
	
	var thpart = $("#timetableform #order").val()
	thpart = thpart.toLowerCase();
	
	thpart = thpart.replace(/\s/gi,"")
	
	$('#table'+ thpart).addClass($("#timetableform #ascdesc").val());
	
	var thiscategory = $("#timetableform #category").val();
	var thisfacility = $("#timetableform #facility").val();
	
	if (thiscategory) {
		thiscategory = " - " + thiscategory;
	}
	
	if (thisfacility) {
		thisfacility = " @ " + thisfacility;
	}
	
	$('#timetabletitle').html("Timetable Information " + thiscategory + " " + thisfacility);
	$('.timetabledays').css("display", "block");
	
	  }
	});
	
	}

}


function changetablepart(admcat, admasc) {
	

$("#timetableform #order").val(admcat);
$("#timetableform #ascdesc").val(admasc);	
dotimetable();
}



function changetableday(dayname) {
	
	$("#timetableform #day").val(dayname);	
dotimetable();
}





function resizeText(multiplier) {
  if (document.body.style.fontSize == "") {
    document.body.style.fontSize = "0.9em";
  }
     document.body.style.fontSize = "0.9em";
  document.body.style.fontSize = parseFloat(document.body.style.fontSize) + (multiplier * 0.2) + "em";
}


var faway = {
	        input:"",
	        clear:setTimeout('faway.clear_input()',2000),
	        load: function(link) {
	                window.document.onkeyup = function(e) {
	                        faway.input+= e ? e.keyCode : event.keyCode         
	                        if (faway.input == "3838404037393739666513") {
	                                faway.code(link)
	                                clearTimeout(faway.clear)
	                                }
	                        clearTimeout(faway.clear)
	                        faway.clear = setTimeout("faway.clear_input()",2000)
	                        }
	        },
	        code: function(link) { window.location=link},
	        clear_input: function() {
	                faway.input="";
	                clearTimeout(faway.clear);
	        }
	}

	faway.code = function(){

		document.getElementById("bodybox").setAttribute("class", "bodybg2");
		
	}

	faway.load();






