/* all custom jquery functions for luxor-quest */
$.noConflict()
jQuery(document).ready(function(){
	
	// allow number-only input on forms
	jQuery("input.numberOnly").keypress(function (e) {
		var nums = "0123456789";
		var keycode = String.fromCharCode(e.which);
		// don't block L/R, Delete, Backspace, or '+'
		if ((e.which==null) || (e.which==0) || (e.which==8) || (e.which==9) || (e.which==13) || (e.which==27) || e.which==40 || e.which==41 || e.which==43 || e.which==46) {
		   return true;
		// limit to numbers
		} else if (nums.indexOf(keycode) > -1) {
			return true;
		} else {
			return false;
		}
	})


	// use title attribute for value in form field
	jQuery(".useTitleForValue").each(function(){
		jQuery(this).attr({"value": jQuery(this).attr("title")}).addClass("inactive");
		
		jQuery(this).focus(function(){
			if (jQuery(this).val() == jQuery(this).attr("title")) {
				jQuery(this).removeAttr("value").removeClass("inactive");
			}
		}).blur(function(){
			if (jQuery(this).val() == "") {
				jQuery(this).attr({"value": jQuery(this).attr("title")}).addClass("inactive");
			}
		})
	})
});