 //     LIBRARIES       //
//
//Twitter
function relative_time(time_value) {
    var values = time_value.split(" ");
    time_value = values[1] + " " + values[2] + ", " + values[5] + " " + values[3];
    var parsed_date = Date.parse(time_value);
    var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
    var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
    delta = delta + (relative_to.getTimezoneOffset() * 60);
    
    if (delta < 60) {
        return 'alguns segundos atrás';
    } else if (delta < 120) {
        return '1 minuto atrás';
    } else if (delta < (60 * 60)) {
        return (parseInt(delta / 60)).toString() + ' minutos atrás';
    } else if (delta < (120 * 60)) {
        return '1 hora atrás';
    } else if (delta < (24 * 60 * 60)) {
        return (parseInt(delta / 3600)).toString() + ' horas atrás';
    } else if (delta < (48 * 60 * 60)) {
        return '1 dia atrás';
    } else {
        return (parseInt(delta / 86400)).toString() + ' dias atrás';
    }
}

function timeline(twitters) {
    var statusHTML = [];
    for (var i = 0; i < twitters.length; i++) {
        var username = twitters[i].user.screen_name;
        var status = twitters[i].text.replace(/((https?|s?ftp|ssh)\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!])/g, function(url) {
            return '<a href="' + url + '">' + url + '</a>';
        }).replace(/\B@([_a-z0-9]+)/ig, function(reply) {
            return reply.charAt(0) + '<a href="http://twitter.com/' + reply.substring(1) + '">' + reply.substring(1) + '</a>';
        });
        
        statusHTML.push('<li><span>' + status + '</span> <a class="status" href="http://twitter.com/' + username + '/statuses/' + twitters[i].id + '"><span class="sprite replace"></span>' + relative_time(twitters[i].created_at) + '</a></li>');
    }
    
    $('#timeline').prepend('<ul>' + statusHTML.join('') + '</ul>').find('.loading').remove();
}

//
//jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/

