var docEl;
var footer;

$(document).ready(function()
{
    Lightbox.initialize();


    CheckIfPrintPopup();

    if (jQuery.browser.msie && parseInt(jQuery.browser.version) == 6)
    {
        // Fix top navigation paddings in IE6
        $('ul#navigation li:last').addClass('last-nav-item');
        $('ul#navigation li.current').next().css('padding-left', '0.16em');

        // Fix hover effect for buttons
        $('.selectButton').mouseover(function() { $(this).toggleClass('selectButtonHover'); }).mouseout(function() { $(this).toggleClass('selectButtonHover'); });
        $('.searchButton').mouseover(function() { $(this).toggleClass('searchButtonHover') }).mouseout(function() { $(this).toggleClass('searchButtonHover') });

        // Fix empty ULs in Sitemap
        $('ul.sitemap:empty').hide();
    }

    // Fix headline width of intro boxes
    $('div#content div.intro-3 h1').width($('div#content div.intro-3 h1 span').width());

    // Adjust height of headline in teaser module (requires jquery.equalHeight.js)
    $('div.fauxcol2').each(function(i, e) {
        $('div.teaser-topic h2', e).equalHeight();
    });

    // Positon footer in IE6
    if (jQuery.browser.msie) {
        if (parseInt(jQuery.browser.version)==6){
            docEl= (
                 typeof document.compatMode != "undefined" && 
                 document.compatMode        != "BackCompat"
                 )? "documentElement" : "body";
            if (document.getElementById('footer')!=null) footer=document.getElementById('footer');
            else if (document.getElementById('popup-footer')!=null) footer=document.getElementById('popup-footer');
            if (footer!=null){
                footer.style.position="absolute";
                footer.style.top = document[docEl].clientHeight + document[docEl].scrollTop -16 +"px";
                window.onscroll=posFooter;
                window.onresize=posFooter;
            }
        }
    }

});
 
 
function posFooter(){
    if (parseInt(jQuery.browser.version)==6){
       footer.style.top = document[docEl].clientHeight + document[docEl].scrollTop -16 +"px";
    } else {
       footer.style.top = document[docEl].clientHeight + document[docEl].scrollTop -20 +"px";
    }
}


function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable) {
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';
  if (name == 'win' ) {
      name = name+String(Math.random()).slice(2);
  }
  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}
