function initialize() {
    var map = new google.maps.Map(document.getElementById('map'), {
        scrollwheel: false,
        zoom: 16,
        center: new google.maps.LatLng(42.362549,14.142172),
        mapTypeId: google.maps.MapTypeId.ROADMAP
    });
    
    var infoWindow = new google.maps.InfoWindow;

    var onMarkerClick = function() {
        var marker = this;
        infoWindow.setContent(this.html);
        infoWindow.open(map, marker);
    };
    google.maps.event.addListener(map, 'click', function() {
        infoWindow.close();
    });
    
    var image = new google.maps.MarkerImage('/resources/marker.png',
        new google.maps.Size(33, 33),
        new google.maps.Point(0,0),
        new google.maps.Point(16, 16));
        
    var marker = new google.maps.Marker({
        map: map,
        position: new google.maps.LatLng(42.362549,14.142172),
        icon: image,
        title: 'Nexteam s.a.s.',
        html: '<b>Nexteam s.a.s.</b><br/>Via San Francesco d\'Assisi, 33<br/>66013 - Chieti Scalo (CH)<br/>'
    });
    
    google.maps.event.addListener(marker, 'click', onMarkerClick);
}
function TooltipInfo(html){
    var e = $("#tooltip_info");
    var c = $("#tooltip_content");
    c.html(html);
    //var pti = getAbsolutePosition(document.getElementById('center'));
    var sY = document.body.scrollTop;
    if (sY == 0) {
        if (window.pageYOffset) sY = window.pageYOffset;
        else sY = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
    }
    sY += document.documentElement.clientHeight/6;
    var y = sY;
    e.css({
        top: 0 + "px",
        left: 250 + "px"
    });
    $("#fade").fadeTo('', '0.4').css({
        height: $("body").height()
    });
    e.fadeIn();
    $('#requestInfo').hide();
}
function hideTooltipInfo() {
    $("#tooltip_info").fadeOut();
    $("#fade").fadeTo('', '0').css({
        display: 'none'
    });
    $('#requestInfo').show();
}

function onk(s) {
    var x = new RegExp(s.value, 'i');
    $('.item').each(function(){
        t = $(this);
        if (t.html().match(x)) t.closest(this).show(); else t.closest(this).hide();
    });
    $('.item:visible').length == 0 ? $('#noResult').show() : $('#noResult').hide();
    $('.item').css('margin-right','0');
    $('.item:visible:even').css('margin-right','40px');
}

$(document).ready(function() {
    // Effetto su immagini del menù
    $('#menu a').not('.active a').hover(function(){
        $(this).children('img').animate({
            opacity:0.15,
            width:'60',
            left:'-=13',
            top:'-=20'
        },150)
    }, function(){
        $(this).children('img').animate({
            opacity:1,
            width:'34',
            left:'+=13',
            top:'+=20'
        })
    },150);
    // Breadcrumb
    $('.breadcrumb li').last().css('background','none')
    // Slider home page
    $('#slider').coinslider({
        width:940,
        height:390,
        delay:3000
    });
    // Slider page solutions
    $('#smallSlider').coinslider({
        width:300,
        height:200,
        delay:3000,
        effect:'rain',
        spw: 6,
        sph: 4
    });
    // Request Info sticker
    $('#requestInfo').hover(function(){
        $(this).animate({
            left:'+=175'
        });
    }, function(){
        $(this).animate({
            left:'-=175'
        })
    });
    // Effetto sui box in home page, in solutions e partners
    $('.box, .solution, .partners').hover(function(){
        $(this).children('span, a').addClass('active');
    }, function(){
        $(this).children('span, a').removeClass('active');
    });
    // Effetto su immagini dei box in solutions
    $('.solution').hover(function(){
        $(this).children('a').children('.img').animate({
            opacity:0.5
        });
    }, function(){
        $(this).children('a').children('.img').animate({
            opacity:1
        });
    });
    // Effetto immagini portfolio
    $('.item a img').hover(function(){
        $(this).animate({
            opacity:0.5
        });
    }, function(){
        $(this).animate({
            opacity:1
        });
    });
    $('.item:even').css('margin-right','40px');
    // Testimonials
    $('#testimonials').jCarouselLite({
        btnNext: '.down',
        btnPrev: '.up',
        visible: 1,
        vertical: true,
        circular: true,
        auto: 3500,
        speed: 1000
    });
    // Servizi Offerti portfolio
    $('.item #buttonTech').hover(function(){
        $(this).addClass('active');
    }, function(){
        $(this).removeClass('active');
    });
    $('.item #buttonTech').click(function(){
        var f = $(this).parent('.item');
        f.children('.technologies, .description').slideToggle();
        $(this).children('span').toggle();
    })
    // Hover su button submit
    $('.submit').hover(function(){
        $(this).css('background-position','top');
    }, function(){
        $(this).css('background-position','bottom');
    });
    // Effetto hover Admin menu
    $('.admin .menu a').hover(function(){
        $(this).children('span').animate({
            marginLeft:'+=25'
        });
    }, function(){
        $(this).children('span').animate({
            marginLeft:'-=25'
        });
    });
    // Hover color su admin list
    $('.list tr').not('tr:first').hover(function(){
        $(this).addClass('active');
    }, function(){
        $(this).removeClass('active');
    });
});