jQuery.easing['jswing'] = jQuery.easing['swing'];
jQuery.extend(jQuery.easing, {def: 'easeOutQuad',swing: function(x, t, b, c, d) {
        return jQuery.easing[jQuery.easing.def](x, t, b, c, d)
    },easeInQuad: function(x, t, b, c, d) {
        return c * (t /= d) * t + b
    },easeOutQuad: function(x, t, b, c, d) {
        return -c * (t /= d) * (t - 2) + b
    },easeInOutQuad: function(x, t, b, c, d) {
        if ((t /= d / 2) < 1)
            return c / 2 * t * t + b;
        return -c / 2 * ((--t) * (t - 2) - 1) + b
    },easeInCubic: function(x, t, b, c, d) {
        return c * (t /= d) * t * t + b
    },easeOutCubic: function(x, t, b, c, d) {
        return c * ((t = t / d - 1) * t * t + 1) + b
    },easeInOutCubic: function(x, t, b, c, d) {
        if ((t /= d / 2) < 1)
            return c / 2 * t * t * t + b;
        return c / 2 * ((t -= 2) * t * t + 2) + b
    },easeInQuart: function(x, t, b, c, d) {
        return c * (t /= d) * t * t * t + b
    },easeOutQuart: function(x, t, b, c, d) {
        return -c * ((t = t / d - 1) * t * t * t - 1) + b
    },easeInOutQuart: function(x, t, b, c, d) {
        if ((t /= d / 2) < 1)
            return c / 2 * t * t * t * t + b;
        return -c / 2 * ((t -= 2) * t * t * t - 2) + b
    },easeInQuint: function(x, t, b, c, d) {
        return c * (t /= d) * t * t * t * t + b
    },easeOutQuint: function(x, t, b, c, d) {
        return c * ((t = t / d - 1) * t * t * t * t + 1) + b
    },easeInOutQuint: function(x, t, b, c, d) {
        if ((t /= d / 2) < 1)
            return c / 2 * t * t * t * t * t + b;
        return c / 2 * ((t -= 2) * t * t * t * t + 2) + b
    },easeInSine: function(x, t, b, c, d) {
        return -c * Math.cos(t / d * (Math.PI / 2)) + c + b
    },easeOutSine: function(x, t, b, c, d) {
        return c * Math.sin(t / d * (Math.PI / 2)) + b
    },easeInOutSine: function(x, t, b, c, d) {
        return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b
    },easeInExpo: function(x, t, b, c, d) {
        return (t == 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b
    },easeOutExpo: function(x, t, b, c, d) {
        return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b
    },easeInOutExpo: function(x, t, b, c, d) {
        if (t == 0)
            return b;
        if (t == d)
            return b + c;
        if ((t /= d / 2) < 1)
            return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
        return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b
    },easeInCirc: function(x, t, b, c, d) {
        return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b
    },easeOutCirc: function(x, t, b, c, d) {
        return c * Math.sqrt(1 - (t = t / d - 1) * t) + b
    },easeInOutCirc: function(x, t, b, c, d) {
        if ((t /= d / 2) < 1)
            return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
        return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b
    },easeInElastic: function(x, t, b, c, d) {
        var s = 1.70158;
        var p = 0;
        var a = c;
        if (t == 0)
            return b;
        if ((t /= d) == 1)
            return b + c;
        if (!p)
            p = d * .3;
        if (a < Math.abs(c)) {
            a = c;
            var s = p / 4
        } else
            var s = p / (2 * Math.PI) * Math.asin(c / a);
        return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b
    },easeOutElastic: function(x, t, b, c, d) {
        var s = 1.70158;
        var p = 0;
        var a = c;
        if (t == 0)
            return b;
        if ((t /= d) == 1)
            return b + c;
        if (!p)
            p = d * .3;
        if (a < Math.abs(c)) {
            a = c;
            var s = p / 4
        } else
            var s = p / (2 * Math.PI) * Math.asin(c / a);
        return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b
    },easeInOutElastic: function(x, t, b, c, d) {
        var s = 1.70158;
        var p = 0;
        var a = c;
        if (t == 0)
            return b;
        if ((t /= d / 2) == 2)
            return b + c;
        if (!p)
            p = d * (.3 * 1.5);
        if (a < Math.abs(c)) {
            a = c;
            var s = p / 4
        } else
            var s = p / (2 * Math.PI) * Math.asin(c / a);
        if (t < 1)
            return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
        return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b
    },easeInBack: function(x, t, b, c, d, s) {
        if (s == undefined)
            s = 1.70158;
        return c * (t /= d) * t * ((s + 1) * t - s) + b
    },easeOutBack: function(x, t, b, c, d, s) {
        if (s == undefined)
            s = 1.70158;
        return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b
    },easeInOutBack: function(x, t, b, c, d, s) {
        if (s == undefined)
            s = 1.70158;
        if ((t /= d / 2) < 1)
            return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;
        return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b
    },easeInBounce: function(x, t, b, c, d) {
        return c - jQuery.easing.easeOutBounce(x, d - t, 0, c, d) + b
    },easeOutBounce: function(x, t, b, c, d) {
        if ((t /= d) < (1 / 2.75)) {
            return c * (7.5625 * t * t) + b
        } else if (t < (2 / 2.75)) {
            return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b
        } else if (t < (2.5 / 2.75)) {
            return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b
        } else {
            return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b
        }
    },easeInOutBounce: function(x, t, b, c, d) {
        if (t < d / 2)
            return jQuery.easing.easeInBounce(x, t * 2, 0, c, d) * .5 + b;
        return jQuery.easing.easeOutBounce(x, t * 2 - d, 0, c, d) * .5 + c * .5 + b
    }});


//
//Suffle
(function($) {
    $.fn.shuffle = function() {
        return this.each(function() {
            var items = $(this).children();
            return (items.length) ? $(this).html($.shuffle(items)) : this;
        });
    }
    
    $.shuffle = function(arr) {
        for (var j, x, i = arr.length; i; j = parseInt(Math.random() * i), x = arr[--i], arr[i] = arr[j], arr[j] = x)
            ;
        return arr;
    }
})(jQuery);



//      COMMONS     //
//
//Blank
$('.blank a, a.blank, a[rel=blank]').attr({target: '_blank'});

//
//Language bar
$('#lang').each(function() {
    var txt = $(this).children('h4').text();
    
    $(this).children('.flag').hover(function() {
        $('#lang h4').text($(this).attr('title'));
    }, function() {
        $('#lang h4').text(txt);
    });
});

//
//Form submit
$('.submit').click(function() {
    $(this).parents('form').submit();
});

//
//Fade button
$('.fade:not(.open)').live('mouseenter', function() {
    $(this).find('.layer').stop().fadeTo(250, 0);
});
$('.fade:not(.open)').live('mouseleave', function() {
    $(this).find('.layer').stop().fadeTo(250, 1);
});

//
//Block link
$('.block').click(function() {
    var ref = $(this).find('a').attr('href');
    window.location = ref;
});

//
// Menu
$('#menu .main').hover(function() {
    $op = $(this);
    if ($op.has('ul')) {
        if ($op.children('ul').find('.layer').text() != $op.find('a:eq(0) strong').text()) {
            $op.children('ul').find('.layer').html('<strong>' + $op.find('a:eq(0) strong').text() + '</strong>');
        }
        $op.children('ul').fadeTo(0, 0).stop(true).css({visibility: 'visible'}).fadeTo(250, 1);
    }
}, function() {
    $cl = $(this);
    if ($cl.has('ul')) {
        $cl.children('ul').stop(true).fadeTo(250, 0, function() {
            $cl.children('ul').css({display: 'none'})
        });
    }
});

//
//Weather
var code = 'BRXX0232';
function weather(data) {
    //console.log(data);
    var temp = data.query.results.channel.item.condition.temp, 
    code = data.query.results.channel.item.condition.code, 
    time = data.query.results.channel.item.pubDate;
    time = time.split(' ');
    if ((time[5] == 'pm' && parseInt(time[4].split(':')) >= 6 && parseInt(time[4].split(':')) != 12) || (time[5] == 'am' && parseInt(time[4].split(':')) < 6)) {
        time = 'n';
    } else {
        time = 'd'
    }
    $('#weather').append('<span>' + temp + '°<img src="http://l.yimg.com/a/i/us/nws/weather/gr/' + code + time + '.png" /></span> <a target="_blank" href="http://br.tempo.yahoo.com/brazil/sao-paulo/sao-paulo-455827/" class="yahoo"><img src="http://l.yimg.com/x/i/br/brwe4b.gif" /></a>');
}

$.ajax({
    dataType: 'script',
    timeout: 45000,
    cache: true,
    async: true,
    type: 'GET',
    url: 'http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20location=%22' + code + '%22%20and%20u=%22c%22&format=json&callback=weather',
    error: function() {
        $('#weather').append('Fail');
    }
});


//
// Blog rss
$('#bbox li').each(function() {
    var cat = $(this).find('h4').text().replace(' ', '-').replace('ã', 'a').toLowerCase();
    $(this).addClass(cat).find('h4 a').attr({href: 'http://visitesaopaulo.com/blog/index.php/category/' + cat});
    $(this).find('div').html('<a href="' + $(this).find('h5 a').attr('href') + '"><img src="' + $(this).find('div img').attr('src') + '" alt="" width="115" /></a>');
});

//
//Watermark
$('form .watermark').each(function() {
    var field = $(this), 
    watermark = field.val();
    
    field
    .attr({title: watermark})
    .bind({
        focus: function() {
            if (field.val() == watermark) {
                $(this).val('');
            }
        },
        blur: function() {
            if (field.val() == '') {
                $(this).val(watermark);
            }
        }
    });
});

//
//Casts
$('#audio, #video').each(function() {
    var code = $(this).find('code').text();
    if ($(this).attr('id') == 'audio') {
        $('#audio').prepend('<object height="81" width="100%"> <param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F' + code + '&amp;show_comments=true&amp;auto_play=false&amp;color=d81921"></param> <param name="allowscriptaccess" value="always"><param name="wmode" value="transparent"></param> <embed allowscriptaccess="always" height="81" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F' + code + '&amp;show_comments=true&amp;auto_play=false&amp;color=d81921" wmode="transparent" type="application/x-shockwave-flash" width="100%"></embed> </object>').find('code').remove();
    } else {
        $('#video').prepend('<iframe title="YouTube video player" class="youtube-player" type="text/html" width="194" height="145" src="http://www.youtube.com/embed/' + code + '?rel=0&wmode=transparent" frameborder="0"></iframe>').find('code').remove();
    }
});

$('#cast h3 .label:not(.open)').live('click', function(e) {
    $('#cast h3 .label').toggleClass('open');
    $('#video, #audio').slideToggle();
    return false;
});

//
//Busca agenda
$('#agenda .label:not(.open)').live('click', function(e) {
    $('#agenda .label').toggleClass('open');
    $('#destaques, #pag, #lista').fadeToggle();
    return false;
});




//
//Acontece
$('#spcvb').each(function() {
    $('a.fancy').fancybox({
        titlePosition: 'over'
        ,overlayColor: '#FFF'
    });
});

//
//Acontece
$('#acontece').each(function() {
    var sea = window.location.search;
    sea = sea.split('?t=');
    
    $('.submenu a').live('click', function() {
        var t = $(this).attr('href');
        
        $('.list').hide();
        
        $(t).show();
        
        return false;
    });
    
    if (sea[1] != '') {
        $('.submenu a[href$="' + sea[1] + '"]').trigger('click');
    }
});

//

//
//Nossos parceiros
$('#parcerias').each(function() {
    var hash = window.location.hash;
    
    $('.partners a').live('click', function() {
        var t = $(this).attr('href');
        
        $('.partner').slideUp();
        
        $(t).slideDown();
        
        return false;

    //      $(window).scrollTop(0);
    });
    
    if (hash != '') {
        $('.partners a[href$="' + hash + '"]').trigger('click');
    }
});

//
//Opine
$('#answer').click(function() {
    $(this).toggleClass('close');
    $('#opiniao, #opinar').slideToggle();
    return false;
});

//
//Featured
function move_slider(i) {
    step = i;
    $('#controls li').removeAttr('style');
    $('#controls li:eq(' + i + ')').css({color: '#FFF'});
    
    $('#slider').stop().animate({
        top: -1 * (i - 1) * 240
    }, 500, 'easeOutExpo');
    
    $('#arrow').stop().animate({
        top: 1 * (i - 1) * 60
    }, 500, 'easeOutExpo');
}

var pilot = '', 
step = 1;

function auto_pilot() {
    if (step < 4) {
        move_slider(step + 1);
    } else {
        move_slider(1);
    }
}
move_slider(1);

function restart() {
    pilot = window.setInterval(auto_pilot, 15000);
}
restart();

$('#featured').hover(function() {
    clearInterval(pilot);
}, function() {
    restart();
});

$('#featured').each(function() {
    $('#controls li').live('mouseenter', function() {
        var i = $(this).index();
        i = parseInt(i, 10);
        move_slider(i);
    });
});


//
// Agenda
$('#destaques').each(function() {
    var qtd = $(this).find('dl').length;
    
    if (qtd > 3) {
        $('#destaques').append('<div class="roll"></div>').after('<div id="pag"></div>');
        $('#destaques div').width(qtd * $('#destaques dl:eq(1)').outerWidth(true)).append($('#destaques dl'));
        $('#destaques dl:nth-child(3n+1)').css({margin: '0'});
        
        pages = Math.ceil(qtd / 3);
        
        for (i = 0; i < pages; i++) {
            $('#pag').append('<strong>.</strong>');
        }
    }
    
    $('#pag strong:not(".selected")').live('click', function() {
        var page = $(this).index();
        
        $('#pag strong').removeClass('selected');
        $(this).addClass('selected');
        
        $('#destaques .roll').animate({
            left: page * -$('#destaques').width()
        }, 500);
    });
    
    $('#pag strong:eq(0)').trigger('click');

    //Start turn
    var turn = '';
    
    function restart() {
        turn = window.setInterval(function() {
            if ($('#pag strong.selected').index() + 1 >= pages) {
                $('#pag strong:eq(0)').trigger('click');
            } else {
                $('#pag strong.selected').next('strong').trigger('click');
            }
        }, 10000);
    }
    restart();
    
    $('#destaques').hover(function() {
        clearInterval(turn);
    }, function() {
        restart();
    })
});


//
//Parceiros
$('#sponsors').each(function() {
    var size = 0;
    for (i = 0; i <= $(this).find('a').length; i++) {
        size += $('#sponsors li:eq(' + i + ')').outerWidth(true);
        $('#sponsors ul').css({width: size});
    }
    
    $('#sponsors ul').shuffle();

    //Start ticker
    var ticker = '';
    
    function restart() {
        ticker = window.setInterval(function() {
            $('#sponsors ul').stop().animate({
                left: -($('#sponsors li:eq(0)').width())
            }, 1000, function() {
                $('#sponsors ul').css({left: '0px'});
                $('#sponsors li:eq(0)').appendTo('#sponsors ul');
            });
        }, 5000);
    }
    restart();
    
    $('#sponsors').hover(function() {
        clearInterval(ticker);
    }, function() {
        restart();
    })
});


//
//Postal
var controlPage = 0, 
limitPage = 0;

function control() {
    var qtd = $('#postal li:visible').length;
    
    if (qtd > 5) {
    //ative();
    }
    
    if (controlPage + 5 >= qtd) {
        $('#postal span.next').addClass('block').stop().fadeTo(500, .5);
    } else if (controlPage == 0) {
        $('#postal span.prev').addClass('block').stop().fadeTo(500, .5);
        $('#postal span.next').removeClass('block').stop().fadeTo(500, 1);
    } else if (controlPage > 0 && controlPage + 5 < qtd) {
        $('#postal span.prev, #postal span.next').removeClass('block').stop().fadeTo(500, 1);
    }
    if (qtd <= 5) {
        $('#postal span.prev, #postal span.next').addClass('block').stop().fadeTo(500, .5);
    }
}

function resetControl() {
    controlPage = 0;
    
    $('#postal ul').stop().animate({
        left: 0
    }, 500);
}

$('#postal span.next:not(.block)').live('click', function() {
    controlPage += 1;
    
    $('#postal ul').stop().animate({
        left: -controlPage * 104
    }, 500, 'easeOutExpo');
    
    control();
});

$('#postal span.prev:not(.block)').live('click', function() {
    controlPage -= 1;
    
    $('#postal ul').stop().animate({
        left: -controlPage * 104
    }, 500, 'easeOutExpo');
    
    control();
});

$('#postal').each(function() {
    
    var qtd = $('#postal li').length;
    
    $('#postal select').change(function() {
        var str = '';
        $('#postal select option:selected').each(function() {
            str = $(this).val();
        });
        
        if (str == 'all') {
            $('#postal li').show();
        } else {
            $('#postal li').hide();
            $('#postal li.s' + str).show();
        }
        
        if ($('#postal .send').is(':visible')) {
            if ($('#postal li a.select').is(':visible')) {
            } else {
            }
        }
        
        resetControl();
        control();
    }).trigger('change');
    
    $('#postal li a').each(function() {
        $(this).attr({title: $(this).prev().attr('alt')}); //, href: $(this).prev().attr('src')
    });
    
    $('#postal li a').live('click', function() {
        $('#postal li a').removeClass('select');
        $(this).addClass('select');
        $('#postal .send h4').text($(this).attr('title'));
        $('#postal .send input[name="nome"]').val($(this).attr('title'));
        $('#postal .send input[name="val"]').val($(this).attr('href').replace('#', ''));
        $('#postal .send img:eq(0)').attr({src: $(this).prev().attr('src')});
        $('#postal .send').slideDown();
        
        return false;
    });
    
    $('#postal .close').live('click', function() {
        $('#postal .send').slideUp();
        
        return false;
    });
});

//Send
$('#postal form').bind('submit', function(e) {
    
    var $form = $('#postal form').serialize(), 
    emailMask = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/, 
    valid = false;
    
    if ($('#postal form input[name="de"]').val() != '') {
        $('#postal form input[name="de"]').css({outline: 'none'});
        valid = true;
    } else {
        $('#postal form input[name="de"]').css({outline: '1px solid red'});
        valid = false;
    }
    
    if ($('#postal form input[name="para"]').val() != '') {
        $('#postal form input[name="para"]').css({outline: 'none'});
        valid = true;
    } else {
        $('#postal form input[name="para"]').css({outline: '1px solid red'});
        valid = false;
    }
    
    if (emailMask.test($('#postal form input[name="email_de"]').val())) {
        $('#postal form input[name="email_de"]').css({outline: 'none'});
        valid = true;
    } else {
        $('#postal form input[name="email_de"]').css({outline: '1px solid red'});
        valid = false;
    }
    
    if (emailMask.test($('#postal form input[name="email_para"]').val())) {
        $('#postal form input[name="email_para"]').css({outline: 'none'});
        valid = true;
    } else {
        $('#postal form input[name="email_para"]').css({outline: '1px solid red'});
        valid = false;
    }
    
    if (valid == true) {
        $.ajax({
            type: "POST",
            url: "/cartoes_postais_envia.asp",
            data: $form,
            timeout: 45000,
            success: function(msg) {
                //console.log(msg)
                if (msg.search("0") == 0) {
                    $('#postal .submit').after('<p>' + msg.split('|')[1] + '</p>');
                    setTimeout(function() {
                        $('#postal .send').slideUp();
                    }, 1000);
                } else {
                    $('#postal .submit').after('<p>' + msg.split('|')[1] + '</p>');
                }
            },error: function() {
                $('#postal .submit').after('<p>Erro de servidor, tente mais tarde.</p>');
            }
        });
    }
    
    e.stopPropagation();
    e.preventDefault();
    return false;
});

//
//Modal
function create_modal(ref) {
    $('body').append('<div id="overlay" style="background:#000; height:100%; display:block; left:0; overflow:hidden; position:fixed; top:0; width:100%; z-index:9999;"></div>');
    $('#overlay').fadeTo(250, 0.9);
    
    $('body').append('<div id="frame" style="border: 10px solid white; background:#000; height:90%; display:block; left:5%; position:fixed; top:5%; width:90%; z-index:10000;"><p id="close" style="cursor: pointer; color: #FFF; position: absolute; top: -25px; right: -10px; font-size: 10px;">Fechar</p><iframe width="100%" height="100%" src="' + ref + '" scrolling="no" frameborder="0"></iframe></div>');
    
    $(document).keyup(function(e) {
        if (e.keyCode == 27) {
            close_modal();
        }
    });
    
    $('#overlay, #close').live('click', close_modal);
    
    function close_modal() {
        $('#overlay, #frame').fadeTo(250, 0);
        
        setTimeout(function() {
            $('#overlay, #frame').remove();
        }, 500);
    }
}

//
//Tour
$('.tour dl').bind('click', function() {
    var ref = $(this).find('a').attr('href');
    create_modal(ref);
    
    return false;
});

//      DOM Ready       //
$(document).ready(function() {

});

