/*
  	function showmyNav(element){
		element.className += "hover";
		}

	function hidemyNav(element){
		element.className = element.className = "";
	}
*/
	function MyReload(){
		window.location.reload();
		}

	function toggleBox(id) {
		
		var status = document.getElementById(id).style.display;
		
		if(status == "block") {
			document.getElementById(id).style.display = "none";
			/*document.toggleBTN.src = '/omi/images/icon_helpinfo_closed.gif';*/
		} else {
			document.getElementById(id).style.display = "block";
			/*document.toggleBTN.src = '/omi/images/icon_helpinfo_open.gif';*/
		}
	}


jQuery('document').ready(function($) {

	try {
		$("header img").pngfix({
			sizingMethod: "crop"
		});
		$("#main-inner").pngfix({
			sizingMethod: "scale"
		});
	} catch(err) {}
	
 $(".teaser-pager-1, .teaser-pager-2, .teaser-pager-3").bind('click', function() {
	var matching = $(this).attr('className').match(/teaser-pager-(\d)/);
	if ( $(this).hasClass("teaser-pager-"+matching[1]+"-cur")) {
		return false;
	} else {
  		$(".teaser-pager-1").removeClass('teaser-pager-1-cur');
  		$(".teaser-pager-2").removeClass('teaser-pager-2-cur');
  		$(".teaser-pager-3").removeClass('teaser-pager-3-cur');
		$(".teaser-pager-"+matching[1]).addClass('teaser-pager-'+matching[1]+'-cur');
    	$("#book-1, #book-2, #book-3").hide();
    	$("#book-"+matching[1]).show();
 	}
	return false;
  });

/*
  if(typeof jQuery.fn.prettyCheckboxes === 'function') {
    $('input[type=checkbox],input[type=radio]').prettyCheckboxes({
      checkboxWidth: 10, // The width of your custom checkbox
      checkboxHeight: 10, // The height of your custom checkbox
      className : 'prettyCheckbox', // The classname of your custom checkbox
      display: 'list' // The style you want it to be display (inline or list)
    });
  }
*/
  /**
   * toggle box
   */
  if($('.toggle-box').length) {
    $('.toggle-box .toggle-box-head').bind('click', function() {
      if($(this).parent('div').hasClass('toggle-box-open')) {
        $(this).parent('div').removeClass('toggle-box-open').addClass('toggle-box-closed');
      //$(this).parent('div').switchClass('toggle-box-open', 'toggle-box-closed');
      } else {
        //$(this).parent('div').switchClass('toggle-box-closed', 'toggle-box-open', 1000);
        $(this).parent('div').removeClass('toggle-box-closed').addClass('toggle-box-open');
      }
    });
  }






  /**
   * black bg hover and click
   */
  if($('ul.a-black-bg')) {
    $('ul.a-black-bg li a').hover(
      function() {
// console.log('hover-1');
		var a = {};
        a.obj = $(this);
        a.text = a.obj.text();
        if(!a.obj.hasClass('black-bg')) {
          a.obj.addClass('black-bg clearfix');
          a.obj.html('<span class="black-bg-left"></span><span class="text">'+$.trim(a.text)+'</span><span class="black-bg-right"></span>');
        }
      },
      function() {
// console.log('hover-2');
        var a = {};
        a.obj = $(this);
        if(!a.obj.hasClass('act')) {
          a.text = a.obj.children('.text').text();
          a.obj.removeClass('black-bg clearfix');
          a.obj.text(a.text);
        }
      }
      );
    $('ul.a-black-bg li a').bind('click', function() {
      if(!$(this).hasClass('act')) {
// console.log('click');
        var a = {};
        // console.log($(this).parents('ul.a-black-bg').contents().find('a.black-bg').not($(this)).children('.text').html());
        a.prevAct = $(this).parents('ul.a-black-bg').contents().find('a.black-bg').not($(this));
        a.prevText = a.prevAct.children('.text').text();
        a.prevAct.removeClass('black-bg act clearfix');
        a.prevAct.text($.trim(a.prevText));
        a.text = $(this).text();
        $(this).addClass('black-bg act clearfix').html('<span class="black-bg-left"></span><span class="text">'+$.trim(a.text)+'</span><span class="black-bg-right"></span>');
      }
    });
  }

// Pager Steuerung Startseite

try {

$("#fragment-1").css({'display' : 'block'});

	} catch(err) {}
			
			$("a.teaser-pager-1").click(function(){
				if ( $(this).hasClass("teaser-pager-1-cur")) {
					return false;
				} else {
					$("#fragment-1").css({'display' : 'block'});
					$("#fragment-2").css({'display' : 'none'});
					$("#fragment-3").css({'display' : 'none'});
					$("a.teaser-pager-1").addClass('teaser-pager-1-cur');	
					$("a.teaser-pager-2").removeClass('teaser-pager-2-cur');
					$("a.teaser-pager-3").removeClass('teaser-pager-3-cur');
				}	
			});
			$("a.teaser-pager-2").click(function(){
				if ( $(this).hasClass("teaser-pager-2-cur")) {
					return false;
				} else {
					$("#fragment-1").css({'display' : 'none'});
					$("#fragment-2").css({'display' : 'block'});
					$("#fragment-3").css({'display' : 'none'});
					$("a.teaser-pager-1").removeClass('teaser-pager-1-cur');	
					$("a.teaser-pager-2").addClass('teaser-pager-2-cur');
					$("a.teaser-pager-3").removeClass('teaser-pager-3-cur');
				}	
			});
			$("a.teaser-pager-3").click(function(){
				if ( $(this).hasClass("teaser-pager-3-cur")) {
					return false;
				} else {
					$("#fragment-1").css({'display' : 'none'});
					$("#fragment-2").css({'display' : 'none'});
					$("#fragment-3").css({'display' : 'block'});
					$("a.teaser-pager-1").removeClass('teaser-pager-1-cur');
					$("a.teaser-pager-2").removeClass('teaser-pager-2-cur');
					$("a.teaser-pager-3").addClass('teaser-pager-3-cur');
				}	
			});


});
