// JavaScript Document

$(document).ready(function(){
	
	var alto = (screen.height);
	var navegador = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
	resolucion();
	function resolucion(){
		if(alto >= 1050){
			if(navegador == true){
			$(".fondo").css("margin-top","75px");
			alto = alto*0.55;
			}else{
			$(".fondo").css("margin-top","25px");
			alto = alto*0.53;
			}
		return false;
		}
		if(alto <= 800){
			if(navegador == true){
			$(".fondo").css("margin-top","-50px");
			alto = alto*0.53;
			}
			else{
			$(".fondo").css("margin-top","-100px");
			alto = alto*0.52;
			}
		return false;
		}
		if(alto > 800 && alto < 1050){
			if(navegador == true){
			alto = alto*0.54;
			}else{
			$(".fondo").css("margin-top","-20px");
			alto = alto*0.54;
			}
		return false;
		}
	}
	$(".fondo").css("height",""+(alto)+"px");
	$("a[rel='titulos']").fadeTo("slow",800);
	$(".p1").delay(200).fadeTo("slow",0.65);
	$(".p2").delay(400).fadeTo("slow",0.65);
	$(".p3").delay(600).fadeTo("slow",0.65);
	$(".p4").delay(800).fadeTo("slow",0.65);
	$(".p5").delay(1000).fadeTo("slow",0.65);
	$(".p6").delay(1200).fadeTo("slow",0.65);

	$("a[rel='p1']").colorbox({width:"700px", inline:true, href:"#content1"});
	$("a[rel='p2']").colorbox({width:"700px", inline:true, href:"#content2"});
	$("a[rel='p3']").colorbox({width:"700px", inline:true, href:"#content3"});
	$("a[rel='p4']").colorbox({width:"700px", inline:true, href:"#content4"});
	$("a[rel='p5']").colorbox({width:"700px", inline:true, href:"#content5"});
	$("a[rel='p6']").colorbox({width:"700px", inline:true, href:"#content6"});
	$("a[rel='a1']").colorbox({width:"700px", inline:true, href:"#content1"});
	$("a[rel='a2']").colorbox({width:"700px", inline:true, href:"#content2"});
	$("a[rel='a3']").colorbox({width:"700px", inline:true, href:"#content3"});
	$("a[rel='a4']").colorbox({width:"700px", inline:true, href:"#content4"});
	$("a[rel='a5']").colorbox({width:"700px", inline:true, href:"#content5"});
	$("a[rel='a6']").colorbox({width:"700px", inline:true, href:"#content6"});
	
	$(".servicio").hover(function(event){
		$(".hover").remove();
		$(this).append('<img id="hv1" class="hover" src="images/hover_menu.png" border="0" />');
	});
	$(".fotocopiado").hover(function(event){
		$(".hover").remove();
		$(this).append('<img id="hv2" class="hover" src="images/hover_menu.png" border="0" />')
	});
	$(".productos").hover(function(event){
		$(".hover").remove();
		$(this).append('<img id="hv3" class="hover" src="images/hover_menu.png" border="0" />')
	});
	$(".redes").hover(function(event){
		$(".hover").remove();
		$(this).append('<img id="hv4" class="hover" src="images/hover_menu.png" border="0" />')
	});
	$(".camaras").hover(function(event){
		$(".hover").remove();
		$(this).append('<img id="hv5" class="hover" src="images/hover_menu2.png" border="0" />')
	});
	$(".quienes_somos").hover(function(event){
		$(".hover").remove();
		$(this).append('<img id="hv6" class="hover" src="images/hover_menu2.png" border="0" />')
	});	
	$("#fancy, #fancy2").tooltip({
		delay: 0,
		track: true,
		showURL: false,
		fixPNG: true,
		showBody: " - ",
		extraClass: "pretty fancy",
		top: -15,
		left: 5
	});
	$("#slideshow").slideshow({
		pauseSeconds: 6,
		width: 250,
		height: 260,
		fadeSpeed: 0,
		caption: true
	});
	$("#slideshow2").slideshow({
		pauseSeconds: 6,
		width: 250,
		height: 260,
		fadeSpeed: 0,
		caption: true
	});
	
});
