/* 
 * client: proxistep.com
 * author: fabrice@proxistep.com
 * update: 2007-06-26
*/

// -------------------------------------------------------- //

$(document).ready(function() {
  // popup window
  $('a.popup').click(function() {
    window.open($(this).attr('href'), 'new_window');
    return false;
  });
  
  // print page
  $('a.print').click(function() {
    // print window
    print();
    console.info('test');
    return false;
  });
  
  // send mail to a friend
  if ($('a.send').length > 0) {
    //$('a.send').add('');
    $('a.send').click(function() {
      // mail form
    });
  };

 // init googleMap plugin, set map starting point
 if ($("#google-map").length > 0) {
  $("#google-map").googleMap(48.835374, 2.399011, 14, {
   controls: ["GSmallMapControl", "GMapTypeControl"],
   markers: $(".geo")
  });
 };

 //cmxform : fix Firefox inline-box
 if ( document.addEventListener ) {
   document.addEventListener( 'DOMContentLoaded', cmxform, false);
 }
});

function cmxform()
{
  // Hide forms
  $('form.cmxform').hide().end();

  // Processing
  $('form.cmxform').find('li/label').not('.nocmx').each(function(i) {
    var labelContent = this.innerHTML;
    var labelWidth = document.defaultView.getComputedStyle( this, '' ).getPropertyValue( 'width' );
    var labelSpan = document.createElement( 'span' );
        labelSpan.style.display = 'block';
        labelSpan.style.width = labelWidth;
        labelSpan.innerHTML = labelContent;
    this.style.display = '-moz-inline-box';
    this.innerHTML = null;
    this.appendChild( labelSpan );
  } ).end();

  // Show forms
  $('form.cmxform').show().end();
}


// get info for UFO plugin
$(document).ready(function() {
  var bodyId = $("body").attr('id');

  // init UFO plugin
  var FO = {
    movie:"./swf/"+ bodyId +".swf",
    width:"190",
    height:"300",
    majorversion:"8",
    build:"0",
    wmode: "transparent"
  };  
  UFO.create(FO, "swf");
});