jQuery(document).ready(function() {

/*   reset search box text - rowan */
	jQuery("#signup-text").click(function () {
    this.value = '';
  })
  
/*   put it back if user doesn't enter anything - rowan */
	jQuery("#signup-text").blur(function () {
    if (this.value == '') {this.value = 'Enter your Email';};
  })  
  
  
/* primary nav rollovers */
	jQuery("#primary-nav img").mouseover(function()
  {
    this.src= this.src.split(".gif")[0]+"_on.gif";
  })
  
	jQuery("#primary-nav img").mouseout(function()
  {
    if (this.src.indexOf("_on")>-1)
    {
      this.src= this.src.split("_on.gif")[0]+".gif";
    }
  })  
    
    
 /* on action page, hide "already a defender" email box, until CSS hooks are assigned - rowan */
  
  
  if (jQuery("#already-defender input")[0])  jQuery("#already-defender input")[0].id ="already-defender-input";
  if (jQuery("#already-defender input")[1])  jQuery("#already-defender input")[1].id ="already-defender-submit";
  if (jQuery("#already-defender"))  jQuery("#already-defender").css("visibility","visible");    
    
    
/*   assign an id to the table containing the submit buttons, for the campaign donation page   - rowan */
    
    if (jQuery("#ga-donationLayout"))
    {
      jQuery("#ga-donationLayout table:last").addClass("submit-button-table");   
      jQuery("#ga-donationLayout table td:last").addClass("submit-button-table-last");          
     }
    
/*   add a hover id to the homepage biogem list - rowan */
    
  jQuery('#biogem-list div.list-item').each(function()
  {   
   jQuery(this).mouseover(function()
   {
    
   
    jQuery(this).addClass("selected");
    
    })
   jQuery(this).mouseout(function()
   {
    jQuery(this).removeClass("selected");
    
    })    
  })    
    
        
        
  /*    hack for step2 page (campaign error page) --  listen for  a unique "goback" form name, assign css class accordingly - rowan 
  function stepTwoHack()
  {
    var theforms = document.forms;
    for (i=0;i<theforms.length;i++)
    {
      if (theforms[i].name == "goback") 
      {
        document.getElementById("content").className += " step-two-container";
      }         
    }
   }
  stepTwoHack();*/
  
  
/*  hack for login page -- listen for a unique form element with the name of 'login_page', and assign css class accordingly - rowan */
  function loginPageHack()
  {
    var theforms = document.forms;
    for (i=0;i<theforms.length;i++)
    {
      if(theforms[i].login_page) 
      {
        document.getElementById("left-column").className += " login-page";
      }
    }
  }  
  loginPageHack();  
  
  
});  
  
