var langmenu_visible = false;


$(document).ready( function(){

	if ($.browser.msie){
		//		$('.box').corner('top 2px');
	}
});

function resizer() {
	var heightw;
	if (window.innerHeight) {
		heightw = window.innerHeight;
	}else {
		heightw = document.documentElement.clientHeight;
	}
	
	if ($("#MainContent").height()  + ($("#footer").height() + $("#header").height() ) >= heightw) {
		
		if ($("#footer").css('position') != 'relative'){
			$("#footer").css('position', 'relative');
		}
	} else {
		if ($("#footer").css('position') != 'absolute'){
			$("#footer").css('position', 'absolute');
		}
	}
}
function initialize() {
	if ($.browser.msie && ($.browser.version == 6)) {
	 
    node = $("#service");
    node.mouseover(function() {
		this.className+=" over";
    });
    node.mouseout(function() {
    	this.className=this.className.replace(" over", "");
    });
  }
	$('#header').bind("click", function () {
		$('#lang').removeClass('active');
		  langmenu_visible = false;
		  $('#langmenu').hide();
		  $("#langmenu_overlay").remove();
		
	});
  $('#lang').bind("click", function () { 
	if (langmenu_visible == false){
		  langmenu_visible = true;
	$(this).addClass('active');
	$('body').prepend('<div id="langmenu_overlay"></div>');
	$('#langmenu_overlay').css(
			{height: "100%",
			 width: "100%",
			 position: "absolute",
			 "z-Index": "20"
			});
	$('#langmenu_overlay').bind("click", function () {
		$('#lang').removeClass('active');
		  langmenu_visible = false;
		  $('#langmenu').hide();
		  $("#langmenu_overlay").remove();
		
	});
	$('#langmenu').show();
	return false;
  }else{
	  langmenu_visible = false;
		$(this).removeClass('active');
		$('#langmenu').hide();
		$("#langmenu_overlay").remove();

		return false;
  }
  });
  
  initialie_press_slider();
  initialie_fernseh_slider();
  window.onresize = resizer;
  resizer();
  $('#presseBox ul li a[href$=jpg]').lightBox();
  $('#fernsehBox ul li a[href$=jpg]').lightBox();
}



function initialie_press_slider(){
	var itemWidth = 120;
	var container = $('div#presseBox');
	var blocked = false;
	var ul = $('ul', container);
	var count = ul.find('li').length;
	ul.css('width', (count * itemWidth + itemWidth));
		$("#arrow_left").bind("click", function () {
			if (blocked == false){
						blocked = true;

						ul.prepend('<li>' + ul.find('li:last').html() + '</li>');
						ul.css({left:-120});
						ul.find('li:first a[href$=jpg]').lightBox();
						ul.animate({left:0},500, function () { blocked = false ;
						ul.find('li:last').remove();});
			}
		});
		$("#arrow_right").bind("click", function () {
			if (blocked == false){;
					blocked = true;
					ul.append('<li>' + ul.find('li:first').html() + '</li>');
					ul.find('li:last a[href$=jpg]').lightBox();
					ul.animate({left:-120},500, function () { blocked = false ;
					ul.css({left:0});
					ul.find('li:first').remove();});
					
			}
		});
}

function initialie_fernseh_slider(){
	var itemWidth = 180;
	var container = $('div#fernsehBox');
	var blocked = false;
	var ul = $('ul', container);
	var count = ul.find('li').length;
	ul.css('width', (count * itemWidth + itemWidth));
		$("#arrow_left").bind("click", function () {
			if (blocked == false){
						blocked = true;

						ul.prepend('<li>' + ul.find('li:last').html() + '</li>');
						ul.css({left:-180});
						ul.find('li:first a[href$=jpg]').lightBox();
						ul.animate({left:0},500, function () { blocked = false ;
						ul.find('li:last').remove();});
			}
		});
		$("#arrow_right").bind("click", function () {
			if (blocked == false){;
					blocked = true;
					ul.append('<li>' + ul.find('li:first').html() + '</li>');
					ul.find('li:last a[href$=jpg]').lightBox();
					ul.animate({left:-180},500, function () { blocked = false ;
					ul.css({left:0});
					ul.find('li:first').remove();});
					
			}
		});
}


