/* GETS URL AND DATE FOR PRINT VIEW */

function getPrintDetails() {
    var spanUrl = document.getElementById("spURL");
    var spanDate = document.getElementById("spDate");
    var date = new Date();
    spanUrl.innerHTML = "<b>URL:</b>" + document.location.href;
    spanDate.innerHTML = "<b>Datum:</b>" + getCurrentDate();
}

function getCurrentDate() {
    with (new Date()) return [getDate(), getMonth() + 1, getFullYear()].join(arguments[0] || '.');
}


/*--------------------------------------*/
function hightLightLng(obj)
{
    var lngEN = document.getElementById("lngEN");
    var lngDE = document.getElementById("lngDE");
    var statusActive = "aLanguage active";
    var statusInactive = "aLanguage";

    if (obj == "DE") {
        lngEN.className = statusInactive;
        lngDE.className = lngDE.className + " active";
    }
    else 
    {
        lngEN.className = lngEN.className + " active";
        lngDE.className = statusInactive;    
    }
}


function openLayer(href, width, height, text) {
  width=width+10;
  outerheight = height+10;
  if (href.indexOf("repeat=true&autostart") > 0)
    outerheight = height + 20
  add = (href.indexOf("?") > 0) ? "" : "?";
  
  $.fancybox({
    'showCloseButton': true,
    'width': width,
    'height': outerheight,
    'autoScale': false,
    'transitionIn': 'fade',
    'transitionOut': 'fade',
    'titlePosition': 'inside',
    'title': decodeURI(text),
    'type': 'iframe',
    'href': href + add + '&width=' + width + '&height=' + outerheight,
    'scrolling': 'no'
  })
}

if ($.browser.msie && parseInt($.browser.version) < 8) {
  document.write("<style>.contentBox { margin-top: 10px; }</style>")
}

$(document).ready( function() {
  
  //videoPopupTeaser
  $("div.teaser > div.teaserContent > span.video").click(function(){
            var source = $(this).data("src");
            var content = '<iframe width="560" height="349" src="https://www.youtube.com/embed/'+source+'?controls=1&theme=light" frameborder="0" allowfullscreen></iframe>';
            $.fancybox({
                'transitionIn': 'none',
                'transitionOut': 'none',
                'autoDimensions': true,     
                'showCloseButton': true,
                'titleShow': true,
                'titlePosition': 'inside',
                'title': '',
                'content': content,
                'centerOnScroll': false
                //'onComplete': function () { $("#fancybox-wrap").css({ 'top': '200px', 'bottom': 'auto' }); }
            });   
  });
  

});

/*--------------------------------------*/

