h1. JavaScript for Search Box

h2. quickSearch(resultPageURI) function

* This function will be redirected to the page which shows search results by setting url of a page for *window.location* variable.

* Accept one parameter *resultPageURI* to indicate the correct page to be used to view results. If customers don't pass the value for *resultPageURI*, we will set a default value is *searchResult*.

* url of result page in well format: *http:\//\[host-name]:\[port-number]/.../\[resultPageURI]*
                  
         For example: http://localhost:8080/portal/private/classic/eXoResult?portal=classic&keyword=exoplatform


h2. quickSearchOnEnter(event, resultPageURI) function

* This function will call *quickSearch(resultPageURI)* after you press enter key in case textbox contains your keyword.
          
* Accept event and *resultPageURI* parameters, so we can check right when the enter key is pressed. If true (the enter key is pressed) it's very simple to call *quickSearch(resultPageURI)*, otherwise it will do nothing.
         
* We check a key that is pressed by *getKeynum(event)* function, it returns a number. If this number equals to 13 (keycode of enter key), enter key is pressed.

h2. keepKeywordOnBoxSearch() function
          
* When you enter your keyword and click search or press enter key on textbox, the keyword is lost - it's not useful. This function is provided to make good one's shortcomings - keep your keyword that you've just entered to search.
          
* This function always be active when a web site is loaded. By using the function: *eXo.core.Browser.addOnLoadCallback(param1, param2)* - you can have a look at this function in *exo.portal.web.eXoResources.Browse.js*. Here is an example:
{code}
eXo.core.Browser.addOnLoadCallback("keepKeywordOnBoxSearch", keepKeywordOnBoxSearch);
{code}
          
* How to get keyword for keeping. Firstly, I get a query string (it's value of *location.search*) and then paste it to get a value of keyword parameter. At last I store the keyword in textbox. 