function detalleproducto(capa, tipo){
	if(tipo == 'pyme'){
		$("#img_Overview").attr("src","img/menu4-1-pyme.jpg");
		$("#img_ventajas").attr("src","img/menu4-2-pyme.jpg");
		$("#img_Caracteristicas").attr("src","img/menu4-3-pyme.jpg");
		$("#img_PorqueBT").attr("src","img/menu4-4-pyme.jpg");
		img = $("#img_"+capa).attr("src");
		$("#img_"+capa).attr("src", img.replace(".jpg","_ON.jpg"));
	}else{
		$("#img_Overview").attr("src","img/menu4-1-sys.jpg");
		$("#img_ventajas").attr("src","img/menu4-2-sys.jpg");
		$("#img_Caracteristicas").attr("src","img/menu4-3-sys.jpg");
		$("#img_PorqueBT").attr("src","img/menu4-4-sys.jpg");
		img = $("#img_"+capa).attr("src");
		$("#img_"+capa).attr("src", img.replace(".jpg","_ON.jpg"));
	}	
	$('#Cuerpo_f_Overview').hide();
	$('#Cuerpo_f_ventajas').hide();
	$('#Cuerpo_f_Caracteristicas').hide();
	$('#Cuerpo_f_PorqueBT').hide();
	$('#Cuerpo_f_'+capa).show();
}

formularioContactoimg1 = new Image();
formularioContactoimg2 = new Image();
formularioContactoimg1.src = 'img/flechita3.gif';
formularioContactoimg2.src = 'img/flechita.gif';

var formularioContacto = {
	activado:false,	error:false,
	borrar:function(){
		document.formucontacto.reset();
		$('#cenContenido').hide();
	},	
	enviar:function(){
		if(!this.activado){
			$(".Campo").keypress( function() {
				formularioContacto.cambia($(this).attr("id"));				  
			});
			this.activado = true;			
		}
				
		if($('#cEmpresa').val().length == 0){
			this.mostrarError('Debe introducir el nombre de su empresa', $('#cEmpresa').offset().top, $('#cEmpresa').offset().left, '#cEmpresa');
		}else if($('#cNombre').val().length == 0){
			this.mostrarError('Debe introducir el nombre de la persona de contacto', $('#cNombre').offset().top, $('#cNombre').offset().left, '#cNombre');
		}else if($('#cTelefono').val().length == 0){
			this.mostrarError('Debe introducir su tel&eacute;fono', $('#cTelefono').offset().top, $('#cTelefono').offset().left, '#cTelefono');
		}else if($('#cProvincia').val().length == 0){
			this.mostrarError('Debe introducir su provincia', $('#cProvincia').offset().top, $('#cProvincia').offset().left, '#cProvincia');
		}else{
			document.formucontacto.submit();
		}
	}, 
	mostrarError:function(msg, top, left, div){
		$("#cenContenido").show();
		$("#cenContenido").offset({'top':0, 'left':0});
		if((left-$('#Principal').offset().left) > 500) {
			$('#msg_error').html(msg+'<img src="img/flechita3.gif" width="10" />');
			$("#cenContenido").offset({'top':top-8, 'left':left-25-$('#msg_error').width()});
		} else {
			$('#msg_error').html('<img src="img/flechita.gif" width="10" />'+msg);
			$("#cenContenido").offset({'top':top-8, 'left':left+10+$(div).width()});
		}
		//$("#cenContenido").css('margin-top',posicion + 'px');
		this.error = true;
		
	},
	cambia:function(campo){
		if(this.error){
			if(campo == 'cNombre' && $("#cenContenido").css('margin-top') == '50px'){
				this.ocultarError();
			}else if(campo == 'cApellidos' && $("#cenContenido").css('margin-top') == '80px'){
				this.ocultarError();
			}else if(campo == 'cCompania' && $("#cenContenido").css('margin-top') == '110px'){
				this.ocultarError();
			}else if(campo == 'cCargo' && $("#cenContenido").css('margin-top') == '142px'){
				this.ocultarError();
			}else if(campo == 'cEmail' && $("#cenContenido").css('margin-top') == '175px'){
				this.ocultarError();
			}else if(campo == 'cTelefono' && $("#cenContenido").css('margin-top') == '205px'){
				this.ocultarError();
			}else if(campo == 'cPais' && $("#cenContenido").css('margin-top') == '238px'){
				this.ocultarError();
			}else if(campo == 'cAsunto' && $("#cenContenido").css('margin-top') == '268px'){
				this.ocultarError();
			}else if(campo == 'cPregunta' && $("#cenContenido").css('margin-top') == '309px'){
				this.ocultarError();
			}			
		}
	}, 
	ocultarError:function(){
		$("#cenContenido").hide();
		this.error = false;
	},
	muestraMensajePrivacidad:function(){
		Shadowbox.open({
			content: $('.masInfoContacto').html(),
			player:  "html",
			height:  230,
			width:   350
		});
	}
};

