//***********************************************************************************************************
// Form Handling
//***********************************************************************************************************
//Gedrückte Tasten überwachen
if (document.attachEvent)
	document.attachEvent("onkeydown",keyDownEvents);
else if (document.addEventListener)
	document.addEventListener("keydown",keyDownEvents,false);

//Wenn die Seite in einem Frame/iframe geladen wird, ausbrechen
if (window.location != window.parent.location)
{
  window.parent.location  = window.location;
}

//Gedrückte Tasten an Funktionen zuordnen
function keyDownEvents(e)
{
  if (window.event)
    var keynum = window.event.keyCode;
  else if (e.which)
    var keynum = e.which;
  
  //ENTER Taste, Funktion ausführen die im "btnSubmit" definiert ist
  if (keynum == 13)
  {
	if (document.getElementById('btnSubmit'))
	{
	  if (document.getElementById('btnSubmit').disabled == false)
	  {
		var onclick = String(document.getElementById('btnSubmit').onclick);
		onclick = onclick.replace('function onclick(event) {','');
		onclick = onclick.replace('function onclick()','');
		onclick = onclick.replace('function anonymous()','');
		onclick = onclick.replace('function (event)','');
		onclick = onclick.replace('}','');
		onclick = onclick.replace('{','');
		eval(onclick);
      }
	}
  }
}


//Foto und Subnavigation optisch hervorheben wenn der Besucher auf dem entsprechenden Pendant mit der Maus darüber fährt
function markNavigationFotoPendant()
{
//Alle Gallerie-Fotos auf Normalzustand wenn Maus über Hauptnavigationspunkt
  $('#lstSubNavigation a').bind(
  {
    mouseover: function()
	{
	  $('img').removeClass('hell');
	}
  });

  //Entsprechende Gallerie-Fotos markieren wenn mit Maus über dem Sub-Navigation Eintrag
  $('#lstSubNavigation ul a').bind(
  {
    mouseover: function()
	{
	  $('img').addClass('hell');
	  $('.indexgallery a[href$="' + getFilename($(this).attr('href')) + '"] img').removeClass('hell');
	},
	
    mouseout: function()
	{
	  $('.indexgallery a[href$="' + getFilename($(this).attr('href')) + '"] img').addClass('hell');
	}
  });  

  //Entsprechende identische Sub-Navigation Einträge markieren wenn mit Maus über den Fotos
  $('.indexgallery a').bind(
  {
    mouseover: function()
	{
	  $('#lstSubNavigation .extended a').removeClass('active');
	  $('#lstSubNavigation .extended a[href$="' + $(this).attr('href') + '"]').addClass('active');
	  $('img').addClass('hell');
	  $('img',this).removeClass('hell');
	},
	
    mouseout: function()
	{
	  $('#lstSubNavigation .extended a').removeClass('active');
	  $('img').addClass('hell');
	}
  });  
}



//  jQuery IE Fade Fix
(function($) {
	$.fn.customFadeIn = function(speed, callback) {
		$(this).fadeIn(speed, function() {
			if(jQuery.browser.msie)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	$.fn.customFadeOut = function(speed, callback) {
		$(this).fadeOut(speed, function() {
			if(jQuery.browser.msie)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
})(jQuery);




