﻿function trim(str) {
	var	str = str.replace(/^\s\s*/, ''),
		ws = /\s/,
		i = str.length;
	while (ws.test(str.charAt(--i)));
	return str.slice(0, i + 1);
}

function fEvent(sType,oInput)
{
	switch (sType){
		case "focus" :
			oInput.isfocus = true;
		case "mouseover" :
			oInput.style.borderColor = '#9ecc00';
			break;
		case "blur" :
			oInput.isfocus = false;
		case "mouseout" :
			if(!oInput.isfocus){
				oInput.style.borderColor='#84a1bd';
			}
			break;
	}
}

/*Master function*/

function Search()
{
    var txtKey = document.getElementById("txtKey");
    var key =  trim(txtKey.value) ;
    
    if ( key == "" )
    {
        alert("Keyword can not be null!") ;
        txtKey.focus ();
        return;
    }
    else
    {
        window.location = "Search.aspx?Key=" + key ;
    }
}


function SearchSubmit()
{
    var txtKey = document.getElementById("txtKey");
    var key =  trim(txtKey.value) ;
    
    if(event.keyCode==13)
    {
        if ( key == "" )
        {
            alert("Keyword can not be null!") ;
            txtKey.focus ();
            return false;
        }
        else
        {
            window.location = "Search.aspx?Key=" + key ;
            return false ;
        }
    }
}

/*End of Master function*/

