function ltrim(theString) 
{
	return theString.replace(/^\s+/,'');
}

function rtrim(theString) 
{
	return theString.replace(/\s+$/,'');
}

function trim(theString) 
{
	return theString.replace(/^\s+/,'').replace(/\s+$/,'');
}

function isEmptyString(theString) 
{
	var tmpString;
	tmpString=theString;
	return (trim(tmpString).length==0)
}

function isEmailValid(theEmail)
// http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=22
{
	var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
	var tmpString;
	tmpString=theEmail;
	tmpString=trim(tmpString);
	return regex.test(tmpString);
}

function isURLValid(theURL)
// http://regexplib.com/REDetails.aspx?regexp_id=96
{
	var regex = /(http|ftp|https):\/\/[\w]+(.[\w]+)([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/;
	var tmpString;
	tmpString=theURL;
	tmpString=trim(tmpString);
	return regex.test(tmpString);
}

function isDateCorrect(theDate)
// http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20603911.html
{	var strDate;
	strDate=theDate;
	if(strDate.length>0)
		{
		var dateregex=/^[ ]*[0]?(\d{1,2})\/(\d{1,2})\/(\d{4,})[ ]*$/;
		var match=strDate.match(dateregex);
		if (match)
			{
			var tmpdate=new Date(match[3],parseInt(match[1],10)-1,match[2]);
			if (tmpdate.getDate()==parseInt(match[2],10) && tmpdate.getFullYear()==parseInt(match[3],10) && (tmpdate.getMonth()+1)==parseInt(match[1],10))
				{ 
				return true; 
				}
			}
		}
	return false;
}

function URLFieldFocused(Field)
{
if (isEmptyString(Field.value))
	{
	Field.value="http://";
	Field.select();
	}
return;
}

function URLFieldBlur(Field)
{
if (Field.value=="http://")
	{
	Field.value="";
	}
return;
}
 