function getCities(countryId)
{
	$('city').disabled = true;
	$('hospital').disabled = true;
		
	$('hospital').length=0;
	$('hospital').options[0] = new Option('Bitte zuerst eine Stadt auswaehlen','0');
		
	$('city').length=0;
		
	if (countryId == 0 || countryId == 'f')
	{
		$('city').options[0] = new Option('Bitte zuerst ein Land auswaehlen','0');
	}

	if (countryId != 0 && countryId != 'f' && countryId != '')
	{
		$('city').options[0] = new Option('Bitte warten','0');

		new Ajax
		(
			'/cgi/public/ajax.cgi',
			{
				method: 'post',
				postBody: "cid="+countryId,
 				onComplete: function transResult (response)
                {
                    $('city').length=0;
					
					data = Json.evaluate(response);
					for (var i = 0; i<data.cities.length; i++)
					{
						$('city').options[i] = new Option(data.cities[i].name, data.cities[i].id);
					}
					
                    $('city').disabled = false;
 				}
 			}
 		).request();
    }

    return false;
}

function getHospitals(value)
{
	$('hospital').disabled = true;
	$('hospital').length=0;
		
	if (value == 0)
	{
		$('hospital').options[0] = new Option('Bitte zuerst eine Stadt auswaehlen','0');
	}

	if (value != 0 && value != '')
	{
        $('hospital').options[0] = new Option('Bitte warten','0');

		new Ajax
		(
			'/cgi/public/ajax.cgi',
			{
				method: 'post',
				postBody: "ciid="+value,
 				onComplete: function transResult (response)
                {
					$('hospital').length=0;
					
					data = Json.evaluate(response);
					for (var i = 0; i<data.hospitals.length; i++)
					{
						$('hospital').options[i] = new Option(data.hospitals[i].name, data.hospitals[i].id);
					}
					
                    $('hospital').disabled = false;
 				}
 			}
 		).request();
    }

    return false;
}

function startRead(countryId, cityId)
{
	$('city').disabled = (countryId != 0) ? false : true;
	$('hospital').disabled = (cityId != 0) ? false : true;
}

function generate_address( name, domain )
{
    var atsign = "&#64;";
    var addr = name + atsign + domain;
    document.write( "<" + "a" + " " + "href=" + "mail" + "to:" + addr + ">" + addr + "<\/a>");
}

function activateSearch (box_id) {
	$(box_id).style.color = '#A82222';
	if ($(box_id).value == 'Stadt, Land, Fachrichtung')
	{
		$(box_id).value = '';
	}
}

function deactivateSearch (box_id) {
	$(box_id).style.color = '#A4A4A4';
	if ($(box_id).value == '')
	{
		$(box_id).value = 'Stadt, Land, Fachrichtung';
	};
}

function mouseOver(name, status) {
	document.getElementById(name).src= "/htdocs/static/image/layout/0803/menu_" + name + "_" + status + ".gif";
	return true;
}

function toggleBox (boxId, state) {
	$(boxId).style.display = (state == 1) ? 'block' : 'none';
	$(boxId).value = (state == 1) ? $(box_id).value : '';
}