 var map = null;
 var geocoder = null;
 var stat = 0;
 var marker = null;
 var infoHTML;
 var vonHTML;
 var nachHTML;
 var mymap ;
 function showSp_DL(geoX,geoY,myDiv,zoom) {
    if(geoX != "" && geoY !="" && geoX != 'NF' && geoY != 'NF')
	{ 		  
	 if (GBrowserIsCompatible()) 
		{	   
		map = new GMap2(document.getElementById(myDiv));

		geocoder = new GClientGeocoder();
		
		if (geocoder) 
			{
			point = new GLatLng(geoY, geoX, true);
	        if (!point) {
	            /*mymap.innerHTML = "<h1  style='color:#F00; margin-top: 5em';><b>" + address + " no fue encontrado! </b><h1>";
				alert(address + " no fue encontrado!");
				mymap = document.getElementById(myDiv);
				mymap.innerHTML = "<h1  style='color:#F00; margin-top: 5em';><b>" + address + " no fue encontrado! </b><h1>";*/
	        } else {
				map.setCenter(point, zoom);			
			}
			map.addControl(new GLargeMapControl());
			map.addControl(new GMapTypeControl());     
			map.addControl(new GOverviewMapControl());   
			GMap2.prototype.wheelZoom = function(event)
											{ 
											if((event.detail || -event.wheelDelta) < 0)
											   { map.zoomIn();}
											else
											   { map.zoomOut();}
											return false;
											}
			GEvent.addDomListener(document.getElementById(myDiv), "DOMMouseScroll", map.wheelZoom);
			GEvent.addDomListener(document.getElementById(myDiv), "mousewheel", map.wheelZoom);         
			
			}
		//showLocation();        
		}
	}
}
 function showmap_new(land,firmnam,gaddr,bubadress,gtel,gurl,weblkz,vonhier,nachhier,geo,firmanr,logo) {
	if(firmnam){	 
		if (GBrowserIsCompatible()) {
			if(!mymap){
				mymap = document.getElementById("map");  
			}
			if(stat==3){
				map = new GMap2(mymap);
			}
			 if(!map){		
				map = new GMap2(mymap);
			}
			geocoder = new GClientGeocoder();
			var address;
			if (geo != "" && geo != "," && geo != "NF,NF")
			{
				address = geo;
				geoplus = "@" + geo;
				sg = geo.split(",");
				geoY = sg[0];
				geoX = sg[1];
			}
			else{
				address = gaddr + "," + land;				
				geoplus = "";
				
				geocoder = null;
				mymap.innerHTML = "<h1  style='color:#F00; margin-top: 5em';><b>" + address + " " + eTxt + " </b><h1>";
				stat=3;
			}
			if (geocoder) {
				point = new GLatLng(geoY, geoX, true);
	            if (!point) {	              
					//  alert(address + " wurde nicht gefunden !");				
					 mymap.innerHTML = "<h1  style='color:#F00; margin-top: 5em';><b>" + address + " " + eTxt + " </b><h1>";
					 stat=3;				 
	            } 
				else {
		            if (stat == 1){
						map.panTo(point); 
		            }
					else{
						map.setCenter(point, 15);
						stat = 1;
					}
					if (marker) {
						map.removeOverlay(marker);
					}
					marker = new GMarker(point); 
					map.addOverlay(marker);
					if (gtel){
						gtel = "Tel.:" + gtel;
					}
					if (logo == "1"){
						logoHtml = "<img src='/image.asp?firma="+ firmanr +"' height='40'><br>";
					}
					else{
						logoHtml = "";
					}				  
					infoHTML = "<div id='blase'><h4>" + logoHtml + firmnam + "</h4><address>" + bubadress+ "<br />" + gtel + "<br /><a href='" + gurl + "'>" + 
				              gurl + "</a>" + "</address>" + "<h5><a href='javascript:routnach();'>" + nachhier + "</a>" + " - " + 
							  "<a href='javascript:routvon()'>" + vonhier + "</a></h5></div>";
				  
					vonHTML = "<div id='blase'><h4>" + logoHtml + firmnam + "</h4><address>" + bubadress+ "<br />" + gtel + "<br /><a href='" + gurl + "'>" + 
				              gurl + "</a>" + "</address>" + "<h5><a href='javascript:routnach();'>" + nachhier + "</a>" + " - "  
							   + vonhier + "</h5><br>" + 
							   "<form action='http://maps.google." + weblkz + "/maps'>" + 
		                       "<input type='hidden' size='40' name='saddr' value='" + address + "(" + firmnam + ") " + geoplus + "'/>" +
	                           eTxt1 + ":<br/>" +
							   "<input type='text' id='daddr' name='daddr' value='' />" +
		                       "<input type='submit' value='" + eTxt3 + "'/>" +
		                       "</form>" +
							   "</div>";
				    nachHTML = "<div id='blase'><h4>" + logoHtml + firmnam + "</h4><address>" + bubadress+ "<br />" + gtel + "<br /><a href='" + gurl + "'>" + 
				              gurl + "</a>" + "</address>" + "<h5>" + nachhier  + " - <a href='javascript:routvon();'>" + 
							   vonhier + "</a></h5><br>" + 
							   "<form action='http://maps.google." + weblkz + "/maps'>" + 
		                       "<input type='hidden' size='40' name='daddr' value='" + address + "(" + firmnam + ") " + geoplus + "'/>" +
	                           eTxt2 + ":<br/>" +
							   "<input type='text' id='saddr' name='saddr' value='' />" +
		                       "<input type='submit' value='" + eTxt3 + "'/>" +
		                       "</form>" +
							   "</div>";			   
				  
				  //			     

					marker.openInfoWindowHtml(infoHTML);
					map.addControl(new GLargeMapControl());
					map.addControl(new GMapTypeControl());     
					map.addControl(new GOverviewMapControl());   
	            
				}
			}
       //showLocation();        
		}
	}
}
 
