jQuery(document).ready(function() {
  if(jQuery("#map_canvas").size() > 0) {
    var onMobile = false;
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {
      onMobile = true;
    }
    if (onMobile == false){
      jQuery(window).load(function(){
        //Google Map
        var settings = {
          zoom: 16,
          center: new google.maps.LatLng(40.748395,-73.985542),
          mapTypeId: google.maps.MapTypeId.ROADMAP,
          mapTypeControl: false,
          scrollwheel: false,
          draggable: true,
          styles:[ { stylers: [ { saturation: "-100"} ] } ],
          mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
          navigationControl: false,
          navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL}
        };
        var map = new google.maps.Map(document.getElementById("map_canvas"), settings);
        google.maps.event.addDomListener(window, "resize", function() {
            var center = map.getCenter();
            google.maps.event.trigger(map, "resize");
            map.setCenter(center);
        });
        var contentString =
            '<div id="content"><h3>Megadrupal</h3><div id="bodyContent"><p>Ha Noi , Viet Nam, Asia</p></div></div>';
        var infowindow = new google.maps.InfoWindow({
            content: contentString
        });
        var companyImage = new google.maps.MarkerImage("http://demo.megadrupal.com/d7/md-alpine/sites/all/themes/md_alpine/img/marker.png",
            new google.maps.Size(120,80), //Width and height of the marker
            new google.maps.Point(0,0),
            new google.maps.Point(35,20) //Position of the marker
        );
        var companyPos = new google.maps.LatLng(40.748395,-73.985542);
        var companyMarker = new google.maps.Marker({
            position: companyPos,
            map: map,
            icon: companyImage,
            title:"Creative News",
            zIndex: 3});
        
        google.maps.event.addListener(companyMarker, "click", function() {
            infowindow.open(map,companyMarker);
        });
      });
    }else{
      // jQuery("#map_canvas").addClass("map-bg-mobile");
    }
  }
});