function clearDefault(el) {
	if (el.defaultValue == el.value) el.value = "";
}

function pharmacyOnLoad() {
	localSearch = new google.search.LocalSearch();
	localSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);

	localSearch.setSearchCompleteCallback(null, function(){
		my_html = "";
		for(i = 0; i < localSearch.results.length; i++) {
			res = localSearch.results[i];
			adress = (res.addressLines[1]).replace(/, Germany/g, "");
			adress1 = (localSearch.results[0].addressLines[1]).replace(/, Germany/g, "");
		
			my_html += "<ul><li>";
			my_html += "<strong class='title'>" + res.titleNoFormatting + "</strong>";
			my_html += res.streetAddress + ", " + adress + "<br />";
			
			if(res.phoneNumbers != undefined){
				for(j = 0; j < res.phoneNumbers.length; j++){
					numbers = res.phoneNumbers[j];
					if(numbers.type == null || numbers.type == ""){
						numbers.type = "Telefon";
					}
					my_html += numbers.type + ": " + numbers.number + "<br />";
				}
			}
			my_html += "</li></ul>";
			my_html += "<strong class='direction'><a href='" + res.ddUrl + "' target='_blank'>Wegbeschreibung</a></strong>";
		}
		$("#searchresults").html(my_html);
		$("#resultshead").html('Apotheken in der Nähe von ' + adress1);
	});
	google.search.Search.getBranding(document.getElementById("branding"));
}

function setPostcode(plz){
    localSearch.setCenterPoint(plz + " Deutschland");
    localSearch.execute("Apotheke");
	$('#myframe').attr('src', 'http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=Apotheke+' + plz + '+Deutschland&output=embed');
	$("#result").show();
}

function showProducts(){
    var obj = swfobject.getObjectById("flash");
    obj.showProducts();
}

function homeSlider(){
	$("#flashWrapper").animate( { "height": "498px" } );
}
