var geocoder = null;
var map = null;

function load() {
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("map"));
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		
		map.setCenter(new GLatLng(47.510012,19.080162), 12);
	}
	
	 geocoder = new GClientGeocoder();
}

var address = '';
var apostfix = ', Budapest, , Hungary';

function addAddressToMap(response) {
	map.clearOverlays();
	if (!response || response.Status.code != 200) {
		alert(address + " :: NOT FOUND");
		document.cookie = "c_Gocountry=";
		document.cookie = "c_Gocity=";
		document.cookie = "c_goaddress=";
	} else {
		place = response.Placemark[0];
		point = new GLatLng(place.Point.coordinates[1],
		place.Point.coordinates[0]);
		marker = new GMarker(point);
		map.setCenter(point, 16);
		map.addOverlay(marker);
		marker.openInfoWindowHtml('Address:<br>' + place.address);
		document.cookie = "c_Gocountry=Hungary";
		document.cookie = "c_Gocity=Budapest";
		document.cookie = "c_goaddress="+address;
	}
}

function showAddress(street) {
	address = street+apostfix;
	geocoder.getLocations(address, addAddressToMap);
}

function hmapload(coordx,coordy,zoom) {
	if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("map"));
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		
		map.setCenter(new GLatLng(coordx,coordy), zoom);
		
		var point = new GLatLng(coordx,coordy);
	    map.addOverlay(new GMarker(point));
									
	}
	
	geocoder = new GClientGeocoder();
}



function init() {

}

function imgwindow(url,width,height) {
	width+=20;
	height+=20;
	var w = window.open(url,'image','width='+width+',height='+height);
}


function showimage(url,width,height) {
	var w = window.open('','image','width='+width+',height='+height);
	w.document.write('<html><head><title>Photo</title></head><body style="padding: 0px; margin: 0px;"><a href="#" onclick="window.close();"><img src="'+url+'" border="0" /></a></body></html>');
}

function addfav() {
	var title = "BudapestAirportTransfers.com"; 
	var url = "http://www.budapestairporttransfers.com";
	
	url = location.href;
	title = document.title;
	   
   	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
}

function sendpage() {

//	var obj = new getObj('sendpage');
//	obj.style.display = 'block';
//	var obj = new getObj('sendpage-bg');
//	obj.style.display = 'block';
	
//	return false;

//	var email = 'myfriend@example.com';
//	while (email=='myfriend@example.com' || email=='') {
//		email = prompt('Please enter your friend\'s email address!',email);
//	}
	
//	if (email == null) {
//		return false;
//	}
	
	window.open('http://www.budapesthungary.hu/sendpage.html?url='+location.href+'&title='+document.title,'');
}
