function totalWidth(j){ return j.width()+parseInt(j.css('padding-left'),10)+parseInt(j.css('padding-right'),10); }
function totalHeight(j){ return j.height()+parseInt(j.css('padding-top'),10)+parseInt(j.css('padding-bottom'),10); }

/*######################################################################*/
/*INIT LOADING POPUP*/

function init_loader(){
 popup_html(''
 +'<a href="javascript:;" id="popup-close" onclick="popup_close();" title="Click here to close this popup."></a>'
// +'<div style="padding:0px 0px 16px;"><div style="margin:0px;" class="warning-msg">'
// +'This request has taken quite a while.<br/>If your browser is indicating no network activity then the request may have stalled.<br/>You may wish to <a onclick="window.location.reload();" href="javascript:;" style="color:blue;text-decoration:underline;">refresh</a> the page to view updated data.'
// +'<span title="Clear error." onclick="jQuery(this).parent().parent().remove();" class="sm-btn-close"></span></div></div>'
 +'<div style="text-align:center;"><img src="gfx/ajax-loader2.gif" style="margin:0px auto;"/></div>'
 ,590);
 }
function init_uploader(f){
 jQuery(f).css({'display':'none'})
 .before('<div style="text-align:center;"><img src="gfx/ajax-loader2.gif" style="margin:0px auto;"/></div><div class="cl"></div>');
 }
/*######################################################################*/
/*POPUP1 - SINGLE FIXED CENTER*/
function popup_ajax(file,width,onComplete){
 popup_html('<div style="text-align:center;padding:50px 0px 80px;"><img src="gfx/loading.gif" /></div>',width);
 jQuery('#popup-inner').load(file,'',function(){
  jQuery('#popup-inner').prepend(jQuery('#information-dialog>*').eq(0).clone());
  });//.prepend('<div id="popup-close" onclick=""></div>');
 }

function popup_html(content,width){
 var width = (typeof(width)=='undefined' ? 600 : width ); 
 if(typeof(content)=='string'){innerhtml=content;}else if(isElement(content)){innerhtml=content.innerHTML;}
 
 if(jQuery('#popup').size()>0)jQuery('#popup').remove();//ALLOW ONLY ONE POPUP AT A TIME
 
 html = ''
 +'<div id="popup" class="popup popup-A"><div class="popup-bgnd"></div><table><tr><td>'
 +'<div id="popup-inner" style="width:'+width+'px;">'
 +innerhtml
 +'</div></td></tr></table></div>';
 jQuery(document.body).prepend(html);
 
 if(jQuery.browser.msie&&jQuery.browser.version.substr(0,1)<7)jQuery(window).bind('scroll',ie6_popup_onscroll);
 }
function popup_html2(content,width){
 var width = (typeof(width)=='undefined' ? 600 : width ); 
 if(typeof(content)=='string'){innerhtml=content;}else if(isElement(content)){innerhtml=content.innerHTML;}
 
 if(jQuery('#popup').size()>0)jQuery('#popup').remove();//ALLOW ONLY ONE POPUP AT A TIME
 
 html = ''
 +'<div id="popup" class="popup" onclick="popup_close();"><div class="popup-bgnd"></div><table><tr><td style="padding:90px 0px;">'
 +'<div id="popup-inner" style="width:'+width+'px;">'
 +innerhtml
 +'</div></td></tr></table></div>';
 jQuery(document.body).prepend(html);
 
 if(jQuery.browser.msie&&jQuery.browser.version.substr(0,1)<7)jQuery(window).bind('scroll',ie6_popup_onscroll);
 }

function popup_close(){ jQuery('#popup').remove(); }

function ie6_popup_onscroll(event){
 if(jQuery('#popup').size()<1){jQuery(window).unbind('scroll',ie6_popup_onscroll);}
 else{document.getElementById('popup').style.top = document.body.parentElement.scrollTop;}
 }

