      function deb(txt){
        //ShowMsg(txt, "success");
        alert(txt);
        return "ok";
        
      }
      function showAvant(){
        AvantApres("avant","apres");
      }
      function showApres(){
        AvantApres("apres","avant");
      }
      function AvantApres(miseEnAvant,lautre){
        $("."+miseEnAvant).css('font-weight','bold');
        $("."+lautre).css('font-weight','normal');
        $("#"+lautre).hide();
        $("#"+miseEnAvant).show();
      }
      function ShowMsg(txt,type){
        var code = "";
        if(type=="success"){
          code='<div class="ui-widget">';
    			code+='<div class="ui-state-highlight ui-corner-all"> ';
    			code+='<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>';
          code+=''+txt+'</p>';
    			code+='</div>';
    			code+='</div>';

        }else{
          code = txt;
        }
        
        if($('#messageBox').size()==0)
          $(document.body).append($('<div id="messageBox" style="display:none;"></div>'));	             	 
            			  
        $("#messageBox").html(code); 
        $("#messageBox").slideDown('slow', function() {
          setTimeout('hideMsg()',4000);
        });

      }
      function hideMsg(){
        $("#messageBox").slideUp('slow');
      }
      function resizeBoxFull (){
                var h = $(window).height()/ 3 * 2;
        var elm =$('#FullScreenBox');
        var offset = elm.offset();
        //elm.css('height',h - offset.top);
        elm.dialog('option', 'height', h);
        elm.dialog('option', 'width', $(window).width() / 3 * 2);
        elm.dialog('option', 'position', 'center');
    
       // $("#directionsPanel").css('height',h - offset.top);
        try{google.maps.event.trigger(map , 'resize');}catch(ex){};
          
    }
    function UpdateDesignPost(){
      $(".changeBtn").button();
      
    }
    
    function Restenhaut() {
      
      var msie6 = $.browser == 'msie' && $.browser.version < 7;
      
      if (!msie6 && $('div.restenhaut').size()>0) {
        var top = $('div.restenhaut').offset().top - parseFloat($('div.restenhaut').css('margin-top').replace(/auto/, 0));
        $(window).scroll(function (event) {
          // what the y position of the scroll is
          var y = $(this).scrollTop();
          
          // whether that's below the form
          if (y >= top) {
            // if so, ad the fixed class
            $('div.restenhaut').addClass('fixed');
          } else {
            // otherwise remove it
            $('div.restenhaut').removeClass('fixed');
          }
        });
      }  
    }


    $(document).ready(function() {
	  UpdateDesignPost();
    Restenhaut();
    
		$('.ModalBox').each(function() {
			var $link = $(this);	
				
			$link.click(function() {
  			  if($('#modalBox').size()==0)
            $(document.body).append($('<div id="modalBox"></div>'));	     
  			  else 
  			    $('#modalBox').dialog( 'destroy' );
  			    
          $('#modalBox').dialog({
                                  modal: true,
                                  title: $link.attr('title'),
                                  width: 600
                                }).load($link.attr('href') + '?ContentOnly');
          return false;
			});
		});
		 $('.FullScreenBoxImage').each(function() {
			var $link = $(this);	
				
			$link.click(function() {
			     var created = false;
  			  if($('#FullScreenBox').size()==0){
            $(document.body).append($('<div id="FullScreenBox"></div>'));	     
            $(document.body).append($('<div id="FullScreenBoxGrey"></div>'));	     
            created = true;
  			  }else {
  			    $('#FullScreenBox').dialog( 'destroy' );
  			     $("#FullScreenBoxGrey").fadeIn("slow");	  
  			  }  
          $('#FullScreenBox').dialog({
                                      modal: true,
                                      resizable:false,
                                      draggable:false,
                                      title: $link.attr('title'),
                                      //width: $(window).width() / 3 * 2,
                                      //height: $(window).height() / 3 * 2,
                                      hide: 'blind',
                                      close: function(event, ui) {                                    
                                         $("#FullScreenBoxGrey").fadeOut("slow");	                 
                                      },
                                      open: function(event, ui) { 
                                        resizeBoxFull();
                                        
                                      }                                      
                                    }
                                    ).html('<img src="'+$link.attr('href')+'" width="100%" />');
          if(created){
            
            jQuery.event.add(window, "resize", resizeBoxFull);
          }
          
          
          setTimeout("resizeBoxFull()","1000");
          
          return false;
			});
		});
    $('.FullScreenBox').each(function() {
			var $link = $(this);	
				
			$link.click(function() {
			     var created = false;
  			  if($('#FullScreenBox').size()==0){
            $(document.body).append($('<div id="FullScreenBox"></div>'));	     
            $(document.body).append($('<div id="FullScreenBoxGrey"></div>'));	     
            created = true;
  			  }else {
  			    $('#FullScreenBox').dialog( 'destroy' );
  			     $("#FullScreenBoxGrey").fadeIn("slow");	  
  			  }  
          $('#FullScreenBox').dialog({
                                      modal: false,
                                      resizable:false,
                                      draggable:false,
                                      //position:['left','top'] ,
                                      title: $link.attr('title'),
                                      width: $(window).width() / 3 * 2,
                                      height: $(window).height() / 3 * 2,
                                     // show: 'blind',
			                                hide: 'blind',
                                      close: function(event, ui) {                                    
                                         $("#FullScreenBoxGrey").fadeOut("slow");	                 
                                      },
                                      open: function(event, ui) { 
                                        resizeBoxFull();
                                        
                                      }                                      
                                    }
                                    ).load($link.attr('href') + '?ContentOnly');
          if(created){
            
            jQuery.event.add(window, "resize", resizeBoxFull);
          }
          
          
          setTimeout("resizeBoxFull()","1000");
          
          return false;
			});
		});
		$('.ContentBox').each(function() {
			var $link = $(this);

			$link.click(function() {
  			  if($('#ContentBox').size()==0)
            $(document.body).append($('<div id="ContentBox"></div>'));	     
          else
  			    $('#ContentBox').dialog( 'destroy' );
  			     
          $('#ContentBox').dialog({
                                    modal: false,
                                    title: $link.attr('title'),
                                    width: 600
                                  }).load($link.attr('href') + '?ContentOnly');
          return false;
			});
		});
		$(".imgRO").hover(
      function () {
        $(this).attr('src', $(this).attr('src')+"_on.png");
      }, 
      function () {
        src = $(this).attr('src');
        $(this).attr('src', src.substr(0,src.length - 7));
      }
    );
	});

