  var popStatus = 0;

  function showPopUp(id, fixHeight){
    //Facebook specific
    /*      
    FB.Connect.forceSessionRefresh(function(){
      if ( FB.XFBML.Host.parseDomTree )
        setTimeout( FB.XFBML.Host.parseDomTree, 0 );
      });
    if ( FB.XFBML.Host.parseDomTree )
      setTimeout( FB.XFBML.Host.parseDomTree, 0 );
    
    FB.ensureInit(
      function(){
        FB.Connect.get_status().waitUntilReady(
          function( status ) {
            switch ( status ) {
              case FB.ConnectState.connected:
                jQuery('.ukSpecific').hide();
                jQuery('.fbSpecific').show();
                loggedIn = true; break;
              case FB.ConnectState.appNotAuthorized:
              case FB.ConnectState.userNotLoggedIn:
                jQuery('.fbSpecific').hide();
                jQuery('.ukSpecific').show();
            }
          }
        );
      }
    );
*/
    
    //loads popup only if it is disabled
    fixHeight = typeof(fixHeight) != 'undefined' ? fixHeight : false;

    if(popStatus==0){
      centerPopUp(id, fixHeight);
      var maskWidth = jQuery(document).width();
      var maskHeight = jQuery(document).height();
      jQuery("#backgroundPopup").css({
        "opacity": "0.5",
        "width": maskWidth,
        "height": maskHeight
        });
      jQuery(window).scrollTop(0);
      jQuery("#backgroundPopup").fadeIn("slow");
      jQuery(id).fadeIn("slow");
      jQuery(".flashPlaceholder").show();
      jQuery(".flashContent").hide();
      popStatus = 1;
      }
  }
  
  function hideAllPopUp(){
    //disables popup only if it is enabled
    if(popStatus==1){
      jQuery("#backgroundPopup").fadeOut("slow");
      jQuery(".popBox").fadeOut("slow");
      jQuery(".flashPlaceholder").hide();
      jQuery(".flashContent").show();
      popStatus = 0;
      }
  }
  
  function centerPopUp(id, fixHeight){
    //request data for centering
    var windowWidth = jQuery(window).width();
    var windowHeight = window.innerHeight ? window.innerHeight : jQuery(window).height();  
    var popupHeight = jQuery(id).height();
    var popupWidth = jQuery(id).width();
    if (fixHeight || (popupHeight > (windowHeight - 80))) {
      popupHeight = (windowHeight - 80);
      jQuery(id).css({"height": popupHeight });
    }
    //centering
    jQuery(id).css({
          "position": "absolute",
          "left": windowWidth/2-popupWidth/2
          });
    //only need force for IE6
    jQuery("#backgroundPopup").css({"height": windowHeight });
  }
  
// Liefert die Groesse der Seite oder des Fensters zurueck, je nachdem was groesser ist.
function getPageDimensions(){
  var windowWidth = jQuery(window).width();
  var windowHeight = window.innerHeight ? window.innerHeight : jQuery(window).height();  
  var documentWidth = jQuery(document).width();
  var documentHeight = jQuery(document).height();

  dimensions['width'] = (windowWidth > documentWidth) ? windowWidth : documentWidth;
  dimensions['height'] = (windowHeight > documentHeight) ? windowHeight : documentHeight;
  return dimensions;
}

