	function inlineAlert(text) {
 		$("main_content_dealer").setOpacity(0.4);
		$('alert_Inline').style.display='block';
		var table = document.createElement("div");
		table.className="alert_Inline_box";
		var table_text = document.createElement("div");
		table_text.className = "alert_Inline_text";
		table_text.appendChild(document.createTextNode(text));
		var table_button = document.createElement("input");
		table_button.type = "button";
		table_button.value = "OK";
		table_button.className = "alert_Inline_button";
		table_button.onclick = new Function("$('alert_Inline').style.display='none'; $('main_content_dealer').style.opacity='1';");
		table.appendChild(table_text);
		table.appendChild(table_button);
		$("alert_Inline").update(table);
		$("alert_Inline").className = "alert_Inline";
	}

	function getChoiceOfLocation(i_nom) {
		$('slidedown_demo').style.display='block'; 
		so.sourceLocation = locations[i_nom]; 
		dealer_loc_x = (locations[i_nom]).x; 
		dealer_loc_y = (locations[i_nom]).y;
		$('multipleLocations').className = 'hidden';
		so.getDealers();
		return;
	}

	function checkSafariVersion() {
		var ua = navigator.userAgent.toLowerCase();
		var isSafari = (ua.indexOf('safari') != - 1);
		var versionMinor;
		if (isSafari) {
			versionMinor = parseFloat( ua.substring( ua.lastIndexOf('safari/') + 7 ) );
	 		versionMajor = parseInt(versionMinor);
		 	if (versionMajor<400){
				$("alertBox").style.display="block";
		 		return false;
	 		}
 		}
	 	return true;
 	}
	
	function DealerLocator()
	{
    	var translations = {start: start_message, backToList: back_to_list_message, error1: error_message, getMoreDealers: more_dealers_message};
		var sourceString;		// Search String user entered
		var sourceLocation;		// Source Location resolved by webservice
		var sourceLocations;	// Source Locations resolved by webservice in case mulitple matches for sourceString were found
		var selectedProdutGroup;// Selected product group
		var selectedDealer;		// Select Dealer
		var selectedServiceGroup;
		
		if (typeof(_dealerLocator_prototype_called) == 'undefined')
		{
			_dealerlocator_prototype_called = true;
			DealerLocator.prototype.searchDealers 	 = searchDealers;
			DealerLocator.prototype.getDealers	 = getDealers;
			DealerLocator.prototype.getMoreDealers	 = getMoreDealers;
			DealerLocator.prototype.createDealerEntry = createDealerEntry;
			DealerLocator.prototype.createMapEntry    = createMapEntry;
			DealerLocator.prototype.setDirections	 = setDirections;
			DealerLocator.prototype.createRouting	 = createRouting;
			DealerLocator.prototype.backToList	 = backToList;
			DealerLocator.prototype.showDetails	 = showDetails;
			DealerLocator.prototype.filterSearchResult = filterSearchResult;
			DealerLocator.prototype.filterSearchResultSGR = filterSearchResultSGR;
			DealerLocator.prototype.multipleLocations =multipleLocations;
			DealerLocator.prototype.dealerList = new Hash();
			DealerLocator.prototype.productGroups = new Array();
		}
		
		function searchDealers(form) {
			$("slidedown_demo").style.display="block";
			$("main_content_dealer").setOpacity(0.4);
			numberOfDealers = 5;
			selectedProdutGroup = "";
			selectedServiceGroup ="";
			var keys = so.dealerList.keys();
			for (  i=0 ; i < keys.size() ; i++){
		   		var key = keys[i];
		   		so.dealerList.unset(keys[i]);
			}
			if (form.from.value==""){
				inlineAlert(translations.start);
				document.getElementsByTagName("body")[0].style.cursor = "";
				return;
			}
			this.sourceString=form.from.value;
			
			var params = new Object();
			var te = unescape( this.sourceString);
			var te2 = encodeURI( this.sourceString);
			//params.address =this.sourceString;
			params.address =this.sourceString + locate;
			geocoder.getLatLng(params.address , function(point) {
				map.clearOverlays();
				if (!point) {
					initNullLocations();
					$("slidedown_demo").style.display="none";
					$("main_content_dealer").setOpacity(1);
					$('content_right').className = "hidden";
					$('dealer_filter_id').className = "dealer_filter_start";
					$('top_div_id').className = "topStart";
					$('fromAddress').style.width="638px";
					while ($('filter').hasChildNodes()) {
						$('filter').removeChild($('filter').firstChild);
					}
				} else {

					so.sourceLocation = point;
					dealer_loc_x = so.sourceLocation.x;
					dealer_loc_y = so.sourceLocation.y;
					so.getDealers();
				}
				return;
			});
				
			new Ajax.Request(url + "location.jsp", {
				method:'get',
				parameters:params,
				onSuccess: function(transport){
					map.clearOverlays();
					source_Locations = (eval( "(" + transport.responseText + ")" )).locations;
					if (source_Locations.size() == 0 ) {
						initNullLocations();
						$("slidedown_demo").style.display="none";
						$("main_content_dealer").setOpacity(1);
						$('content_right').className = "hidden";
						$('dealer_filter_id').className = "dealer_filter_start";
						$('top_div_id').className = "topStart";
						$('fromAddress').style.width="638px";

						while ($('filter').hasChildNodes()) {
							$('filter').removeChild($('filter').firstChild);
						}

						inlineAlert(er_not_find_startpoint);
					} else if (source_Locations.size() == 1){ 
						so.sourceLocation = source_Locations[0];
						dealer_loc_x = so.sourceLocation.x;
						dealer_loc_y = so.sourceLocation.y;			      			
						so.getDealers();
					} else {
						so.sourceLocations = source_Locations;
						so.multipleLocations();			
					}
					return;
			    	},
			    	onFailure: function(){ 
					$("slidedown_demo").style.display="none";
		  			$("main_content_dealer").setOpacity(1);  
			    		inlineAlert(translations.error1); 
			    	}
			});
			return;
		}
		
		function multipleLocations() {
			$("slidedown_demo").style.display="none";
			locations = source_Locations;
			var table = document.createElement("div");
			table.className="multipleLocations_table";
			var td_head = document.createElement("div");
			td_head.className = "multipleHits_header";
			td_head.appendChild(document.createTextNode(multiple_result_text));
			table.appendChild(td_head);
			for (i = 0; i < locations.size(); i++) {
				var td = document.createElement("div");
				td.className = "multipleHits_odd";
				td.id = i;
				if (i % 2 == 0) {
					td.className = "multipleHits_even";
				}
				td.appendChild(document.createTextNode(locations[i].address));
				td.onclick = new Function("getChoiceOfLocation("+i+");");
				table.appendChild(td);
			}
			$("multipleLocations").update(table);
			$("multipleLocations").className = "multipleLocations";
		}
		
		function getMoreDealers(){
			numberOfDealers = numberOfDealers + 5;
			$("slidedown_demo").style.display="block";
		  	$("main_content_dealer").setOpacity(0.4);  
			this.getDealers();
		}
		
		function getDealers(){
  			var params = new Object();
			params.x = dealer_loc_x;
			params.y = dealer_loc_y;
			params.pgr = selectedProdutGroup;
			params.sgr = selectedServiceGroup;
			params.numberOfDealers =numberOfDealers;
			var point = new GLatLng(dealer_loc_y,dealer_loc_x);
			var marker = new GMarker(point);
			map.addOverlay(marker);
			document.getElementsByTagName("body")[0].style.cursor = "wait";
			new Ajax.Request(url+ "dealers.jsp", {
				method:'get',
				parameters:params,
				onSuccess: function(transport){

					var dealers = eval( "(" + transport.responseText + ")" ).dealers;
					if (dealers.size() < 1) {
						initNullLocations();
						$("slidedown_demo").style.display="none";
						$("main_content_dealer").setOpacity(1);
	   	  	 			$('content_right').className = "hidden";
	    			  		$('dealer_filter_id').className = "dealer_filter_start";
  			    			$('top_div_id').className = "topStart";
		  	    			$('fromAddress').style.width="638px";
		  	    	    		while ($('filter').hasChildNodes()) {
							$('filter').removeChild($('filter').firstChild);
  						}

						inlineAlert(er_no_dealers);
						return;
					}
		    			$('content_right').className = "contentRight";
		    			$('dealer_filter_id').className = "dealer_filter";
		    			$('top_div_id').className = "top";
		    			$('fromAddress').style.width="448px";
			    		while ($('dealerlist').hasChildNodes()) {
						$('dealerlist').removeChild($('dealerlist').firstChild);
					}
			    		while ($('dealer_filter_title_id').hasChildNodes()) {
   						$('dealer_filter_title_id').removeChild($('dealer_filter_title_id').firstChild);
					}
					var b = document.createElement("b");
					b.appendChild(document.createTextNode(filterTitle));
		    			$('dealer_filter_title_id').appendChild(b);

//ProdutGroup section  						
					var tr = document.createElement("tr");
					var td = document.createElement("td");
					if (availableProdutGroup.length>0){
						td.className='plus';
						var ul = document.createElement("ul");
						td.colSpan = '3';
						if (pg_section_criteria!="show"){						
							td.style.display="none";
						}
  						td.appendChild(document.createTextNode(namePG));
						for (i=0; i < availableProdutGroup.length; i++) {
							var li = document.createElement("li");	
  							j = i + 1;							
							li.appendChild(document.createTextNode(namesOfAvailableProdutGroup[i]));
  							li.onclick = new Function("so.filterSearchResult('"+availableProdutGroup[i] +"');");
  							li.onmouseout  =  new Function("this.style.fontWeight = 'normal';");
  							li.onmousemove =  new Function("this.style.fontWeight = 'bold';");  
 							ul.appendChild(li);
							if (selectedProdutGroup.indexOf(availableProdutGroup[i])>=0) {
								li.style.color='yellow';
							}
  						}
  						td.appendChild(ul);
					}
					tr.appendChild(td);

//ServiceGroup<500 section 
					var tr2 = document.createElement("tr");
					var td2 = document.createElement("td");
					if (availableServiceGroup.length>0){
						td2.className='plus';
						var ul2 = document.createElement("ul");
						td2.colSpan = '3';
						if (sg_lt_section_criteria!="show"){						
							td2.style.display="none";
						}
  						td2.appendChild(document.createTextNode(nameSGlt));
						for (i=0; i < availableServiceGroup.length; i++) {
							var li2 = document.createElement("li");	
  							j = i + 1;							
							li2.appendChild(document.createTextNode(namesOfAvailableServiceGroup[i]));
  							li2.onclick = new Function("so.filterSearchResultSGR('"+availableServiceGroup[i] +"');");
  							li2.onmouseout  =  new Function("this.style.fontWeight = 'normal';");
  							li2.onmousemove =  new Function("this.style.fontWeight = 'bold';");  
 							ul2.appendChild(li2);
							if (selectedServiceGroup.indexOf(availableServiceGroup[i])>=0) {
								li2.style.color='yellow';
							}
  						}
  						
  						td2.appendChild(ul2);
					}
					tr2.appendChild(td2);

//ServiceGroup>500 section 

					var tr3 = document.createElement("tr");
					var td3 = document.createElement("td");
					if (moreAvailableServiceGroup.length>0){
						td3.className='plus';
						var ul3 = document.createElement("ul");
						td3.colSpan = '3';
						if (sg_gt_section_criteria!="show"){						
							td3.style.display="none";
						}
  						td3.appendChild(document.createTextNode(nameSGgt));
						for (i=0; i < moreAvailableServiceGroup.length; i++) {
							var li3 = document.createElement("li");	
  							j = i + 1;							
							li3.appendChild(document.createTextNode(moreNamesOfAvailableServiceGroup[i]));
  							li3.onclick = new Function("so.filterSearchResultSGR('"+ moreAvailableServiceGroup[i] +"');");
  							li3.onmouseout  =  new Function("this.style.fontWeight = 'normal';");
  							li3.onmousemove =  new Function("this.style.fontWeight = 'bold';");  
 							ul3.appendChild(li3);
							if (selectedServiceGroup.indexOf(moreAvailableServiceGroup[i])>=0) {
								li3.style.color='yellow';
							}
  						}
  						td3.appendChild(ul3);
					}
					tr3.appendChild(td3);
				   	while ($("filter").hasChildNodes()) {
						$("filter").removeChild($("filter").firstChild);
					}
					$("filter").appendChild(tr);
					$("filter").appendChild(tr2);
					$("filter").appendChild(tr3);
					var bounds = new GLatLngBounds();
					for (i=0 ; i < dealers.size() ; i++ ) {
						so.dealerList.set(dealers[i].KUNNR,dealers[i]);
						so.createDealerEntry(dealers[i],false);
						so.createMapEntry(dealers[i], bounds);
					}
					var tr = document.createElement("div");
				  	p1 = document.createElement("p");
					p1.id='button_left';
					p1.className ='button_left';
				  	p2 = document.createElement("p");
					p2.id='button_right';
					p2.className ='button_right';
	  				p3 = document.createElement("p");
					p3.className ='submitarea';
					var input = document.createElement("input");
					input.className = "dealerbutton3";
					input.type = "submit";
					input.value = translations.getMoreDealers;
					input.onclick = new Function("so.getMoreDealers();");
					p3.appendChild(input);
					tr.appendChild(p1);	
					tr.appendChild(p3);	
					tr.appendChild(p2);	
					$('dealerlist').insert(tr);
					map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
    					document.getElementsByTagName("body")[0].style.cursor = "";
					return;
			    	},
		    		onFailure: function(){ 
					$("slidedown_demo").style.display="none";
		  			$("main_content_dealer").setOpacity(1);  
		    			inlineAlert(translations.error1);
		    			
		    		},
	    			onComplete: function(){
					$("slidedown_demo").style.display="none";
	  				$("main_content_dealer").setOpacity(1);  		
				}
	  		});
			return; 
   		}
				
		function createDealerEntry(dealer,isRouting) {
			var divRow = document.createElement("div");
			divRow.className = 'two_tr';

   			//Sidebar entry
			var tr = document.createElement("div");
			tr.className ='dealerHeader';
			tr.height='40px';
			
			var div = document.createElement("div");
			div.onclick=new Function('so.showDetails("'+dealer.KUNNR+'");');		
			div.className = 'dealerHeaderText';
			var addr_line_temp = dealer.NAME1 + "   " + "  Tel: " + dealer.TELF1;
			var addr_trunc_length = parseInt(address_length);
			if (addr_line_temp.length > addr_trunc_length) {
				addr_line_temp = addr_line_temp.substring(0,addr_trunc_length) + "...";
			}
			div.appendChild(document.createTextNode(addr_line_temp));

			tr.appendChild(div);
			   	  
			var tdIcons = document.createElement("div");
			tdIcons.className = "image_div";
			
			if (isRouting){
				tdIcons.width='40px';

				var imgDetails = document.createElement("div");
				imgDetails.onclick=new Function('so.showDetails("'+dealer.KUNNR+'");');
				imgDetails.className = "info";
				imgDetails.width='20px';
				tdIcons.appendChild(imgDetails);
			} else {
				tdIcons.width='20px';
			}
			
			var imgRoute = document.createElement("div");
			imgRoute.onclick=new Function('so.createRouting("'+dealer.KUNNR+'");');
			imgRoute.className = "route";
			imgRoute.appendChild(document.createTextNode(route_text));
			tdIcons.appendChild(imgRoute);
			
			tr.appendChild(tdIcons);

			divRow.appendChild(tr);
			
			var trdetails = document.createElement("div");
			trdetails.className ='dealerSubText';
			trdetails.height='40px';
			trdetails.style.backgroundColor='black';
			var tddetails = document.createElement("div");
			tddetails.id = 'dealerDetails_' + dealer.KUNNR;
			tddetails.className ='dealerText';
			if (address_config.length != 6) {
				tddetails.appendChild(document.createTextNode(dealer.STRAS + " " + dealer.HOUSE_NUM1 + " "));
				tddetails.appendChild(document.createTextNode(dealer.LAND1 + ", "));
				tddetails.appendChild(document.createTextNode(dealer.PSTLZ + " "));
				tddetails.appendChild(document.createTextNode(dealer.ORT01 + " "));
				tddetails.appendChild(document.createTextNode(dealer.ORT02 + " "));
			} else {
				tddetails.appendChild(document.createTextNode(eval(address_config[0]) + " " + eval(address_config[1]) + " "));
				tddetails.appendChild(document.createTextNode(eval(address_config[2]) + ", "));
				tddetails.appendChild(document.createTextNode(eval(address_config[3]) + " "));
				tddetails.appendChild(document.createTextNode(eval(address_config[4]) + " "));
				tddetails.appendChild(document.createTextNode(eval(address_config[5]) + " "));
			}
			
			var divPGRIcons = document.createElement("div");
			divPGRIcons.className="image_div";
						
			var pgrs = dealer.PGR.split(",");
			for (j=0; j<pgrs.length; j++){
				var icon = document.createElement("div");
				icon.className = 'icon_' + pgrs[j];
				divPGRIcons.appendChild(icon);
			}
			
			trdetails.appendChild(tddetails);
			trdetails.appendChild(divPGRIcons);

			divRow.appendChild(trdetails);
			$("dealerlist").appendChild(divRow);

			return;
   		}
		
		function createMapEntry(dealer, bounds){
			// MapEntry
			var point = new GLatLng(dealer.y,dealer.x);
			bounds.extend(point);
			var divTab1 = document.createElement("div");
			divTab1.className='mapInfo';
			var name1 = document.createElement("b");
			name1.appendChild(document.createTextNode(dealer.NAME1));
			divTab1.appendChild(name1);
			divTab1.appendChild(document.createElement("br"));
			if (address_config.length != 6) {
				divTab1.appendChild(document.createTextNode(dealer.STRAS +" " +dealer.HOUSE_NUM1));
				divTab1.appendChild(document.createElement("br"));
				divTab1.appendChild(document.createTextNode(dealer.LAND1+" "+ dealer.PSTLZ+" "+ dealer.ORT01+" "+ dealer.ORT02 ));
			} else {
				divTab1.appendChild(document.createTextNode(eval(address_config[0]) +" " +eval(address_config[1])));
				divTab1.appendChild(document.createElement("br"));
				divTab1.appendChild(document.createTextNode(eval(address_config[2])+" "+ eval(address_config[3])+" "+ eval(address_config[4])+" "+ eval(address_config[5]) ));
			}
			divTab1.appendChild(document.createElement("br"));
			divTab1.appendChild(document.createTextNode("Tel.: " + dealer.TELF1));
			divTab1.appendChild(document.createElement("br"));
			divTab1.appendChild(document.createElement("br"));
			var imgArrow = document.createElement("img");
			imgArrow.src=arrow_forward;
			imgArrow.border='0';
			
			var aRoute = document.createElement("a");
			aRoute.href = '#';	
			aRoute.appendChild(document.createTextNode(route_text));
			aRoute.onclick=new Function('so.createRouting("'+dealer.KUNNR+'");return false;');
			aRoute.appendChild(imgArrow);
			divTab1.appendChild(aRoute);
					
			var divTab2 = document.createElement("div");
			divTab2.className='mapInfo';
			divTab2.appendChild(document.createTextNode("dieser Text ist noch zu definieren"));		
					
			var customIcon = new GIcon(G_DEFAULT_ICON);
		 	customIcon.image = map_icon_dunlop;
		 	customIcon.shadow = map_icon_dunlop;
		 	customIcon.imageMap = [0, 0, 0, map_icon_dunlop_height, map_icon_dunlop_width, map_icon_dunlop_height, map_icon_dunlop_width, 0];
		 	customIcon.iconAnchor = new GPoint(13,15);
		 	customIcon.iconSize = new GSize(map_icon_dunlop_width, map_icon_dunlop_height);
		 	customIcon.shadowSize = new GSize(map_icon_dunlop_width, map_icon_dunlop_height);
		 	
		 	dealer.marker = new GMarker(point,{ icon:customIcon });
		 	
			GEvent.addListener(dealer.marker , "click", function() {
				dealer.marker.openInfoWindowTabs([new GInfoWindowTab(info_first_tab_text,divTab1)]);
//				dealer.marker.openInfoWindowTabs([new GInfoWindowTab(info_first_tab_text,divTab1), new GInfoWindowTab(info_second_tab_text,divTab2)]);
			});
			
			map.addOverlay(dealer.marker);
			return;
		}
		
		function showDetails(KUNNR){
			var dealer = window.so.dealerList.get(KUNNR);
			GEvent.trigger(dealer.marker, "click"); 
			map.setCenter(new GLatLng(window.so.dealerList.get(KUNNR).y,window.so.dealerList.get(KUNNR).x), 16);
		}
		
		function createRouting(KUNNR){
    		                while ($('dealerlist').hasChildNodes()) {
				$('dealerlist').removeChild($('dealerlist').firstChild);
			}
			
   			var dealer = window.so.dealerList.get(KUNNR);
   			so.createDealerEntry(dealer, true);
		  	$('dealerDetails_'+KUNNR).className='dealerDetails';
		  	
	  		var tr = document.createElement("div");

		  	p1 = document.createElement("p");
			p1.id='button_left';
			p1.className ='button_left';
		  	p2 = document.createElement("p");
			p2.id='button_right';
			p2.className ='button_right';
		  	p3 = document.createElement("p");
			p3.className ='submitarea';

			var input = document.createElement("input");
			input.className = "dealerbutton3";
			input.type = "submit";
			input.value = translations.backToList;
			input.onclick = new Function("so.backToList();");
			p3.appendChild(input);
			tr.appendChild(p1);	
			tr.appendChild(p3);	
			tr.appendChild(p2);		
			$('dealerlist').insert(tr);

	  		var print_div = document.createElement("div");
	  		print_div.className = 'print_image';
			var destAddress = escape(dealer.STRAS+" "+dealer.HOUSE_NUM1+" "+ dealer.ORT01+" "+dealer.ORT02+"@"+dealer.y+","+dealer.x);
			var fromAddress =  escape(so.sourceLocation.address+"@"+dealer_loc_y+","+dealer_loc_x);
			var imgPrint = document.createElement("img");
			imgPrint.src=print_image;
			imgPrint.border='0';
			imgPrint.onclick=new Function("window.open('print.jsp?fromAddress="+fromAddress+"&destAddress="+destAddress+"','_blank');");
			print_div.appendChild(imgPrint);
			$('dealerlist').insert(print_div);				  		
	  		

			td = document.createElement("div");
		  	td.id = 'directions';
		  	td.className = 'directions';
		  	$('dealerlist').insert(td);

		  	window.so.setDirections(dealer.NAME1+ "@"+dealer.y+","+dealer.x );	
   		}

   		function setDirections(toAddress) {
   			if (typeof gdir=='undefined'){
   				gdir = new GDirections(map, $("directions"));
   			} else {
   				gdir.clear();
   				gdir = null;
   				gdir = new GDirections(map, $("directions"));
   			}
   		
			GEvent.addListener(gdir, "load", function() {} );
			GEvent.addListener(gdir, "error",function() {
				if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
					inlineAlert(er_unknown_address + ": " + gdir.getStatus().code);
				else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
					inlineAlert(er_server_error + ": " + gdir.getStatus().code);
				else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
					inlineAlert(er_missing_query + ": " + gdir.getStatus().code);
				else if (gdir.getStatus().code == G_GEO_BAD_KEY)
					inlineAlert(er_bad_key + ": " + gdir.getStatus().code);
				else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
					inlineAlert(er_bad_request + ": " + gdir.getStatus().code);
				else inlineAlert(er_unknown_error);
	   		});
			gdir.load("from: " + so.sourceLocation.address + "@" + dealer_loc_y + "," + dealer_loc_x + " to: " + toAddress ,{ "locale" : locale });
		}

		function backToList(){
			gdir.clear();
			while ($('dealerlist').hasChildNodes()) {
   				$('dealerlist').removeChild($('dealerlist').firstChild);
  			}
			var bounds = new GLatLngBounds();
			var dealers = this.dealerList.values();
			for (i = 0; i < dealers.size(); i++) {
				so.createDealerEntry(dealers[i],false);
				so.createMapEntry(dealers[i], bounds);
			}
			
		  	p1 = document.createElement("p");
			p1.id='button_left';
			p1.className ='button_left';
		  	p2 = document.createElement("p");
			p2.id='button_right';
			p2.className ='button_right';
		  	p3 = document.createElement("p");
			p3.className ='submitarea';

			var tr = document.createElement("div");
			var input = document.createElement("input");
			input.className = "dealerbutton3";
			input.type = "submit";
			input.value = translations.getMoreDealers;
			input.onclick = new Function("so.getDealers();");
			p3.appendChild(input);
			tr.appendChild(p1);	
			tr.appendChild(p3);	
			tr.appendChild(p2);	

			$('dealerlist').insert(tr);
			
			map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds)); 
		}
		
		function filterSearchResult(filter){
			$("slidedown_demo").style.display="block";
			$("main_content_dealer").setOpacity(0.4);  
			var keys = so.dealerList.keys();
			for (  i=0 ; i < keys.size() ; i++){
				var key = keys[i];
				so.dealerList.unset(keys[i]);
			}
			selectedProdutGroup = filter;
			selectedServiceGroup = "";
		   	while ($('dealerlist').hasChildNodes()) {
				$('dealerlist').removeChild($('dealerlist').firstChild);
			}
			map.clearOverlays();
			so.getDealers();
		}
		
		function filterSearchResultSGR(filter){
			$("slidedown_demo").style.display="block";
			$("main_content_dealer").setOpacity(0.4);  
			var keys = so.dealerList.keys();
			for (  i=0 ; i < keys.size() ; i++){
				var key = keys[i];
		   		so.dealerList.unset(keys[i]);
			}
			selectedServiceGroup = filter;
			selectedProdutGroup = "";
		   	while ($('dealerlist').hasChildNodes()) {
				$('dealerlist').removeChild($('dealerlist').firstChild);
			}
			map.clearOverlays();
			so.getDealers();
		}
		
   	}
