var ie=document.all
var ns6=document.getElementById&&!document.all

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat" && !window.opera)? document.documentElement : document.body
}

function enlarge(which, e, comment, position, imgwidth, imgheight){
if (ie||ns6){
crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
if (position=="center"){
pgyoffset=ns6? parseInt(pageYOffset) : parseInt(ietruebody().scrollTop)
horzpos=ns6? pageXOffset+window.innerWidth/2-imgwidth/2 : ietruebody().scrollLeft+ietruebody().clientWidth/2-imgwidth/2
vertpos=ns6? pgyoffset+window.innerHeight/2-imgheight/2 : pgyoffset+ietruebody().clientHeight/2-imgheight/2
if (window.opera && window.innerHeight) //compensate for Opera toolbar
vertpos=pgyoffset+window.innerHeight/2-imgheight/2
vertpos=Math.max(pgyoffset, vertpos)
}
else{
var horzpos=ns6? pageXOffset+e.clientX : ietruebody().scrollLeft+event.clientX
var vertpos=ns6? pageYOffset+e.clientY : ietruebody().scrollTop+event.clientY
}

crossobj.style.left=horzpos+"px"
crossobj.style.top=vertpos+"px"

if(which.substr(0, 7) == 'images/' || which.substr(0, 9) == 'dossiers/')
{	
	crossobj.innerHTML='<div id="content" onClick="closepreview()"><img src="'+which+'" title="Cliquez sur l\'image pour fermer"></div>'
	if(comment.length > 0)
		crossobj.innerHTML+='<div id="dragbar" style="background-color:#EFEFEF">'+comment+'</div>'
	
	crossobj.style.left="133px"
	if(which.substr(0, 7) == 'images/')
	{
		crossobj.style.top="237px"
	}
}
else if(which.substr(0, 4) == 'http')
{
	crossobj.innerHTML='<table id="topbar" cellpadding=0 cellspacing=0 width="340"><tr><td width="320" height="22" id="dragbar" background="images/site/topbar.gif">'+comment+'</td><td height="22" onClick="closepreview()" background="images/site/topbar.gif" style="cursor:pointer">X &nbsp;</td></tr></table>'
	crossobj.innerHTML+='<div id="content"><object width="340" height="280"><param name="movie" value="'+which+'&iv_load_policy=3"></param><embed src="'+which+'&iv_load_policy=3" type="application/x-shockwave-flash" wmode="transparent" width="340" height="280"></embed></object></div>'
	crossobj.style.borderWidth="1px"
}
else
{
	crossobj.innerHTML='<table id="topbar" cellpadding=0 cellspacing=0 width="240"><tr><td width="220" height="22" id="dragbar" background="images/site/topbar.gif">'+comment+'</td><td height="22" onClick="closepreview()" background="images/site/topbar.gif" style="cursor:pointer">X &nbsp;</td></tr></table>'	
	crossobj.innerHTML+='<div id="content"><object type="application/x-shockwave-flash" data="player_mp3_maxi.swf" width="240" height="20"><param name="movie" value="player_mp3_maxi.swf" /><param name="FlashVars" value="mp3=musiques/'+which+'.mp3&amp;showstop=1&amp;showvolume=1&amp;bgcolor1=ffffff&amp;bgcolor2=ffffff&amp;buttoncolor=000000&amp;buttonovercolor=ff5e04&amp;sliderovercolor=ff5e04&amp;loadingcolor=ff5e04" /></object></div>'
	crossobj.innerHTML+='<div id="bottombar"><a href=\"?page=modifierplaylist&idMusique='+which+'\" class=\"lienNoir\">Ajouter à la playlist</a></div>'	
	crossobj.style.borderWidth="1px"
}


crossobj.style.visibility="visible"
return false
}
else //if NOT IE 4+ or NS 6+, simply display image in full browser window
return true
}

function closepreview(){
crossobj.style.visibility="hidden"
crossobj.innerHTML=""
}

function drag_drop(e){
if (ie&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx+"px"
crossobj.style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
}
return false
}

function initializedrag(e){
if (ie&&event.srcElement.id=="dragbar"||ns6&&e.target.id=="dragbar"){
offsetx=ie? event.clientX : e.clientX
offsety=ie? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}

document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")