<!-- Comienza el Script. (c) Juan Pablo Tejero Martín '03
var ie=document.all;
var ns=document.layers;
var ns6=document.getElementById&&!document.all;

function abrir(archivo,ancho,alto,barras,nombreventana) {
var ventana;
if (document.all || document.layers || document.getElementByld){
	w=screen.availWidth; h=screen.availHeight;}
else {w=800; H=600;}
if (!barras) {var barras = "yes";} 
if (!nombreventana) {var nombreventana = "";} 
if (barras=="yes") {ancho=ancho+25;} 
ventana = window.open (archivo,nombreventana,"toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars="+barras+",resizable=yes,width="+ancho+",height="+alto);
ventana.moveTo(parseInt((w-ancho)/2),parseInt((h+40-alto)/2)-40);
ventana.focus();

}
function imprime(){
	abrir("index.php?imprimir",700,600,"yes","imp");
}
function over (id){
document.getElementById(id+1).style.backgroundColor="#F4D7D7";
if (document.getElementById(id+2)) document.getElementById(id+2).style.backgroundColor="#F4D7D7";
}
function out (id) {
document.getElementById(id+1).style.backgroundColor="";
if (document.getElementById(id+2)) document.getElementById(id+2).style.backgroundColor="";
}

function vermapa(){
	x = (screen.availWidth -600)/2; // Supongo que hace 600 de ancho
	y = 160;
	if (ie||ns6){
		crossobj=document.getElementById? document.getElementById("mapa") : document.all.showimage
		if (crossobj.style.visibility){
			if (crossobj.style.visibility=="hidden"){
				crossobj.style.left=ns6? pageXOffset+x : document.body.scrollLeft+x
				crossobj.style.top=ns6? pageYOffset+y : document.body.scrollTop+y
				crossobj.style.visibility="visible"
			} else crossobj.style.visibility="hidden"
		}

	}
	else if (document.layers){
		if (document.mapa.visibility){
			document.mapa.document.write('<a href="#" onMouseover="drag_dropns(showimage)"><img src="'+which+'" border=0></a>')
				document.mapa.document.close()
				document.mapa.left=x
				document.mapa.top=y
				document.mapa.visibility="show"
		}
		
	}
	else
	return true
}

var nsx,nsy,nstemp;

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 initializedrag(e){
	if (ie&&event.srcElement.id=="drag"||ns6&&e.target.id=="drag"){
		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")