var posX=0, posY=0;
var deltaX=0, deltaY=0;
var calqueDragDrop="";
var isLimiteDragDrop;

function startDragDrop(calque, isLimite)
{
	if (document.getElementById)
	{
		var calques=document.getElementsByTagName("div");
		var zIndexMax=0;
		for (var i=0; i<calques.length; i++)
		{
			if (calques[i].className=="calque")
			{
				if (calques[i].id!=calque.id)
				{
					if (zIndexMax=parseInt(calques[i].style.zIndex))
					{
						zIndexMax=parseInt(calques[i].style.zIndex);
					}
				}
			}
		}
		calque.style.zIndex=zIndexMax+1;
		calque.style.borderColor="#999";
                calque.style.borderStyle="dashed";
                
	   	 if (navigator.userAgent.toLowerCase().indexOf("msie")>0)
	   	 {
	   	 	calque.filters.alpha.opacity=50;
	   	 }
	   	 if (window.sidebar)
	   	 {
	   		calque.style.MozOpacity=0.5;
	   	 }

		isLimiteDragDrop=isLimite;
		deltaX=posX-calque.offsetLeft;
		deltaY=posY-calque.offsetTop;
		calqueDragDrop=calque;
	}
	return false;
}

function goDragDrop(e)
{
	if (document.all)
	{
		posX=event.x+document.body.scrollLeft;
		posY=event.y+document.body.scrollTop;
	}

	else 
	{
		posX=e.pageX;
		posY=e.pageY;
	}

	if (calqueDragDrop!="")
	{
		var tmpX=posX-deltaX;
		var tmpY=posY-deltaY;
		if (isLimiteDragDrop)
		{
			if (tmpX<document.body.scrollLeft) { tmpX=document.body.scrollLeft; }
			if (tmpY<document.body.scrollTop) { tmpY=document.body.scrollTop; }
			var largeurScrollBarX=(document.all)?22:-14;
			var largeurScrollBarY=(document.all)?4:0;
			var maxX=document.body.scrollLeft+document.body.offsetWidth-calqueDragDrop.offsetWidth-largeurScrollBarX;
			if (tmpX>maxX)
			{
				tmpX=maxX;
			}
			var maxY=document.body.scrollTop+document.body.offsetHeight-calqueDragDrop.offsetHeight-largeurScrollBarY;
			if (tmpY>maxY)
			{
				tmpY=maxY;
			}
		}
		calqueDragDrop.style.left=tmpX+"px";
		calqueDragDrop.style.top=tmpY+"px";
		return false;
	}
}

function stopDragDrop()
{
   	if (calqueDragDrop!="")
   	{
                if (calqueDragDrop.id == "hiwin")
		{
			calqueDragDrop.style.borderStyle="solid";
		}
		else
		{
   		calqueDragDrop.style.borderStyle="none";
		}
   		if (navigator.userAgent.toLowerCase().indexOf("msie")>0)
   		{
   			calqueDragDrop.filters.alpha.opacity=100;
   		}
   		if (window.sidebar)
   		{
   			calqueDragDrop.style.MozOpacity=1;
			
   		}
	calqueDragDrop="";
	return false;
   	}

}


function showpresentation()
{

	document.getElementById("presentation").style.display="block";

}

function closepresentation()
{

	document.getElementById("presentation").style.display="none";

}

function curriculumOpen()
{

	document.getElementById("main").style.height="1000px";
	document.getElementById("hidecv").style.display="block";

}

function currihide()
{

	document.getElementById("main").style.height="auto";
	document.getElementById("hidecv").style.display="none";
}
