// JavaScript Ampliar imatge

var ie=document.all;
var ns=document.layers;
var ns6=document.getElementById&&!document.all;
var nsx,nsy,nstemp;

function enlarge(which,e){
	
	if (ie||ns6){
		
		crossobj = document.getElementById ? document.getElementById("showimage") : document.all.showimage;
		if (crossobj.style.visibility=="hidden"){
			e = e?e:event;
			scrollposx = ns6 ? pageXOffset: document.body.scrollLeft;
			scrollposy = ns6 ? pageYOffset: document.body.scrollTop;
			crossobj.style.left= scrollposx + e.clientX -200 + "px"; 
			crossobj.style.top= scrollposy + e.clientY -100 +"px";
			crossobj.innerHTML='<div align="right" id="drag"><a href="#" onClick=closepreview()><strong>cerrar</strong></a></div><img src="'+which+'">';
			crossobj.style.visibility="visible";
		}
		else
			crossobj.style.visibility="hidden";
			return false;
		}
	else if (document.layers){
		if (document.showimage.visibility=="hide"){
			document.showimage.document.write('<a href="#" onMouseover="drag_dropns(showimage)"><img src="'+which+'" border=0></a>')
			document.showimage.document.close()
			document.showimage.left=e.x
			document.showimage.top=e.y
			document.showimage.visibility="show"
		}
		else
			document.showimage.visibility="hide"
			return false
		}
	else
		return true
}

function closepreview(){
	
	crossobj.style.visibility="hidden";
}


function drag_dropns(name){
	
	temp=eval(name)
	temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
	temp.onmousedown=gons
	temp.onmousemove=dragns
	temp.onmouseup=stopns
}

function gons(e){
	
	temp.captureEvents(Event.MOUSEMOVE)
	nsx=e.x
	nsy=e.y
}

function dragns(e){
	
	temp.moveBy(e.x-nsx,e.y-nsy)
	return false
}

function stopns(){
	
	temp.releaseEvents(Event.MOUSEMOVE)
}

function drag_drop(e){
	
	if (ie&&dragapproved){
	crossobj.style.left=tempx+event.clientX-offsetx
	crossobj.style.top=tempy+event.clientY-offsety
	}
	else if (ns6&&dragapproved){
	crossobj.style.left=tempx+e.clientX-offsetx
	crossobj.style.top=tempy+e.clientY-offsety
	}
	return false
}


function enlargeProf(which,e){
	
	if (ie||ns6){
		
		crossobj = document.getElementById ? document.getElementById("showimageProf") : document.all.showimageProf;
		if (crossobj.style.visibility=="hidden"){
			e = e?e:event;
			scrollposx = ns6 ? pageXOffset: document.body.scrollLeft;
			scrollposy = ns6 ? pageYOffset: document.body.scrollTop;
			crossobj.style.left= scrollposx +20 +"em"; 
			crossobj.style.top= scrollposy +150 +"px";
			crossobj.innerHTML='<div align="right" id="drag"><a href="#" onClick=closepreview()><strong>cerrar</strong></a></div><img src="'+which+'">';
			crossobj.style.visibility="visible";
		}
		else
			crossobj.style.visibility="hidden";
			return false;
		}
	else if (document.layers){
		if (document.showimageProf.visibility=="hide"){
			document.showimageProf.document.write('<a href="#" onMouseover="drag_dropns(showimageProf)"><img src="'+which+'" border=0></a>')
			document.showimageProf.document.close()
			document.showimageProf.left=e.x
			document.showimageProf.top=e.y
			document.showimageProf.visibility="show"
		}
		else
			document.showimageProf.visibility="hide"
			return false
		}
	else
		return true
}
