function checkEmail(email) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)){
		return (true);
	}
	else
	{
		return (false);
	}
}
function checkService(lform)
{
	var country = lform.CountryID.options[lform.CountryID.selectedIndex].value;
	var countrycode = lform.CountryCode.value;
	var cellphone = lform.CellPhone.value;
	if (isNaN(cellphone))
	{
		alert('Please enter only numbers for the cell phone number.');
		return false;
	}
	if (isNaN(countrycode) || countrycode.indexOf('+') > 0 || countrycode.charAt(0) == '+')
	{
		alert('Please enter only numbers for the country code.');
		return false;
	}
	else if (countrycode == '' || countrycode == null)
	{
		alert('Please enter a country code.');
		return false;
	}
	else if (country == '1' && cellphone.length != 10)
	{
		alert('Please enter a 10 digit cell phone number.');
		return false;
	}
	else
	{
		return true;
	}
}
function openWindow(page) {
	window.name = 'homewin';
	var info;
    info = 'toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,width=550,height=550';
   	if (navigator.appName.indexOf('Microsoft')>=0)
   	{
      info = info + ',left=40,top=40';
    }
    else
    {
      info = info + ',screenX=40,screenY=40';
    }
    window.open(page, 'newwin', info);
}
function midiPlay(song, nameOfSong) {
	var winStats='toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=375,height=325,left=150,top=40';
	midiWindow = window.open ('playTone.asp?song=' + song + '&nameOfSong=' + nameOfSong,'midiWindow',winStats);
	if (midiWindow.opener == null) midiWindow.opener = self;
}
function ltrim ( s )
{
	return s.replace( /^\s*/, '' );
}
function rtrim ( s )
{
	return s.replace( /\s*$/, '' );
}
function trim ( s )
{
	return rtrim(ltrim(s));
}
function selectstate(tbox, tvalue) {
	for (i = 0; i < tbox.options.length; i++) {
		if (tbox.options[i].value == tvalue){
			tbox.options[i].selected = true;
		}
	}
}
