/* -------------------------------------------------------------- 
   
   Site.js - version 0.2.0
   * Sets some default site behaviour
-------------------------------------------------------------- */

var site = {
	
	start: function(){
	    
		// Search events
		search.start();
		
		// Hyperlink list event
		hlkList.start();

	}
};


var search = {

    start: function() {
    
       // Init search input text box
        if ($("ctl00_ctl00_SiteLabelControl_txtSearch")) {
        
            var searchBox = $("ctl00_ctl00_SiteLabelControl_txtSearch");
            var searchLabel = searchBox.value;
        
            // Clear default search value on onfocus
            searchBox.addEvent('focus', function(){
	            if (this.value == searchLabel) this.value = "";
	        });
	    
	        searchBox.addEvent('blur', function(){
	            if (this.value == "") this.value = searchLabel;
	        });
        }
    }
};

var hlkList = {

    start: function() {
        
        // Init hyperlink list
        var liList = $$('div.hlkList li');
        
        liList.forEach(function(li){
	         li.addEvent('mouseover', function(){
	            li.addClass('onHover');
	         }); 
	         
	         li.addEvent('mouseout', function(){
	            li.removeClass('onHover');
	         });     
	    });
    }
};

// Executes site.start when the dom tree is loaded, without waiting for images. 
window.addEvent('load', site.start);
