//code google analitycs

  var _gaq = _gaq || [];

  _gaq.push(['_setAccount', 'UA-22096968-1']);

  _gaq.push(['_trackPageview']);

 

  (function() {

    var ga = document.createElement('script'); ga.type =
'text/javascript';
ga.async = true;

    ga.src = ('https:' == document.location.protocol ? 'https://ssl'
:
'http://www') + '.google-analytics.com/ga.js';

    var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);

  })();
function envoi_mail() {
  get_something('pages/contact-envoi.php', 'nom='+$('#nom').val()+'&prenom='+$('#prenom').val()+'&telephone='+$('#tel').val()+'&message='+$('#textfield5').val()+'&email='+$('#textfield3').val());
}
function envoi_mail_agent() {
  get_something('pages/contact-envoi.php', 'nom='+$('#nom').val()+'&agent_nom='+$('#agent_nom').val()+'&agent_id='+$('#agent_id').val()+'&telephone='+$('#tel').val()+'&message='+$('#message').val()+'&email='+$('#email').val()+'&agent_produit='+$('#agent_produit').val());
}
var slideshow_timer_id;
$(document).ready(function() {
	var posx = findPosX(document.getElementById('moncadre'));
	$('#slideshow').css('left', posx + 'px');
	$('#slideshow img').css('visibility', 'visible');
});

function findPosX(obj)
 {
   var curleft = 0;
   if(obj.offsetParent)
       while(1) 
       {
         curleft += obj.offsetLeft;
         if(!obj.offsetParent)
           break;
         obj = obj.offsetParent;
       }
   else if(obj.x)
       curleft += obj.x;
   return curleft;
 }

 function findPosY(obj)
 {
   var curtop = 0;
   if(obj.offsetParent)
       while(1)
       {
         curtop += obj.offsetTop;
         if(!obj.offsetParent)
           break;
         obj = obj.offsetParent;
       }
   else if(obj.y)
       curtop += obj.y;
   return curtop;
 }
	function slideSwitch() {
	    var $active = $('#slideshow IMG.active');

	    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

	    var $next =  $active.next().length ? $active.next()
	        : $('#slideshow IMG:first');

	    $active.addClass('last-active');
	    $next.css({opacity: 0.0})
	        .addClass('active')
	        .animate({opacity: 1.0}, 1000, function() {
	            $active.removeClass('active last-active');
	        });
	}

	$(function() {
	    slideshow_timer_id = setInterval( "slideSwitch()", 5000 );
	});
	
	    function test() {
      var err = "";
      if (Number(document.ess.nbrentiers4.value) > Number(document.ess.nbrdcp.value)) 
        err = "le champs (1) doit-être inférieure au champ (2)";
      return err;
    }
    
