function alacesta(idp,conf,ruta,comprobar){
	if(idp){
		proseguir = true;
		switch(comprobar){
			case 'tallas':
				var talla = document.getElementById("tallas"+conf).value;
				
				if(talla==''){
					alert("Has de seleccionar una talla");
					proseguir = false;
				}
				
			break;
			case 'grados':
				var grados = document.getElementById("grados"+conf).value;
				
				if(grados==''){
					alert("Has de seleccionar los grados");
					proseguir = false;
				}
			break;
			case 'medidas':
				
				var medidas = document.getElementById("medidas"+conf).value;
				
				if(medidas==''){
					alert("Has de seleccionar una talla");
					proseguir = false;
				}
			break;
			case 'color':
				
				var color = document.getElementById("color"+conf).value;
				
				if(color==''){
					alert("Has de seleccionar un color");
					proseguir = false;
				}
			break;
		}
		
		if(proseguir){
			document.getElementById("form_addcesta"+conf).action = ruta+'proceso-compra/procesa-articulo.php';
			document.getElementById("form_addcesta"+conf).submit();
		}
	}
}

function alacesta_pack(idp,ruta){
	if(idp){
		document.getElementById("form_packs").action = ruta+'proceso-compra/procesa-pack.php';
		document.getElementById("id_pack").value = idp;
		document.getElementById("form_packs").submit();
	}
}

function actualizarUnidades(linea,units){
	document.getElementById("linea").value = linea;
	document.getElementById("unidades").value = units.value;
	document.getElementById("form-cesta").action = "actualizar-unidades.php";
	document.getElementById("form-cesta").submit();
}

function actualizarTalla(linea,talla){
	document.getElementById("linea").value = linea;
	document.getElementById("tallas").value = talla.value;
	document.getElementById("form-cesta").action = "actualizar-tallas.php";
	document.getElementById("form-cesta").submit();
}

function actualizarGrados(linea,grado){
	document.getElementById("linea").value = linea;
	document.getElementById("grados").value = grado.value;
	document.getElementById("form-cesta").action = "actualizar-grados.php";
	document.getElementById("form-cesta").submit();
}

function actualizarMedidas(linea,medida){
	document.getElementById("linea").value = linea;
	document.getElementById("medidas").value = medida.value;
	document.getElementById("form-cesta").action = "actualizar-medidas.php";
	document.getElementById("form-cesta").submit();
}
function actualizarColor(linea,color){
	document.getElementById("linea").value = linea;
	document.getElementById("color").value = color.value;
	document.getElementById("form-cesta").action = "actualizar-color.php";
	document.getElementById("form-cesta").submit();
}

function actualizarTallaPack(linea,pack,talla){
	document.getElementById("linea").value = linea;
	document.getElementById("tallas").value = talla.value;
	document.getElementById("pack").value = pack;
	document.getElementById("form-cesta").action = "actualizar-tallas-pack.php";
	document.getElementById("form-cesta").submit();
}

function actualizarGradosPack(linea,pack,grado){
	document.getElementById("linea").value = linea;
	document.getElementById("grados").value = grado.value;
	document.getElementById("pack").value = pack;
	document.getElementById("form-cesta").action = "actualizar-grados-pack.php";
	document.getElementById("form-cesta").submit();
}

function actualizarMedidasPack(linea,pack,medida){
	document.getElementById("linea").value = linea;
	document.getElementById("medidas").value = medida.value;
	document.getElementById("pack").value = pack;
	document.getElementById("form-cesta").action = "actualizar-medidas-pack.php";
	document.getElementById("form-cesta").submit();
}

function verProducto(idp,ruta){
		document.location.href= ruta+'fichas-productos/index.php?idp='+idp;
}

//abrirventana
//Abrir ventana flotante sin barra de scroll
function winNoScroll(url,ancho,alto,nombre){
	var posx = (screen.width-ancho)/2;
	var posy = (screen.height-alto)/2;
	window.open(url,nombre,'toolbar=0, resizable=0, location=0,status=0,directories=0,menubar=0,scrollbars=0,width='+ancho+',height='+alto+',left='+posx+',top='+posy);	
}

function winScroll(url,ancho,alto,nombre){
	var posx = (screen.width-ancho)/2;
	var posy = (screen.height-alto)/2;
	window.open(url,nombre,'toolbar=0, resizable=0, location=0,status=0,directories=0,menubar=0,scrollbars=1,width='+ancho+',height='+alto+',left='+posx+',top='+posy);	
}

function printComprovante(idu){
	winScroll('comprovante.php?var='+idu,700,780,'COMPROBANTE');
}

function condicionescompra(){
	var posx = (screen.width-700)/2;
	var posy = (screen.height-780)/2;
	window.open('../terminos-condiciones-compra.php','CONDICIONESCOMPRA','toolbar=1, resizable=1, location=1,status=0,directories=0,menubar=1,scrollbars=1,width=700,height=780,left='+posx+',top='+posy);
}
