﻿function showPopup(selector) {  
    var left = (($(window).width()) / 2) - ($(selector).width() / 2) +  $(window).scrollLeft() - 120; 
    $(selector).css("left",left + 'px');
    $(selector).css("top",'110px');
    $(selector).css("z-index",'1001');
     
    $("div#divPopupBG").css("width", $(document).innerWidth() + 'px');
    $("div#divPopupBG").css("height", $(document).innerHeight() + 'px'); 
    $("div#divPopupBG").show(); 
    $(selector).show();
}
function showPopupCenteredHoriz(selector, topOffset) {  
    var left = (($(window).width()) / 2) - ($(selector).width() / 2) +  $(window).scrollLeft();  
    var top = parseInt($(window).scrollTop()) + topOffset;
    $(selector).css("left",left + 'px');
    $(selector).css("top",top + 'px');
    $(selector).css("z-index",'1001');
     
    $("div#divPopupBG").css("width", $(document).innerWidth() + 'px');
    $("div#divPopupBG").css("height", $(document).innerHeight() + 'px'); 
    $("div#divPopupBG").show(); 
    $(selector).show();
}

function hidePopup(selector) {  
    $("#divPopupBG").hide(); 
    $(selector).css("top",-10000); 
}
    
function copy(inElement,RootDir) { 
    var BodyLoaded = 1; 
      if (inElement.createTextRange) { 
        var range = inElement.createTextRange();
        if (range && BodyLoaded==1)
          range.execCommand('Copy');
      } else { 
        var flashcopier = 'flashcopier';
        if(!document.getElementById(flashcopier)) {
          var divholder = document.createElement('div');
          divholder.id = flashcopier;
          document.body.appendChild(divholder);
        }
        document.getElementById(flashcopier).innerHTML = '';
        var divinfo = '<embed src="' + RootDir + 'javascript/_clipboard.swf" FlashVars="clipboard='+encodeURIComponent(inElement.value)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
        document.getElementById(flashcopier).innerHTML = divinfo; 
      }
}

document.write('<div id="divPopupBG" class="popupBG"></div>');

jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

function showAjaxLoading(elm,margin,imgPath) {
    if(!margin)
        margin = 0;  
    
    var html = '<div style="text-align: center; line-height: 14pt; color: #666666;padding: ' + margin + 'px; font-size: 8pt;"><img src="' + imgPath + 'spinner_lg.gif" /><br />Loading...</div>';
    $(elm).attr("innerHTML",html); 
} 