function jsOpenhWnd(u){p="toolbar=no,height=660,width=380,directories=no,status=no,scrollbars=auto,resizable=no,menubar=no";hWnd=window.open(u,"Hwnd",p);hWnd.focus();}

function disableselect(e)
{
return false;
}

function reEnable()
{
return true;
}


var dom = (window.document.getElementById)? true:false;
var ns4 = (window.document.layers)? true:false;
var ie4 = (window.document.all)? true:false;
var dd_mode="";


function start() {			
	var h="50px";
	var w="50px";
 	if (ie4) {
		//var w=window.document.body.clientWidth-800;
		cadre_barre.style.left=w;
		cadre_barre.style.top=h;
		
		
		cadre_barre.onmousedown=beginDrag;
	}else if (dom) {
		//var w=window.outerWidth-800;
		window.document.getElementById('cadre_barre').style.left=w;
		window.document.getElementById('cadre_barre').style.top=h;
		
		window.document.getElementById("cadre_barre").addEventListener("mousedown",beginDrag, false);
	}else if (ns4) {
		//var w=window.outerWidth-800;
		window.document.layers.cadre_barre.left=w;
		window.document.layers.cadre_barre.top=h;
		
		window.document.captureEvents(Event.MOUSEDOWN);
		window.document.onmousedown=beginDrag;
	}
}

function doDrag(e) {
	
	
	window.document.getElementById('cadre_barre').style.filter = 'alpha(opacity=' + 5*10 + ')';	
	window.document.getElementById('cadre_barre').style.opacity = 5/10;

	// Déplacement des Divs-Layers
	if (ie4) {
	   var difX=event.clientX-window.lastX;
	   var difY=event.clientY-window.lastY;
	   var newX1 = parseInt(cadre_barre.style.left)+difX;
	   var newY1 = parseInt(cadre_barre.style.top)+difY;
	   cadre_barre.style.left=newX1+"px";
	   cadre_barre.style.top=newY1+"px";
	   

	   
	   window.lastX=event.clientX;
	   window.lastY=event.clientY;
	}else if (dom) {
	   var difX=e.clientX-window.lastX;
	   var difY=e.clientY-window.lastY;
	   var newX1 = parseInt(window.document.getElementById("cadre_barre").style.left)+difX;
	   var newY1 = parseInt(window.document.getElementById("cadre_barre").style.top)+difY;
	   window.document.getElementById("cadre_barre").style.left=parseInt(newX1)+"px";
	   window.document.getElementById("cadre_barre").style.top=newY1+"px";
	  
	 
	  
	   window.lastX=e.clientX;
	   window.lastY=e.clientY;
	}else if (ns4) {
		
	   var difX=e.pageX-window.lastX;
	   var difY=e.pageY-window.lastY;
	   var newX1 = parseInt(window.document.layers.cadre_barre.left)+difX;
	   var newY1 = parseInt(window.document.layers.cadre_barre.top)+difY;
	   window.document.layers.cadre_barre.left=newX1;
	   window.document.layers.cadre_barre.top=newY1;
	  
	   window.lastX=e.pageX;
	   window.lastY=e.pageY;
	} 
}

function beginDrag(e) {	


	window.document.getElementById('cadre_barre').style.filter = 'alpha(opacity=' + 5*10 + ')';	
	window.document.getElementById('cadre_barre').style.opacity = 5/10;

	if (ie4) {
	   window.lastX=event.clientX;
	   window.lastY=event.clientY;
	   window.document.onmousemove=doDrag;
	   window.document.onmouseup=endDrag;
	   window.document.onselectstart = function() { return false; };

	}else if (dom) {
	   window.lastX=e.clientX;
	   window.lastY=e.clientY;
	   window.onmousemove=doDrag;
	   window.onmouseup=endDrag;
	   
		window.document.onmousedown = disableselect;
		window.document.onclick=reEnable;
		
	 
		myattr=e.target.getAttribute("ID");

	}else if (ns4) {
	   window.lastX=e.pageX;
	   window.lastY=e.pageY;
	   window.document.captureEvents(Event.MOUSEMOVE)
	   window.document.onmousemove=doDrag;
	   
		window.document.captureEvents(Event.MOUSEDOWN)
		window.document.onmousedown = disableselect;
		
	   window.document.captureEvents(Event.MOUSEUP)
	  window.document.onmouseup=endDrag;
	}
}

function endDrag(e) {		
	
	window.document.getElementById('cadre_barre').style.filter = 'alpha(opacity=' + 10*10 + ')'
	window.document.getElementById('cadre_barre').style.opacity = 10/10;
	window.document.onselectstart = function() { return true; };
	if (window.sidebar)
	{
		window.document.onmousedown = reEnable;
	}
	
	 if (ie4 || ns4) {
	 	window.document.onmousemove=null;
	 }else if (dom) {
		window.onmousemove=null;
	}else if (ns4) {
		//alert("endDrag");
		window.document.onmousemove=null;
	}
	
}




////

