jQuery(document).ready(function () { 
  // Design
  jQuery(window).resize(function() { DoDesingReset() });
  DoDesingReset();
  
});
/*
 * Design strecken
*/ 
function DoDesingReset() {
  if (jQuery(".page_margins").height() < jQuery(window).height()) {
    jQuery(".page_margins").height((jQuery(window).height()));
    jQuery("#main").height((jQuery(window).height()-30));
  }
  
  jQuery(".Bild_Tabele").each(function() {  
    //alert(jQuery(this).width());
     if (jQuery(this).width() < 470) {
      jQuery(this).css("margin-right", "10px");

    }
  
  }); 
}

/*
 * Artikel Popup
*/
var popupStatus = 0;  
var activPopId = 0;

function loadPopup(windowID){  
  if(popupStatus==0){  
    activPopId = windowID;
    jQuery("#backgroundPopup").css({  
      "opacity": "0.2"  
    });  
    jQuery("#backgroundPopup").fadeIn("slow");  
    jQuery("#popWin"+activPopId).fadeIn("slow");  
    popupStatus = 1;  
  }  
}  

function disablePopup(){  
  if(popupStatus==1){  
    jQuery("#backgroundPopup").fadeOut("slow");  
    jQuery("#popWin"+activPopId).fadeOut("slow");  
      popupStatus = 0;  
    }  
}  

function centerPopup(){  
  if(popupStatus==1){ 
    var windowWidth = jQuery(window).width();  
    //Sonderfall BKU
    var extraWinWidth = ((windowWidth-1000)/2);
    var windowHeight = jQuery(window).height();  
    var popupHeight = jQuery("#popWin"+activPopId).height();  
    var popupWidth = jQuery("#popWin"+activPopId).width();  
    
    var finalWindowWidth = ((windowWidth/2-popupWidth/2)-extraWinWidth);
    //alert(windowWidth+" & "+windowHeight+" pop: "+popupWidth+" & "+popupHeight) ;
    jQuery("#popWin"+activPopId).css({  
    "position": "absolute",  
    "top": windowHeight/2-popupHeight/2,  
    "left": finalWindowWidth  
    });  
    //only need force for IE6  
      
    jQuery("#backgroundPopup").css({  
      "height": windowHeight  
    });  
  }   
}  