document.write(unescape("%3Cscript src='" + (("https:" == document.location.protocol) ? "https" : "http") +"://a.mouseflow.com/projects/71d57a06-264f-4933-8e28-9e8754c7b610.js' type='text/javascript'%3E%3C/script%3E"));

$(document).ready(function(){
    language = 'en';
    filterHash();
		
});

/* Init
 ---------------------------------------------------------------------------------------
 */
function init(){
    activateNavigation();
    Cufon.replace('.tallys', {
        fontFamily: 'tallys'
    });
	
	$("ul#navi li#contact a").fancybox({overlayOpacity: 0.5, frameHeight:256, frameWidth:386});
 
    animate();
    $("#buttons a:not(a.close)").remove();
    install_switch($("#buttons"), // Where to put the lang buttons
 		$("body"), // The scope of the switch
 		$("#templates a") // The template to use for a single button
	);
	
	 activarGallery()
    
}


/* ANIMATIONS
 ---------------------------------------------------------------------------------------
 */
function animate(){
    //bird-hat
    $('#bird #bird-hat').hover(function(){
        $(this).stop().effect('bounce', 'slow');  
    });  
    activateClouds();
}

//nubes
function activateClouds(){
    $('#nubes .nube').animate({
        marginLeft: '500px'
    }, 50000, function(){
        $('#nubes .nube').animate({
            marginLeft: '0px'
        }, 50000, function(){
            activateClouds()
        });
    });
}

/* NAVIGATION
 ---------------------------------------------------------------------------------------
 */
function filterHash(){
    switch (window.location.hash) {
        case '#gallery':
            goTo('gallery.php');
            break
        case '#galeria':
            goTo('gallery.php');
            break
        case '#about':
            goTo('about.php');
            break
        case '#acercade':
            goTo('about.php');
            break
        default:
            goTo('start.php');
            break
    }
}

function goTo(location){
    $("div#mask .page").fadeOut(900);
    $("div#buttons").fadeOut(900);
  	jQuery.post(location,null,function(a,b,c){
		$("div#mask").empty();
		$("div#mask").append(a);
        init();
        $("div#mask .page").fadeIn(900);
        $("div#buttons").fadeIn(900);
    });
}

function activateNavigation(){
    $('a.link').bind("click", function(e){
        e.preventDefault();
    });
    $('.link').click(function(){
        $("div#mask .page").fadeOut(900);
        $("div#buttons").fadeOut(900);
        var link = $(this).attr('alt');
        
        switch (link) {
            case 'gallery.php':
                goTo('gallery.php');
                window.location.hash = 'gallery';
                break
            case 'about.php':
                goTo('about.php');
                window.location.hash = 'about';
                break
            case 'start.php':
                goTo('start.php');
                window.location.hash = 'start';
                break
        }        
    });
}

/* GALLERY
 ---------------------------------------------------------------------------------------*/

function activarGallery(){

    $("div#pageGallery div.galleries ul li div.balloon").hide();
    
    $("div#pageGallery div.galleries ul li").hover(function(){
    	
		

	
        $(this).find('div.balloon').show('puff', {
            percent: 100
        }, 'slow');
        
    }, function(){
        $(this).find('div.balloon').stop(true, false).delay(2000).hide('puff', {
            percent: 100
        }, 'slow');
    });
    
}

/* QUOTES
 ---------------------------------------------------------------------------------------*/
 
function getQuote(){

    var Quotation = new Array()
    
    if (language == 'es') {
        Quotation[0] = '"La perfeccion no se logra cuando ya no puede agregarse nada, sino cuando ya no puede quitarse nada" Antoine de Saint-Exup\u00E9ry';
        Quotation[1] = '"El arte es una mentira que dice la verdad." Pablo Picasso';
        Quotation[2] = '"La dosis define al veneno." Paracelsus';
        Quotation[3] = '"Quizas la imaginacion sea solo inteligencia divirtiendose." George Scialabba';
        Quotation[4] = '"La realidad es aquella parte de la imaginacion en la cual coincidimos todos." Anonimo';
        Quotation[5] = '"La moda es una forma de fealdad tan intolerable que es necesario cambiarla cada seis meses." Oscar Wilde';
        Quotation[6] = '"Un artista nunca termina realmente su trabajo, simplemente lo abandona." Paul Valery';
        Quotation[7] = '"El buen arte continua donde la naturaleza termina." Marc Chagall';
        Quotation[8] = '"Esta es tu vida, y se esta terminando minuto a minuto." Chuck Palahniuk';
        
    }
    else 
        if (language == 'en') {
            Quotation[0] = '"Perfection is attained, not when no more can be added, but when no more can be removed" Antoine de Saint-Exup\u00E9ry';
            Quotation[1] = '"Art is the lie that tells the truth." Pablo Picasso';
            Quotation[2] = '"The dose makes the poison" Paracelsus';
            Quotation[3] = '"Perhaps imagination is only intelligence having fun." George Scialabba';
            Quotation[4] = '"Reality is that part of the imagination we all agree on" Unknown';
            Quotation[5] = '"And, after all, what is a fashion? From the artistic point of view, it is usually a form of ugliness so intolerable that we have to alter it every six months." Oscar Wilde';
            Quotation[6] = '"An artist never really finishes his work, he merely abandons it." Paul Valery';
            Quotation[7] = '"Great art picks up where nature ends." Marc Chagall';
            Quotation[8] = '"This is your life and its ending one minute at the time" Chuck Palahniuk';
        }
    var Q = Quotation.length;
    var whichQuotation = Math.round(Math.random() * (Q - 1));
    
    quoteNode = document.createTextNode(Quotation[whichQuotation]);
    
    
    return quoteNode;
}

