var $,ajax_error_redirect,ajax_global_error_redirect,display_ajax_error,display_ajax_response_error,display_global_ajax_error,exports,filesizeformat,progress_tmpl;$=jQuery;exports=this;exports.media_url=media_url;exports.errmsgbox='<div id="alertmsg" class="alpos">'+'<div class="error">'+'<a class="closeflash" href="#" title="Close">x</a>'+gettext('AJAX Error:')+' {{msg}}</div></div>';exports.errbox='<div id="alertmsg" class="alpos"><div class="error">'+'<a class="closeflash" href="#" title="Close">x</a>'+gettext('Error Occured:')+' {{msg}}</div></div>';progress_tmpl='<div id="shield"><div id="loading"><img src="{{media_url}}imgs/large-progress.gif" alt="loading"/><br/>'+gettext('Loading')+'</div></div>';exports.loading=$.mustache(progress_tmpl,{'media_url':exports.media_url});filesizeformat=function(bytes){var e,s;s=['bytes','KB','MB','GB','TB','PB'];e=Math.floor(Math.log(bytes)/Math.log(1024));return(bytes/Math.pow(1024,Math.floor(e))).toFixed(1)+" "+s[e];};display_ajax_error=function(XHR,textStatus,errorThrown){var html;html=$.mustache(exports.errmsgbox,{msg:errorThrown||gettext('Unknown error occured !')});if($('#alertmsg').length){$('#alertmsg').empty();$('#alertmsg').remove();}$('#heading').after(html);return 1;};ajax_error_redirect=function(XHR,textStatus,errorThrown){var html;if(XHR.status===200)window.location=location.href;html=$.mustache(exports.errmsgbox,{msg:errorThrown||gettext('Unknown error occured !')});if($('#alertmsg').length){$('#alertmsg').empty();$('#alertmsg').remove();}$('#heading').after(html);return 1;};ajax_global_error_redirect=function(event,request,settings,errorThrown){var html;if(request.status===200)location.href=settings.url;else{html=$.mustache(exports.errmsgbox,{msg:errorThrown||gettext('Unknown error occured !')});if($('#alertmsg').length){$('#alertmsg').empty();$('#alertmsg').remove();}$('#heading').after(html);}$(this).hide();return 1;};display_global_ajax_error=function(e,jqxhr,settings,errorThrown){var html;html=$.mustache(errmsgbox,{msg:errorThrown||gettext('Unknown error occured !')});if($('#alertmsg').length){$('#alertmsg').empty();$('#alertmsg').remove();}$('#heading').after(html);return 1;};display_ajax_response_error=function(errormsg){var html;html=$.mustache(exports.errmsgbox,{msg:errormsg});if($('#alertmsg').length){$('#alertmsg').empty();$('#alertmsg').remove();}$('#heading').after(html);return 1;};$(document).ready(function(){$('#globallang').change(function(){var n;n=$(this).val();if(window.location.search)location.href="/accounts/setlang"+window.location.search+"&amp;language="+n;else location.href="/accounts/setlang?language="+n;return 1;});$('.closeflash').bind('click',function(e){e.preventDefault();$(this).parent().parent().remove();return 1;});return 1;});