document.observe("dom:loaded",function(){
    //tabs ficha producto
    var Pest = new Tabs('Tabs1',["detalles", "tallaje", "devoluciones"]);
    if(Pest!=undefined && Pest!=null && Pest!=""){
        Pest.Capas();
        CambiaTab=function(Nom,IdTab){
            Pest.MuestraTab(Nom,IdTab);
        }
    }   
});
function desplegarCarro()
{
    if(($("barraCarro")!=undefined && $("barraCarro")!=null) && $("barraCarro")!=""){
	if($("contenidoCarroSidebar")!=undefined && $("contenidoCarroSidebar")!=null){
	    if($("contenidoCarroSidebar").getStyle('display')=="block"){
		$("contenidoCarroSidebar").hide();
	    }else{
		$("contenidoCarroSidebar").show();
	    }
	}
    }
}

function abrirPopTerminos(direccio,titol,wi,he)
{

var w=600;
var h=310;
if(wi!=undefined){
    w=wi
}
if(he!=undefined){
   h=he
}
var win = new Window({className: "magento", title: titol,
width:w, height:h,
destroyOnClose: true,
url: direccio, showEffectOptions: {duration:1.5}});
win.showCenter(true);
return true;
}
function abrirPopContenido(contenido,titol,wi,he)
{

var w=600;
var h=410;
if(wi!=undefined){
    w=wi
}
if(he!=undefined){
   h=he
}
contenido=contenido.split("<p>");
contenido=contenido[0];
var win = new Window({className: "magento", title: titol,
width:w, height:h,
destroyOnClose: true,
showEffectOptions: {duration:1.5}});
win.getContent().update(contenido.replace(/#3/gi,'"'));
win.showCenter(true);
return true;
}

function getOptionsPoblaciones(ur,prov,campo,ciudad)
{
    ur=ur + "?seleccion=" + ciudad + "&provincia=" + prov + "&campo=" + campo;
    new Ajax.Request(ur,
    {
	method:"GET",
	onComplete:function(texto){
	    if($('poblaciones')!=undefined){
		//cargar poblaciones devuelve un select con las poblaciones de la provincia
		if(texto.responseText!="" && texto.responseText!=null && texto.responseText!=undefined){
		    $('poblaciones').update(texto.responseText);
		}
		
		/*si hay seleccion poner en el campo oculto el valor de la poblacion
		* de esta manera se desliga el tipo de forumlario manteniendo los campos
		* que ya tiene y solo tenemos que ocultar el input de ciudad para
		* despues darle el valor*/
		if(ciudad!=null && ciudad!=""){
		    if($(campo)!=undefined){
			$(campo).value=$('poblacion').value
		    }
		}
	    }
	}
    });
}

function getOptionsPoblacionesbilling(ur,prov,campo,ciudad)
{
    ur=ur + "?seleccion=" + ciudad + "&provincia=" + prov + "&campo=" + campo;
    new Ajax.Request(ur,
    {
	method:"GET",
	onComplete:function(texto){
	    if($('poblacionesbilling')!=undefined){
		//cargar poblaciones devuelve un select con las poblaciones de la provincia
		if(texto.responseText!="" && texto.responseText!=null && texto.responseText!=undefined){
		    $('poblacionesbilling').update(texto.responseText);
		}
		
		/*si hay seleccion poner en el campo oculto el valor de la poblacion
		* de esta manera se desliga el tipo de forumlario manteniendo los campos
		* que ya tiene y solo tenemos que ocultar el input de ciudad para
		* despues darle el valor*/
		if(ciudad!=null && ciudad!=""){
		    if($(campo)!=undefined){
			$(campo).value=$('poblacionbilling').value
		    }
		}
	    }
	}
    });
}


function solo_numeros(evt)
{    
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57)){
    return false;
}
return true;
}