function start_caddie() {			
	var h="50px";
	var w="50px";
 	if (ie4) {
		//var w=window.document.body.clientWidth-800;
		caddie_dc2.style.left="-200px";
		caddie_dc2.style.top=h;
		
		
		caddie_dc2.onmousedown=beginDrag_caddie;
	}else if (dom) {
		//var w=window.outerWidth-800;
		//window.document.getElementById('caddie_dc2').style.left=w;
		//window.document.getElementById('caddie_dc2').style.top=h;
		
		window.document.getElementById('caddie_dc2').addEventListener("mousedown",beginDrag_caddie, false);
	}else if (ns4) {
		//var w=window.outerWidth-800;
		//window.document.layers.caddie_dc2.left=w;
		//window.document.layers.caddie_dc2.top=h;
		
		window.document.captureEvents(Event.MOUSEDOWN);
		window.document.onmousedown=beginDrag_caddie;
	}
}




 function stop (event) {

    if (event.preventDefault) { 

      event.preventDefault(); 

      event.stopPropagation(); 

    } 
 }

function doDrag_caddie(e) {
	
	
	window.document.getElementById('caddie_dc2').style.filter = 'alpha(opacity=' + 5*10 + ')';	
	window.document.getElementById('caddie_dc2').style.opacity = 5/10;
	
	
	
	

	if (ie4) {
	   var difX=event.clientX-window.lastX;
	   var difY=event.clientY-window.lastY;
	   var newX1 = parseInt(caddie_dc2.style.left)+difX;
	   var newY1 = parseInt(caddie_dc2.style.top)+difY;
	   caddie_dc2.style.left=newX1+"px";
	   caddie_dc2.style.top=newY1+"px";
	   

	   
	   window.lastX=event.clientX;
	   window.lastY=event.clientY;
	}else if (dom) {
	   var difX=e.clientX-window.lastX;
	   var difY=e.clientY-window.lastY;
	   var newX1 = parseInt(window.document.getElementById("caddie_dc2").style.left)+difX;
	   var newY1 = parseInt(window.document.getElementById("caddie_dc2").style.top)+difY;
	   window.document.getElementById("caddie_dc2").style.left=parseInt(newX1)+"px";
	   window.document.getElementById("caddie_dc2").style.top=newY1+"px";
	  
	 
	  
	   window.lastX=e.clientX;
	   window.lastY=e.clientY;
	}else if (ns4) {
		
	   var difX=e.pageX-window.lastX;
	   var difY=e.pageY-window.lastY;
	   var newX1 = parseInt(window.document.layers.caddie_dc2.left)+difX;
	   var newY1 = parseInt(window.document.layers.caddie_dc2.top)+difY;
	   window.document.layers.caddie_dc2.left=newX1;
	   window.document.layers.caddie_dc2.top=newY1;
	  
	   window.lastX=e.pageX;
	   window.lastY=e.pageY;
	} 
}

function beginDrag_caddie(e) {	


	window.document.getElementById('caddie_dc2').style.filter = 'alpha(opacity=' + 5*10 + ')';	
	window.document.getElementById('caddie_dc2').style.opacity = 5/10;
	
	if (ie4) {
	   window.lastX=event.clientX;
	   window.lastY=event.clientY;
	   window.document.onmousemove=doDrag_caddie;
	   window.document.onmouseup=endDrag_caddie;
	   window.document.onselectstart = function() { return false; };
		//if (event.srcElement.id=="cadre_barre"){
	//		Récup de l'Id d'un élément sous IE
//		}
	}else if (dom) {
	   window.lastX=e.clientX;
	   window.lastY=e.clientY;
	   window.onmousemove=doDrag_caddie;
	   window.onmouseup=endDrag_caddie;
	   
		window.document.onmousedown = disableselect;
		window.document.onclick=reEnable;
		
	 
		myattr=e.target.getAttribute("ID");
//		if(myattr=="cadre_barre") {
//			Récup de l'ID d'un élément sous NS6
//		}
	}else if (ns4) {
	   window.lastX=e.pageX;
	   window.lastY=e.pageY;
	   window.document.captureEvents(Event.MOUSEMOVE)
	   window.document.onmousemove=doDrag_caddie;
	   
		window.document.captureEvents(Event.MOUSEDOWN)
		window.document.onmousedown = disableselect;
		
	   window.document.captureEvents(Event.MOUSEUP)
	  window.document.onmouseup=endDrag_caddie;
	}
}

function endDrag_caddie(e) {		
	
	window.document.getElementById('caddie_dc2').style.filter = 'alpha(opacity=' + 10*10 + ')'
	window.document.getElementById('caddie_dc2').style.opacity = 10/10;
	window.document.onselectstart = function() { return true; };
	if (window.sidebar)
	{
		window.document.onmousedown = reEnable;
	}
	
	 if (ie4 || ns4) {
	 	window.document.onmousemove=null;
	 }else if (dom) {
		window.onmousemove=null;
	}else if (ns4) {
		//alert("endDrag");
		window.document.onmousemove=null;
	}
	
}



