function blackout(keep){var winWidth=$j(document).width();var winHeight=$j(document).height();if($j('#blackout').length==0){$j(document.body).append('<div id="blackout"></div>');$j('#blackout').css('height',winHeight+'px');$j('#blackout').css('width',winWidth+'px');$j('#blackout').css('position','absolute');$j('#blackout').css('display','block');$j('#blackout').css('background-color','#000000');$j('#blackout').css('opacity','0.7');$j('#blackout').css('-moz-opacity','0.7');$j('#blackout').css('khtmlopacity','0.7');$j('#blackout').css('filter','alpha(opacity=70)');}else{if(keep==true){return true;}else if(keep=='hide'){$j('#blackout').hide();}else if(keep=='show'){$j('#blackout').show();}else if(typeof keep=='undefined'||typeof keep==null){$j('#blackout').toggle();}}}
function htmlPopup(name,content,iw,ih,header){if(typeof name=='undefined'||typeof name==null){name='htmlPop';}
var aw=$j(window).width();var ah=$j(window).height();var st=$j(document).scrollTop();var sl=$j(document).scrollLeft();if(iw.toString().indexOf('px')!=-1){var w=iw.toString().substr(0,iw.toString().indexOf('px'));}else{var w=aw*iw;}
if(iw.toString().indexOf('px')!=-1){var h=ih.toString().substr(0,ih.toString().indexOf('px'));}else{var h=ah*ih;}
var ch=h;var headh=0;var theHtml='';var ajaxContent={};if($j('#'+name).length==0){$j(document.body).append('<div id="'+name+'" class="popup-html"><div class="popup-content"></div></div>');}
if(typeof header!='undefined'&&typeof header!=null){if($j('#'+name+' .popup-header').length==0){if(header.substring(0,1)=='#'){$j('#'+name).prepend('<div class="popup-header">'+$j(header).html()+'</div>');}else{$j('#'+name).prepend('<div class="popup-header">'+header+'</div>');}}
if($j('#'+name+' .popup-header').length==0){headh=0;}else{headh=$j('#'+name+' .popup-header').height();}
ch=(h-headh);h=parseFloat(h)+parseFloat(headh);}
var t=((ah-h)/2)+st;var l=((aw-w)/2)+sl;if(ah<h){t=20;}
$j('#'+name).css('background-color','#ffffff');$j('#'+name).css('width',w+'px');$j('#'+name).css('height',h+'px');$j('#'+name).css('position','absolute');$j('#'+name).css('zIndex',999);$j('#'+name).css('top',t+'px');$j('#'+name).css('left',l+'px');$j('#'+name).show();$j('#'+name+' .popup-content').css('width',w+'px');$j('#'+name+' .popup-content').css('height',ch+'px');$j('#'+name+' .popup-content').css('overflow','auto');if(typeof content=='object'){$j.post(content.url,{action:content.action,func:content.func},function(r){$j('#'+name+' .popup-content').html(r);});return true;}else if(typeof content=='function'){theHtml=content();}else if(content.substring(0,1)=='#'){theHtml=$j(content).html();$j(content).remove();}else{theHtml=content;}
$j('#'+name+' .popup-content').html(theHtml);}
function htmlPopupCenter(popup){if(typeof popup=='undefined'){popup='.popup-html';}else{if(popup.indexOf('#')==-1){popup='#'+popup;}}
var aw=$j(window).width();var ah=$j(window).height();var st=$j(document).scrollTop();var sl=$j(document).scrollLeft();var w=$j(popup).width();var h=$j(popup).height();var t=((ah-h)/2)+st;var l=((aw-w)/2)+sl;$j(popup).css('position','absolute');$j(popup).css('zIndex',999);$j(popup).css('top',t+'px');$j(popup).css('left',l+'px');$j(popup).show();}
function htmlPopupResize(popup,iw,ih){if(typeof popup=='undefined'){popup='.popup-html';}else{if(popup.indexOf('#')==-1){popup='#'+popup;}}
if(iw.toString().indexOf('px')!=-1){var w=iw.toString().substr(0,iw.toString().indexOf('px'));}else{var w=aw*iw;}
if(iw.toString().indexOf('px')!=-1){var h=ih.toString().substr(0,ih.toString().indexOf('px'));}else{var h=ah*ih;}
var ch=h;var headh=0;if($j(popup+' .popup-header').length>=1){headh=$j(popup+' .popup-header').height();ch=(h-headh);h=parseFloat(h)+parseFloat(headh);}else{headh=0;}
$j(popup).css('width',w+'px');$j(popup).css('height',h+'px');$j(popup+' .popup-content').css('width',w+'px');$j(popup+' .popup-content').css('height',ch+'px');$j(popup+' .popup-content').css('overflow','auto');}
function windowsLoaderAdd(func){windowsLoader[windowsLoader.length]=func;}
function windowsLoadFunc(){for(i=0;i<windowsLoader.length;i++){eval(windowsLoader[i]);}}
function loadFunc(){window.onload=windowsLoadFunc;}
windowsLoader=new Array();function setState(w){if(w.value!='US'){$j('#state').attr('value','99');$j('#state').attr('disabled',true);$j('#state_outside').attr('disabled',false);}else{$j('#state').attr('value','0');$j('#state').attr('disabled',false);$j('#state_outside').attr('disabled',true);}}
function popUp(theURL,Name,popW,popH,scroll){var winleft=(screen.width-popW)/2;var winUp=((screen.height-popH)/2)-50;winProp='width='+popW+',height='+popH+',left='+winleft+',top='+winUp+',scrollbars='+scroll+',resizable'
Win=window.open(theURL,Name,winProp)
if(parseInt(navigator.appVersion)>=4){Win.window.focus();}}
function verify_country(country,stateID){var state=document.getElementById(stateID);if(state){if(country.options[country.selectedIndex].text=="US"){state.disabled=false;}else{state.disabled=true;}}}
function checkAll(field,type,theclass){if(!type){type='checkbox';}
if(field.checked){if(typeof theclass!='undefined'){if($j(':'+type).hasClass(theclass)){$j('.'+theclass).attr('checked',true);}else{return false;}}else{$j(':'+type).attr('checked',true);}}else{if(typeof theclass!='undefined'){if($j(':'+type).hasClass(theclass)){$j('.'+theclass).attr('checked',false);}else{return false;}}else{$j(':'+type).attr('checked',false);}}
$j(':'+type).select();}
function Delete(m){if(!window.confirm(m)){return false;}
return true;}
function disableButton(b,t){$j(b).attr('disabled',true);$j(b).attr('value',t);}
function dismissElement(el){var hide=true;if(document.addEventListener){document.addEventListener("click",function(event){var element=event.target;for(var e=element;e;e=e.offsetParent){if(e.getAttribute('id')==el){hide=false;}}
if(hide==true){if($j('#'+el).length==1){$j('#'+el).hide();}}},true);}else{document.numclicks=0;document.onclick=function(){var element=event.srcElement;document.numclicks++;for(var e=element;e;e=e.offsetParent){if(e.getAttribute('id')==el){hide=false;}}
if(hide==true&&document.numclicks>1){if($j('#'+el).length==1){$j('#'+el).hide();document.numclicks=0;}}}}}
function findPosX(obj){var curleft=0;if(obj.offsetParent)
while(1)
{curleft+=obj.offsetLeft;if(!obj.offsetParent)
break;obj=obj.offsetParent;}
else if(obj.x)
curleft+=obj.x;return curleft;}
function findPosY(obj){var curtop=0;if(obj.offsetParent)
while(1)
{curtop+=obj.offsetTop;if(!obj.offsetParent)
break;obj=obj.offsetParent;}
else if(obj.y)
curtop+=obj.y;return curtop;}
