var imagemap_map = null;

/**
 * jQuery Init
 */
function init() {

  /* Fix transparent PNG images for IE5+IE6 */
  jQuery(document).pngFix();

  /* Initialize gallery */
  jQuery('a.fancygallery, a.jqfancybox').fancybox(
    {
    'transitionIn'  :   'elastic',
    'transitionOut' :   'elastic',
    'speedIn'       :   800,
    'speedOut'      :   200,
    'overlayShow'   :   true,
    'overlayOpacity':   0.75,
    }
  );

  /* People rechts unten Platzieren */
  var people = jQuery('<img />').attr('src', '/fileadmin/templates/images/people.png');
  people.attr('id', 'peopleimage');
  people.hide();
  people.appendTo(jQuery('body'));
  posPeople();

  jQuery(window).resize(posPeople);

  /* Ticker starten */
  jQuery("ul.newsticker").liScroll(); 

  /* Map init */
  var map = jQuery('div.map');

  if(map) {
    imagemap_map = jQuery('div.map img');
    
    jQuery('div.map map area').hover(
      function(ev) {
	var hoverImg = jQuery(this).attr('rel');
	if(!hoverImg)
	  return;
        jQuery(this).attr('rel', imagemap_map.attr('src'));
	imagemap_map.attr('src', hoverImg);


      }
    ); 
  }
}


/**
 * People rechts unten passend positionieren. 
 */
function posPeople() {

  var people = jQuery('#peopleimage');
 
  if(jQuery(window).width() < 1250 || jQuery(window).height() < 700 ) {
    people.hide();    
    return;
  }
  
  people.css('position', 'fixed');

  var main = jQuery('#main');
 
  var imgLeft = (jQuery(document).width() / 2) + 451;
  var imgTop = jQuery(document).height();

  people.css('left', imgLeft + 'px');
  people.css('bottom', '0px');

  people.show();

}

jQuery(document).ready(init);

