/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

$(document).ready(function(){
   $ani_speed = 'fast';
   
   /*$('#fontsizer').jfontsizer({
    applyTo: '#main',
    changesmall: '2',
    changelarge: '2',
    expire: 30
   });*/

    /**
     * Image Maps
     * 
     */
    
   $('area').mousemove(function(event){
    if ($(this).attr('id')<90) {
        $('img#areahover'+$(this).attr('id')).fadeIn('fast');
    } else if ($(this).attr('id')==98) {
          $('#tageszentrum_og').fadeIn('$ani_speed');
    } else if ($(this).attr('id')==99) {
          $('#tageszentrum_og').fadeOut('$ani_speed');
    }
    });
   
   $('area').mouseout(function(){
    if ($(this).attr('id')<90) {
        $('img#areahover'+$(this).attr('id')).fadeOut($ani_speed);
    }  
    
   });
   
   $('area').click(function(event){
      event.preventDefault();
      if ($(this).attr('id')<90) {
          
          $('.tageszentrum_popup').hide();


          popup = '.tageszentrum_popup'+$(this).attr('id');

          var height = $(popup).height();
          var width = $(popup).width();

          leftVal=event.pageX-(width/2);
          topVal=event.pageY-(height/2)+50;

          if ((topVal+height) > $(window).height()) {
              topVal = event.pageY-(height)-(height/2);
          }
          if (leftVal < 0) {leftVal = 20}
          if (leftVal + width > $(window).width()) {
              leftVal = $(window).width()-width-20;
          }

          leftVal = leftVal + "px";
          topVal = topVal + "px";

          $(popup).css({left:leftVal,top:topVal}).fadeIn('fast');
      } else if ($(this).attr('id')==98) {
          $('#tageszentrum_og').fadeIn('$ani_speed');
      } else if ($(this).attr('id')==99) {
          $('#tageszentrum_og').fadeOut('$ani_speed');
      } 
   });
   

$('.tageszentrum_popup,img.tageszentrum').click(function(){
       $('.tageszentrum_popup').fadeOut($ani_speed);
});

$('.tageszentrum_popup .closebtn a').click(function(event){
    event.preventDefault();
});
  


});


