
constMaxItem=3

function fnDispThis(active)
{
for (i=1; i < constMaxItem+1; i++)
	{
	if (i!=active)
		{
		document.all("sub"+i).style.display="NONE"
		}
	else
		{
		document.all("sub"+active).style.display="BLOCK"
		}
	}
}



function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function GetPath(aPath){	
	var DirS =new Array('/Funciones/','/Imagenes/','/Img/','/Modules/','/Styles/');	
	var AP=new String(location.href);
	var PTO=new String(aPath);	
	var RPP;
	var PrP;
	var Parameters =new String('');	
	PrP=aPath.lastIndexOf('?');
	if (PrP !=-1){
	   PTO=aPath.slice(0,PrP);
	   Parameters=aPath.slice(PrP);}
	AP=AP.toLowerCase();	
	PTO=PTO.toLowerCase();		
	PTO=PTO.slice(1,PTO.length);	
	for (counter=0;counter<DirS.length;counter++){		
		var Directory=new String(DirS[counter]);		
		Directory=Directory.toLowerCase();			
		RPP=AP.lastIndexOf(Directory);	
		alert(AP + ' ' +Directory);	
		if (RPP > -1){ 
			AP=AP.slice(0,RPP);							
			return AP + PTO + Parameters;}}	
	if (RPP=-1)
		return AP}
function Activa(Elemento){
	//Elemento.src = "imagenes/" +Elemento.name +"_i.gif"
}
function DesActiva(Elemento){
	// Elemento.src = "imagenes/" +Elemento.name +".gif"
}

function OpenRegistro(){
		pt=new String(location.href);
	PrP=pt.lastIndexOf('?');
	if (PrP !=-1)
	   pt=pt.slice(0,PrP);

	PrP=pt.toLowerCase().lastIndexOf('default.asp');
	pt=pt.slice(0,PrP)+'Registro.asp';
	window.open(pt,'Registrese','width=400,height=400,top=100,left=100');  
	return false;}
	
function OpenPass(){
	pt=new String(location.href);
	PrP=pt.lastIndexOf('?');
	if (PrP !=-1)
	   pt=pt.slice(0,PrP);

	PrP=pt.toLowerCase().lastIndexOf('default.asp');
	pt=pt.slice(0,PrP)+'Pass.asp';
	window.open(pt,'Olvido','width=550,height=450,top=100,left=100');   
	return false;}

function OpenBuy(idarticulo){
	cont=prompt('¿Seguro que quiere añadir el artículo ' + idarticulo + ' a su pedido?. Si es así indique la cantidad, sino pulse cancelar.','1')
	if(cont!=null){
	pt=new String(location.href);
	PrP=pt.lastIndexOf('?');
	if (PrP !=-1)
	   pt=pt.slice(0,PrP);

	PrP=pt.toLowerCase().lastIndexOf('default.asp');
	pt=pt.slice(0,PrP)+'Modules/carrito_unidades.asp?IdArticulo=' + idarticulo +"&unidades="+cont;
	window.open(pt,'Compre','resizable=yes,width=400,height=180,top=100,left=100');   
	}
	return false;}
	
function OpenArticulo(idarticulo){

	pt=new String(location.href);
	PrP=pt.lastIndexOf('?');
	if (PrP !=-1)
	   pt=pt.slice(0,PrP);
	
	PrP=pt.toLowerCase().lastIndexOf('default.asp');
	pt=pt.slice(0,PrP)+'Modules/Articulo.asp?IdArticulo=' + idarticulo;
	frm=window.open(pt,'Articulo','resizable=yes,width=500,height=350,top=100,left=100');
	frm.focus();

	return false;}
	

function removeArticulo(idarticulo,i){
	cont=confirm('Seguro que quiere eliminar el ' + idarticulo + ' de su pedido');
	if(cont){
	pt=new String(location.href);
	PrP=pt.lastIndexOf('&Remove');
	if (PrP !=-1)
	   pt=pt.slice(0,PrP);
	//alert(pt + '&Remove=' + i);
	window.location= pt + '&Remove=' + i;
	//window.location.reload();
	}
	return false;}
	
function enviarPedido(){
	cont=confirm('Seguro que quiere enviar el pedido');
	if(cont){
	pt=new String(location.href);
	PrP=pt.lastIndexOf('?');
	if (PrP !=-1)
	   pt=pt.slice(0,PrP);

	PrP=pt.toLowerCase().lastIndexOf('default.asp');
	pt=pt.slice(0,PrP)+'PedidoDatos.asp';
	window.open(pt,'Enviar','width=400,height=300,top=100,left=100');  

	}
	return false;}
	
function borrarPedido(){
	cont=confirm('Seguro que quiere eliminar todo el pedido');
	if(cont){
		pt=new String(location.href);
		PrP=pt.lastIndexOf('&Eliminar');
		if (PrP !=-1)
			pt=pt.slice(0,PrP);
		
		window.location= pt + '&Eliminar=1' ;
			
	}
	return false;}





