$(function(){total_con=$("#total_con").text();total_rows=$("#total_rows").text();max_con=$("#max_con").text();cat_id=$("#cat_id").attr("value");cat_name=$("#cat_name").attr("value");current_con=1;i=0;$("#next_num_search").on("click",function(){if(current_con<total_con){current_con++;table=$(this).attr("lang");num_rows=$(this).attr("max");search=$(this).attr("search");end=parseInt(current_con)*(parseInt(num_rows)-1);start=parseInt(current_con-1)*(parseInt(num_rows));current_mod=(current_con-1)%max_con;comp=$("#main_company_list").val();depart=$(this).attr("depart");if(current_mod!=0){$(".num_con_search").removeClass("num_active");$("#num_con_search"+current_con).addClass("num_active");$("#next_num_search").attr("alt",parseInt($("#next_num_search").attr("alt"))+1);$("#prev_num_search").attr("alt",parseInt($("#prev_num_search").attr("alt"))+1);}else{from=(parseInt(current_con)-1)+parseInt(max_con);to=parseInt(from)-(parseInt(max_con)+1);$(".num_con_search").show();for(i=from;i>=to;i--){before=i-max_con;$("#num_con_search"+before).attr("alt",i);$("#num_con_search"+before).text(i);$("#num_con_search"+before).attr("id","num_con_search"+i);if(i>total_con){$("#num_con_search"+i).hide();}}
$(".num_con_search").removeClass("num_active");$("#num_con_search"+current_con).addClass("num_active");}
page=$("#load_page").html();page=page+".php";$("#load_wait").show();$('body').animate({scrollTop:$(".single-post-area").offset().top},500);$("#result_view").load(page,{"cat":'','search':search,"table":table,"start":start,"end":end,"num_rows":num_rows,"cat_id":cat_id,"cat_name":cat_name,"comp":comp,"depart":depart},function(){if(end>total_rows){end=total_rows}
$("#rows_range").html((end+1)+"-"+(start+1));$("#load_wait").hide();});}});$("#prev_num_search").on("click",function(){if(current_con>1){current_con--;table=$(this).attr("lang");num_rows=$(this).attr("max");search=$(this).attr("search");end=parseInt(current_con)*(parseInt(num_rows)-1);start=parseInt(current_con-1)*(parseInt(num_rows));current_mod=(current_con)%max_con;comp=$("#main_company_list").val();depart=$(this).attr("depart");if(current_mod!=0){$(".num_con_search").removeClass("num_active");$("#num_con_search"+current_con).addClass("num_active");$("#next_num_search").attr("alt",parseInt($("#next_num_search").attr("alt"))-1);$("#prev_num_search").attr("alt",parseInt($("#prev_num_search").attr("alt"))-1);}else{from=current_con;to=parseInt(current_con)-(parseInt(max_con)+1);$(".num_con_search").show();for(i=from;i>=to;i--){before=parseInt(i)+parseInt(max_con);$("#num_con_search"+before).attr("alt",);$("#num_con_search"+before).text(i);$("#num_con_search"+before).attr("id","num_con_search"+i);if(i>total_con){$("#num_con_search"+i).hide();}}
$(".num_con_search").removeClass("num_active");$("#num_con_search"+current_con).addClass("num_active");}
page=$("#load_page").html();page=page+".php";$("#load_wait").show();$('body').animate({scrollTop:$(".single-post-area").offset().top},500);$("#result_view").load(page,{"cat":'','search':search,"table":table,"start":start,"end":end,"num_rows":num_rows,"cat_id":cat_id,"cat_name":cat_name,"comp":comp,"depart":depart},function(){if(end>total_rows){end=total_rows}
$("#rows_range").html((end+1)+"-"+(start+1));$("#load_wait").hide();});}});$(".num_con_search").on("click",function(){total_con=$("#total_con").text();if($(this).attr("class")!='num_con_search num_active'){$(".num_con_search").removeClass("num_active");$(this).addClass("num_active");current_con=$(this).attr("alt");table=$(this).attr("lang");num_rows=$(this).attr("max");search=$(this).attr("search");comp=$("#main_company_list").val();depart=$(this).attr("depart");page=$("#load_page").html();page=page+".php";$("#load_wait").show();$('body').animate({scrollTop:$(".single-post-area").offset().top},500);end=parseInt(current_con-1)*(parseInt(num_rows));start=parseInt(current_con-1)*(parseInt(num_rows));$("#next_num").attr("alt",parseInt(current_con)+1);$("#prev_num").attr("alt",parseInt(current_con)-1);$("#result_view").load(page,{"cat":'','search':search,"table":table,"start":start,"end":end,"num_rows":num_rows,"comp":comp,"depart":depart},function(){$("#load_wait").hide();});}});$("#main_company_list_internal").bind("change",function(){comp=$(this).val();$("#main_depart_list_internal").load("ajax_load_depart.php",{"comp":comp},function(data){});});$("#main_company_list").bind("change",function(){total_con=$("#total_con").text();current_con=$(this).attr("alt");table=$(this).attr("lang");num_rows=$(this).attr("max");search=$("#search_text").val();comp=$("#main_company_list").val();depart
depart=$(this).attr("depart");page=$("#load_page").html();page=page+".php";$("#load_wait").show();$('body').animate({scrollTop:$(".single-post-area").offset().top},500);end=0;start=0;$("#load_wait").show();$('body').animate({scrollTop:$(".single-post-area").offset().top},500);$("#result_view").load(page,{"cat":'','search':search,"table":table,"start":start,"end":end,"num_rows":num_rows,"comp":comp,"depart":depart},function(){$("#main_depart_list").load("ajax_load_depart.php",{"comp":comp},function(){});$("#num_container").load("ajax_num_container.php",{"table":table,'search':search,"comp":comp,"depart":depart},function(){$("#num_rows").html($("#total_con").html());});$("#load_wait").hide();});});$("#main_depart_list").bind("change",function(){total_con=$("#total_con").text();current_con=$(this).attr("alt");table=$(this).attr("lang");num_rows=$(this).attr("max");search=$("#search_text").val();comp=$("#main_company_list").val();depart=$(this).attr("depart");page=$("#load_page").html();page=page+".php";$("#load_wait").show();$('body').animate({scrollTop:$(".single-post-area").offset().top},500);end=0;start=0;$("#load_wait").show();$('body').animate({scrollTop:$(".single-post-area").offset().top},500);$("#result_view").load(page,{"cat":'','search':search,"table":table,"start":start,"end":end,"num_rows":num_rows,"comp":comp,"depart":depart,"is_search":"1",},function(data){$("#num_container").load("ajax_num_container.php",{"table":table,'search':search,"comp":comp,"depart":depart},function(){$("#num_rows").html($("#total_rows").html());});$("#load_wait").hide();});});$("#search_btn").bind("click",function(){total_con=$("#total_con").text();current_con=$(this).attr("alt");table=$(this).attr("lang");num_rows=$(this).attr("max");search=$("#search_text").val();comp=$("#main_company_list").val();depart=$(this).attr("depart");page=$("#load_page").html();page=page+".php";$("#load_wait").show();$('body').animate({scrollTop:$(".single-post-area").offset().top},500);end=0;start=0;$("#load_wait").show();$('body').animate({scrollTop:$(".single-post-area").offset().top},500);$("#result_view").load(page,{"cat":'','search':search,"table":table,"start":start,"end":end,"num_rows":num_rows,"comp":comp,"depart":depart},function(){$("#num_container").load("ajax_num_container.php",{"table":table,'search':search,"comp":comp,"depart":depart},function(){$("#num_rows").html($("#total_con").html());});$("#load_wait").hide();});});});