function selectAll() {
	//Checks all checkboxes on page regardless of the amount of forms
	//Requires a checkbox with the name/id "select_all" to initiate this function on click
	var x = document.getElementsByTagName("input");
	for(i=0; i<x.length; i++) {
		if((x[i].type == "checkbox") && (x[i].name != "select_all")) {
			x[i].checked = (document.getElementById("select_all").checked == false) ? false : true;
		}
	}
}

function copyChecked() {
	//Grabs the value of all checked checkboxes, builds a comma seperated string and dumps the string into a hidden field
	var c = new Array();
	var z = 0; //A counter for assembling the array nicely
	var x = document.getElementsByTagName("input");
	for(i=0; i<x.length; i++) {
		if((x[i].type == "checkbox") && (x[i].name != "select_all")) {
			if(x[i].checked == true) {
				c[z] = x[i].value;
				z++;
			}
		}
	}
	document.getElementById("selected").value = c.join(",");
}

function redirect(target) {
	var page = document.getElementById(target).value;
	if(page.length > 0) {
		var bits = page.split("|");
		window.location = "/product/"+bits[0]+"/"+bits[1]+"/"+bits[2]+"/1.html";
	}
}

function clearContent(target, defaultContent) {
	if(target.value == defaultContent) {
		target.value = "";
	}
}