// clear text in the search news box.
function ClearSearchBy() {}

// toggle visibility 
function toggle( targetId ){
   target = $("#" + targetId );
   if ($(target).css("display") == "none"){
      $(target).show();
   } else {
      $(target).hide();
   }
}

$(document).ready(function() {
   if ($("#donate_pg").length > 0) {
      // toggles the more_info box on clicking the More Info &darr; link 
      $('#donate_pg h2').click(function(){
        $(this).next('.toggle').toggle(400);
        $(this).toggleClass("up").toggleClass("down");
        return false;
      }).toggleClass("down");

      //hide the div's to begin with
      $('#donate_pg h2:not(.default_open)').next('.toggle').hide();
      $('#donate_pg h2.default_open').toggleClass("up").toggleClass("down");

      $("#frequency_contain").html($("#frequency_txt").html()).removeClass("hidden");
      
      $("#frequency").change(function(){
         target = $("#frequency option:selected").val();
         
         if ($("#swap_info").attr("class") != target) {
            var amount = $("#swap_info #amount").val();
            $("#swap_info").attr("class","");
            $("#swap_info").html($("#"+target).html()).addClass(target);
            $("#swap_info #amount").val(amount);
         }
      });
   }
   
   $('#q').focus(function () {
      // If value and title are equal on focus, clear value
      if (this.value == 'Search MCF') {
         this.value = '';
         this.select(); // Make input caret visible in IE
      }
   });

   //ADDED it back if field is empty
   $('#q').blur(function () {
      if (!this.value.length) { this.value = 'Search MCF'; }
   });
});