var AppPath = '';

function SearchSubmit()
{
	CheckIfElementExists = document.getElementById('IMS_Header1_GoogleSearchSelection');
	if(CheckIfElementExists.checked)
	{
		CheckIfElementExists = document.getElementById('IMS_Header1_input');
		window.location.href = AppPath + '/Public/GoogleSearchInputTextBox.htm?Search=' + document.getElementById('IMS_Header1_input').value;
	}

	CheckIfElementExists = document.getElementById('IMS_Header1_CatalogDataSearchSelection');
	if(CheckIfElementExists.checked)
	{
		CheckIfElementExists = document.getElementById('IMS_Header1_input');
		return 'IMSSearch';
	}
	return ' ';
}

function ExtendSession()
{
	setTimeout(ExtendSession, 1020000);
	IMS_Web_Gold.UserControls.IMS_Header.ExtendSession('parameter', ExtendSession_CallBack);
}

function ExtendSession_CallBack(response)
{
}

function EnterKeyPressed(e)
{
	if(window.event)
	{
		keynum = e.keyCode;
	}
	else if(e && e.which)
	{
		keynum = e.which;
	}
	CheckIfElementExists = document.getElementById('IMS_Header1_input');
	if(keynum == 13 && CheckIfElementExists)
		CheckIfElementExists.click();
}

function ThreeCharsOrMore()
{
	document.getElementById('IMS_Header1_input').value = Trim(document.getElementById('IMS_Header1_input').value);
	if(document.getElementById('IMS_Header1_input').value.length >= 3)
		return true
	else
	{
		document.getElementById('IMS_Header1_errorLabel').innerHTML = 'Please enter 3 or more characters to search';
		return false;
	}
}

function Trim(UserInput)
{
	return UserInput.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}

function DetectCookies()
{
   var tmpcookie = new Date();
   chkcookie = (tmpcookie.getTime() + '');
   document.cookie = "chkcookie=" + chkcookie + "; path=/";
   if(document.cookie.indexOf(chkcookie,0) < 0) 
   {
		document.getElementById('NoCookiesLabel').style.display = '';
   }
}