// JavaScript Document
function hide(element_id) {
	if (document.getElementById(element_id)) {
		document.getElementById(element_id).style.display = "none";
		return true;
	} else {
		return false;	
	}
}

function show(element_id, display_type) {
	var display_type = (arguments.length < 2) ? "block" : display_type;
	
	if (document.getElementById(element_id)) {
		document.getElementById(element_id).style.display = display_type;
		return true;
	} else {
		return false	
	}
}

function change_content(element_id, changed_content) {
	document.getElementById(element_id).innerHTML = changed_content;
}

function popup(filename, width, height) {
	var center_left = (screen.width/2) - width/2;
	var center_top = (screen.height/2) - height/2;
	var filename_array = filename.split(".");
	z = window.open(filename, filename_array[0], 'width=' + width + ',height=' + height + ',left=' + center_left + ',top=' + center_top + ',scrollbars=yes,resizable=yes');
	z.focus();
}

function email_page(url_var) {
	pageurl  = '/email_page.asp?url=' + escape(url_var);
	winname  = 'email_page';
	w_width  = 330;
	w_height = 460;
	
	top_pos  = (screen.availHeight - w_height) / 2;
	left_pos = (screen.availWidth  - w_width)  / 2;

	w = window.open(pageurl, winname, 'width=' + w_width + ',height=' + w_height + ',toolbars=0,resizable=1,scrollbars=1,top=' + top_pos + ',left=' + left_pos);
	w.focus();
}

function rand() {
	var randomNumber = Math.floor(Math.random() * 9999999);
	return randomNumber;
}