<!--
function menu(a){	
	$("#"+a ).css({'background':'url(/Content/images/bg_menu_a.jpg) bottom repeat-x'});
}

function cabecera(){
	var num = Math.round(Math.random()*2);
	$(".cabecera").css({'background':'url(/Content/images/bg_cabecero_'+num+'.jpg) 0px 0px no-repeat'});
}
function menuLateral(a){
		$("#"+a ).css({'background-image':'url(/Content/images/menu_lat_a_on.gif)'});
		$("#"+a+" a" ).css({'color':'#0a6c90'});
}
function imgProducto(a){
	var ancho = $(".producto .img:eq("+a+") img").width();	
	var alto =  $(".producto .img:eq("+a+") img").height();	
	var nTop = (80-alto);
	var nLeft = (146-ancho)/2;
	$(".producto .img:eq("+a+") img").css({'top':nTop , 'left': nLeft});
}

function trim(cadena)
{
var cadena;
	for(i=0; i<cadena.length; )
	{
		if(cadena.charAt(i)==" ")
			cadena=cadena.substring(i+1, cadena.length);
		else
			break;
	}

	for(i=cadena.length-1; i>=0; i=cadena.length-1)
	{
		if(cadena.charAt(i)==" ")
			cadena=cadena.substring(0,i);
		else
			break;
	}
	
	return cadena;
}
function submitenter(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   myfield.form.submit();
   return false;
   }
else
   return true;
}

function clickenter(e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {  
  $("#botonBuscar").click();
   return false;
   }
else
   return true;
}

var acordeon;
var acordeonOld;

var preguntas= new Array();
for(var i=0; i<$('.pregunta a').length;i++){
	preguntas[i] = 0;	
}


function ShowCarrito(){
    
     $("#carrito_view").slideDown("slow");


}

function HideCarrito(){
    
    $("#carrito_view").slideUp("slow");

}


function UpdatingCarrito(){

    $("#carrito_cabecera_content").hide();
    $("#ajax_loading").show();

}

function CarritoUpdated(){

    $("#ajax_loading").hide();
    $("#carrito_cabecera_content").show();

}



$(document).ready(function(){
    $.preloadCssImages();
  
    $('#show_carrito').unbind('click');
    $('#show_carrito').bind('click', function () {
        ShowCarrito();
    });
  

    $('#hide_carrito').unbind('click');
    $("#hide_carrito").click(function () {
        HideCarrito();
    });

        
    $('#borrar_carrito').unbind('click');
    $('#borrar_carrito').bind('click', function () {
        $("#dialog-confirm").dialog('open');
    });

    


  
   $("a[rel^='prettyPopin']").prettyPopin({
			modal : false, /* true/false */
			width : false, /* false/integer */
			height: false, /* false/integer */
			opacity: 0.7, /* value from 0 to 1 */
			animationSpeed: 'fast', /* slow/medium/fast/integer */
			followScroll: true, /* true/false */
			loader_path: '/Content/images/prettyPopin/loader.gif', /* path to your loading image */
			callback: function(){} /* callback called when closing the popin */
		});
   
   
 $(".pregunta h3 a").click(function () {
		  var orden =  $(".pregunta h3 a").index(this);	
			acordeonOld = acordeon;
			acordeon = orden;
			if(acordeonOld!=undefined&&acordeonOld!=acordeon){
				preguntas[acordeonOld] = 0;
				 $(".pregunta .respuesta:eq("+acordeonOld+")").slideUp("slow");
			}
			if(preguntas[acordeon] == 1){
				preguntas[acordeon] = 0;
				$(".pregunta .respuesta:eq("+acordeon+")").slideUp("slow");	
			}
			else{
				preguntas[acordeon] = 1;
				$(".pregunta .respuesta:eq("+acordeon+")").slideDown("slow");		
			}
			return false;
    });  
    $(".areaClientes input:text").click(function () {
     // var orden =  $(".registro input:text").index(this);	
	    $(".areaClientes input:text").val("");
    });
    $(".areaClientes input:password").click(function () {
     // var orden =  $(".registro input:text").index(this);	
	    $(".areaClientes input:password").val("");
    });
   
	cabecera();
	for(var i=0; i<$(".producto .img").length; i++){
			imgProducto(i);
	}
	
//	 $("a.imgP").click(function () {		
//		var enlace = $(this).attr("href");
//		$(".imgG img").fadeOut("slow", function(){
//			$(".imgG img").attr({ 
//				  src: enlace
//				});
//			$(".imgG img").fadeIn("slow", function(){				
//			});
//		});		
//		return false;		
//	});
	
}); 


function abrir(a,e,b,c,d){
	if(document.all){var ventanaW=document.body.clientWidth;}
	else{var ventanaW=window.innerWidth}
	if(document.all){var ventanaH=document.body.clientHeight+150;}
	else{var ventanaH=window.innerHeight}
	var w = ventanaW/2;
	w = w-(b/2);
	var h = ventanaH/2;
	h = h-(c/2);
	window.open(a, e, 'width='+b+', height='+c+', top='+h+',left='+w+', scrollbars='+d+', location=0');
}

function validarRegistro(formu) {
    var texto = '';
    
     if (formu.Nombre.value == '')
        texto += "- El campo nombre es obligatorio.\n";     
        
    if (formu.Mail.value == '')
        texto += "- El E-Mail es obligatorio.\n";        
    else if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(formu.Mail.value))) {
        texto += "- Formato de E-Mail incorrecto.\n";
    }
   
       
    if (formu.Usuario.value == '')
        texto += "- El campo usuario es obligatorio.\n";  
    if (formu.Password.value == '')
        texto += "- El campo contrase\xF1a es obligatorio.\n";   
    if (!formu.acepto[0].checked)
        texto += "- Debe aceptar la protecci\u00F3n de datos personales.\n";
   
    if (texto != '') {
        alert(texto);
        return false;
    }
    return true;
}
function validarContacto(formu) {
    var texto = '';
    
     if (formu.nombre.value == '')
        texto += "- El campo nombre es obligatorio.\n";     
        
    if (formu.mail.value == '')
        texto += "- El E-Mail es obligatorio.\n";        
    else if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(formu.mail.value))) {
        texto += "- Formato de E-Mail incorrecto.\n";
    }
       
    if (formu.comentarios.value == '')
        texto += "- Escriba un comentario.\n";  
  
    if (texto != '') {
        alert(texto);
        return false;
    }
    return true;
}

;



//-->
