﻿$(function () {
    $('a.media').media();
});

$(function () {
    $("#tabs").tabs();
    $(".tabs-bottom .ui-tabs-nav, .tabs-bottom .ui-tabs-nav > *")
			.removeClass("ui-corner-all ui-corner-top")
			.addClass("ui-corner-bottom");
});

$(document).ready(function () {
    $("#slider1").easySlider({
        auto: true,
        continuous: true,
        speed: 800,
        pause: 5000
    });
});

function MM_openBrWindow(theURL, winName, features) { //v2.0
    window.open(theURL, winName, features);
}

if (checkmobile(navigator.userAgent)) window.parent.location = "http://m.pianetamountainbike.it/"
function checkmobile(nameApp) {
    if (nameApp.indexOf('MSIE') != -1) return false;
    if (nameApp.indexOf('iPhone') != -1) return true;
    if (nameApp.indexOf('Trident') != -1) return true;
    if (nameApp.indexOf('Android') != -1) return true;
    if (nameApp.indexOf('SymbianOS') != -1) return true;
    if (nameApp.indexOf('BlackBerry') != -1) return true;
    if (nameApp.indexOf('iPod') != -1) return true;
    if (nameApp.indexOf('Creative AutoUpdate') != -1) return false;
    if (nameApp.indexOf('nokia') != -1) return true;
    if (nameApp.indexOf('palmos') != -1) return true;
    if (nameApp.indexOf('windows ce') != -1) return true;
    if (nameApp.indexOf('Samsung') != -1) return true;

    browser_list = new Array("midp", "j2me", "avantg", "docomo", "novarra", "palmos", "palmsource", "240x320", "opwv", "chtml", "pda", "windows ce", "mmp/", "blackberry", "mib/", "symbian", "wireless", "hand", "mobi", "phone", "cdm", "up.b", "audio", "SIE-", "SEC-", "samsung", "HTC", "mot-", "mitsu", "sagem", "sony", "alcatel", "lg", "erics", "vx", "NEC", "philips", "mmm", "xx", "panasonic", "sharp", "wap", "sch", "rover", "pocket", "benq", "java", "pt", "pg", "vox", "amoi", "bird", "compal", "kg", "voda", "sany", "kdd", "dbt", "sendo", "sgh", "gradi", "jb", "dddi", "moto");
    for (i = 0; i < (browser_list).length; i++) {
        if (nameApp.indexOf(browser_list[i]) != -1) return true;
    }
    return false;
}

$(function () {
    $(".newsticker-jcarousellite").jCarouselLite({
        vertical: true,
        hoverPause: true,
        visible: 8,
        speed: 2000,
        btnNext: ".next",
        btnPrev: ".prev"
    });
});
$(function () {
    $(".newsticker-jcarousellite-2").jCarouselLite({
        vertical: true,
        hoverPause: true,
        visible: 8,
        speed: 2000,
        btnNext: ".nextBianca",
        btnPrev: ".prevBianca"
    });
});

google.load('search', '1', { language: 'it', style: google.loader.themes.GREENSKY });
google.setOnLoadCallback(function () {
    var customSearchControl = new google.search.CustomSearchControl('016438976325789314567:7-sbmilhxlk');
    customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
    var options = new google.search.DrawOptions();
    options.setAutoComplete(true);
    options.setSearchFormRoot('cse-search-form');
    customSearchControl.draw('cse', options);
}, true);

jQuery(document).ready(function () {
    jQuery("#sliderM").sliderM({
        wS: 998,
        hS: 195,
        wP: 0,
        timerS: 6000,
        auto: true
    });
});

$(document).ready(function () {
    $('#ImgNewsCentro').css('margin-top', ($('#box_testo_contenuto_hp').height() - $('#ImgNewsCentro').height()) / 2);
});

$(document).ready(function () {
    $('#box_news_testo_centrale').css('margin-top', ($('#box_testo_contenuto_hp').height() - $('#box_news_testo_centrale').height()) / 2);
});

$(window).load(function () {
    $(".gsc-search-button input").each(function () {
        var obj = $(this);
        obj.click(function () {
            var t = setInterval(function () {
                $(".gs-title a").attr("target", "_self");
            }, 1000);
        });
    });
});
