//	test for getElementById object to weed out old browsers
if(!document.getElementById) {
	window.location = "upgrade.php";
}

//	popup window for images
function popup_image(image, width, height) {
	new_width = new Number(width);
	new_height = new Number(height);
	popup = window.open("popup.php?image= " + image + "&amp;width=" + width + "&amp;height=" + height, "", "width=" + (new_width + 20) + ",height=" + (new_height + 60) + ",location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no");
	popup.document.close();
}

//	popup window for images
function popup_menu(menu) {
	popup = window.open("popup_menu.php?menu= " + menu, "", "width=670,height=500,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no");
	popup.document.close();
}

//	popup window for services
function popup_services(service) {
	popup = window.open("popup_services.php?service= " + service, "", "width=670,height=500,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no");
	popup.document.close();
}

//	popup window for careers
function popup_careers(career) {
	popup = window.open("popup_careers.php?career= " + career, "", "width=670,height=500,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no");
	popup.document.close();
}

/*

//	pass commands to webpilot logic handler
function wp_ui_logic(arguments) {
	window.parent.uilogic.location.replace('php/wp_ui_logic.php?' + arguments);
}

//	popup product window
function popup_product(ext_stock, format) {
	if(format == "v") {
		window.open("popup.php?idxStockExt=" + ext_stock, "", "width=672,height=570,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no");
	}
	if(format == "h") {
		window.open("popup.php?idxStockExt=" + ext_stock, "", "width=672,height=570,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no");
	}
}

//	create username from input name
//	first 3 letters from first name and first 3 letters from last name
function create_username(input_name, output_username) {
	var username_string = input_name.substr(0,3);
	var found_space_at = input_name.indexOf(" ");
	username_string += input_name.substr((found_space_at + 1), 3);
	output_username.value = username_string.toLowerCase();
}
						
//	generate random password
function generate_password(alphanumeric_type, password_length, output_password){
	var password = "";
	if(alphanumeric_type == "numeric") {
		for(i = 0; i < password_length; i++) {
			password += Math.floor(Math.random() * 10);
		}
	}
	output_password.value = password;
}

//	print webpilot screen
function print_frame(main_menu) {
	this.focus();
	this.print();
}

//	highlight rows in webpilot search results
function highlight_row(row) {
	for(i = 0; i < row.cells.length; i++) {
		if(row.cells[i].className == "even") {
			row.cells[i].className = "even_highlight";
		}
		if(row.cells[i].className == "odd") {
			row.cells[i].className = "odd_highlight";
		}
	}
}

//	unhighlight rows in webpilot search results
function unhighlight_row(row) {
	for(i = 0; i < row.cells.length; i++) {
		if(row.cells[i].className == "even_highlight") {
			row.cells[i].className = "even";
		}
		if(row.cells[i].className == "odd_highlight") {
			row.cells[i].className = "odd";
		}
	}
}

//	submit rows from webpilot search results
function submit_row(row, parent_form, delete_row, delete_name) {
	if(delete_row == true) {
		if(confirm("Warning!\nYou are about to remove " + delete_name + " from the database.")) {
			parent_form.action += "&id=" + row.id;
			parent_form.submit(true);
			parent_form.action = parent_form.action.slice(0, -4 + (row.id.length * -1));
		}
	} else {
		parent_form.action += "&id=" + row.id;
		parent_form.submit(true);
		parent_form.action = parent_form.action.slice(0, -4 + (row.id.length * -1));
	}
}

//	hit a checkbox when row is clicked
function check_row(row, parent_form) {
	var checkbox = eval("parent_form.article_" + row);
	if(checkbox.checked == true) {
		checkbox.checked = false;
	} else {
		checkbox.checked = true;
	}
}

//	submit rows from webpilot search results
function submit_search(search_type, parent_form) {
	parent_form.action += "&search_type=" + search_type;
	parent_form.submit(true);
	parent_form.action = parent_form.action.slice(0, -13 + (search_type.length * -1));
}

//	submit layout for article
function submit_layout(template, parent_form) {
	parent_form.action += "&template=" + template;
	parent_form.submit(true);
	//	for some reason, the form doesn't work with this line...
	// parent_form.action = parent_form.action.slice(0, -10 + (template.length * -1));
}

//	swap div's for UI
function new_file_update(show_div, hide_div, marker) {
	document.getElementById(show_div).style.display = "";
	document.getElementById(hide_div).style.display = "none";
	marker.value = "true";
}

//	allow downloads to be selected from a select list
function download_from_select(select_list, path) {
	window.location = (path + select_list.options[select_list.selectedIndex].value);
}

//	allow pages to be loaded from a select list
function view_tip(select_list) {
	window.location = "beta.php?function=marketing_tips&tip=" + select_list.options[select_list.selectedIndex].value;
}

*/