// Do not edit the following functions:

function disableSubmit() {
	$('input[@type=submit]').click(function(){ $(this).attr('disabled',true); });
}

// Your functions go here

$(document).ready(function() {
	// This function finds the li with the id of sendtofriend and adds another li before it, which is the print page link
	$("li#sendtofriend").before("<li id=\"print\" title=\"Print this page\"><a href=\"#\">" + "Print this page &#x25BA;" + "</a></li>");
	// It then allows the li with id of print to print the page on click
	$("li#print").bind("click", function() { window.print(); });
	// Go back link
	$("span.goback").bind("click", function() { history.back();return false; });

	//This function looks for the input field of the id qsearchterm and clears the field on focus and restores in onblur. 
	var qsearchterm = $("#qsearchterm");
	if (qsearchterm.length != 0) {
		if (qsearchterm[0].value == qsearchterm[0].defaultValue)
			qsearchterm[0].style.color = "#cccccc";
		qsearchterm.focus(function() {
			if (this.value == this.defaultValue) {
				this.value = "";
				this.style.color = "#000000";
			}
		}).blur(function() {
			if (!this.value.length) {
				this.value = this.defaultValue;
				this.style.color = "#cccccc";
			}
		});
	}

	//This function looks for the input field of the id ilsearchterm and clears the field on focus and restores in onblur. 
	var ilsearchterm = $("#ilsearchterm");
	if (ilsearchterm.length != 0) {
		if (ilsearchterm[0].value == ilsearchterm[0].defaultValue)
			ilsearchterm[0].style.color = "#cccccc";
		ilsearchterm.focus(function() {
			if (this.value == this.defaultValue) {
				this.value = "";
				this.style.color = "#000000";
			}
		}).blur(function() {
			if (!this.value.length) {
				this.value = this.defaultValue;
				this.style.color = "#cccccc";
			}
		});
	}

	//This function looks for the input field of the id qsearchterm and clears the field on focus and restores in onblur. 
	var gsearchterm = $("#gsearchterm");
	if (gsearchterm.length != 0) {
		if (gsearchterm[0].value == gsearchterm[0].defaultValue)
			gsearchterm[0].style.color = "#cccccc";
		gsearchterm.focus(function() {
			if (this.value == this.defaultValue) {
				this.value = "";
				this.style.color = "#000000";
			}
		}).blur(function() {
			if (!this.value.length) {
				this.value = this.defaultValue;
				this.style.color = "#cccccc";
			}
		});
	}
});
