/*
 * DroidsOnRoids.pl
 * Copyright (c) 2011 Tomasz Muter & Wojciech Szwajkiewicz
 * http://www.DroidsOnRoids.pl
 * tmuter@droidsonroids.pl
 *
 */

$(document).ready(function () {

    // Cross-browser Hover
    $(".hov").hover(function () {
        $(this).addClass("hover");
    }, function () {
        $(this).removeClass("hover");
    });

    // Slider wraz z nawigacja generowana automatycznie
    $('#quotes').cycle({
        fx:     'scrollHorz',
        speed:   600,
        timeout: 60000,
        pager:   '#testimonials-nav'
    });
    $('#feature-slider').cycle({
        fx:     'scrollHorz',
        speed:   600,
        timeout: 60000,
        pager:   '#feature-nav'
    });
    $('#synchro-slider').cycle({
        fx:     'scrollHorz',
        speed:   600,
        timeout: 5000
    });
    $('#tabs').cycle({
        fx:     'scrollHorz',
        speed:   600,
        timeout: 0,
        startingSlide: 0
    });
    $('#tab1').addClass("activeSlide");
    $('#tab1').click(function() {
        $('#tabs').cycle(0);
        $("#features-tabs a").removeClass();
        $(this).addClass("activeSlide");
        return false;
    });
    $('#tab2').click(function() {
        $('#tabs').cycle(1);
        $("#features-tabs a").removeClass();
        $(this).addClass("activeSlide");
        return false;
    });
    $('#tab3').click(function() {
        $('#tabs').cycle(2);
        $("#features-tabs a").removeClass();
        $(this).addClass("activeSlide");
        return false;
    });

    $('#goto2').click(function() {
        $('#s1').cycle(1);
        return false;
    });

    $("#tag ul li a:last").css("margin-right", "0");
    $("#tag ul li a:first").css("margin-left", "0");

    // Cufon Font
    Cufon('h1,.cufon', {
        fontFamily: 'Myriad Pro',
        hover: {
            color: '#9f3c88'
        }
    });

    // Lightbox
    $("a[rel^='prettyPhoto']").prettyPhoto({
        animation_speed: 'fast', /* fast/slow/normal */
        slideshow: 5000, /* false OR interval time in ms */
        opacity: 0.80, /* Value between 0 and 1 */
        show_title: true, /* true/false */
        allow_resize: true, /* Resize the photos bigger than viewport. true/false */
        default_width: 500,
        default_height: 344,
        counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
        theme: 'dark_rounded', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
        horizontal_padding: 20, /* The padding on each side of the picture */
        wmode: 'opaque', /* Set the flash wmode attribute */
        modal: false, /* If set to true, only the close button will close the window */
        deeplinking: true, /* Allow prettyPhoto to update the url to enable deeplinking. */
        overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
        keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */
        social_tools: '<div class="pp_social"><div class="twitter"><a href="http://twitter.com/share" class="twitter-share-button" >Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="http://www.facebook.com/plugins/like.php?locale=en_US&href=' + location.href + '&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div></div>' /* html or false to disable */
    });

    // Rozpoznawanie url'a i otwieranie odpowiedniego Supportu
    var str = location.href;
    $("#support").hide();
    if(str.toLowerCase().indexOf("#mac") >= 0) { $('#support, #support-mac').slideDown('slow'); }
    if(str.toLowerCase().indexOf("#ipad") >= 0) {  $('#support,#support-ipad').slideDown('slow'); }
    if(str.toLowerCase().indexOf("#iphone") >= 0) {  $('#support,#support-iphone').slideDown('slow'); }


});
