 function getBrowserDimensions() { 
          var intH = 0; 
          var intW = 0; 
 
          if(typeof window.innerWidth  == 'number') { 
             intH = window.innerHeight; 
             intW = window.innerWidth; 
          }  
          else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { 
               intH = document.documentElement.clientHeight; 
               intW = document.documentElement.clientWidth; 
          } 
          else if(document.body && (document.body.clientWidth || document.body.clientHeight)) { 
            intH = document.body.clientHeight; 
            intW = document.body.clientWidth; 
          } 
 
          return {width: parseInt(intW), height: parseInt(intH)}; 
      };
 
      
      var runJPickerPosFix = true;
      
      //setTimeout('runFixJpickersPos()', 5000);
      
      function runFixJpickersPos() {
    	  if(runJPickerPosFix) {
    		  fixJpickersPositions();
    		 // setTimeout('runFixJpickersPos()', 5000);
    	  } 
      };
      
      function fixJpickersPositions() {
    	 var jPickers = jq('.jPicker*');
    	 var ii = 0;
    	 var jPickers2 = jq('.jPicker Container');

    	 alert('Fixing jpciker pos' + jPickers.length + ', other find gives: ' + jPickers2.length);

    	 while(ii<jPickers.length) {
    		 var picker = jPickers[ii];
    		 ii++;
    		 setLayerPosition(picker);
    	 }
    	  
      };
      
      jQuery.fn.center = function () {     this.css("position","absolute");     this.css("top", (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop() + "px");     this.css("left", (($(window).width() - this.outerWidth()) / 2) + $(window).scrollLeft() + "px");     return this; };
 
      function setLayerPosition(elem) { 

    	//  var elem = document.getElementById(divId);     
          var bws = getBrowserDimensions(); 
  
          var left = parseInt((parseInt(bws.width) - 400)/2) + 'px'; 
          var top = parseInt((parseInt(bws.height) - 400)/2) + 'px'; 

          
    	  alert('Setting div position for jpicker ' + elem);

          elem.style.left = left;
          elem.style.top = top;
          
//          jqWrappedPicker.css("left", left);
//          jqWrappedPicker.css("top", top);
          
      };
 
      //window.onresize = SetLayerPosition; 

