﻿function clearText(Id, text) 
{    
    var txtKeyword = document.getElementById(Id);
        
    if(txtKeyword.value == text) 
    {
        txtKeyword.value = '';
        txtKeyword.focus();    
    }
}

function setText(Id, text)
{
    var txtKeyword = document.getElementById(Id);

    if(trim(txtKeyword.value) == '') 
    {
        txtKeyword.value = text;
    }
}

function trim(strValue)
{ 
    while (strValue.substring(0,1) == ' ')
    { 
        strValue= strValue.substring(1, strValue.length);
    }

    while (strValue.substring(strValue.length-1, strValue.length) == ' ')
    { 
        strValue= strValue.substring(0,strValue.length-1);
    }
    return strValue;
}

