$(document).ready(function(){
	
	$(".cuerpo a").attr("target","_blank");
	//########### SERVICIOS ##########//
	var foto1 = $("#info1 img").attr("src");
	var texto1 = $("#info1 p").html();
	
	$("#texto_servicios").html(texto1);
	$("#foto_servicios").attr("src",foto1);
		
	$("td.servicio").mouseover(function(){
				
		var id = $(this).attr("id");
		var foto = $("#info_"+id+" img").attr("src");
		var texto = $("#info_"+id+" p").html();
		
		$("#texto_servicios").html(texto);
		$("#foto_servicios").attr("src",foto);
		
		$(this).addClass("servicio_hover");
		if($(this).attr("href")!=""){
			$(this).css("cursor","pointer");
		}
		
	}).mouseout(function(){
		$(this).removeClass("servicio_hover");	
		
	}).click(function(){
		document.location = $(this).attr("href");
	});
	
	
	
	//################################//
	
	$("#nota_envio").fadeTo(1,0);
	$("#nota_envio").fadeTo(2000,1);
	
	$("#enviar_contacto").click(function(){
		  
		if($("#nombre").val() == ""){window.alert("El campo nombre está vacío");}
    	else if ($("input:checked").val() == undefined){window.alert("Seleccione si es empresa, centro educativo u otro");}    	
    	else if ($("#email").val() == ""){window.alert("El campo email está vacío");}    	
    	else {
    		if(window.confirm("Se van a enviar los datos. ¿Quiere continuar?")){
    			$("#formulario").submit();	
    		}
    	}
    	
	});
	
	
	$("#mailto").hover(
		function(){
			$(this).addClass("mailto_hover");
		},
		function(){
			$(this).removeClass("mailto_hover");
		}
	);
	
	//########### VER PRODUCTO ############//
	//inicio//
	$("#info_lateral").html($("#datos_descripcion").html());
	$('#boton_descripcion').addClass('boton_pulsado');
	//------//
	
	$("#boton_especificaciones").click(function(){
		$("#info_lateral").html($("#datos_especificaciones").html());
	});
	
	$("#boton_descripcion").click(function(){
		$("#info_lateral").html($("#datos_descripcion").html());
	});
	
	$(".img_thumb").mouseover(function(){
		$("#foto_zoom").attr("src","fotos/productos/"+$(this).attr("id"));
	});
	
	$(".boton_reposo").hover(
		function(){
			$(this).addClass("boton_hover");
		},
		function(){
			$(this).removeClass("boton_hover");
		}	
		
	).click(function(){
		$(".boton_pulsado").removeClass("boton_pulsado");
		if($(this).hasClass("boton_hover")){
			$(this).addClass("boton_pulsado");
		}
	});
	
	//########### HOME ############//
	
	$("#cab_educacion").hover(
		function(){
			$("#tit_educacion").addClass("educacion_hover");
		},
		function(){
			$("#tit_educacion").removeClass("educacion_hover");
		}
	).click(function(){
		document.location = "index.php?seccion=educacion";
	});
		
	$("#cab_informatica").hover(
		function(){
			$("#tit_informatica").addClass("informatica_hover");
		},
		function(){
			$("#tit_informatica").removeClass("informatica_hover");
		}
	)
	.click(function(){
		document.location = "index.php?seccion=informatica";
	});
	
	
	$(".td_destacado").mouseover(function(){
		
		var id = $(this).attr("id");
		$("#tit_"+id).css("background","#555555");
		$("#foto_"+id).fadeTo(1,0.85);
	}).mouseout(function(){
		var id = $(this).attr("id");
		$("#tit_"+id).css("background","#b5b5b5");
		$("#foto_"+id).fadeTo(1,1);
	});
	
	$(".tit_destacado").mouseover(function(){
		var id = $(this).attr("id");
		id = id.replace("tit_","");
		$(this).css("background","#555555");
		$("#foto_"+id).fadeTo(1,0.85);
	}).mouseout(function(){
		var id = $(this).attr("id");
		id = id.replace("tit_","");
		$(this).css("background","#b5b5b5");
		$("#foto_"+id).fadeTo(1,1);
	});
	
	/*
	$("td[id*='destacado']").mouseover(function(){
		$("#tit_"+$(this).attr("id")).css("background","#555555");
   	}).mouseout(function(){
   		$("#tit_"+$(this).attr("id")).css("background","#b5b5b5");
   	});	
   	
   	$(".tit_destacado").mouseover(function(){
   		$(this).css("background","#555555");
   	}).mouseout(function(){
   		$(this).css("background","#b5b5b5");	
   	}).click(function(){
   		document.location = $(this).children().attr("href");	
   	});
   	*/
     	
});













