function moteur_dimension_detect()
{
 var d={'viewW':0,'viewH':0,'docH':0,'docW':0,'left':0,'top':0};
 if (document.body.scrollHeight>document.body.offsetHeight)
 {
  d.docW=document.body.scrollWidth;
  d.docH=document.body.scrollHeight;
 }
 else
 {
  d.docW=document.body.offsetWidth;
  d.docH=document.body.offsetHeight;
 }
 if (self.innerWidth)
 {
 d.viewW=self.innerWidth;
 d.viewH=self.innerHeight;
 d.left=window.pageXOffset;
 d.top=window.pageYOffset;
 }
 else
 {
  var ie=(document.compatMode&&document.compatMode!='BackCompat')?document.documentElement:document.body;
  d.viewW=ie.clientWidth;
  d.viewH=ie.clientHeight;
  d.left=ie.scrollLeft;
  d.top=ie.scrollTop;
 }
 return d;
}

function moteurEcrireCookie(nom, valeur, delai)
{
 var moteurtoday = new Date();
 var moteurtempday = moteurtoday.getTime() + ( delai * 1000 * 60 * 60 * 24 );
 var moteurexpires = new Date(moteurtempday);
 document.cookie = nom + "=" + escape(valeur) + "; expires=" + moteurexpires.toGMTString() + "; path=/";
}

function moteurGetCookieVal(offset)
{
 var endstr=document.cookie.indexOf (";", offset);
 if (endstr==-1) endstr=document.cookie.length;
 return unescape(document.cookie.substring(offset, endstr)); 
}

function moteurLireCookie(nom)
{
 var arg=nom+"=";
 var alen=arg.length;
 var clen=document.cookie.length;
 var i=0;
 while (i<clen)
 {
  var j=i+alen;
  if (document.cookie.substring(i, j)==arg) return moteurGetCookieVal(j);
  i=document.cookie.indexOf(" ",i)+1;
  if (i==0) break;
 }
 return ""; 
}

function gotomoteurfct()
{
 var moteurdimzz = moteur_dimension_detect();
 var moteurviewW = moteurdimzz.viewW + moteurdimzz.left;
 var moteurviewH = moteurdimzz.viewH + moteurdimzz.top;
 window.moteur_page = window.open('http://promo.vador.com/index.php/sellpage/id=820041');
 if ( typeof(window.moteur_page) != "undefined" )
 {
  window.moteur_page.blur();
  window.focus();
  moteurEcrireCookie('gotomoteur', '1', '1');
 }
 return false
}

function moteurdata()
{
 var moteur_vu = moteurLireCookie("gotomoteur");
 
 if (moteur_vu != 1)
 {
  Event.observe(document.body, 'click', function() { if (moteurLireCookie("gotomoteur") != 1) { gotomoteurfct(); } });
 }
}

Event.observe(window, 'load', moteurdata);
