Exp={}
Exp.Map={

  //global variables
    MapArea       :'', 
    MarkerImage   :'', 
    MarkerOptions : '',
    MarkerManager :'',  
 
  
  setup: function() { 
  
                    //setting up inital map controls 
                    Exp.Map.MapArea = new GMap2(document.getElementById("map")); 
                    Exp.Map.MapArea.setCenter(new GLatLng( 52.5234051, 13.4113999 ), 5); 
                    Exp.Map.MapArea.setMapType(G_NORMAL_MAP);
                    Exp.Map.MapArea.addControl(new GSmallMapControl());
                    Exp.Map.MarkerManager = new MarkerManager( Exp.Map.MapArea );     
                           
                    //setting up custom icons
                    Exp.Map.MarkerImage = new GIcon();
					Exp.Map.MarkerImage.image = 'http://media.expedia.com/media/content/shared/graphics/stores/domestic/marker.png?v1';
					Exp.Map.MarkerImage.iconSize = new GSize(50, 28);
					Exp.Map.MarkerImage.iconAnchor = new GPoint(16, 16);
					Exp.Map.MarkerImage.infoWindowAnchor = new GPoint(25, 7);      
                       
                    
                    //getting data source and parsing through      
                       
                                     for( var j = 1; j < POS.countries.length; j++)
                                     {
                                        var countries=null; var cities=null;  
                                        
                                        countries = POS.countries[j];   
                                        parseInt(countries.minzlevel); parseInt(countries.maxzlevel);
                                        
                                        if( countries.Carprice == 0  ) { var CarClass = 'hidden'; }else { var CarClass = '';}
                                        if( countries.Epackageprice == "" ) { var PackClass = 'hidden'; }else { var PackClass = '';}
                                        if( countries.Epackageprice == "" ) { var PackClass = 'hidden'; }else { var PackClass = '';}
                                        if( countries.Morelink.length < 20 ) { var MoreClass = 'hidden'; }else { var MoreClass = '';} 
                                        
                                        var content = '<ul class="mapContent"><li><span>'+countries.name+'</span></li><li><a href="'+countries.Hotellink+'&rfrr=CATEGORY:Multi:Domestic:Map:'+countries.name.replace(/ /g,"")+'">'+countries.Hotelclass+'* hotels</a> ab <a href="'+countries.Hotellink+'&rfrr=CATEGORY:Multi:Domestic:Map:'+countries.name.replace(/ /g,"")+'"  class="xp-t-price xp-t-bold">'+countries.Hotelprice+'</a> pro Nacht</li><li class="'+CarClass+'"><a href="'+countries.Carlink+'&rfrr=CATEGORY:Multi:Domestic:Map:'+countries.name.replace(/ /g,"")+'">Mietwagen</a> ab <a href="'+countries.Carlink+'&rfrr=CATEGORY:Multi:Domestic:Map:'+countries.name.replace(/ /g,"")+'" class="xp-t-price xp-t-bold">&euro;'+countries.Carprice+'</a> pro Tag</li><li class="'+PackClass+'"><a href="'+countries.Epackagelink+'&rfrr=CATEGORY:Multi:Domestic:Map:'+countries.name.replace(/ /g,"")+'" >Flug + Hotel</a> ab <a href="'+countries.Epackagelink+'&rfrr=CATEGORY:Multi:Domestic:Map:'+countries.name.replace(/ /g,"")+'"  class="xp-t-price xp-t-bold">&euro;'+countries.Epackageprice+'</a></li><li class="'+MoreClass+'"><a href="'+countries.Morelink+'&rfrr=CATEGORY:Multi:Domestic:Map:'+countries.name.replace(/ /g,"")+'">Weitere hotels in '+countries.name+'</a></li></ul>'
                                        var point = new GLatLng( countries.latitude , countries.longitude );
                                         var opt = { 
									                    "icon": Exp.Map.MarkerImage,
									                    "clickable": true,
                    									
									                    "labelText": countries.Hotelprice,
									                    "labelOffset": new GSize(-5, -15)
								                    } 
                                        var marker = new LabeledMarker( point , opt )    
                                        Exp.Map.ClickEvent( marker, content); 
                                        Exp.Map.MarkerManager.addMarker( marker , 1 , 14 ); 
                                     }
                                
                                    Exp.Map.MarkerManager.refresh();   
                                
		              
                    return false; 
							 
                    },
ClickEvent: function( destination ,  content ){  
                                GEvent.addListener( destination ,"click", function() { 
                                                        destination.openExtInfoWindow(
                                                        Exp.Map.MapArea,
                                                        "simple_example_window",
                                                        content,
                                                        {beakOffset: 3}
                                                        )   
                                });
                                            
                          }                    							 
                    
}
