function pinchar(){
	var capa = $('vineta'); 
	capa.style.display='none';
}
	
	// la funcion sumar y restar, tiene dos maneras distintas en la web, al añadir un producto y al modificar en la cesta la cantidad de cada productos,
	// es por ello por lo ke le pasamos la variable "valor", si valor tiene contenido, significa k se llama a la funcion desde la cesta para poder ponerle 
	// los "input" el nombre del id+valor, un tema del sebas valla.
	
function sumar(valor,id){
	if((valor=='' || valor==-1) && (id=='' || id==-1)){				 
		var a = $('canti');  // funcion de prototype para sustituir document.getElementById('cantidad');
		if(a.value > 0)
			 a.value = Number(a.value) + 1;	
		else
			 a.value = 1;		
	}else{
		var a = $('cantidad'+valor);  // funcion de prototype para sustituir document.getElementById('cantidad');
		if(a.value > 0){		
			 a.value = Number(a.value) + 1;	
		}else
			 a.value = 1;	
			 
		document.getElementById('form_cesta').idp.value = id;
		document.getElementById('form_cesta').submit();
	}		
}
	
function restar(valor,id){	
	if((valor=='' || valor==-1) && (id=='' || id==-1)){				 
		var a = $('canti');  // funcion de prototype para sustituir document.getElementById('cantidad');
		if(a.value > 0)
			 a.value = Number(a.value) - 1;	
		else
			 a.value = 1;		
	}else{	
		var a = $('cantidad'+valor);  // funcion de prototype para sustituir document.getElementById('cantidad');
		if(a.value > 0){		
			 a.value = Number(a.value) - 1;	
		}else
			 a.value = 1;	
			 
		document.getElementById('form_cesta').idp.value = id;			 
		document.getElementById('form_cesta').submit();
	}	 
}

function popup_avisos (pagina, altura) {
	var opciones="toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width=450, height="+altura+", top=250, left=300";
	window.open(pagina,"",opciones);
}
	
function validacantidad(stock,url){   // le tengo ke pasar la seccion url para ke me coja el archivo del popup

	var a = $('canti');	
	var reg=/^\d{1,8}$/;   // expresion regular para solo numeros
	
	if(a.value <= stock){
	
			if(reg.test(a.value)){		
			   document.getElementById('form_meter').submit();
			}else{		
			   var capa = $('vineta'); 
			   capa.style.display='block';
			}
	}
	else{
		 popup_avisos(''+url+'avisar_stock.php', 300);
		}
}

function enviar_pedido(){		
	form=document.getElementById("comprar_paypal");
	form.submit();		
}
		
function enviar(num){		
	document.getElementById('form'+num).submit();			
}
function enviar2(){		
	document.getElementById('comprar').submit();			
}



// funciones para la seccion de servicios.php

//**************************************************************
// FUNCION PARA HACER UN FADE DE UNA CAPA

	var tempo;	// variable para mostrar
	var opa = 0;  // variable para mostrar
	
	function ver() {
	    if(opa==100) // para ke cuando le de otra ves a enviar vuelva a hacer el fade.
		{
	      opa = 0;
	    }
	  opa+=10;
	  if (opa==100) clearInterval(tempo);
	  obj = document.getElementById('capa_form');
	  if (document.all)
		obj.style.filter = 'alpha(opacity='+opa+')';
	  else
		obj.style.MozOpacity = opa/100; 
	}
//**************************************************************

function mostrar_form(capa)
{ 	
   document.getElementById(capa).style.filter= 'alpha(opacity=0)';   // ponemos el alpha a 0 para ke no se vea desde el principio
   Element.toggle(capa);  // para ocultar la capa o mostrarla segun como esté, funciona con prototype
   
   tempo=setInterval('ver()',10);	  // esta funcion esta arriba del validaFomr
}