var mailPromptText = "Your email address";


function ClearTextFromInput(textBox,promptText)
{
	if(textBox)
	{	
		if (textBox.value.toLowerCase() == promptText.toLowerCase())
		{
			textBox.value = "";
		}
	}
}

function ResetInputText(textBox,promptText)
{
	if (textBox)
	{
		if (textBox.value == "")
		{
			textBox.value = promptText;
		}
	}
}

function checkValidText() {
	textBox = document.getElementById("emailnewsletter");
	validemail = formIsEmail(textBox.value);
	if ((textBox.value == mailPromptText) || (validemail != true)) {
		alert("Please enter a valid email address");
		return false;
	} else {
		return true;
	}
}

function formIsEmail(str) {
	return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}

function getkey(e)
{
	if (window.event)
	{
		return window.event.keyCode;
	}
	else if (e)
	{
		return e.which;
	
	}
	else
    {
		return null;
	}
}

function StopBubbling(e)
{
	if(window.event && window.event.cancelBubble != null)
	{
		window.event.cancelBubble = true;
	}
	else if(e && e.stopPropogation)
	{
		e.stopPropogation();
	}
}

function onInputKeyPress(e, inputTextBox)
{
	if (getkey(e) == 13)
	{
		StopBubbling(e);
		return false;
	}
	else
	{
		return true;
	}
}
