var c1=new Calendar(document.getElementById("fecha_recogida_dia"),document.getElementById("fecha_recogida_mes_ano"),document.getElementById("cal"));
var c2=new Calendar(document.getElementById("fecha_entrega_dia"),document.getElementById("fecha_entrega_mes_ano"),document.getElementById("cal"));
var abierto=-1;
//calendarPool.add(0);
function calendario(q) {
	//alert(document.getElementById("cal").style.position);
	if(abierto==q) {
		calendarPool.closeAll();
		cerrado();
		return;
	}
	var button=document.getElementById("lanza"+(q+1));
	calendarPool.closeAll();
	var pos=findPos(button);
	document.getElementById("cal").style.top=(pos[1]+19)+"px";
	document.getElementById("cal").style.left=pos[0]+"px";
	calendarPool.get(q).show(button);
	abierto=q;
}
function cerrado() { abierto=-1; return; }


function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

