function isValidEmailAddress(emailAddress) {
	var pattern = new RegExp(
			/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
	return pattern.test(emailAddress);
}
function trim(string) {
	return string.replace(/(^\s*)|(\s*$)/g, '');
}
/* popup */
var newWin = null;
function popUp(strURL, strScrollbars) {
	/*
	 * if (newWin !== null) { if(!newWin.closed) { newWin.close(); } }
	 */
	var strOptions = "";
	strOptions = "toolbar=no,menubar=no,scrollbars=" + strScrollbars
			+ ",resizable,location=no,width=790, height=470";
	newWin = window.open(strURL, 'newWin', strOptions);
	newWin.focus();
}


function sharePopUp(strURL, strScrollbars) {
	/*
	 * if (newWin !== null) { if(!newWin.closed) { newWin.close(); } }
	 */
	var strOptions = "";
	strOptions = "toolbar=no,menubar=no,scrollbars=" + strScrollbars
			+ ",resizable,location=no,width=590, height=250";
	newWin = window.open(strURL, 'newWin', strOptions);
	newWin.focus();
}
function popupResize(containerId) {

	if (containerId == null) {
		containerId = "container";
	}
	var pageHeight = document.getElementById(containerId).offsetHeight;
	var pageWidth = document.getElementById(containerId).offsetWidth;

	var name = navigator.appName;
	var version = navigator.appVersion;

	var autoLeft = (screen.availWidth - pageWidth) / 2;
	var autoTop = (screen.availHeight - pageHeight) / 2;

	/* if popup content higher than screen height */
	if (pageHeight > screen.availHeight) {
		/* if IE */
		if (name == 'Microsoft Internet Explorer') {
			id = version.indexOf('MSIE');
			version = version.substring(id + 5, id + 9);
			/* if IE 7 */
			if (version == '7.0;') {
				// alert(version);
				window.resizeTo(pageWidth + 50, screen.availHeight - 100);
				window.moveTo(autoLeft - 20, 50);
			}
			/* if other IE version */
			else {
				window.resizeTo(pageWidth + 50, screen.availHeight - 100);
				window.moveTo(autoLeft, 50);
			}
		}
		/* if other navitor */
		else {
			window.resizeTo(pageWidth + 50, screen.availHeight - 100);
			window.moveTo(autoLeft, 50);
		}
	}
	/* else if content smaller than screen height */
	else {
		/* if IE */
		if (name == 'Microsoft Internet Explorer') {
			id = version.indexOf('MSIE');
			version = version.substring(id + 5, id + 9);
			/* if IE 7 */
			if (version == '7.0;') {
				// alert(version);
				window.resizeTo(pageWidth + 50, pageHeight + 100);
				window.moveTo(autoLeft - 20, autoTop);
			}
			/* if other IE version */
			else {
				window.resizeTo(pageWidth + 50, pageHeight + 80);
				window.moveTo(autoLeft, autoTop);
			}
		}
		/* if other navitor */
		else {
			window.resizeTo(pageWidth + 50, pageHeight + 80);
			window.moveTo(autoLeft, autoTop);
		}

	}

}
