function validateEmail(emailStr)
{
	var re=new RegExp("^[\\w.-]+@([0-9a-z][\\w-]+\\.)+[a-z]{2,3}$","i");
 	if(re.test(emailStr))
	{
  		//alert("Valid Email Address");
  		return true;
 	}
 	else
 	{
  		//alert("Invalid Email Address");
  		return false;
 	}
}

function checkForm(moduleid)
	{
		name = document.getElementsByName(moduleid+'name')[0];
		email = document.getElementsByName(moduleid+'email')[0];
		if(name.value == '')
		{
			alert('name must be filled');
			name.focus();
			return;
		}
		if(email.value == '' || validateEmail(email.value) == false)
		{
			alert('Valid email address must be filled');
			email.focus();
			return;
		}
		document.forms[moduleid+"moduleform-1"].submit();
		
	}
	
	function checkFileType(fileName)
{
	text_array = fileName.split(".");
	return text_array[(text_array.length-1)].toLowerCase();
}

function allTrim(cValue)
{
 var lDone=false;
 while (lDone==false){
  if (cValue.length==0) {return cValue;}
  if (cValue.indexOf(' ')==0){cValue=cValue.substring(1);lDone=false; continue;}
  else {lDone=true;}
  if (cValue.lastIndexOf(' ')==cValue.length-1){cValue=cValue.substring(0, cValue.length-1);lDone=false;continue;}
  else {lDone=true;}
 }
 return cValue;
}

function HideContent(d) {
	document.getElementById(d).style.display = "none";
}

function ShowContent(d) {
	document.getElementById(d).style.display = "";
}

function open_window(link, title, width, height){
    WREF = window.open(link, title, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height);
	if(!WREF.opener)
	{
		WREF.opener = this.window;
	}
}

function whichBrs() {
	var agt=navigator.userAgent.toLowerCase();		
	if (agt.indexOf("opera") != -1) return 'Opera';
	if (agt.indexOf("staroffice") != -1) return 'Star Office';
	if (agt.indexOf("webtv") != -1) return 'WebTV';
	if (agt.indexOf("beonex") != -1) return 'Beonex';
	if (agt.indexOf("chimera") != -1) return 'Chimera';
	if (agt.indexOf("netpositive") != -1) return 'NetPositive';
	if (agt.indexOf("phoenix") != -1) return 'Phoenix';
	if (agt.indexOf("firefox") != -1) return 'Firefox';
	if (agt.indexOf("safari") != -1) return 'Safari';
	if (agt.indexOf("skipstone") != -1) return 'SkipStone';
	if (agt.indexOf("msie") != -1) return 'Internet Explorer';
	if (agt.indexOf("netscape") != -1) return 'Netscape';
	if (agt.indexOf("mozilla") != -1) return 'Camino';
	if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
	if (agt.indexOf('\/') != -1) {
	if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
	return navigator.userAgent.substr(0,agt.indexOf('\/'));}
	else return 'Netscape';} else if (agt.indexOf(' ') != -1)
	return navigator.userAgent.substr(0,agt.indexOf(' '));
	else return navigator.userAgent;
}