var g_promotion_show_type="",g_promotion_show_ids=[];function getPromotions(a){g_promotion_show_type=a;a={type:encodeURIComponent(a),curr_aids:g_promotion_show_ids.join(",")};$j.post("/promotion/getpromotions.php",a,function(b){getPromotions_ajaxShow(b)},"json")}function getPromotions_haibei(a,b,c){g_promotion_show_type=a;a={type:encodeURIComponent(a),curr_aids:g_promotion_show_ids.join(","),gnick:c};$j.post("/promotion/getpromotions.php",a,function(d){getPromotions_ajaxShow(d)},"json")}
function getPromotions_ajaxShow(a){try{$j("#promotions_div").html(a.html);g_promotion_show_ids=a.aids}catch(b){if(g_promotion_show_type==6||g_promotion_show_type==7||g_promotion_show_type==14||g_promotion_show_type==18)parent.document.getElementById("frmAd").style.display="none"}}function promCommitClose(a,b){var c={promuid:encodeURIComponent(a),promid:encodeURIComponent(b)};$j.post("/promotion/close_s.php",c)}
function closePromtion(a,b,c){promCommitClose(b,c);b={type:encodeURIComponent(g_promotion_show_type),curr_aids:g_promotion_show_ids.join(","),only:"only",idx:a};$j.post("/promotion/getpromotions.php",b,function(d){close_response(d,a)},"json")}function close_response(a,b){var c="#prom_list_"+b;try{$j(c).html(a.html);g_promotion_show_ids=a.aids}catch(d){$j(c).remove();if($j.trim($j("#promotions_div").html())=="")parent.document.getElementById("frmAd").style.display="none"}}
function checkAllAdEmpty(){checkCpmAdEmpty()&&checkPromAdEmpty()?$j("#prombar").hide():$j("#prombar").show()}function checkCpmAdEmpty(){for(var a,b=$j("#prombar > div").not("#promotions_div"),c=b.length,d=0;d<c;d++)if($j(b[d]).html()!=""){a=false;break}else a=true;return a}function checkPromAdEmpty(){var a=$j("#prom_list_0"),b=$j("#prom_list_1"),c=$j("#prom_list_2");return(!a||a.length==0||a.html()=="")&&(!b||b.length==0||b.html()=="")&&(!c||c.length==0||c.html()=="")?true:false};