function showSp_new(geoX,geoY,myDiv,zoom) {
if(geoX != "" && geoY !="" && geoX != 'NF' && geoY != 'NF')
	{ 		  
	 if (GBrowserIsCompatible()) 
		{	   
		map = new GMap2(document.getElementById(myDiv));

		geocoder = new GClientGeocoder();
		
		if (geocoder) 
			{
			point = new GLatLng(geoY, geoX, true);
	        if (!point) {
	            /*mymap.innerHTML = "<h1  style='color:#F00; margin-top: 5em';><b>" + address + " no fue encontrado! </b><h1>";
				alert(address + " no fue encontrado!");
				mymap = document.getElementById(myDiv);
				mymap.innerHTML = "<h1  style='color:#F00; margin-top: 5em';><b>" + address + " no fue encontrado! </b><h1>";*/
	        } else {
				map.setCenter(point, zoom);			
			}
			map.addControl(new GLargeMapControl());
			map.addControl(new GMapTypeControl());     
			map.addControl(new GOverviewMapControl());   
			GMap2.prototype.wheelZoom = function(event)
											{ 
											if((event.detail || -event.wheelDelta) < 0)
											   { map.zoomIn();}
											else
											   { map.zoomOut();}
											return false;
											}
			GEvent.addDomListener(document.getElementById(myDiv), "DOMMouseScroll", map.wheelZoom);
			GEvent.addDomListener(document.getElementById(myDiv), "mousewheel", map.wheelZoom);         
			
			}
		//showLocation();        
		}
	}
}
function showsearch(land, weblkz, vonhier, nachhier) {
    var straddr = document.getElementById("Strasse").value.toLowerCase();
    var myort = document.getElementById("MyOrt").value.toLowerCase();
    if (Trim(straddr)) {
        if (GBrowserIsCompatible()) {
            if (!map) {
                map = new GMap2(document.getElementById("map"));
            }
            geocoder = new GClientGeocoder;
            var address = straddr + "," + myort + "," + land;
            if (geocoder) {
                geocoder.getLatLng(address, function (point) {if (!point) {
				//alert(address + " wurde nicht gefunden !");
				} else {if (stat == 1) {map.panTo(point);} else {map.setCenter(point, 16);}if (marker) {map.removeOverlay(marker);}marker = new GMarker(point);map.addOverlay(marker);marker.openInfoWindowHtml("<div id='blase'><h4>" + unescape(straddr.toUpperCase()) + ", " + unescape(myort.toUpperCase()) + "</h2></div>" + "<h4><a href=http://maps.google." + weblkz + "/maps?daddr=" + escape(address) + ">" + nachhier + "</a>" + " - " + "<a href=http://maps.google." + weblkz + "/maps?saddr=" + escape(address) + ">" + vonhier + "</a></h4>");map.addControl(new GLargeMapControl);map.addControl(new GMapTypeControl);map.addControl(new GOverviewMapControl);stat = 1;}});
            }
        }
    } else {
        alert(eTxt4);
    }
}
	function Filternt()
 {

 Name = escape(Trim(document.getElementById("TWert").value.toLowerCase())); 
 
  Name=Name.replace('\n','');  
Stadt = escape(Trim(document.getElementById("TOrt").value.toLowerCase())); 

  Stadt=Stadt.replace('\n','');

  
  
  
   var myregexp = /[a-z]/i;
 var match = new RegExp(myregexp);
 if(match.test(Name)==true || Name == "") {
  location.replace("http://www.cylex-telefonbuch.de/suche/deutschland/bundesland-/stadt-"+Stadt+"/l-0049-plz--strasse-_name-"+Name+"-s1_filter-0.html");

 }
 else
 {
  var nummer = unescape(Name).replace(/[^\d]/g,'');// replace all non numeric characters
  location.replace("http://www.cylex-telefonbuch.de/invers/" + nummer + "/s1.html");

 }
  
 
 
        
 }
function Trim(TRIM_VALUE){
	if(TRIM_VALUE.length < 1){
		return"";
	}
	
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	
	if(TRIM_VALUE==""){
		return "";
	}
	else{
		return TRIM_VALUE;
	}
}

function RTrim(VALUE){
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	if(v_length < 0){
		return"";
		}
	var iTemp = v_length -1;

	while(iTemp > -1){
		if(VALUE.charAt(iTemp) == w_space){
			}
		else{
			strTemp = VALUE.substring(0,iTemp +1);
			break;
		}
		iTemp = iTemp-1;

	} //End While
	return strTemp;

} //End Function

function LTrim(VALUE){
	var w_space = String.fromCharCode(32);
	if(v_length < 1){
		return"";
	}
	
	var v_length = VALUE.length;
	var strTemp = "";

	var iTemp = 0;

	while(iTemp < v_length){
		if(VALUE.charAt(iTemp) == w_space){
		}
		else{
			strTemp = VALUE.substring(iTemp,v_length);
			break;
		}
		iTemp = iTemp + 1;
	} //End While
	return strTemp;
} //End Function

 //--------------------------------------------------------
 function routnach()
 {
 //divblase= document.getElementById("blase");
 //divblase.outerHTML = "Test";
 //alert("nach");
 marker.openInfoWindowHtml(nachHTML);
 }
function routvon()
 {
 //divblase= document.getElementById("blase");
 //divblase.outerHTML = vonHTML;
 marker.openInfoWindowHtml(vonHTML);
 //alert("von");
 }
 function clear(value)
 {
    value = value.replace("'"," ");
	
    return value 
 }