
function nuevaventana(url,nombreventana)
    {
        spop=window.open(url,nombreventana,"width=900,height=700,scrollbars=1,resizable=1,statusbar=1,menubar=0")
        spop.moveTo(Math.round((screen.availWidth-900)/2),Math.round((screen.availHeight-900)/2))
        spop.focus()
    }

function AbrirVentana(url,nombreventana,ancho,alto)
    {
        spop=window.open(url,nombreventana,"width="+ancho+",height="+alto+",scrollbars=1,resizable=1,statusbar=1,menubar=0")
        spop.moveTo(Math.round((screen.availWidth-ancho)/2),Math.round((screen.availHeight-alto)/2))
        spop.focus()
    }

function miniventana(url,nombreventana)
    {
        spop=window.open(url,nombreventana,"width=200,height=150,scrollbars=1,resizable=1,statusbar=1,menubar=0")
        spop.moveTo(Math.round((screen.availWidth-200)/2),Math.round((screen.availHeight-150)/2))
        spop.focus()
    }


function ActualizarImagen(campo,imagen,tienda,directorio) 
    { 
        imagen.src= '/tiendas/'+tienda+'/'+directorio+'/'+campo.options[campo.selectedIndex].value; 
    }

function FormatNumber(expr, decplaces)
    {
        var str = "" + Math.round(eval(expr) * Math.pow(10, decplaces));
        while (str.length <= decplaces)
        {
          str += "0";
        }
        var decpoint = str.length - decplaces;
        return str.substring(0,decpoint) + "." + str.substring(decpoint,str.length);
    }

function nuevaventana2(url)
    {
        spop=window.open(url,"tienda","width=799,height=500,scrollbars=1,resizable=1,statusbar=1,menubar=0")
        spop.moveTo(Math.round((screen.availWidth-799)/2),Math.round((screen.availHeight-500)/2))
        spop.focus()
    }
	function cambiarVista(panel) {
		if (panel == '') panel = 'descrip';
		escribirMenuProd(panel);
		if (panel=='comentar') document.getElementById('comentar').style.display="block";
		else document.getElementById('comentar').style.display="none";
		if (panel=='prodrel') document.getElementById('prodrel').style.display="block";
		else document.getElementById('prodrel').style.display="none";
		if (panel=='especif') document.getElementById('especif').style.display="block";
		else document.getElementById('especif').style.display="none";
		if (panel=='descrip') document.getElementById('descrip').style.display="block";
		else document.getElementById('descrip').style.display="none";
	}

	function escribirSubMenuProd() {
		document.writeln('		<div class="inPageQuadCol">');
		document.writeln('			<div class="subMenuProd">');
		document.writeln('				<ul id="productnav"></ul>');
		document.writeln('			</div>');
		document.writeln('		</div>');
		document.writeln('		<hr class="limpiar" />');
	}

	function escribirMenuProd(panel) {
		var text = "";
		text += "<li><a href=\"javascript:void(0);\" onclick=\"cambiarVista('descrip');\" class=\"";
		if (panel == "descrip") text += "on";
		else text += "off";
		text += "\">Descripción</a></li>\n";
		text += "<li><a href=\"javascript:void(0);\" onclick=\"cambiarVista('especif');\" class=\"";
		if (panel == "especif") text += "on";
		else text += "off";
		text += "\">Especificaciones</a></li>\n";
		text += "<li><a href=\"javascript:void(0);\" onclick=\"cambiarVista('comentar');\" class=\"";
		if (panel == "comentar") text += "on";
		else text += "off";
		text += "\">Comentarios</a></li>\n";
		text += "<li><a href=\"javascript:void(0);\" onclick=\"cambiarVista('prodrel');\" class=\"";
		if (panel == "prodrel") text += "on";
		else text += "off";
		text += "\">Productos Relacionados</a></li>\n";
		document.getElementById('productnav').innerHTML = text;
	}
	
