function changeCountry(code, name) {
	if ($("EintragLand")!=null) {
		$("EintragLand").setHTML(name);
	}
	new Ajax("/_ajax/getIntVorwahl.php?code="+code, {
						method: "get", 
						onSuccess: function(response) {
							var elems = $$(['intTelVw', 'intMobilVw', 'intFaxVw']);
							for (var i=0; i<elems.length; i++) {
								elems[i].value = response;
							}
							if ($("EintragTelefon")!=null) {
								$("EintragTelefon").setHTML($("intTelVw").getValue()+" "+$("telVw").getValue()+" "+$("tel").getValue());
							}
							if ($("EintragMobil")!=null) {
								$("EintragMobil").setHTML($("intMobilVw").getValue()+" "+$("mobilVw").getValue()+" "+$("mobil").getValue());
							}
							if ($("EintragFax")!=null) {
								$("EintragFax").setHTML($("intFaxVw").getValue()+" "+$("faxVw").getValue()+" "+$("fax").getValue());
							}
						}
				}
	).request();
}
function getBranche(name, number, notFoundMsg) {
	if (name.length>1) {
		var branchenAjax = new Json.Remote('/_ajax/getBranchen.php', {
			autoCancel: 'true',
			onComplete: function(jsonObj) {
				var html = '<ul class="hidden_list">';
				$('addShowBranche'+number).style.display = 'block';
				if (jsonObj.length>0) {
					//$('input_sB').removeClass('error');
					//$('input_sB').getPrevious().removeClass('error');
					for (var i=0; i<jsonObj.length; i++) {
						html+= '<li class="clickable" onClick="$(\'bid'+number+'\').value=\''+jsonObj[i].id+'\'; $(\'addShowBranche'+number+'\').empty(); $(\'addShowBranche'+number+'\').style.display = \'none\'; $(\'branche'+number+'\').value = \''+jsonObj[i].name+'\'; setCatPreview(); $(\'branche'+number+'\').removeClass(\'error\'); if ($(\'branche'+number+'\').getPrevious()) $(\'branche'+number+'\').getPrevious().removeClass(\'error\'); $(\'branche'+number+'\').focus()">'+jsonObj[i].name+'</li>';
					} 
				}
				else {
					html+='<li>'+notFoundMsg+'</li>';
				}	
				html+= "</ul>";
				$('addShowBranche'+number).innerHTML = html;
			}
		}).send({'inp': name, 'mode': 'json'});
	}
	else {
		$('addShowBranche'+number).empty();
		$('addShowBranche'+number).style.display = 'none';
	}
}
function setCatPreview() {
	if ($("EintragKategorien")) {
		$("EintragKategorien").empty();
		var elems = $$(['branche1', 'branche2', 'branche3', 'branche4', 'branche5']);
		for (var i=0; i<elems.length; i++) {
			$("EintragKategorien").appendText(elems[i].getValue());
			if (i+1<elems.length && elems[i+1].getValue()!="")
				$("EintragKategorien").appendText(', ');
		}
	}
}
