function openWindow(theURL,winName,features) 
{
  window.open(theURL,winName,features);
}

function changeTextboxContent(textboxObj, id)
{
	switch(id)
	{
		case "search":
			initialText = "[email address]";
			break;
	}

	if(textboxObj.value == initialText)
	{
		textboxObj.style.color = '#000000';
		textboxObj.value = "";
	}
	else if(textboxObj.value == "")
	{
		textboxObj.style.color = '#999999';
		textboxObj.value = initialText;
	}
}

function validateEmail(textboxObj, form, errorMsg)
{
	if(!emailCheck(textboxObj.value))
	{
		alert(errorMsg);
		return false;
	}
	else
	{
		form.action = "subscribe.aspx";
		form.submit();
	}
}

function emailCheck(str)
{
	var ret = false;
	
	if (typeof(str) != "undefined")
	{
		if (/^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/.test(str))
		{
		ret = str;
		}
	}
	
	return ret;
}