/*if (typeof browser != 'object') {
  browser = [['Opera', 'opera ', '9.0', 'windows', 'mac os x', 'other'], ['Safari', 'safari/', '125', '', 'mac os x', ''], ['Netscape', 'netscape/', '7.1', 'windows', 'mac os x', 'other'], ['Firefox', 'firefox/', '1.0', 'windows', 'mac os x', 'other'], ['Mozilla', 'rv:', '1.7', 'windows', 'mac os x', 'other'], ['MSIE', 'msie ', '6.0', 'windows', '', ''], ['Netscape4', 'mozilla/', '4.0', '', '', '']];
}*/

divsToBeAltered.push("mainNavigationContainerIAP");

var hideCo2LayerTimer = 5000;

function showCo2(co2HeaderOn, co2HeaderOff, co2body){
  setVisibility(co2HeaderOn, 1, 'block');
  setVisibility(co2HeaderOff, 0, 'none');
  setVisibility(co2body, 1, 'block');
}

function hideCo2(co2HeaderOn, co2HeaderOff, co2body){
  setVisibility(co2HeaderOn, 0, 'none');
  setVisibility(co2HeaderOff, 1, 'block');
  setVisibility(co2body, 0, 'none');
}

function setLoginStatus(showLogin) {
	if(showLogin) {
		setVisibility('logoutLink', 1, 'block');
	}
}

jQuery().ready(function(){
	
	if((navigator.appVersion.indexOf('AppleWebKit')!=-1)&&(navigator.appVersion.indexOf('Mobile/')!=-1)){
		//jQuery('.metaNavigation').css({bottom:'auto',top:'2000px',position:'absolute'});
		jQuery('body #copyText td a span div').css('font-size','13px');
		jQuery('#videoContainer').css('display','none');
		jQuery(".selectBoxDropdownList a:contains('Video')").css('display','none');
		jQuery(".standardTeaser .topicHeadline:contains('VIDEO')").parent().css('display','none');
	}
	
	jQuery('#voucher').accordion({
		active: 0,
		header: 'a.voucherEntry' 
	});
	
	// start slideshow number 1 for sweepstake and specials & event teaser in marginal bar
	if(typeof document.getElementById('sweepstakeEventSlideshow') != 'undefined' && typeof startSweepstakeEventSlideshow == 'function') {
		startSweepstakeEventSlideshow('sweepstakeEventSlideshow', 0);
	}
	// start slideshow number 2 for sweepstake and specials & event teaser in marginal bar
	if(typeof document.getElementById('sweepstakeEventSlideshow_2') != 'undefined' && typeof startSweepstakeEventSlideshow == 'function') {
		startSweepstakeEventSlideshow('sweepstakeEventSlideshow_2', 0);
	}
	
	
	
});

function setInfolayerTop(el) {
  tmpTop = document.getElementById("infoContainer").offsetTop;
  tmpTop = tmpTop-200;
  document.getElementById(el).style.top=tmpTop+"px";
}

// initializes slideshow for sweepstake and specials & events
function startSweepstakeEventSlideshow(id, startOffer) {
	$('ul#' + id).innerfade({
		speed: 1000,
		timeout: 7000,
		type: 'sequence',
		containerheight: '175px'
	});
	
	$("#" + id).css("display", "block");
	$("#sweepstakeEventContainer").css("display", "block");
}



$(document).ready(function() {
	function moveBottomNavigation(){
  if(window.orientation==0){
    if(initialCallPortrait){
     heightPortrait = $(document).height();
     initialCallPortrait=false;
    }
    endHeight = heightPortrait;
   }else{
    if(initialCallLandscape){
     heightLandscape = $(document).height(); ;
     initialCallLandscape=false;
    }
     endHeight = heightLandscape;
   }
   $(".metaNavigation").css("top", ""+endHeight+"px");
   $(".metaNavigation").css("display", "block");
   $(".metaNavigation").css("visibility", "visible");
   $(".metaNavigation").css("width", "1024px");
   $(".metaNavigation").css("overflow", "hidden");
}

var supportsOrientationChange = "onorientationchange" in window,
  orientationEvent = supportsOrientationChange ? "orientationchange" : "resize";

if(supportsOrientationChange){
  $("#metaNavigation").css("position", "absolute");
  $("#metaNavigation").css("display", "none");
  $("#metaNavigation").css("visibility", "hidden");
  var initialCallPortrait= true;
  var initialCallLandscape= true;
  var heightPortrait= "";
  var heightLandscape= "";
  var endHeight = "";
  var isInitialCall = true;

  if(isInitialCall){
    isInitialCall = false;
    moveBottomNavigation()
  }
   window.addEventListener(orientationEvent, function() {
    $("#bottomNavigation").css("display", "block");
    $("#bottomNavigation").css("visibility", "visible");
    moveBottomNavigation();

}, false);
};
});

// tracks facebook like in etracker
// param facebookResponse: the response returned by facebook. contains the liked url.
function trackFacebookLike(facebookResponse) {
	trackEvent('facebook_like', window.location.pathname, facebookResponse);
}
