/* Comunes (javascripts.js)*/
/* Documento JS realizado por Luciano Petrosini */
/* Copyright 2011 Estudio Eurisco / Todos los derechos reservados */
/* www.estudioeurisco.com*/

/********************************************************************************************************************/
// Email Encrypt

<!-- Encrypted version of: contacto [at] *******.** //-->

var emailriddlerarray=[105,110,102,111,64,101,115,116,117,100,105,111,101,117,114,105,115,99,111,46,99,111,109]
var encryptedemail_id80='' //variable to contain encrypted email 
for (var i=0; i<emailriddlerarray.length; i++)
 encryptedemail_id80+=String.fromCharCode(emailriddlerarray[i])

/********************************************************************************************************************/

jQuery(document).ready(function($){
	$('html, body').animate({ scrollTop: 0 }, 'slow');
	$('html').css("background", "none")
	
	//Frases
$('#promoIMG').splashScreen({
		textLayers : [
			'img/intro/frase1.png',
			'img/intro/frase2.png'
		]
	});
	
	// Medidas
	var height = $(window).height();
	$(".section").height(height);
	$(".bg").height(height);
	$("#footer").height(height);
	
	// Cufon font replacement
	Cufon.replace('#main-nav a, h2, h3, h4, h5 ', { fontFamily: 'Sans', hover: 'true' });
	Cufon.replace('h1, blockquote span', { fontFamily: 'Serif', hover: 'true' });
	
    $("a[href*=#]").click(function (e) {
        if (location.pathname.replace(/^\//, "") == this.pathname.replace(/^\//, "") && location.hostname == this.hostname) {
            Core.scrollTo($(this.hash))
        }
        return false
    });
    var c = $.browser == "msie" && $.browser.version < 7;
    if (!c) {
        var d = $("#main-nav ul").offset().top+18 - parseFloat($("#main-nav ul").css("margin-top").replace(/auto/, 0));

        $(window).scroll(function (e) {
            var f = $(this).scrollTop();
            if (f >= d) {
                $("#main-nav").addClass("sticky")
				$("#copyright").addClass("sticky")
				$("#toplink").show("slow");
            } 
			
			else {
                $("#main-nav").removeClass("sticky")
				$("#copyright").removeClass("sticky")
				$("#toplink").hide("slow");
            }
        })
    }
    $(window).scroll(function () {
        var g = "#" + $("body .target a:in-viewport").parent().attr("id"),
            e = $("#main-nav ul li a").filter("[hash=" + g + "]");
        var f = true;
        if ($.browser.msie && $.browser.version == "7.0") {
            if (parseInt(document.documentElement.scrollTop, 0) < 12160 && g == "#contact") {
                f = false
            }
        }
        if (e.length && !e.is(".active")) {
            $("#main-nav ul li a").parent("li").removeClass("active");
            if (f) {
                e.parent("li").addClass("active")
            }
        }
        switch (g) {
        case "#webdesign":
            Core.position(g);
            //Stats.trackDiscover();
            break;
        case "#webdevelopment":
            Core.position(g);
            //Stats.trackWatch();
            break;
        case "#seosem":
            Core.position(g);
            //Stats.trackEnjoy();
            break;
        case "#corporate":
            Core.position(g);
            //Stats.trackShare();
            break;
		case "#graphicdesign":
            Core.position(g);
            //Stats.trackShare();
            break;
		case "#innews":
            Core.position(g);
            //Stats.trackShare();
            break;
        case "#contact":
            Core.position(g);
            //Stats.trackRegister();
            break
        }
       });
    (function (e) {
        e.fn.pulse = function (f) {
            return this.each(function () {
                var g = e.extend({}, e.fn.pulse.defaults, f),
                    j = g.count,
                    i = e(this);

                function h() {
                    --j;
                    i.fadeOut(g.speed, function () {
                        i.fadeIn(g.speed, function () {
                            j ? h() : g.callback()
                        })
                    })
                }
                h()
            })
        };
        e.fn.pulse.defaults = {
            count: 1000,
            speed: 3000,
            callback: function () {
                return false
            }
        }
    })(jQuery);
    $(function(){$("#inicio .header a span").pulse()});
    $("#inicio .header a").click(function () {
        $("#toplink").fadeIn();
    });
    
    /*$(".togglelopd").click(function () {
        if (!$("#lopd").is(":visible")) {
            $("#lopd").fadeIn();
            Core.scrollTo("#lopd", ($(window).height() - $("#lopd").height() - 50))
			
        } else
		{
			$("#lopd").fadeOut();
			}

    });*/

    var b = document.createElement("input");
    var a = "placeholder" in b;
    if (!a) {
        $(":input[placeholder]").each(function () {
            var e = $(this);
            if (e.val() === "") {
                e.addClass("placeholder");
                e.val(e.attr("placeholder"))
            }
            e.focus(function () {
                e.addClass("focus");
                if (e.val() === e.attr("placeholder")) {
                    e.val("");
                    e.removeClass("placeholder")
                }
            }).blur(function () {
                e.removeClass("focus");
                if (e.val() === "") {
                    e.addClass("placeholder");
                    e.val(e.attr("placeholder"))
                }
            })
        })
    }
    Core.teaserInit()
	
	//back to top scroll function. Any link with a hash (#) will scroll to that id on the page
	$('a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			var $target = $(this.hash);
			$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
			if ($target.length) {
				var targetOffset = $target.offset().top;
				targetOffset = targetOffset - 10;
				$('html,body').animate({scrollTop: targetOffset}, 800);
				return false;
			}
		}
	});
	
	topYloc = parseInt($("#toplink").css("top").substring(0,$("#toplink").css("top").indexOf("px")));
	
//Tooltip
$(".twitter a[title], .facebook a[title], a.tel[title], #media a[title], #copyright .languaje a[title], a.empezar[title]").qtip({content:{text:false},position:{corner:{tooltip:'bottomMiddle',target:'topMiddle'}},hide:{fixed:true},style:{padding:5,background:'#FF227A',color:'white',textAlign:'center',border:{width:3,radius:4,color:'#FF227A'},tip:'bottomLeft',width:{min:60,max:400},tip:true},show:{effect:{type:'fade',length:430},delay:500},hide:{delay:500},effect:{type:'fade',length:300}});


	// Barra de tope
	$(function() {
	var bar = $('#headerSlideContainer');
	var top = bar.css('top');
	$(window).scroll(function() {
		if($(this).scrollTop() > 50) {
			bar.stop().animate({'top' : '0px'}, 500);
		} else {
			bar.stop().animate({'top' : top}, 500);
		}
		});
	});
	
	//Remove the title
	$('#main-nav a[title], a.contacto[title]').removeAttr('title');
	
	
	//GALERIAS
	
	//Webdesign
	$("#gal_webdesign").click(function() {
		$.fancybox([
			{
				'href'	: 'img/webdesign/imagen01.jpg',
				'title'	: 'Dise&ntilde;o y Desarrollo de <strong>www.familiadejesus.com</strong> (Tienda Online)'
			},
			{
				'href'	: 'img/webdesign/imagen02.jpg',
				'title'	: 'Dise&ntilde;o y Desarrollo de <strong>www.artesanadelavida.com</strong>'
			},
			{
				'href'	: 'img/webdesign/imagen03.jpg',
				'title'	: 'Dise&ntilde;o y Desarrollo de <strong>www.optimafruit.es</strong>'
			},
			{
				'href'	: 'img/webdesign/imagen04.jpg',
				'title'	: 'Dise&ntilde;o y Desarrollo de <strong>www.londoncafe.es</strong>'
			},
			{
				'href'	: 'img/webdesign/imagen05.jpg',
				'title'	: 'Dise&ntilde;o y Desarrollo de <strong>www.catedraldevalencia.es</strong>'
			},
			{
				'href'	: 'img/webdesign/imagen06.jpg',
				'title'	: 'Dise&ntilde;o y Desarrollo de <strong>www.guyi.es</strong>, destacada en Web Design Index by Content 4'
			},
			{
				'href'	: 'img/webdesign/imagen07.jpg',
				'title'	: 'Dise&ntilde;o y Desarrollo de <strong>www.iglesiasanpedroapostol.com</strong>'
			},
			{
				'href'	: 'img/webdesign/imagen08.jpg',
				'title'	: 'Dise&ntilde;o de <strong>www.renovandsol.com</strong>, 1º Premio Mejor Web Empresarial de Castilla La Mancha en la Red 2010'
			},
			{
				'href'	: 'img/webdesign/imagen09.jpg',
				'title'	: 'Dise&ntilde;o y Desarrollo de <strong>www.juanmartindiaz.com</strong>'
			},
			
		], {
			'padding'			: 0,
			'titlePosition'		: 'inside',
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'              : 'image',
			'changeFade'        : 500
		});
	});
	
	//webdevelopment
	$("#gal_webdevelopment").click(function() {
		$.fancybox([
			{
				'href'	: 'img/webdevelopment/imagen01.jpg',
				'title'	: 'Dise&ntilde;o, desarrollo e implementaci&oacute;n de Area de Socio, Tienda virtual y Transmisi&oacute;n online de eventos en vivo'
			},
			{
				'href'	: 'img/webdevelopment/imagen02.jpg',
				'title'	: 'Dise&ntilde;o y Desarrollo de una Galer&iacute;a multimedia de la S&aacute;bana Santa para <strong>www.linteum.com</strong>'
			},
			{
				'href'	: 'img/webdevelopment/imagen03.jpg',
				'title'	: 'Dise&ntilde;o y Desarrollo de una Galer&iacute;a multimedia de la S&aacute;bana Santa para <strong>www.linteum.com</strong>'
			},
			
			{
				'href'	: 'img/webdevelopment/imagen04.jpg',
				'title'	: 'Dise&ntilde;o y Desarrollo de un Tienda Online para <strong>www.familiadejesus.com</strong>'
			},
			{
				'href'	: 'img/webdevelopment/imagen05.jpg',
				'title'	: 'Dise&ntilde;o y Desarrollo de un Tienda Online para <strong>www.familiadejesus.com</strong> (detalle)'
			},
			
			{
				'href'	: 'img/webdevelopment/imagen06.jpg',
				'title'	: 'Dise&ntilde;o y Desarrollo para <strong>www.optima.es</strong>'
			},
			
			{
				'href'	: 'img/webdevelopment/imagen07.jpg',
				'title'	: 'Dise&ntilde;o y Desarrollo para <strong>www.optima.es</strong> (detalle)'
			},
			
			{
				'href'	: 'img/webdevelopment/imagen08.jpg',
				'title'	: 'Personalizaci&oacute;n de una plataforma Wordpress para <strong>www.extravalencia.com</strong>'
			},
			{
				'href'	: 'img/webdevelopment/imagen09.jpg',
				'title'	: 'Dise&ntilde;o y Desarrollo para una Aplicaci&oacute;n de Autoevaluaci&oacute;n para la <strong>Universidad de Valencia</strong>'
			},

		], {
			'padding'			: 0,
			'titlePosition'		: 'inside',
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'              : 'image',
			'changeFade'        : 500
		});
	});
	
	//corporate
	$("#gal_graphicdesign").click(function() {
		$.fancybox([
			{
				'href'	: 'img/graphicdesign/imagen01.jpg',
				'title'	: 'Dise&ntilde;o tipogr&aacute;fico para la <strong>Revista Acido Surtido #21</strong> (Buenos Aires)'
			},
			{
				'href'	: 'img/graphicdesign/imagen02.jpg',
				'title'	: 'Dise&ntilde;o y Maquetaci&oacute;n de Dossiers para <strong>U-Play Sport Events S.L.</strong> (Madrid)'
			},
			{
				'href'	: 'img/graphicdesign/imagen03.jpg',
				'title'	: 'Ilustraci&oacute;n para <strong>Guyi Andr&eacute;s Campod&oacute;nico</strong> (Madrid)'
			},
			{
				'href'	: 'img/graphicdesign/imagen04.jpg',
				'title'	: 'Dise&ntilde;o de cubierta y booklet para <strong>Imagen Factory</strong> (Madrid)'
			},
			{
				'href'	: 'img/graphicdesign/imagen05.jpg',
				'title'	: 'Ilustraci&oacute;n para <strong>Zonapadel</strong> (Valencia)'
			},
			{
				'href'	: 'img/graphicdesign/imagen06.jpg',
				'title'	: 'Dise&ntilde;o de Cartel para Vigilia de J&oacute;venes, <strong>Iglesia de Chiva</strong> (Valencia)'
			},
			{
				'href'	: 'img/graphicdesign/imagen07.jpg',
				'title'	: 'Dise&ntilde;o de cubierta y booklet para <strong>El Bibliotecario</strong>, Imagen Factory (Madrid)'
			},
			{
				'href'	: 'img/graphicdesign/imagen08.jpg',
				'title'	: 'Folletos corporativos para <strong>Renov&amp;sol</strong> (Cuenca)'
			},
		], {
			'padding'			: 0,
			'titlePosition'		: 'inside',
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'              : 'image',
			'changeFade'        : 500
		});
	});
	
	//graphicdesign
	$("#gal_corporate").click(function() {
		$.fancybox([
		    {
				'href'	: 'img/corporate/imagen01.jpg',
				'title'	: 'Dise&ntilde;o de Imagen Corporativa para <strong>Imagen Factory</strong> (Madrid)'
			},
			{
				'href'	: 'img/corporate/imagen02.jpg',
				'title'	: 'Dise&ntilde;o de Imagen Corporativa para <strong>Rent &amp; Move</strong>, alquiler de veh&iacute;culos low cost (Granada)'
			},
			
			{
				'href'	: 'img/corporate/imagen03.jpg',
				'title'	: 'Propuesta de Dise&ntilde;o de Imagen Corporativa para el <strong>Obispado de San Sebasti&aacute;n</strong>'
			},
			{
				'href'	: 'img/corporate/imagen04.jpg',
				'title'	: 'Dise&ntilde;o de Imagen Corporativa para <strong>Suuite</strong> (Valencia)'
			},
			{
				'href'	: 'img/corporate/imagen05.jpg',
				'title'	: 'Dise&ntilde;o de Imagen Corporativa para <strong>Zonapadel</strong> (Valencia)'
			},
			{
				'href'	: 'img/corporate/imagen06.jpg',
				'title'	: 'Dise&ntilde;o de Imagen Corporativa para <strong>Artesana de la Vida</strong> (Madrid)'
			},
			{
				'href'	: 'img/corporate/imagen07.jpg',
				'title'	: 'Dise&ntilde;o de Imagen Corporativa para <strong>ADB</strong> (Madrid)'
			},
			{
				'href'	: 'img/corporate/imagen08.jpg',
				'title'	: 'Propuesta de Imagen Corporativa para <strong>Burton/Wolfe Entertainment</strong> (EEUU)'
			},
			{
				'href'	: 'img/corporate/imagen09.jpg',
				'title'	: 'Dise&ntilde;o de Imagen Corporativa para <strong>Imagen Factory</strong> (Madrid)'
			},
			{
				'href'	: 'img/corporate/imagen10.jpg',
				'title'	: 'Dise&ntilde;o de Imagen Corporativa para <strong>Artesana de la Vida</strong> (Madrid)'
			},
			{
				'href'	: 'img/corporate/imagen11.jpg',
				'title'	: 'Dise&ntilde;o de Logotipo para <strong>ADB</strong> (Madrid)'
			},
			{
				'href'	: 'img/corporate/imagen12.jpg',
				'title'	: 'Aplicaci&oacute;n web de Imagen Corporativa de <strong>Artesana de la Vida</strong> (Madrid)'
			},
		], {
			'padding'			: 0,
			'titlePosition'		: 'inside',
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'              : 'image',
			'changeFade'        : 500
		});
	});
	
	
	
	$("#media a, a.notalegal").fancybox({
		'width'				: '75%',
		'height'			: '75%',
        'autoScale'     	: false,
        'titlePosition'		: 'inside',
		'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	
	 
});

var topYloc = null;

jQuery(window).scroll(function(){var scrollTop=jQuery(document).scrollTop();scrollTop=parseInt(scrollTop)+100;var offset=topYloc+scrollTop+"px";jQuery("#toplink").animate({top:offset},{duration:2500,queue:false});});

