
	var timerId;

	function $_(id) { 
		var id;
		return document.getElementById(id);
	}
	
	function showPest(objeto, capa, contenido) {
		var el = $_(capa);
		var objeto, capa;
		var pos = getXY(objeto);		
		var contenido = (contenido!='') ? contenido : 'sin especificar';		
		holdPest(capa);
		el.style.left = (pos.x+50) + "px";
		el.style.top = (pos.y+objeto.offsetHeight) + "px";
		$_(capa).innerHTML = contenido;
	}	
	
	function hidePest(c) {
		var c;
		timerId=setTimeout("hideElement(\'"+c+"\',false)",500);
	}
	
	function holdPest(c) {
		var capa;
		hideElement(c,true);
		clearTimeout(timerId);
	}
	
	function objOver(e) {
		e.style.border='1px solid #91C8FF';
	}
	
	function objOut(e) {
		e.style.border='1px solid #E6F2FF';
	}
	
	function getXY(el) {
		var x=el.offsetLeft,y=el.offsetTop;
		if (el.offsetParent!=null){
			var pos = getXY(el.offsetParent);
			x += pos.x;
			y += pos.y;
		}
		return {x:x,y:y};
	}



/*
	funciones de solicitud de presupuesto
*/

	var Items = [];
	
	function addNewItem() {
		$_('newItem').innerHTML = 'hola';
	}
	
	function showPresupuestadas() {
		var html = [];
		if(Items.length) {
			html.push('<table width="100%"');
			for(var i=0;i<Items.length;i++) {
				html.push('<tr><td>' + (i + 1) + '.- ' + Items[i][0] + '</td></tr>');
			}
			html.push('<tr><td align="right">');			
			html.push('<input type="button" style="width:100px;margin-right:0" class="addItem" value="vista previa" /> ');
			html.push('<input type="button" style="width:70px;margin-right:0" class="addItem" value="enviar" />');
			html.push('</td></tr>');
			html.push('</table>');
		} else {
			html.push('sin registros');
		}
		$_('fAgregadas').innerHTML = html.join("");;
	}
	
	function addFunction(f) {
		var Item = [];
		Item.push(f.nombre.value);
		Item.push(f.detalles.value);
		Item.push(f.dentrada.value);
		Item.push(f.dsalida.value);
		Items.push(Item);
		showPresupuestadas();
		f.nombre.value = '';
		f.detalles.value = '';
		f.dentrada.value = '';
		f.dsalida.value = '';
		f.nombre.focus();
	}
	
	function checkInputContent(input, content) {
		//
	}
	
