if(!Elise) var Elise = {}


Elise.contact = {
  "onSubmit" : function(args){
    Kwo.exec('/contact.send',args,{"callback":Elise.contact.onCallBack});
   },
   
    "onCallBack" : function(h) {
    if(h["error"]>0){
       Kwo.error(h["result"]["msg"]);
    }else{
      alert(h["result"]["msg"])
    }
  }
};


Elise.GoogleMap = {
  "load" : function(){
    if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GSmallMapControl());


    var msg_box = " Au fil d'Elise <br /> 2 rue de l’Avé Maria <br /> 75004 Paris <br /> France <br />";
    map.setCenter(new GLatLng(48.854176283984, 2.3607194423675537), 15);

    var blueIcon = new GIcon(G_DEFAULT_ICON);
    blueIcon.image = "http://gmaps-samples.googlecode.com/svn/trunk/markers/blue/blank.png";

    blueIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
    blueIcon.iconSize = new GSize(20, 34);
    blueIcon.shadowSize = new GSize(37, 34);
    blueIcon.iconAnchor = new GPoint(9, 34);
    blueIcon.infoWindowAnchor = new GPoint(9, 2);

    function createMarker(point) {

      markerOptions = {icon:blueIcon };
      var marker = new GMarker(point, markerOptions);

      GEvent.addListener(marker, "mouseover", function() {
        marker.openInfoWindowHtml(msg_box);
      });
      return marker;
    }

    var point = new GLatLng(48.8526443848411, 2.3606550693511963);
    map.addOverlay(createMarker(point));
  }
  } 
};

Elise.objet = {
  "see" : function(src){
    $('preview-objet').src=src;
  }
}

Elise.Newsletter = {
  onCallback: function(res) {
    if (Kwo.hasError(res)) return Kwo.error(res);
    alert(res["result"]["callback_msg"].ucfirst() + ".");
  },

  onRecipientSave: function(elt) {
    Kwo.exec("/account/push/recipient.save", elt,
             {disable:true, callback:true});
  },

  onSubmit: function(elt) { 
    elt = $(elt);
    Kwo.exec("/push/newsletter.subscribe", elt,
             {disable:true, reset:true,
              callback: Elise.Newsletter.onCallback.bind(elt)});
  }
  

}


