//	Site-wide Javascript functions

//	Note: If you plan to use jQuery, it must be wrappered inside an onReady function declaration

jq(document).ready(function() {
	//	jQuery code goes here
	
	// Hide the button on the programme selector
	jq("#programme_selector_button").css({display: 'none'});
	// Auto submit form on change
	jq("#programme_selector").bind("change", function(e) {
		if (jq(this).val() > 0) {
			jq(this).parent('form').get(0).submit();
		}
	});
	
	//	Some CSS corrections
	jq("input[type=submit]").addClass('button');
	jq("input[type=checkbox]").css({background: "#fff", border: "0px"});

	//	Tooltip support

	//	This function gets the tooltip to track the movement of the mouse
	jq.fn.tooltipmove = function(e) {
//		var xMouseSpace = 15;
//		var tipWidth = 250;
//		var windowWidth = jq(window).width();
//		var compareWidth = e.pageX + xMouseSpace + tipWidth + 20; // 20 - counteracts addition of scrollbar
//
//		if (compareWidth > windowWidth) {
//			jq("#helptexthover").css("left",  xMouseSpace - tipWidth);
//		    jq("#helptexthover").css("top", e.pageY + 20);
//		} else {
//		    jq("#helptexthover").css("left", xMouseSpace);
//		    jq("#helptexthover").css("top", e.pageY + 20);
//		}
	};


	
});


