$(document).ready(function()
{
  // popups
  $("a.popup").popupWindow({ height:600, width:600, centerScreen: 1, scrollbars: 1 }); 
  
  // nospam
  $("a.email").nospam({replaceText: true});
  
  // cycle
  $("#home_slideshow").cycle({
    timeout: 10000
  });
  
  // botones
  $("a.boton").corner();
  
  // imagenes noticias
  function images_details()
  {
    var image_detail_link = $("#actualidad_imagen_detalle_link");
    var image_detail = $("#actualidad_imagen_detalle");
    var current_thumbnail = null;
  
    $(".actualidad_thumbnail_link").click(function() {
      var id = $(this).attr('rel');
      $(".galeria_detalle").hide();
      $("." + id).show();
      /*
      if (current_thumbnail != null) {
        current_thumbnail.fadeTo(300, 1);
      }
      var src = $(this).attr("href");
      image_detail.attr("src", src);
      
      image_detail_link.attr("href", "http://www.hola.com/imagenes//realeza/casa_suecia/2010042414012/anuncio-ruptura/compromiso/magdalena/0-33-80/33080-z.jpg");
    
      $(this, "img").fadeTo(300, 0.4);
      current_thumbnail = $(this);
      
      var description = $(this).siblings(".actualidad_imagenes_descripciones").html();
      $("#actualidad_imagen_descripcion").html(description);
      */
      return false;
    });
  }
  
  images_details();
  
  // agenda
  $("#home_agenda_contenido").hover(
    function() {
      $(this).addClass('open');
    },
    function() {
      $(this).removeClass('open');
    }
  );
  
  // ellipsis
  $(".ellipsis").autoEllipsis();

});

function init_shipping_costs(group, shipping_costs, show_price) {
  $('#order-shipping_cost_zone option').remove();
  $('#order-shipping_cost_zone').append($(document.createElement("option")));

  for(var idx in shipping_costs[group]) {
    var shipping_cost = shipping_costs[group][idx];
    var label = shipping_cost.label;
    if (show_price) {
      label += " - " + shipping_cost.cost + "€";
    }
    $('#order-shipping_cost_zone').append($(document.createElement("option")).attr("value",group+"|"+idx).text(label));

  }
}