function checkEmail(email) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)){
		return (true);
	}
	else
	{
		return (false);
	}
}
function changephoneimage(sPhone)
{
	for (var i = 0; i < sPhone.length; i++)
	{
		if (sPhone[i].selected == true)
		{
			var phoneid = sPhone[i].value;
		}
	}
	document.phoneimage.src='/media/phones/' + phoneid + '.gif';
}

function checkService(lform)
{
	var country = lform.CountryID.options[lform.CountryID.selectedIndex].value;
	var cellphone = lform.CellPhone.value;
	if (isNaN(cellphone))
	{
		alert('Please enter only numbers for the cell phone number.');
		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=450,height=400';
   	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 playtone(productid,versionid) {
	var winStats='toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=300,height=200,left=150,top=40';
	midiWindow = window.open ('/toneplayer/toneplayer.asp?ProductID=' + productid + '&Versionid=' + versionid,'midiWindow',winStats);
	if (midiWindow.opener == null) midiWindow.opener = self;
	midiWindow.focus();
}
function previewgraphic(productid) {
	var winStats='toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=300,height=275,left=150,top=40';
	if (window.parent == null)
	{
		wallpaperWindow = window.open ('/previewGraphic.asp?ProductID=' + productid,'wallpaperWindow',winStats);
	}
	else
	{
		wallpaperWindow = window.parent.open ('/previewGraphic.asp?ProductID=' + productid,'wallpaperWindow',winStats);
	}
	if (wallpaperWindow.opener == null) wallpaperWindow.opener = self;
	wallpaperWindow.focus();
}
function ltrim ( s )
{
	return s.replace( /^\s*/, '' );
}
function rtrim ( s )
{
	return s.replace( /\s*$/, '' );
}
function trim ( s )
{
	return rtrim(ltrim(s));
}
function selectoption(tbox, tvalue) {
	for (i = 0; i < tbox.options.length; i++) {
		if (tbox.options[i].value == tvalue){
			tbox.options[i].selected = true;
		}
	}
}
function linkOver(objContainer)
{
	objContainer.style.color='#0D36FF';
}
function linkOut(objContainer)
{
	objContainer.style.color='#000000';
}
function changeColor(objContainer, color)
{
	objContainer.style.color=color;
}

function windowPop(theURL,winName,features) { 
  window.open(theURL,winName,features);
}
