$(document).ready(function() {
	$("#mainmenu li:last").addClass('hilight');
	$("#commercial img:first").css('margin-left','0px');
	
	Cufon.replace('.cufon, h1,h2, h3, #hot_offer b, #regular_offer b, #hot_offer strong, #regular_offer strong');
	//#mainmenu li.hilight a,
	
	if ($('#carousel').length != 0) {
	$('#carousel').cycle({ 
		fx:      'fade', 
		speed:    1500, 
		timeout:  5000,
		random: 1
	});
	}

	if ($('.col3').length != 0) {
	$(".col3").equalHeight();
	}

	$("a.group, a.staff-picture, a.daily-trip-thumb").fancybox({
		'speedIn':		300,
		'speedOut':	300,
		'overlayColor':	'#fff',
		'overlayOpacity':	0.7
	});
	
	// map
	
	if ($("#map_canvas").length != 0) {
		locationMap(46.05488, 14.50446,'map_canvas','<b>Zeppelin Hostel</b>');
	}
	
});


var geocoder;
var map;
var overlay;
var geomarker;
function locationMap(latitude, longitude, div,contentString) {
	var myLatlng = new google.maps.LatLng(latitude, longitude);
    if (!(geocoder)) {
		geocoder = new google.maps.Geocoder();
	}
    if (!(map)) {
		var myOptions = {
	      zoom:15,
		  center: myLatlng,
	      mapTypeId: google.maps.MapTypeId.ROADMAP
	    }
	    map = new google.maps.Map(document.getElementById(div), myOptions);
		geomarker = new google.maps.Marker({
		  map: map, 
		  position: myLatlng
		});
		if (contentString) {
			var infowindow = new google.maps.InfoWindow({
				content: contentString
			});
		    google.maps.event.addListener(geomarker, 'click', function() {
		      infowindow.open(map,geomarker);
		    });
		}
	}
}

function AddGeoMarker(latitude,longitude, location) {
	geomarker.setMap(null);
	geomarker.setPosition(location);
	geomarker.setMap(map);
	$("#geo_long").html(longitude);
	$("#geo_lon_val").val(longitude);
	$("#geo_lat").html(latitude);
	$("#geo_lat_val").val(latitude);
}




$.fn.equalHeight = function () {
    var height        = 0;
    var maxHeight    = 0;

    // Store the tallest element's height
    this.each(function () {
        height        = $(this).outerHeight();
        maxHeight    = (height > maxHeight) ? height : maxHeight;
    });

    // Set element's min-height to tallest element's height
    return this.each(function () {
        var t            = $(this);
        var minHeight    = maxHeight - (t.outerHeight() - t.height());
        var property    = $.browser.msie && $.browser.version < 7 ? 'height' : 'min-height';

        t.css(property, minHeight + 'px');
    });
};

