window.onload = function () {
  jobvana_page = new home();
  jobvana_page.build();
}


function home(){ 
      
  if (typeof home._initialized == "undefined") {
      
     home.prototype.build = function () {  
        dash_loader = new jobvana();
        dash_loader.build();
     
        if (document.getElementById("search_go_button")) {
          YAHOO.util.Event.addListener("search_go_button", "click", this.process_search, this, true);
        }
           
        if (document.getElementById("feature_buttons")) {
          this.feature_buttons = document.getElementById("feature_buttons").getElementsByTagName("img");
          YAHOO.util.Event.addListener(this.feature_buttons, "click", this.change_flash, this);
          
          this.grey_1 = document.getElementById("grey_1");
          this.oran_1 = document.getElementById("oran_1");
          this.flash_1 = document.getElementById("flash_1")
          
          this.grey_2 = document.getElementById("grey_2");
          this.oran_2 = document.getElementById("oran_2");
          this.flash_2 = document.getElementById("flash_2")
          
          this.grey_3 = document.getElementById("grey_3");
          this.oran_3 = document.getElementById("oran_3");
          this.flash_3 = document.getElementById("flash_3")
          
          this.grey_4 = document.getElementById("grey_4");
          this.oran_4 = document.getElementById("oran_4");
          this.flash_4 = document.getElementById("flash_4")
        }
     }
              
      
     home.prototype.process_search = function() {
		  if (document.getElementById("search_term").value.length > 0) {
        var search_url = "/search?";   
        
        search_url = search_url+"searchterm="+ document.getElementById("search_term").value+"&";
    
        location.href = search_url;
		  
		  } else {    
		   this.error_tip = new YAHOO.widget.Overlay("error_tip", {context:["search_term","tl","bl"], visible:false, width:"220px", zIndex:1500 });
       this.error_tip.setBody("<div class='error_message'>Please enter a search term.</div>"); 
       this.error_tip.render(document.body); 
       this.error_tip.show();
       YAHOO.util.Event.addListener("search_term", "keypress", this.hide_error, this, true);
       YAHOO.util.Event.addListener("search_term", "blur", this.hide_error, this, true);
     }
    }
    
    
    
     home.prototype.change_flash = function (e, obj) { 
       switch(this.id){
        case "grey_1":
          obj.grey_1.style.visibility = "hidden";
  		    obj.grey_2.style.visibility = "visible";
  		    obj.grey_3.style.visibility = "visible";
  		    obj.grey_4.style.visibility = "visible";
  		    
  		    obj.oran_1.style.visibility = "visible";
  		    obj.oran_2.style.visibility = "hidden";
  		    obj.oran_3.style.visibility = "hidden";
  		    obj.oran_4.style.visibility = "hidden";
  		    
  		    obj.flash_1.style.visibility = "visible";
  		    obj.flash_2.style.visibility = "hidden";
  		    obj.flash_3.style.visibility = "hidden";
  		    obj.flash_4.style.visibility = "hidden";
  			  break;
  			case "grey_2":
  		    obj.grey_1.style.visibility = "visible";
  		    obj.grey_2.style.visibility = "hidden";
  		    obj.grey_3.style.visibility = "visible";
  		    obj.grey_4.style.visibility = "visible";
  		    
  		    obj.oran_1.style.visibility = "hidden";
  		    obj.oran_2.style.visibility = "visible";
  		    obj.oran_3.style.visibility = "hidden";
  		    obj.oran_4.style.visibility = "hidden";
  		    
  		    obj.flash_1.style.visibility = "hidden";
  		    obj.flash_2.style.visibility = "visible";
  		    obj.flash_3.style.visibility = "hidden";
  		    obj.flash_4.style.visibility = "hidden";
  				break;
  		  case "grey_3":
  		    obj.grey_1.style.visibility = "visible";
  		    obj.grey_2.style.visibility = "visible";
  		    obj.grey_3.style.visibility = "hidden";
  		    obj.grey_4.style.visibility = "visible";
  		    
  		    obj.oran_1.style.visibility = "hidden";
  		    obj.oran_2.style.visibility = "hidden";
  		    obj.oran_3.style.visibility = "visible";
  		    obj.oran_4.style.visibility = "hidden";
  		    
  		    obj.flash_1.style.visibility = "hidden";
  		    obj.flash_2.style.visibility = "hidden";
  		    obj.flash_3.style.visibility = "visible";
  		    obj.flash_4.style.visibility = "hidden";
  				break;
  			case "grey_4":
  		    obj.grey_1.style.visibility = "visible";
  		    obj.grey_2.style.visibility = "visible";
  		    obj.grey_3.style.visibility = "visible";
  		    obj.grey_4.style.visibility = "hidden";
  		    
  		    obj.oran_1.style.visibility = "hidden";
  		    obj.oran_2.style.visibility = "hidden";
  		    obj.oran_3.style.visibility = "hidden";
  		    obj.oran_4.style.visibility = "visible";
  		    
  		    obj.flash_1.style.visibility = "hidden";   
  		    obj.flash_2.style.visibility = "hidden";
  		    obj.flash_3.style.visibility = "hidden";
  		    obj.flash_4.style.visibility = "visible";
  				break;
    		}
     }
     
     
     //////////////////////////////////////////////////////////////////////////////////////
       
     home._initialized = true;
  } 
}


 