jQuery(document).ready(function() {
  defaultValue = jQuery('#Form_SearchForm_Search').val();
  normalValue = "I'm looking for...";
  if (defaultValue == normalValue) {
    jQuery('#Form_SearchForm_Search').addClass("default");
  }
  jQuery('#Form_SearchForm_Search').click(function() {
      if( jQuery(this).val() == defaultValue ) {
          jQuery(this).val("");
      }
    if (jQuery(this).val() != normalValue) {
      jQuery(this).removeClass("default");
    }
  }).blur(function() {
    if (jQuery(this).val() == "") {
      jQuery(this).val(defaultValue);
    }
    if (jQuery(this).val() == normalValue) {
      jQuery(this).addClass("default");
    }
  });
  jQuery("#Form_SearchForm").submit(function() {
    if (jQuery("#Form_SearchForm_Search").val() == "" || jQuery("#Form_SearchForm_Search").val() == normalValue) {
      return false;
    } else {
      return true;
    }
  });
  
  jQuery("input.quantity").each(function() {
    updateQuantity(this, "each");
  }).click(function() {
    updateQuantity(this, "click");
  }).blur(function() {
    updateQuantity(this, "blur");
  });
  
  jQuery("#gallery a").colorbox();
});

function updateQuantity(object, action) {
  if(action == "click") {
    if (jQuery(object).val() == "0") {
      jQuery(object).val("").removeClass("default");
    }
  } else {
    if(jQuery(object).val() == "" || jQuery(object).val() == "0") {
      jQuery(object).val("0").addClass("default");
    } else {
      jQuery(object).removeClass("default");
    }
  }
}
