<!--
function menu(a){	
	$("#"+a ).css({'color':'#fff','background':'#df3517'});
}

function idioma(a){

    $("#id_1").removeClass("idioma-on");
    $("#id_2").removeClass("idioma-on");
    $("#id_2").removeClass("idioma-on");

    $("#" + a).addClass("idioma-on");
    $("#" + a).css('color','#fff');	
	//$("#" + a).css({'color':'#fff','background':'url(../../Content/images/bg_idiomas_a.jpg) no-repeat'});	
}
function imgProducto(a){
	var ancho = $(".noveInt .img:eq("+a+") img").width();	
	var alto =  $(".noveInt .img:eq("+a+") img").height();	
	var nTop = (170-alto);
	var nLeft = (156-ancho)/2;
	$(".noveInt .img:eq("+a+") img").css({'top':nTop , 'left': nLeft});
}
$(window).load(function(){
 	
	for(var i=0; i<$(".noveInt .img").length; i++){
			imgProducto(i);
	}
}); 
var map;
var mapOld;
var fond = new Array();
fond[0] = "fondo_1.jpg";
fond[1] = "fondo_2.jpg";
fond[2] = "fondo_3.jpg";
fond[3] = "fondo_4.jpg";
fond[4] = "fondo_5.jpg";
fond[5] = "fondo_6.jpg";
fond[6] = "fondo_7.jpg";

function fondo(a){
	//var num = Math.round(Math.random() * (fond.length-1));	
	//alert(num);
	//$("#quienes_1").css({'background':'url(images/'+fond[num]+') 675px 39px no-repeat'});
	$("#quienes_1").css({'background':'url(../../Content/images/fondo_'+a+'.jpg) 675px 39px no-repeat'});
}




var h2;
var h2Old;
var h3;
var h3Old;

function menuLateralH2(a){
	h2 = a;	
	var padre = $("#menuLateral h2:eq("+h2+")").parent().attr('id');
	$("#menuLateral h2 a:eq("+h2+")").css({'background':'url(../../Content/images/h2_a.gif) 0px 3px no-repeat','padding':'0 0 0 16px'});			
	$("#"+h2+" ul").slideDown("fast");
}

function menuLateralH3(a){
	h3 = a;	
	var padre = $("#menuLateral h3:eq("+h3+")").parent().attr('id');
	$("#menuLateral h3 a:eq("+h3+")").css({'background':'url(../../Content/images/h3_a.gif) 0px 3px no-repeat','padding':'0 0 0 16px'});			
	$("#"+h3+" ul li").slideDown("fast");
}

function menuLateralH4(a){
	$("#"+a ).css({'color':'#fff','background':'#df3517'});	
}

/****************/
function slideSwitch() {
    var $active = $('#slideshow IMG.active');
    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 800, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 1400 );
});
/****************/


$(document).ready(function(){					   
 	$.preloadCssImages();
	$("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 */
		});
	
	$("#menuLateral h3 a").click(function () {
		var orden =  $("#menuLateral h3 a").index(this);
		h3Old = h3;
		h3 = orden;
		var padre = $("#menuLateral h3:eq("+h3+")").parent().attr('id');
		if(h3Old!=undefined&&h3Old!=h3){
			$("#menuLateral h3 a:eq("+h3Old+")").css({'background':'none','padding':'0'});			
			var padreOld = $("#menuLateral h3:eq("+h3Old+")").parent().attr('id');
			$("#"+padreOld+" ul li").slideUp("fast");
		}
		$("#menuLateral h3 a:eq("+h3+")").css({'background':'url(../../Content/images/h3_a.gif) 0px 3px no-repeat','padding':'0 0 0 16px'});
		$("#"+padre+" ul li").slideDown("fast");
		return false;
    });
	
	$("#menuLateral h2 a").click(function () {
		var orden =  $("#menuLateral h2 a").index(this);
		h2Old = h2;
		h2 = orden;
		var padre = $("#menuLateral h2:eq("+h2+")").parent().attr('id');
		if(h2Old!=undefined&&h2Old!=h2){
			$("#menuLateral h2 a:eq("+h2Old+")").css({'background':'none','padding':'0'});			
			var padreOld = $("#menuLateral h2:eq("+h2Old+")").parent().attr('id');
			$("#"+padreOld+" ul").slideUp("fast");
		}
		$("#menuLateral h2 a:eq("+h2+")").css({'background':'url(../../Content/images/h2_a.gif) 0px 3px no-repeat','padding':'0 0 0 16px'});
			
		$("#"+padre+" ul").slideDown("fast");
		
		return false;
    });
	
	
	$("#mapa a").click(function () {
		var orden =  $("#mapa a").index(this);
		mapOld = map;
		map = orden;
		if(mapOld!=undefined&&mapOld!=map){
			$("#mapa a:eq("+mapOld+")").css({'background':'url(../../Content/images/lugar.png) no-repeat'});
		}
		$("#mapa a:eq("+map+")").css({'background':'url(../../Content/images/lugar_on.png) no-repeat'});
		var vciudad =  $("#mapa a:eq("+orden+")").attr("title");
		var vpais =  $("#mapa a:eq("+orden+")").attr("rel");
		$("#ciudad").text(vciudad);
		$("#pais").text(vpais);
		return false;
    });
	
	$("#slider").jCarouselLite({
		/*auto: false,
		speed: 2500,*/
		scroll: 1,

		speed: 600,
		btnNext: "#flechaDcha",
        btnPrev: "#flechaIzda"

 	});
	

	
}); 

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 validarContacto(formu) {
    var texto = '';
    if (formu.nombre.value == '')
        texto += "- El campo nombre es obligatorio.\n";
    if (formu.mail.value == '')
        texto += "- El campo email es obligatorio.\n";
    else if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(formu.mail.value))) {
        texto += "- Formato de email incorrecto.\n";
    }
    if (formu.comentario.value == '')
        texto += "- El campo comentario es obligatorio.\n";
    if (texto != '') {
        alert(texto);
        return false;
    }
    return true;
};


