if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/blackberry/i))) {
//	 if (document.cookie.indexOf("iphone_redirect=false") == -1) 
		 window.location = "./mobile";
}

$(document).ready(function(){
	$('#latestNews').html('<img src="img/spinner.gif" />');

	if (window.location.hostname != '') {
		$.get('inc/inc_news.php', function(data) {
			$('#latestNews').html(data);
		});
	}

	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if (sPage == 'contact_us.php') {
		$('a[rel*=facebox]').facebox();
	}
});

var geocoder;
var map;

function pasovariables(address){
	$(document).bind('reveal.facebox', function() {
		load(address);
	})
}

function load(address) {
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("map_canvas"));
		geocoder = new GClientGeocoder();
		geocoder.getLocations(address, addToMap);
		var customUI = map.getDefaultUI();
		// Remove MapType.G_HYBRID_MAP
		customUI.maptypes.hybrid = false;
		map.setUI(customUI);
	}
}

function addToMap(response) {
	place = response.Placemark[0];
	point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]);
	map.setCenter(point, 16);
	map.setMapType(G_HYBRID_MAP);
	var baseIcon = new GIcon(G_DEFAULT_ICON);
	baseIcon.iconSize = new GSize(32, 32);
	var letteredIcon = new GIcon(baseIcon);
	letteredIcon.image = "http://maps.google.com/mapfiles/ms/micons/red-pushpin.png";
	markerOptions = { icon:letteredIcon };

	marker = new GMarker(point, markerOptions);
	map.addOverlay(marker);
}	
