var where=null,limit=0,total=0,models=[],appname=null,number=0,html={index:function(){$.getJSON("?app=system&controller=html&action=createIndex",function(a){if(a.state){ct.ok("\u64cd\u4f5c\u6210\u529f");return true}else{ct.error(a.error);return false}})},roll:function(){ct.form("\u751f\u6210\u6eda\u52a8\u9875","?app=system&controller=html&action=roll",300,250,function(a){if(a.state){ct.ok("\u64cd\u4f5c\u6210\u529f");return true}else{ct.error(a.error);return false}},function(){$("input.input_calendar").focus(function(){WdatePicker({dateFmt:"yyyy-MM-dd"})})})},
rank:function(){$.getJSON("?app=system&controller=html&action=rank",function(a){if(a.state){ct.ok("\u64cd\u4f5c\u6210\u529f");return true}else{ct.error(a.error);return false}})},tags:function(){$.getJSON("?app=system&controller=html&action=tags",function(a){if(a.state){ct.ok("\u64cd\u4f5c\u6210\u529f");return true}else{ct.error(a.error);return false}})},map:function(){$.getJSON("?app=system&controller=html&action=map",function(a){if(a.state){ct.ok("\u64cd\u4f5c\u6210\u529f");return true}else{ct.error(a.error);
return false}})},category:function(){$.getJSON("?app=system&controller=html&action=category&catid="+current_catid,function(a){a.state?ct.ok("\u64cd\u4f5c\u6210\u529f"):ct.error(a.error)})},ls:function(){$("#ls").attr("class","s_3");$("#show").attr("class","");$("#show_form").hide();$("#ls_form").show()},show:function(){$("#ls").attr("class","");$("#show").attr("class","s_3");$("#show_form").show();$("#ls_form").hide()},init:function(){$("#html_ls").ajaxForm("html.ls_submit");$("#html_show").ajaxForm("html.show_submit")},
ls_submit:function(a){if(a.state)if(a.catids)if(a.percent==0){$("input[type='submit']").attr("disabled",true);$("#ls_progressbar").progressBar({barImage:IMG_URL+"images/progressbg_yellow.gif"});setTimeout("html.ls_create()",1E3)}else if(a.percent<1){percent=(a.percent*100+"").substr(0,2);$("#ls_progressbar").progressBar(percent);setTimeout("html.ls_create()",1E3)}else{if(a.percent==1){$("input[type='submit']").attr("disabled",false);$("#ls_progressbar").progressBar(100);setTimeout(function(){$("#ls_progressbar").hide()},
2E3);ct.ok("\u5168\u90e8\u751f\u6210\u5b8c\u6bd5")}}else ct.ok("\u64cd\u4f5c\u6210\u529f");else ct.error(a.error)},ls_create:function(){$.getJSON("?app=system&controller=html&action=ls&maxlimit="+$("#maxlimit").val()+"&catids=true",function(a){html.ls_submit(a)})},show_submit:function(a){if(a.state){where=a.where;total=a.total;limit=$("#limit").val();models=a.models;$("input[type='submit']").attr("disabled",true);$("#show_progressbar").progressBar({barImage:IMG_URL+"images/progressbg_yellow.gif"});
html.show_create(a)}else ct.error(a.error)},show_create:function(a){if(a.finished&&models.length===0){where=null;total=limit=0;models=[];appname=null;number=0;$("input[type='submit']").attr("disabled",false);$("#show_progressbar").progressBar(100);setTimeout(function(){$("#show_progressbar").hide()},2E3);ct.ok("\u5168\u90e8\u751f\u6210\u5b8c\u6bd5")}else{if(a.finished){number+=a.offset;percent=(number/total*100+"").substr(0,2)+"%";appname=models.shift();offset=0;count=""}else{percent=((number+a.offset)/
total*100+"").substr(0,2);offset=a.offset;count=a.count}if(percent=="0")percent="1";$("#show_progressbar").progressBar(percent);$.getJSON("?app="+appname+"&controller=html&action=show_batch&where="+where+"&limit="+limit+"&count="+count+"&offset="+offset,function(b){b.state?html.show_create(b):ct.error(b.error)})}}};