function validarPedido(formu) {
    var texto = '';
    if (formu.empresa.value == '')
        texto += "- El campo empresa / nombre es obligatorio.\n";
    if (formu.telefono.value != '')
    {
        if (!(/^([0-9]{9})*$/.test(formu.telefono.value))) {
            texto += "- El campo telefono no tiene el formato correcto. Ejemplo 918754441.\n";
        }  
    } 
    if (formu.direccion.value == '')
        texto += "- El campo direccion es obligatorio.\n";
    if (formu.poblacion.value == '')
        texto += "- El campo poblacion es obligatorio.\n"; 
    if (formu.cp.value == '')
        texto += "- El campo codigo postal es obligatorio.\n";     
    else{
        if (!(/^([0-9]{5})*$/.test(formu.cp.value))) {
            texto += "- El codigo postal introducido es incorrecto. Ejemplo: 28529. \n";
        } 
    }  
    if (formu.pedido.value=='') 
        texto += "- Introduzca un fichero con el pedido con extension pdf, xls, xlsx, doc o docx.\n"; 
    else{
     if ((formu.pedido.value.lastIndexOf(".pdf")==-1) && (formu.pedido.value.lastIndexOf(".xls")==-1) && (formu.pedido.value.lastIndexOf(".xlsx")==-1) && (formu.pedido.value.lastIndexOf(".doc")==-1) && (formu.pedido.value.lastIndexOf(".docx")==-1))       
       texto += "- Formato de fichero incorrecto. Debe tener extension pdf, xls, xlsx, doc o docx.\n";
    }    
    if (texto != '') {
        alert(texto);
        return false;
    }
    return true;
};

function validarRecordarDatos(formu) {
    var texto = '';
    if (formu.usuario_recordar.value == '' || formu.usuario_recordar.value == 'usuario')
        texto += "- Introduzca su usuario.\n";           
    if (texto != '') {
        alert(texto);
        return false;
    }
    return true;
};

function validarAcceso(formu) {
    var texto = '';
    if (formu.uxUsuario.value == '' || formu.uxUsuario.value == 'usuario')
        texto += "- Introduzca su usuario.\n";        
    if (formu.uxContrasena.value == '' || formu.uxContrasena.value == 'contrasena')
        texto += "- Introduzca su contrase\xF1a.\n";
    if (texto != '') {
        alert(texto);
        return false;
    }
    return true;
};

function validarDistribuidores(formu) {
    var texto = '';
    if (formu.nombre.value == '' || formu.nombre.value == 'Tu nombre')
        texto += "- El campo nombre es obligatorio.\n";
    if (formu.mail.value == '' || formu.mail.value == 'Tu email')
        texto += "- El campo email es obligatorio.\n";
    else if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(formu.mail.value))) {
        texto += "- Formato de email incorrecto.\n";
    }
    if (formu.pais.value == '' || formu.pais.value == 'Pa\xeds')
        texto += "- El campo pa\xeds es obligatorio.\n";
    if (formu.comentario.value == '' || formu.comentario.value == 'Comentarios')
        texto += "- El campo comentario es obligatorio.\n";
    if (texto != '') {
        alert(texto);
        return false;
    }
    return true;
};

function validarInformacion(formu) {
    var texto = '';
    if (formu.mail.value == '')
        texto += "- El campo email es obligatorio.\n";
    else if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(formu.mail.value))) {
        texto += "- Formato de email incorrecto.\n";
    }
    if (formu.comentario.value == '')
        texto += "- El campo comentario es obligatorio.\n";
    if (texto != '') {
        alert(texto);
        return false;
    }
}

//-->
