<!--


var stickerX=0, stickerY=0;
var stickerVX=0.0, stickerVY=0.0;
var stickerAX=0.0, stickerAY=0.0;
var stickerCurX=1280, stickerCurY=-800;
var stickerWidth, stickerHeight;
var sticker_closed=true;
var stickHotX, stickHotY;
var notimeout = false;
var isIE6 = document.all && document.getElementById ? true : false;
var isNS6 = ! isIE6 && document.getElementById ? true : false;
var win_w, win_h;
var auto_close_timeout;


function closeSticker(){
	sticker_closed = true;
	
	stickerX = -(stickerWidth+1000);
	moveSticker();
}

function initStickerPos(){
	var x, y;
	
 	var layer = document.getElementById ('message_sticker');

y = -(stickerHeight+50);
if (isIE6) {
x = document.body.clientWidth + document.body.scrollLeft + 10;
}
else {
x = window.pageXOffset + 10;
}


	stickerCurX=x;
	stickerCurY=y; 

  	if (isIE6) {
    		layer.style.pixelLeft = x;
    		layer.style.pixelTop = y;
	}
  	else if (isNS6) {
    		layer.style.left = x+'px';
    		layer.style.pixelTop = y+'py';
	}
}

function updateStickerTarget(){
	if(sticker_closed) return;

stickerY = 60;
if (isIE6) {
stickerX = document.body.clientWidth + document.body.scrollLeft;
}
else {
stickerX  = window.pageXOffset;
}
stickerX -= (stickerWidth+50);


	stickerVY += 10;
}


function onResize(){
	updateStickerTarget();

	notimeout = false;
	setTimeout('moveSticker()', 20);
}

function accelSticker(x, y){
	var dx, dy;

	dx= stickerX - x; 
	dy= stickerY - y; 

		stickerAX  = dx / 60;
		stickerAY  = dy / 60;
		
}




function moveSticker(){
	var x, y, ax, ay;

 	var layer = document.getElementById ('message_sticker');
		
	accelSticker(stickerCurX, stickerCurY);


	stickerVX*=0.92;
	stickerVY*=0.92;

    	stickerVX += stickerAX;
	stickerVY += stickerAY;


	stickerCurX+=stickerVX ;
	stickerCurY+=stickerVY ; 

	x = Math.round(stickerCurX);
	y = Math.round(stickerCurY);

  	if (isIE6) {
    		layer.style.pixelLeft = x;
    		layer.style.pixelTop = y;
	}
  	else if (isNS6) {
    		layer.style.left = x+'px';
    		layer.style.pixelTop = y+'py';
	}

	if(x == stickerX && y == stickerY && stickerVX < 1 && stickerVY < 1){
		notimeout = true;
		saveSize();
	  	setTimeout('checkSize()', 1000);
	}
	else{
		notimeout = false;
	  	setTimeout('moveSticker()', 15); // vitesse arrivée
	}
}



function saveSize(){
	if(isIE6){
		win_h = document.body.clientHeight;
		win_w = document.body.clientWidth;	
	}
}

function checkSize(){
	if(notimeout == false) return;

	if(isIE6){
		if(win_w != document.body.clientWidth || win_h !=document.body.clientHeight)
			onResize();
		else
			setTimeout('checkSize()', 1000);
	}
}


function initSticker(width, height){
  sticker_closed=false;
  stickerWidth = width;
  stickerHeight = height;

  initStickerPos();
  updateStickerTarget();

  if(isIE6){
	  for(i=1;i<=3;i++){

	    	xImg = document.images["sticker"+i];
	
		if(xImg){
		    xImg.ondragstart = function(){return false};
		    xImg.onmousedown = function(){catchImg(this)};
		    xImg.onmouseup = function(){dropImg(this)};
		    xImg.onmouseover = function(){findImg(this)};
		}
  	}
  }


  notimeout = false;
  setTimeout('moveSticker()', 3*1000); // 3 secondes ... Temp avant démarrage
  auto_close_timeout = setTimeout('closeSticker()', 15*1000); // 10 secondes ... Temp avant départ
}
function catchImg(theImg, e){
  if(!e) e = event;
  theDiv = theImg.parentNode;
  theDiv.style.cursor = "hand";
  theDiv.onmousemove = moveImg;

  stickHotX = e.x - stickerCurX;
  stickHotY = e.y - stickerCurY;

  if(auto_close_timeout){ 	 
	  clearTimeout(auto_close_timeout);
	  auto_close_timeout = 0;
  }

  return false;
}
function moveImg(e){
  if(!e) e = event;

  stickerX = e.x - stickHotX ;
  stickerY = e.y - stickHotY ;

  if(notimeout){
  	setTimeout('moveSticker()', 20);
  }
}
function dropImg(theImg, e){
  if(!e) e = event;
  theDiv = theImg.parentNode;
  theDiv.onmousemove = null;
window.status = theImg.name;
  theImg.parentNode.style.cursor = "auto"; 

stickerVY += 10;
}

function findImg(theImg){
  window.status = theImg.name;
  theImg.parentNode.style.cursor = "hand"; 
}

// if(isNS6){
//window.onLoad=initSticker(); 
//window.onresize=onResize(); 
//}


function toyosSticker(opacity, width, height, loc, dest){
	var flash_mode, w;

	if(!isIE6) return;

	w = width - 78;

document.write('<div id="message_sticker" style="position:absolute; left:1000px; top:1000px; z-index:30"><table border="0" cellspacing="0" cellpadding="0"><tr><td><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="1"><img name="sticker1" src="../../sticker/images/stickbar_left.gif" width="15" height="16"></td><td><img name="sticker3" src="../../sticker/images/stickbar_middle.gif" width="100%" height="16"></td><td width="1"><a href="javascript:closeSticker()"><img src="../../sticker/images/stickbar_right.gif" width="17" height="16" border="0"></a></td></tr></table></td></tr><tr><td>');
		
// jpg
document.write('<A HREF="http://www.archi-urgent.com" title=" Faites un don en ligne ! " target="blank"><IMG src="'+loc+'" width='+width+' height='+height+' border=0></A>');

// ifram
// document.write('<iframe src="'+loc+'" width='+width+' height='+height+' frameborder=0 marginwidth=0 marginheight=0></iframe>');


	document.write("</td></tr></table></div>");

	initSticker(width, height);
}

// jpg
toyosSticker(300, 400, 238, "../../sticker/images/haiti_architectes_urgence.jpg", "");

// ifram
//toyosSticker(100, 500, 350, "http://www.gfgdfg.com/index.htm", "http://www..com/index.htm");
//-->
