/**
 * Common javascript functions
 */

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };
String.prototype.checkEmail = function(email) {
	var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
	return email.match(re);
}

function showDate(div_id) {
	var d = new Date();
	//var localdate = d.toLocaleDateString();
	var localdate = "";
	var localtime = d.toLocaleTimeString();
	localdate = localdate + " " + localtime;
	var display = document.getElementById(div_id);
	display.innerHTML = localdate;
	printDate(div_id);
}
function printDate(div_id) {
	window.setTimeout("showDate('" + div_id + "')", 1000);
}

function adjustMenu() {
	var contentDiv = document.getElementById('content');
	var menu = document.getElementById('menu');
	var menu_wrapper = document.getElementById('menu-wrapper');
	var rightbar = document.getElementById('rightbar');
	var rightbar_wrapper = document.getElementById('rightbar-wrapper');
	
	menu.style.height = (contentDiv.offsetHeight + 1) + "px";
	menu_wrapper.style.height = (contentDiv.offsetHeight + 1) + "px";
	rightbar.style.height = (contentDiv.offsetHeight + 1) + "px";
	rightbar_wrapper.style.height = (contentDiv.offsetHeight + 1) - 6 + "px";
	if (document.all) {
		//menu.style.height = (contentDiv.offsetHeight + 1);
		menu_wrapper.style.height = (contentDiv.offsetHeight + 1);
		//rightbar.style.height = (contentDiv.offsetHeight + 1);
		//rightbar_wrapper.style.height = (contentDiv.offsetHeight + 1);
	}
}
