$(function(){

/*
Deutschland, CSS & jQuery Clickable map - 350px | http://winstonwolf.pl/css,deutschland.html
script version: 2.3 by Winston Wolf | http://winstonwolf.pl
Copyright (C) 2011 Winston_Wolf | All rights reserved
*/
  $('#karte').prepend('<span id="loader">Loading ...</span>').addClass('script'); $('#karte').find('li').hide();
  var mapUrl=$('#de').css('background-image').replace(/"/g,"").replace(/url\(|\)$/ig, "");
/* takes a path to a file with a map, in case of problems with loading the image, replace the direct path to the image:
  var mapUrl='http://example.com/images/de-350px.png'; 
*/
  var mapImg=new Image();
  $(mapImg).load(function(){$('#loader').fadeOut(); $('#karte').find('li').fadeIn(); $('#de').find('a').prepend('<span class="map" />');
   for(var i=1;i<42;i++){ $('#de .map').append('<span class="s'+i+'" />'); }
   if($('#karte').hasClass('tooltip')){$('#de').find('li').each(function(){ var tooltipName=$(this).children('a').text(); var tooltipLeft=$('.tt').outerWidth()/-2; var tooltipTop=$('.tt').outerHeight()/-2; $(this).append('<span class="tt">'+tooltipName+'</span>'); $('.tt').css({'display':'none','margin-left':tooltipLeft,'margin-top':tooltipTop});});$('#de li').hover(function(){$(this).children(".tt:visible").hide(); $(this).children(".tt").show(); $(this).children("a").removeAttr('title');},function(){$(this).children(".tt").hide();});}
   }).error(function(){$('#loader').text('Keine Karte!'); $('#de span').hide(); $('#karte,#de').css({'height':'auto','left':'0','margin':'0 auto'});
    }).attr('src',mapUrl);
  var loaderPos=$('#loader').outerWidth()/-2; $('#loader').css('margin-left',loaderPos);
  $('#de').find('li').click(function(){window.location.href=$(this).children('a').attr('href');});
// end of the map



/* OPTIONAL: 

// Activation of the land without going to a page in the link:

  $('#de').find('li').click(function(){
    $('.active').removeClass();
    $(this).find('a').addClass('active');

    // plus an event for the active country

     return false;
   });


// Activation of the land by URL (np: example.com/#germany activates Germany on the map)

  $('#de').find('a').each(function(){
    if($(this).attr('href')===window.location.hash){
      $(this).addClass('active');

      // plus an event for the active country

     }
   });

*/
});
