
function changeTanfolyamData(index)
{
	$.get("php/read_tanfolyam_data.php", { param: index },
	function(data)
	{
		document.getElementById("tanf_box").innerHTML = data;
	})
}

function clientRequest(type)
{
	var input = document.getElementById(type + "_input");
	sender_email = input.value;
	
	var city = "";
	if(type == "more_info")
	{
		var city_index = document.getElementById("cities").selectedIndex;
		city = document.getElementById("cities")[city_index].text;
	}
	
	if(sender_email == "" || sender_email == "e-mail cím")
	{
		input.value = "e-mail cím";
		input.focus();
		input.select();
	}
	else if (sender_email.indexOf("@") < 1 || sender_email.lastIndexOf(".") < 2)
	{
		input.focus();
		input.select();
	}
	else
	{
		input.value = "e-mail cím";
		tb_show("", "php/client_request.php?type=" + type + "&city=" + city + "&sender_email=" + sender_email + "&TB_iframe=true&height=150&width=300&modal=true");
	}
}

function clearInput(type)
{
	var input = document.getElementById(type + "_input");
	
	if (input.value == "e-mail cím")
	{
		input.value = "";
	}
}

function startMap() {
	if (GBrowserIsCompatible()) {
		map = new GMap2($('#companyMap')[0]);
		map.enableScrollWheelZoom();
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
		if (null == mapLong || null == mapLat) {
			geocoder = new GClientGeocoder();
			geocoder.getLatLng(mapAddr, addPin);
			
		} else {
			addPin(new GLatLng(mapLat,mapLong));
		}
	}
}

function addPin(latLong) {
	if (null == latLong) {
		geocoder = new GClientGeocoder();
		geocoder.getLatLng('Budapest', addPin);
	}
	lastLatLong = latLong;
	map.setCenter(latLong, 15);
	map.addOverlay(new GMarker(latLong));
	var divElement = document.createElement('div');
	divElement.className = 'maps_company_info';
	divElement.innerHTML = '<div class="google_map_company">'+companyName+'</div><div class="google_map_address">'+mapAddr+'</div>';
	map.openInfoWindow(latLong, divElement);
}


