var searchPromptText = "Enter your search here";


function ClearTextFromSearch(textBox,promptText)
{
	if(textBox)
	{	
		if (textBox.value.toLowerCase() == promptText.toLowerCase())
		{
			textBox.value = "";
		}
	}
}

function ResetSearchText(textBox,promptText)
{
	if (textBox)
	{
		if (textBox.value == "")
		{
			textBox.value = promptText;
		}
	}
}

function getkey(e)
{
	if (window.event)
	{
		return window.event.keyCode;
	}
	else if (e)
	{
		return e.which;
	
	}
	else
    {
		return null;
	}
}

function setContext(ctx) {
	//context = ctx;
	//window.status = 'Context is ' + context;
}


function bodyKeyPress(e)
{
	if (getkey(e) == 13)
	{
		return false;
	}
	else 
	{
		return true;
	}
}

function StopBubbling(e)
{
	if(window.event && window.event.cancelBubble != null)
	{
		window.event.cancelBubble = true;
	}
	else if(e && e.stopPropogation)
	{
		e.stopPropogation();
	}
}

function onSearchKeyPress(e, searchTextBox)
{
	if (getkey(e) == 13)
	{
		StopBubbling(e);
		if((searchTextBox.value != "") && (searchTextBox.value != searchPromptText))
		{
			//alert("searching");
			var button = document.getElementById("header_btnSearch");
			if (button)
			{
				button.click();
			}
			return false;
		}
		else 
		{
			//alert("not searching");
			return false;
		}
	}
	else
	{
		return true;
	}
}

function checkTextBox(searchTextBox) 
{
	var textBox = document.getElementById(searchTextBox).value;
	if((textBox != "") && (textBox != searchPromptText))
	{
		return true;	
	}
	else 
	{
		return false;
	}	
}

function advancedSearch(e)
{
	if (getkey(e) == 13)
	{
			var button = document.getElementById("btnAdvancedSearch");
			if (button)
			{
				button.click();
			}
			return false;
	}
	else
	{
		return true;
	}
}

function Logon(e)
{
	if (getkey(e) == 13)
	{
			var button = document.getElementById("Submit1");
			if (button)
			{
				button.click();
			}
			return false;
	}
	else
	{
		return true;
	}
}