// JavaScript Document

/* quita borde punteado de los links --- by Anxo------------------------------------------------------------------------*/
function noplink() {
	lnks=document.getElementsByTagName("a").length;
	for (i=0;i<lnks;i++)
	document.getElementsByTagName("a").item(i).onfocus=new Function(" (this.blur)?this.blur():NULL;")
}

/* calcula el precio de venta ---------------------------------------------------------------------------*/
function  calcularPrecioVenta(){
	
	if(document.getElementById('precio').value!=''){pvp=precio=parseFloat(document.getElementById('precio').value);}
	if(document.getElementById('iva').value!=''){
			pvp=Math.round((precio*(1+(parseFloat(document.getElementById('iva').value)/100)))*100)/100;
			document.getElementById('iva_incluido').innerHTML="IVA incluído";
	}else{document.getElementById('iva_incluido').innerHTML="+ IVA";}
	
	if(isNaN(pvp)){document.getElementById('precio_venta').innerHTML='';}
	else{document.getElementById('precio_venta').innerHTML=pvp+' €';}
}

/* abre una imagen en un pop-up ---------------------------------------------------------------------------*/
function abrirImagen(root, img, ancho, alto){
	url=((root!='')?root+'/':'')+"mostrar_img.php?img="+img;
	 window.open(url , 'img', 'width='+ancho+', height='+alto+', menubar=no,location=no,resizable=no,scrollbars=yes,status=no');	
}

/*********************************************/
function cargarImagenCabecera(root, id_img){
	root.getElementById('img_cabecera').src='imgs/imgs_cabecera/img_'+id_img+'.jpg';
}