    var updateInterval = null;
    function onmlstextfocus(which) 
    {
        clearMLSText(which);
		updateInterval = setInterval("onMLSChange()", 250);
    }
    function onmlstextblur(which) 
    {
        resetMLSText(which);
        if(updateInterval != null)
        {
            clearInterval(updateInterval);
            updateInterval = null;
        }
    }
    function clearMLSText(which) 
    {
	    if ((which == "MLSNum") && ( document.getElementById(MLSNumID).value == MLSNumString ))
		    document.getElementById(MLSNumID).value = "";
    }
    
    function resetMLSText(which) 
    {
        trimSpaces(MLSNumID);

	    if ((which == "MLSNum") && ( document.getElementById(MLSNumID).value == "" ))
		    document.getElementById(MLSNumID).value = MLSNumString;
    }   
    
    function onMLSChange()
    {
        var validateobject = document.getElementById(MLSNumValidatorID);
        if(!validateobject.evaluationfunction(validateobject))
            document.getElementById(MLSNumID).style.backgroundColor = '#ffff00'; 
        else
            document.getElementById(MLSNumID).style.backgroundColor = '#ffffff'; 
    } 

    function trimSpacesMLS(clientID)
    {
        var obj = document.getElementById(clientID);
        sString = obj.value;

        //Trim Left
        while (sString.substring(0,1) == ' ')
        {
            sString = sString.substring(1, sString.length);
        }
        //Trim Right
        while (sString.substring(sString.length-1, sString.length) == ' ')
        {
            sString = sString.substring(0,sString.length-1);
        }
        obj.value = sString;
    }
    function SearchMLSClick()
    {
        var mlsNum = document.getElementById(MLSNumID).value;
        if((mlsNum=="")||(mlsNum==MLSNumString))
        {
            document.getElementById(MLSNumID).style.backgroundColor = '#ffff00'; 
            return false;
        }
        var validateobject = document.getElementById(MLSNumValidatorID);
        if(!validateobject.evaluationfunction(validateobject))
            return false;

        var w=window.open('PropertyDetails.aspx?mls='+mlsNum,mlsNum,'toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width=875');
        w.focus();
    }