function verVideo(Codigo){
	Shadowbox.open({
        //content:    '<div><object><param name="movie" value="swf/player_taw.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="swf/player_taw.swf?source='+Codigo+'&controles_color=0x084887&ancho=640&alto=480" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="480"></embed></object></div>',
		content:    'http://www.youtube.com/v/'+Codigo+'&amp;rel=0&amp;autoplay=1',
        //player:     "html",
		player:     'swf',
        title:      "",
        height:     474,
        width:      600
    });
}

function verPDF(ruta){
	Shadowbox.open({
        content:    ruta,
        player:     'iframe',
        title:      '',
        height:     600,
        width:      920
    });
}

var ELmenu3n = {
	id:0,
	ampliar:function(id, marcar){
		$('#Menu3_subsub'+id).slideToggle('slow');
		$('#Menu3_subsub'+this.id).slideToggle('slow');
		this.id = id;
		if(marcar) $('#Menu3_tit'+id).addClass("M3_On");			
	}
};


$().ready( function (){
	// bloquear cualquier enlace que tenga href=#
	$('a').click( function (evento){
		if($(this).attr("href") == '#') evento.preventDefault();
    });    	

	// rollover para las imagenes
	$("img.rollover").hover(
			function(){
				this.src = this.src.replace(".png","_on.png");
				this.src = this.src.replace(".gif","_on.gif");
				this.src = this.src.replace(".jpg","_on.jpg");
			},
			function(){
				this.src = this.src.replace("_on.png",".png");
				this.src = this.src.replace("_on.gif",".gif");
				this.src = this.src.replace("_on.jpg",".jpg");
			}
	);
	
	// rollover de las imagenes que carga la home al pasar sobre las necesidades
	$(".rolloverNecesidades").hover(
			function(){
				if(this.rel.length > 5)	$('#LaImagenNecesidad').attr('src', 'img/necesidades/' + this.rel);								
			},
			function(){
				$('#LaImagenNecesidad').attr('src', 'img/seleccione.jpg');								
			}
	);
	
	
    // scrolls de la home
    /*if ( $("#LasNecesidadesHome").length > 0 ) {
        $('#LasNecesidadesHome').jScrollPane({showArrows:true, scrollbarMargin:5,maintainPosition:false,dragMaxHeight:64,scrollbarWidth:25});
		$('#LasNoticiasHome').jScrollPane({showArrows:true, scrollbarMargin:5,maintainPosition:false,dragMaxHeight:64,scrollbarWidth:25});
	}*/
});


function slideShow() {

	//Set the opacity of all images to 0
	$('#gallery a').css({opacity: 0.0});
	
	//Get the first image and display it (set it to full opacity)
	$('#gallery a:first').css({opacity: 1.0});
	
	//Get the caption of the first image from REL attribute and display it
	$('#gallery .content').html($('#gallery a:first').find('img').attr('rel'))
	.animate({opacity: 0.7}, 400);
	
	//Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
	setInterval('gallery()',4000);
	
}

function gallery() {
	
	//if no IMGs have the show class, grab the first image
	var current = ($('#gallery a.show')?  $('#gallery a.show') : $('#gallery a:first'));

	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#gallery a:first') :current.next()) : $('#gallery a:first'));	
	
	//Get next image caption
	var caption = next.find('img').attr('rel');	
	
	//Set the fade in effect for the next image, show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);

	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	
}



