var docEl;
var footer;


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


    CheckIfPrintPopup();

    if (jQuery.browser.msie && parseInt(jQuery.browser.version) == 6 || parseInt(jQuery.browser.version) == 7 || parseInt(jQuery.browser.version) == 8)
    {
        // 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 || parseInt(jQuery.browser.version)==7 || parseInt(jQuery.browser.version)==8){
            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'); 
         //   var hght=document.body.scrollHeight
         //   alert(hght);
            
            if (footer!=null){
                footer.style.position="absolute";
                footer.style.top = document[docEl].clientHeight + document[docEl].scrollTop -16 +"px";
		        footer.style.left = (document[docEl].clientWidth-document[docEl].scrollLeft) / 2  - (775 / 2)+"px" ; 
		        
		       // var h=document[docEl].body.scrollHeight; 
		        //var f=document[docEl].clientHeight + document[docEl].scrollTop;

                window.onscroll=posFooter;
                window.onresize=posFooter;
              
            }
        }
    }

});
 
 
function posFooter(){
     

	    if (parseInt(jQuery.browser.version)==6 || parseInt(jQuery.browser.version)==7 || parseInt(jQuery.browser.version)==8){
	        footer.style.top = document[docEl].clientHeight + document[docEl].scrollTop -16 +"px";
		    // footer.style.top =document.body.scrollHeight
		     
		     footer.style.left = (document[docEl].clientWidth-document[docEl].scrollLeft) / 2  - (775 / 2)+"px" ; 
	 
	         
	    } else {
	       footer.style.top = document[docEl].clientHeight + document[docEl].scrollTop -20 +"px";
		   footer.style.left = (document[docEl].clientWidth-document[docEl].scrollLeft) / 2  - (775 / 2)+"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);
}
