﻿var mscForm = document.forms['aspnetForm'];
if (!mscForm) {
    mscForm = document.aspnetForm;
}

function SearchPromptText(ID, Text)
	{ 
	var Textbox = document.getElementById(ID);
	if (Textbox.value == '')
		{
		Textbox.value = Text;
		}
	else if (Textbox.value != Text)
    	{
		return;
		}
	Textbox.onfocus = function() { ClearSearchText(Textbox, Text) };
	Textbox.onblur = function() { ResetSearchText(Textbox, Text) };
	}
function ResetSearchText(Textbox, HelpText)
    {
    if (Textbox.value == '')
        {
        Textbox.value = HelpText;
        }
    }
function ClearSearchText(Textbox, Text)
	{
	if (Textbox.value == Text)
	    {
	    Textbox.value = '';
	    }
	//Textbox.onfocus = null;
	}
function DoSearchSubmit(ID,e,sT,pUrl)
    {
    if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13) || (sT == 3) || (sT == 4))
        {
        if ((sT == 3) || (sT == 4))
        {
	        var targ;
	        if (!e) var e = window.event;
	        if (e.target) targ = e.target;
	        else if (e.srcElement) targ = e.srcElement;
            
            if (targ.value != 0)
            {
                document.getElementById(ID).value = sT;
                if (pUrl != '')
                    {
                    mscForm.action = pUrl;
                    }
                mscForm.submit();
                return false;
            }
        }
        else
            {
            document.getElementById(ID).value = sT;
            if (pUrl != '')
                {
                mscForm.action = pUrl;
                }
            mscForm.submit();
            return false;
            }
        } 
    else
        {
        return true;
        }
    }