function showDiv(id) 
{ 
   document.getElementById(current_divK).style.display = 'none' 
   document.getElementById('div'+id).style.display = 'block' 
   current_divK = 'div'+id 
} 

function LTrim( value ) {
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
}

function RTrim( value ) {
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
}

function trim( value ) {
	return LTrim(RTrim(value));
}

function formatPar( value ) {
	return trim(value.replace(/[()&%`"~'#<>{};]/g, ""));
}

function checkEmail(str)
{
	var at = '@';
	var dot = '.';
	var lat = str.indexOf(at);
	var lstr = str.length;
	var ldot = str.indexOf(dot);
	var isInvalid = false;

	if (str.indexOf(at)==-1) isInvalid = true;
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) isInvalid = true;
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) isInvalid = true;
	if (str.indexOf(at,(lat+1))!=-1) isInvalid = true;
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) isInvalid = true;
	if (str.indexOf(dot,(lat+2))==-1) isInvalid = true;
	if (str.indexOf(" ")!=-1) isInvalid = true;

	if (isInvalid)
	  alert("Invalid Email.");
	return !isInvalid;
}

