function AttachBranchClicks(){document.getElementById("ViewName").value=="Search_Branchsn"&&(name1="מחלקה",name2="קטגוריה",name3="תת קטגוריה");$("ul.items-list").children("li").each(function(){$(this).children().children("label").click(function(){var r=$(this).parent().find("input[type=checkbox]").attr("name"),i=$(this).parent().find("input[type=checkbox]"),n=i.val().split("#"),t=$(this).attr("class");t==undefined||t==""?(AddBranch(oSearch,n[1],n[0]),AddSidebarItem("divBranchData","ulSBBranch","liSBBranches","ulBranches",n[1],n[0],"branch",$(this),"lblBranch",name1)):(RemoveBranch(oSearch,n[1]),RemoveSidebarItem("branch",n[1],"aRemovebranch_"+n[1],!0,"lblBranch"))});$(this).children().children("label").children("div").click(function(){var r=$(this).parent().find("input[type=checkbox]").attr("name"),t=$(this).parent().find("input[type=checkbox]"),n=t.val().split("#"),i=$(this).attr("class");i.indexOf("chk-unchecked")>-1?(AddBranch(oSearch,n[1],n[0]),AddSidebarItem("divBranchData","ulSBBranch","liSBBranches","ulBranches",n[1],n[0],"branch",$(this),"lblBranch",name1)):(RemoveBranch(oSearch,n[1]),RemoveSidebarItem("branch",n[1],"aRemovebranch_"+n[1],!0,"lblBranch"))})});$("ul.sub-items-list").children("li").each(function(){$(this).children().children("label").click(function(){var i=$(this).parent().find("input[type=checkbox]"),n=i.val().split("#"),t=$(this).attr("class");t==undefined||t==""?(AddSubBranch(oSearch,n[1],n[0]),AddSidebarItem("divBranchData","ulSBBranch","liSBSubBranches","ulSubBranches",n[1],n[0],"subbranch",$(this),"lblSubBranch",name2)):(RemoveSubBranch(oSearch,n[1]),RemoveSidebarItem("subbranch",n[1],"aRemovesubbranch_"+n[1],!0,"lblSubBranch"))});$(this).children().children("label").children("div").click(function(){var r=$(this).parent().find("input[type=checkbox]").attr("name"),t=$(this).parent().find("input[type=checkbox]"),n=t.val().split("#"),i=$(this).attr("class");i.indexOf("chk-unchecked")>-1?(AddSubBranch(oSearch,n[1],n[0]),AddSidebarItem("divBranchData","ulSBBranch","liSBSubBranches","ulSubBranches",n[1],n[0],"subbranch",$(this),"lblSubBranch",name2)):(RemoveSubBranch(oSearch,n[1]),RemoveSidebarItem("subbranch",n[1],"aRemovesubbranch_"+n[1],!0,"lblSubBranch"))})})}function CreateBranchContainer(){BranchContainer={SubBranchList:[],AddSubBranch:function(n){var t=!1;for(i=0;i<this.SubBranchList.length;i++)if(this.SubBranchList[i]==n){t=!0;break}t||this.SubBranchList.push(n)},CheckExist:function(n,t){switch(n){case"SubBranch":for(i=0;i<this.SubBranchList.length;i++)if(this.SubBranchList[i]==t)return!0;return!1}}}}function OpenSubBranch(n,t){advLi=$("#SubLi_"+n);advLi.hasClass("opened")?t&&advLi.removeClass("opened"):BranchContainer.CheckExist("SubBranch",n)?$("#SubBranchData_"+n).parent("li").addClass("opened"):$.ajax(document.getElementById("spnBaseUrlSearch").innerHTML+"Update_SubSubBranch_Data",{cache:!1,data:{SubBranchID:n},success:function(t){$("#SubBranchData_"+n).html(t);$("#SubBranchData_"+n).parent("li").addClass("opened");BranchContainer.AddSubBranch(n);initResizeSpecificList_V2("divData_"+n);$("#SubBranchData_"+n).parents(".scrollable-area").height(500);$("#SubBranchData_"+n).parents(".scrollable-area-wrapper").height(500);PushSubSubBranch($("#divData_"+n).children("ul"))},error:function(){console.log("Update subsubbranch data - ajax error")},dataType:"html",cache:!1,async:!1})}function PushSubSubBranch(n){$(n).children("li").each(function(){$(this).children().children("label").click(function(){var r=$(this).parent().find("input[type=checkbox]").attr("name"),i=$(this).parent().find("input[type=checkbox]"),n=i.val().split("#"),t=$(this).attr("class");t==undefined||t==""?(AddSubSubBranch(oSearch,n[1],n[0],n[2]),AddSidebarItem("divBranchData","ulSBBranch","liSBSubSubBranches","ulSubSubBranches",n[1],n[0],"subsubbranch",$(this),"lblSubSubBranch",name3)):(RemoveSubSubBranch(oSearch,n[1]),RemoveSidebarItem("subsubbranch",n[1],"aRemovesubsubbranch_"+n[1],!0,"lblSubSubBranch"))});$(this).children().children("label").children("div").click(function(){var r=$(this).parent().find("input[type=checkbox]").attr("name"),t=$(this).parent().find("input[type=checkbox]"),n=t.val().split("#"),i=$(this).attr("class");i.indexOf("chk-unchecked")>-1?(AddSubSubBranch(oSearch,n[1],n[0],n[2]),AddSidebarItem("divBranchData","ulSBBranch","liSBSubSubBranches","ulSubSubBranches",n[1],n[0],"subsubbranch",$(this),"lblSubSubBranch",name3)):(RemoveSubSubBranch(oSearch,n[1]),RemoveSidebarItem("subsubbranch",n[1],"aRemovesubsubbranch_"+n[1],!0,"lblSubSubBranch"))})})}function SetSearchDef_branch(){ExpandSelected_branch();CheckSelected_branch()}function CheckSelected_branch(){for(var t,i,n=0;n<oSearch.categories.branch_list.length;n++)$("#Branch_"+oSearch.categories.branch_list[n].BranchID).parent().children("div").removeClass("chk-unchecked"),$("#Branch_"+oSearch.categories.branch_list[n].BranchID).parent().children("div").addClass("jcf-unselectable chk-area chk-checked"),$("#Branch_"+oSearch.categories.branch_list[n].BranchID).parent().addClass("chk-label-active"),$("#Branch_"+oSearch.categories.branch_list[n].BranchID).prop("checked",!0);for(t=0;t<oSearch.categories.subBranch_list.length;t++)$("#SubBranch_"+oSearch.categories.subBranch_list[t].SubBranchID).parent().children("div").removeClass("chk-unchecked"),$("#SubBranch_"+oSearch.categories.subBranch_list[t].SubBranchID).parent().children("div").addClass("jcf-unselectable chk-area chk-checked"),$("#SubBranch_"+oSearch.categories.subBranch_list[t].SubBranchID).parent().addClass("chk-label-active"),$("#SubBranch_"+oSearch.categories.subBranch_list[t].SubBranchID).prop("checked",!0);for(i=0;i<oSearch.categories.subSubBranch_list.length;i++)$("#SubSubBranch_"+oSearch.categories.subSubBranch_list[i].SubSubBranchID).parent().children("div").removeClass("chk-unchecked"),$("#SubSubBranch_"+oSearch.categories.subSubBranch_list[i].SubSubBranchID).parent().children("div").addClass("jcf-unselectable chk-area chk-checked"),$("#SubSubBranch_"+oSearch.categories.subSubBranch_list[i].SubSubBranchID).parent().addClass("chk-label-active"),$("#SubSubBranch_"+oSearch.categories.subSubBranch_list[i].SubSubBranchID).prop("checked",!0)}function ExpandSelected_branch(){for(var n=0;n<oSearch.categories.subSubBranch_list.length;n++)OpenSubBranch(oSearch.categories.subSubBranch_list[n].SubBranchID,!1)}function SwitchLetter_buyer(){$("ul.index-list").children("li").click(function(){$("input#shareto").val($(this).data("val"));var n=$("input#shareto").val();RenderLetterData_buyer(n);setTimeout("SetSearchDef_buyer();",400);setTimeout("AttachBuyerClicks()",400);CreateTagContainer()})}function AttachBuyerClicks(){$("ul.buyers-list").children("li").each(function(){$(this).children("label").click(function(){var r=$(this).find("input[type=checkbox]").attr("name"),i=$(this).find("input[type=checkbox]"),n=i.val().split("#"),t=$(this).attr("class");t==undefined||t==""?(AddBuyer(oSearch,n[1],n[0]),AddSidebarItem("divManagerAcData","ulSBManager","liSBBuyers","ulBuyers",n[1],n[0],"buyer",$(this),"lblBuyer","קונה מדיה בטלוויזיה")):(RemoveBuyer(oSearch,n[1]),RemoveSidebarItem("buyer",n[1],"aRemovebuyer_"+n[1],!0,"lblBuyer"))});$(this).children("label").children("div").click(function(){var r=$(this).parent().find("input[type=checkbox]").attr("name"),t=$(this).parent().find("input[type=checkbox]"),n=t.val().split("#"),i=$(this).attr("class");i.indexOf("chk-unchecked")>-1?(AddBuyer(oSearch,n[1],n[0]),AddSidebarItem("divManagerAcData","ulSBManager","liSBBuyers","ulBuyers",n[1],n[0],"buyer",$(this),"lblBuyer","קונה מדיה בטלוויזיה")):(RemoveBuyer(oSearch,n[1]),RemoveSidebarItem("buyer",n[1],"aRemovebuyer_"+n[1],!0,"lblBuyer"))})})}function SetSearchDef_buyer(){for(i=0;i<oSearch.advManager.buyer_list.length;i++)$("#Buyer_"+oSearch.advManager.buyer_list[i].BuyerID).parent().children("div").removeClass("chk-unchecked"),$("#Buyer_"+oSearch.advManager.buyer_list[i].BuyerID).parent().children("div").addClass("jcf-unselectable chk-area chk-checked"),$("#Buyer_"+oSearch.advManager.buyer_list[i].BuyerID).parent().addClass("chk-label-active"),$("#Buyer_"+oSearch.advManager.buyer_list[i].BuyerID).prop("checked",!0)}function RenderLetterData_buyer(n){$.ajax(document.getElementById("spnBaseUrlSearch").innerHTML+"Update_Buyer_Data",{data:{letter:n},success:function(n){$("#divLettersUpdate").html(n);$("#divLettersUpdate").height()<280&&$("#divLettersUpdate").height(280);$("#divLettersUpdate").parent().height()<280&&$("#divLettersUpdate").parent().height(280);initResizeList()},error:function(){console.log("Update buyer data - ajax error")},dataType:"html",cache:!1,async:!1})}function SwitchLetter_celeb(){$("ul.index-list").children("li").click(function(){$("input#shareto").val($(this).data("val"));var n=$("input#shareto").val();RenderLetterData_celeb(n);setTimeout(function(){SetSearchDef_celeb();AttachCelebClicks()},400);CreateTagContainer()})}function AttachCampaignClicks(){AttachCelebClicks();$("ul.items-list").children("li").each(function(){$(this).children().children("label").click(function(){var r=$(this).parent().find("input[type=checkbox]").attr("name"),i=$(this).parent().find("input[type=checkbox]"),n=i.val().split("$#$"),t=$(this).attr("class");t==undefined||t==""||t=="label"?(AddCampaign(oSearch,n[1],n[0]),AddSidebarItem("divCampaignData","ulSBCampaign","liSBCampaigns","ulCampaigns",n[1],n[0],"campaign",$(this),"lblCamp","קמפיין")):(RemoveCampaign(oSearch,n[1]),RemoveSidebarItem("campaign",n[1],"aRemovecampaign_"+n[1],!0,"lblCamp"))});$(this).children().children("label").children("div").click(function(){var r=$(this).parent().find("input[type=checkbox]").attr("name"),t=$(this).parent().find("input[type=checkbox]"),n=t.val().split("$#$"),i=$(this).attr("class");i.indexOf("chk-unchecked")>-1?(AddCampaign(oSearch,n[1],n[0]),AddSidebarItem("divCampaignData","ulSBCampaign","liSBCampaigns","ulCampaigns",n[1],n[0],"campaign",$(this),"lblCamp","קמפיין")):(RemoveCampaign(oSearch,n[1]),RemoveSidebarItem("campaign",n[1],"aRemovecampaign_"+n[1],!0,"lblCamp"))})});$("#OpenCloseCeleb").click(function(){if($("#CelebSlide").hasClass("expanded"))$("#CelebSlide").removeClass("expanded");else{$("#CelebSlide").addClass("expanded");var n=$("#divCelebData").children(".results-area").children(".scrollable-area-wrapper");n.height()==0&&(n.height(253),n.width($("#divCelebData").width()-5),n.children(".scrollable-area").height(253),n.children(".scrollable-area").width($("#divCelebData").width()-5),initResizeList());AttachCelebClicks();SetSearchDef_celeb()}})}function AttachCelebClicks(){$("ul.celebs-list").children("li").each(function(){$(this).children("label").click(function(){var r=$(this).find("input[type=checkbox]").attr("name"),i=$(this).find("input[type=checkbox]"),n=i.val().split("#"),t=$(this).attr("class");t==undefined||t==""?(AddCeleb(oSearch,n[1],n[0]),AddSidebarItem("divCampaignData","ulSBCampaign","liSBCelebs","ulCelebs",n[1],n[0],"celeb",$(this),"lblCeleb","פרזנטור")):(RemoveCeleb(oSearch,n[1]),RemoveSidebarItem("celeb",n[1],"aRemoveceleb_"+n[1],!0,"lblCeleb"))});$(this).children("label").children("div").click(function(){var r=$(this).parent().find("input[type=checkbox]").attr("name"),t=$(this).parent().find("input[type=checkbox]"),n=t.val().split("#"),i=$(this).attr("class");i.indexOf("chk-unchecked")>-1?(AddCeleb(oSearch,n[1],n[0]),AddSidebarItem("divCampaignData","ulSBCampaign","liSBCelebs","ulCelebs",n[1],n[0],"celeb",$(this),"lblCeleb","פרזנטור")):(RemoveCeleb(oSearch,n[1]),RemoveSidebarItem("celeb",n[1],"aRemoveceleb_"+n[1],!0,"lblCeleb"))})})}function SetSearchDef_celeb(){for(var n,t=0;t<oSearch.advCampaign.celeb_list.length;t++)n=$("#Celeb_"+oSearch.advCampaign.celeb_list[t].CelebID),n.parent().children("div").removeClass("chk-unchecked"),n.parent().children("div").addClass("jcf-unselectable chk-area chk-checked"),n.parent().addClass("chk-label-active"),n.prop("checked",!0)}function RenderLetterData_celeb(n){$.ajax(document.getElementById("spnBaseUrlSearch").innerHTML+"Update_Celeb_Data",{data:{letter:n},success:function(n){$("#divLettersUpdate").html(n);initResizeList()},error:function(){console.log("Update celeb data - ajax error")},dataType:"html",cache:!1,async:!1})}function CreateCampaignContainer(){CampaignContainer={CampaignList:[],AddCampaign:function(n){var t=!1;for(i=0;i<this.CampaignList.length;i++)if(this.CampaignList[i]==n){t=!0;break}t||this.CampaignList.push(n)},CheckExist:function(n,t){switch(n){case"Campaign":for(i=0;i<this.CampaignList.length;i++)if(this.CampaignList[i]==t)return!0;return!1}}}}function OpenCampaign(n,t){cmpLi=$("#CmpLi_"+n);cmpLi.hasClass("opened")?t&&cmpLi.removeClass("opened"):CampaignContainer.CheckExist("Campaign",n)?$("#CmpData_"+n).parent("li").addClass("opened"):$.ajax(document.getElementById("spnBaseUrlSearch").innerHTML+"Update_CampaignVersion_Data",{cache:!1,data:{campaignID:n},success:function(t){$("#CmpData_"+n).html(t);$("#CmpData_"+n).parent("li").addClass("opened");CampaignContainer.AddCampaign(n);initResizeSpecificList_V2("divData_"+n);$("#CmpData_"+n).parents(".scrollable-area").height(500);$("#CmpData_"+n).parents(".scrollable-area-wrapper").height(500);PushCampVer($("#divData_"+n).children("ul"))},error:function(){console.log("Update campaign data - ajax error")},dataType:"html",cache:!1,async:!1})}function PushCampVer(n){$(n).children("li").each(function(){$(this).children().children("label").click(function(){var r=$(this).parent().find("input[type=checkbox]").attr("name"),i=$(this).parent().find("input[type=checkbox]"),n=i.val().split("#"),t=$(this).attr("class");t==undefined||t==""?(AddCampVer(oSearch,n[1],n[0],n[2]),AddSidebarItem("divCampaignData","ulSBCampaign","liSBCampaignVersions","ulCampaignVersions",n[1],n[0],"campaignversion",$(this),"lblCampVer","גירסת קמפיין")):(RemoveCampVer(oSearch,n[1]),RemoveSidebarItem("campaignversion",n[1],"aRemovecampaignversion_"+n[1],!0,"lblCampVer"))});$(this).children().children("label").children("div").click(function(){var r=$(this).parent().find("input[type=checkbox]").attr("name"),t=$(this).parent().find("input[type=checkbox]"),n=t.val().split("#"),i=$(this).attr("class");i.indexOf("chk-unchecked")>-1?(AddCampVer(oSearch,n[1],n[0],n[2]),AddSidebarItem("divCampaignData","ulSBCampaign","liSBCampaignVersions","ulCampaignVersions",n[1],n[0],"campaignversion",$(this),"lblCampVer","גירסת קמפיין")):(RemoveCampVer(oSearch,n[1]),RemoveSidebarItem("campaignversion",n[1],"aRemovecampaignversion_"+n[1],!0,"lblCampVer"))})})}function SetSearchDef_campaign(){ExpandSelected_campaign();CheckSelected_campaign()}function CheckSelected_campaign(){for(var t,n=0;n<oSearch.advCampaign.campaign_list.length;n++)$("#Campaign_"+oSearch.advCampaign.campaign_list[n].CampaignID).parent().children("div").removeClass("chk-unchecked"),$("#Campaign_"+oSearch.advCampaign.campaign_list[n].CampaignID).parent().children("div").addClass("jcf-unselectable chk-area chk-checked"),$("#Campaign_"+oSearch.advCampaign.campaign_list[n].CampaignID).parent("label").addClass("chk-label-active"),$("#Campaign_"+oSearch.advCampaign.campaign_list[n].CampaignID).prop("checked",!0);for(t=0;t<oSearch.advCampaign.campaignVersion_list.length;t++)$("#CampVer_"+oSearch.advCampaign.campaignVersion_list[t].CampaignVersionID).parent().children("div").removeClass("chk-unchecked"),$("#CampVer_"+oSearch.advCampaign.campaignVersion_list[t].CampaignVersionID).parent().children("div").addClass("jcf-unselectable chk-area chk-checked"),$("#CampVer_"+oSearch.advCampaign.campaignVersion_list[t].CampaignVersionID).parent("label").addClass("chk-label-active"),$("#CampVer_"+oSearch.advCampaign.campaignVersion_list[t].CampaignVersionID).prop("checked",!0)}function ExpandSelected_campaign(){for(var n=0;n<oSearch.advCampaign.campaignVersion_list.length;n++)OpenCampaign(oSearch.advCampaign.campaignVersion_list[n].CampaignID,!1)}function RemoveSplit(n){for(var f=[],e,o,i,u,r,t=n-1;t>0;t--)document.getElementById("splitBy-"+t)&&(e=$("#splitBy-"+t+" option:selected").val(),o=$("#splitBy-"+t+" option:selected").text(),f.push({val:e,text:o,place:t}));for(i=[],u=f.length-1;u>=0;u--)i.push(f[u]);for(ClearSplits(),r=0;r<i.length;r++)AddSplits(oSearch,i[r].val,i[r].text,i[r].place);for(t=n;t<=groupFieldCount;t++)document.getElementById("splitBy-"+t).value="addRem_spl-"+(t-2).toString(),$("#splitBy-row-"+t).children(".select-area").children("span[class=center]").html("בחר נתון פיצול"),$("#splitBy-row-"+t.toString()).length>0&&t>2&&$("#splitBy-row-"+t.toString()).hide();$("#splitBy-row-"+n).children(".select-area").children("span[class=center]").html("בחר נתון פיצול");$("#splitBy-row-"+n.toString()).show()}function HideCombos(){for(var n=3;n<=groupFieldCount;n++)$("#splitBy-row-"+n).hide()}function AttachDisplayClicks(){var n;for($("#ShowList").click(function(){ShowRelevantData("ShowList","ShowSplit","ShowInfoSys","ShowMediaBuyer","ShowNewCampaigns","ShowLink",!1,!1,!0,!0,!0);SetReportType(oSearch,reportTypeEnum.List)}),$("#ShowSplit").click(function(){ShowRelevantData("ShowSplit","ShowList","ShowInfoSys","ShowMediaBuyer","ShowNewCampaigns","ShowLink",!0,!0,!0,!1,!1);UncheckReportType("mediabuyer");UncheckReportType("ratingchannels");SetReportType(oSearch,reportTypeEnum.Group);oSearch.displaySettings.splits.length==0&&oSearch.displaySettings.splits.push({FieldName:"OperatorTypeName",DisplayName:"סוג מדיה",FieldPlace:1})}),$("#ShowInfoSys").click(function(){ShowRelevantData("ShowInfoSys","ShowList","ShowSplit","ShowMediaBuyer","ShowNewCampaigns","ShowLink",!1,!1,!1,!1,!1);UncheckReportType("mediabuyer");UncheckReportType("ratingchannels");SetReportType(oSearch,reportTypeEnum.Infosys)}),$("#ShowMediaBuyer").click(function(){ShowRelevantData("ShowMediaBuyer","ShowList","ShowSplit","ShowInfoSys","ShowNewCampaigns","ShowLink",!1,!1,!1,!1,!1);UncheckReportType("mediabuyer");UncheckReportType("ratingchannels");UncheckExcel();SetReportType(oSearch,reportTypeEnum.MediaBuyer)}),$("#ShowNewCampaigns").click(function(){ShowRelevantData("ShowNewCampaigns","ShowList","ShowSplit","ShowInfoSys","ShowMediaBuyer","ShowLink",!0,!1,!0,!1,!1);UncheckReportType("mediabuyer");UncheckReportType("ratingchannels");SetReportType(oSearch,reportTypeEnum.NewCampaigns)}),$("#ShowLink").click(function(){ShowRelevantData("ShowLink","ShowInfoSys","ShowList","ShowSplit","ShowMediaBuyer","ShowNewCampaigns",!1,!1,!1,!1,!1);UncheckReportType("mediabuyer");UncheckReportType("ratingchannels");UncheckExcel();SetReportType(oSearch,reportTypeEnum.HyperLinkList)}),$("#splitBy-1").change(function(){var n=$(this).val(),t=$("#splitBy-1 option:selected").text();AddSplits(oSearch,n,t,1)}),n=2;n<=groupFieldCount;n++)$("#splitBy-"+n).change({index:n},function(n){var t=n.data.index,i=$(this).val(),r;i!="addRem_spl-"+(t-2)?($("#splitBy-row-"+(t+1)).show(),r=$("#splitBy-"+t+" option:selected").text(),AddSplits(oSearch,i,r,t)):RemoveSplit(t)});for(n=1;n<ratingTrpCount;n++)$("#cmbRating"+n).change({index:n-1},function(n){var t=$(this).val(),i=$(this).find("option:selected").text();SetTargetType(oSearch,n.data.index,t,i)});$("#cmbFactor").change(function(){var n=$(this).val(),t=$(this).find("option:selected").text();SetFactor(oSearch,0,n,t)});$("#cmbFactor2").change(function(){var n=$(this).val(),t=$(this).find("option:selected").text();SetFactor(oSearch,1,n,t)});SetSearchDirectionClick("box-Listdir-asc");SetSearchDirectionClick("box-Listdir-desc");SetSearchDirectionClick("box-Spldir-asc");SetSearchDirectionClick("box-Spldir-desc");$("#rdPriceDiv").children().click(function(){var n=$(this).parent().children("input[type=radio]").val();SetPriceType(oSearch,n)});$("#rdIfatPriceDiv").children().click(function(){var n=$(this).parent().children("input[type=radio]").val();SetPriceType(oSearch,n)});$("#lblExcel").click(function(){$(this).children("input[type=checkbox]").prop("checked")?SetReportMode("excel",oSearch,0):SetReportMode("excel",oSearch,1)});$("#lblExcel").children("div").click(function(){$(this).parent().children("input[type=checkbox]").prop("checked")?SetReportMode("excel",oSearch,0):SetReportMode("excel",oSearch,1)});$("#lblMediaBuyer").click(function(){$(this).children("input[type=checkbox]").prop("checked")?SetReportMode("mediabuyer",oSearch,0):SetReportMode("mediabuyer",oSearch,1)});$("#lblMediaBuyer").children("div").click(function(){$(this).parent().children("input[type=checkbox]").prop("checked")?SetReportMode("mediabuyer",oSearch,0):SetReportMode("mediabuyer",oSearch,1)});$("#lblChannel").click(function(){$(this).children("input[type=checkbox]").prop("checked")?SetReportMode("ratingchannels",oSearch,0):SetReportMode("ratingchannels",oSearch,1)});$("#lblChannel").children("div").click(function(){$(this).parent().children("input[type=checkbox]").prop("checked")?SetReportMode("ratingchannels",oSearch,0):SetReportMode("ratingchannels",oSearch,1)})}function UncheckExcel(){$("#lblExcel").children("div").removeClass("chk-checked");$("#lblExcel").children("input[type=checkbox]").prop("checked",!1);SetReportMode("excel",oSearch,0)}function SetSearchDirectionClick(n){$("#"+n).children().click(function(){var n=$(this).parent().children("input[type=radio]").val();AddSortDirection(oSearch,n)})}function SetDisplayByReportType(){reportType=GetReportType();reportType==reportTypeEnum.List?ShowRelevantData("ShowList","ShowSplit","ShowInfoSys","ShowMediaBuyer","ShowNewCampaigns","ShowLink",!1,!1,!0,!0,!0):reportType==reportTypeEnum.Group?ShowRelevantData("ShowSplit","ShowList","ShowInfoSys","ShowMediaBuyer","ShowNewCampaigns","ShowLink",!0,!0,!0,!1,!1):reportType==reportTypeEnum.Infosys?ShowRelevantData("ShowInfoSys","ShowList","ShowSplit","ShowMediaBuyer","ShowNewCampaigns","ShowLink",!1,!1,!1,!1,!1):reportType==reportTypeEnum.MediaBuyer?ShowRelevantData("ShowMediaBuyer","ShowList","ShowSplit","ShowInfoSys","ShowNewCampaigns","ShowLink",!1,!1,!1,!1,!1):reportType==reportTypeEnum.NewCampaigns?ShowRelevantData("ShowNewCampaigns","ShowList","ShowSplit","ShowInfoSys","ShowMediaBuyer","ShowLink",!0,!1,!0,!1,!1):reportType==reportTypeEnum.HyperLinkList&&ShowRelevantData("ShowLink","ShowList","ShowSplit","ShowMediaBuyer","ShowNewCampaigns","ShowInfoSys",!1,!1,!1,!1,!1);reportType!=reportTypeEnum.List&&(UncheckReportType("mediabuyer"),UncheckReportType("ratingchannels"))}function ShowRelevantData(n,t,i,r,u,f,e,o,s,h,c){$("#"+n).parent("li").addClass("selected");$("#"+t).parent("li").removeClass("selected");$("#"+i).parent("li").removeClass("selected");$("#"+r).parent("li").removeClass("selected");$("#"+u).parent("li").removeClass("selected");$("#"+f).parent("li").removeClass("selected");o?$("#div_split").show():$("#div_split").hide();s?$("#lblExcel").show():$("#lblExcel").hide();h?$("#lblMediaBuyer").show():$("#lblMediaBuyer").hide();c?$("#lblChannel").show():$("#lblChannel").hide()}function SetSearchDef_display(){var s,u,n,o,t,i,r;if(reportType!=reportTypeEnum.List&&reportType!=reportTypeEnum.Infosys&&reportType!=reportTypeEnum.MediaBuyer){for(n=0;n<oSearch.displaySettings.splits.length;n++)n<groupFieldCount-1&&$("#splitBy-row-"+(n+2).toString()).show(),document.getElementById("splitBy-"+(n+1)).value=oSearch.displaySettings.splits[n].FieldName,s=$("#splitBy-"+(n+1)+" option:selected").text(),u=$("#splitBy-row-"+(n+1)).children("span").children('span[class="center"]'),u&&u.html(s),$("#splitBy-row-"+(n+1)).children("span").removeClass("select-default");oSearch.displaySettings.splits.length==0&&($("#splitBy-row-1").children("span").removeClass("select-default"),oSearch.displaySettings.splits.push({FieldName:"OperatorTypeName",DisplayName:"סוג מדיה",FieldPlace:1}))}var h=oSearch.displaySettings.SortDirection,f="box-Listdir-asc",e="box-Listdir-desc";(reportType==reportTypeEnum.Group||reportType==reportTypeEnum.NewCampaigns)&&(f="box-Spldir-asc",e="box-Spldir-desc");switch(h){case"asc":CheckRadioButton(f,e);break;case"desc":CheckRadioButton(e,f)}for(n=1;n<ratingTrpCount;n++)o="center",MyBrowser.browser=="Firefox"&&(o+=" jcf-unselectable"),t=$("#spnRating"+n).children("span").children('span[class="'+o+'"]'),oSearch.displaySettings.targetTypes[n-1]?(document.getElementById("cmbRating"+n).value=oSearch.displaySettings.targetTypes[n-1].TargetTypeID,t&&t.text(oSearch.displaySettings.targetTypes[n-1].TargetTypeName)):document.getElementById("cmbRating"+n)&&(document.getElementById("cmbRating"+n).value=-1,t&&t.text("ללא רייטינג"),SetTargetType(oSearch,n-1,-1,"ללא רייטינג"));i=$("#factor_div").children("span").children('span[class="center"]');oSearch.displaySettings.factors.length>0?(document.getElementById("cmbFactor").value=oSearch.displaySettings.factors[0].FactorID,i&&i.html(oSearch.displaySettings.factors[0].FactorName)):(document.getElementById("cmbFactor").value=-1,i&&i.html("ללא פקטור"),SetFactor(oSearch,0,-1,"ללא פקטור"));r=$("#factor_div2").children("span").children('span[class="center"]');oSearch.displaySettings.factors.length>1?(document.getElementById("cmbFactor").value=oSearch.displaySettings.factors[1].FactorID,r&&r.html(oSearch.displaySettings.factors[1].FactorName)):(document.getElementById("cmbFactor2").value=-1,r&&r.html("ללא פקטור"),SetFactor(oSearch,1,-1,"ללא פקטור"));currentPriceType=$("#rdPriceDiv").children("input[type=radio]").prop("checked")?priceTypeEnum.PriceList:priceTypeEnum.IfatFactorPrice;oSearch.displaySettings.priceType==priceTypeEnum.PriceList?CheckRadioButton("rdPriceDiv","rdIfatPriceDiv"):oSearch.displaySettings.priceType==priceTypeEnum.IfatFactorPrice&&CheckRadioButton("rdIfatPriceDiv","rdPriceDiv");oSearch.displaySettings.isExcel==1&&($("#lblExcel").children("div").addClass("chk-checked"),$("#lblExcel").children("input[type=checkbox]").prop("checked",!0));oSearch.displaySettings.isMediaBuyer==1&&($("#lblMediaBuyer").children("div").addClass("chk-checked"),$("#lblMediaBuyer").children("input[type=checkbox]").prop("checked",!0));oSearch.displaySettings.useRatingChannels==1&&($("#lblChannel").children("div").addClass("chk-checked"),$("#lblChannel").children("input[type=checkbox]").prop("checked",!0))}function CheckRadioButton(n,t){$("#"+n).children("input[type=radio]").attr("checked",!0);$("#"+n).children("div").attr("class","rad-area rad-checked");$("#"+t).children("div").attr("class","rad-area rad-unchecked");$("#"+t).children("input[type=radio]").removeAttr("checked")}function UncheckReportType(n){switch(n){case"mediabuyer":$("#lblMediaBuyer").children("div").removeClass("chk-checked");$("#lblMediaBuyer").children("input[type=checkbox]").prop("checked",!1);SetReportMode("mediabuyer",oSearch,0);break;case"ratingchannels":$("#lblChannel").children("div").removeClass("chk-checked");$("#lblChannel").children("input[type=checkbox]").prop("checked",!1);SetReportMode("ratingchannels",oSearch,0)}}function SwitchLetter_manager(){$("ul.index-list").children("li").click(function(){$("input#shareto").val($(this).data("val"));var n=$("input#shareto").val();RenderLetterData_manager(n);setTimeout("SetSearchDef_manager();",400);setTimeout("AttachManagerClicks()",400);CreateTagContainer()})}function AttachManagerClicks(){$("ul.managers-list").children("li").each(function(){$(this).children("label").click(function(){var r=$(this).find("input[type=checkbox]").attr("name"),i=$(this).find("input[type=checkbox]"),n=i.val().split("#"),t=$(this).attr("class");t==undefined||t==""?(AddManager(oSearch,n[1],n[0]),AddSidebarItem("divManagerAcData","ulSBManager","liSBManagers","ulManagers",n[1],n[0],"manager",$(this),"lblManager","משרד פרסום")):(RemoveManager(oSearch,n[1]),RemoveSidebarItem("manager",n[1],"aRemovemanager_"+n[1],!0,"lblManager"))});$(this).children("label").children("div").click(function(){var r=$(this).parent().find("input[type=checkbox]").attr("name"),t=$(this).parent().find("input[type=checkbox]"),n=t.val().split("#"),i=$(this).attr("class");i.indexOf("chk-unchecked")>-1?(AddManager(oSearch,n[1],n[0]),AddSidebarItem("divManagerAcData","ulSBManager","liSBManagers","ulManagers",n[1],n[0],"manager",$(this),"lblManager","משרד פרסום")):(RemoveManager(oSearch,n[1]),RemoveSidebarItem("manager",n[1],"aRemovemanager_"+n[1],!0,"lblManager"))})})}function SetSearchDef_manager(){for(i=0;i<oSearch.advManager.manager_list.length;i++)$("#Manager_"+oSearch.advManager.manager_list[i].ManagerID).parent().children("div").removeClass("chk-unchecked"),$("#Manager_"+oSearch.advManager.manager_list[i].ManagerID).parent().children("div").addClass("jcf-unselectable chk-area chk-checked"),$("#Manager_"+oSearch.advManager.manager_list[i].ManagerID).parent().addClass("chk-label-active"),$("#Manager_"+oSearch.advManager.manager_list[i].ManagerID).prop("checked",!0)}function RenderLetterData_manager(n){$.ajax(document.getElementById("spnBaseUrlSearch").innerHTML+"Update_Manager_Data",{data:{letter:n},success:function(n){$("#divLettersUpdate").html(n);$("#divLettersUpdate").height()<280&&$("#divLettersUpdate").height(280);$("#divLettersUpdate").parent().height()<280&&$("#divLettersUpdate").parent().height(280);initResizeList()},error:function(){console.log("RenderLetterData_manager - ajax error")},dataType:"html",cache:!1,async:!1})}function SwitchLetter_handler(){$("ul.index-list").children("li").click(function(){$("input#shareto").val($(this).data("val"));var n=$("input#shareto").val();RenderLetterData_handler(n);setTimeout(function(){SetSearchDef_handler();AttachHandlerClicks()},400);CreateTagContainer()})}function SetSearchDef_handler(){for(var n,t=0;t<oSearch.advAdvertiser.handler_list.length;t++)n=$("#Handler_"+oSearch.advAdvertiser.handler_list[t].HandlerID),n.parent().children("div").removeClass("chk-unchecked"),n.parent().children("div").addClass("jcf-unselectable chk-area chk-checked"),n.parent().addClass("chk-label-active"),n.prop("checked",!0)}function RenderLetterData_handler(n){$.ajax(document.getElementById("spnBaseUrlSearch").innerHTML+"Update_Handler_Data",{data:{letter:n},success:function(n){$("#divLettersUpdate").html(n);initResizeList()},error:function(){console.log("Update handler data - ajax error")},dataType:"html",cache:!1,async:!1})}function AttachHandlerClicks(){$("ul.celebs-list").children("li").each(function(){$(this).children("label").click(function(){var r=$(this).find("input[type=checkbox]").attr("name"),i=$(this).find("input[type=checkbox]"),n=i.val().split("#"),t=$(this).attr("class");t==undefined||t==""?(AddHandler(oSearch,n[1],n[0]),AddSidebarItem("divAdvertiserAcData","ulSBAdvertiser","liSBHandlers","ulHandlers",n[1],n[0],"handler",$(this),"lblHandler","אחזקות")):(RemoveHandler(oSearch,n[1]),RemoveSidebarItem("handler",n[1],"aRemovehandler_"+n[1],!0,"lblHandler"))});$(this).children("label").children("div").click(function(){var r=$(this).parent().find("input[type=checkbox]").attr("name"),t=$(this).parent().find("input[type=checkbox]"),n=t.val().split("#"),i=$(this).attr("class");i.indexOf("chk-unchecked")>-1?(AddHandler(oSearch,n[1],n[0]),AddSidebarItem("divAdvertiserAcData","ulSBAdvertiser","liSBHandlers","ulHandlers",n[1],n[0],"handler",$(this),"lblHandler","אחזקות")):(RemoveHandler(oSearch,n[1]),RemoveSidebarItem("handler",n[1],"aRemovehandler_"+n[1],!0,"lblHandler"))})})}function AttachAdvertiserClicks(){$("ul.items-list").children("li").each(function(){$(this).children().children("label").click(function(){var r=$(this).parent().find("input[type=checkbox]").attr("name"),i=$(this).parent().find("input[type=checkbox]"),n=i.val().split("#"),t=$(this).attr("class");t==undefined||t==""||t=="label"?(AddAdvertiser(oSearch,n[1],n[0]),AddSidebarItem("divAdvertiserAcData","ulSBAdvertiser","liSBAdvertisers","ulAdvertisers",n[1],n[0],"advertiser",$(this),"lblAdvertiser","מפרסם")):(RemoveAdvertiser(oSearch,n[1]),RemoveSidebarItem("advertiser",n[1],"aRemoveadvertiser_"+n[1],!0,"lblAdvertiser"))});$(this).children().children("label").children("div").click(function(){var r=$(this).parent().find("input[type=checkbox]").attr("name"),t=$(this).parent().find("input[type=checkbox]"),n=t.val().split("#"),i=$(this).attr("class");i.indexOf("chk-unchecked")>-1?(AddAdvertiser(oSearch,n[1],n[0]),AddSidebarItem("divAdvertiserAcData","ulSBAdvertiser","liSBAdvertisers","ulAdvertisers",n[1],n[0],"advertiser",$(this),"lblAdvertiser","מפרסם")):(RemoveAdvertiser(oSearch,n[1]),RemoveSidebarItem("advertiser",n[1],"aRemoveadvertiser_"+n[1],!0,"lblAdvertiser"))})});$("#aSelectAll").click(function(){$("#advresize").children("ul").children("li").each(function(){$(this).children("div").children("label").attr("class","chk-label-active");$(this).children("div").children("label").children("div").attr("class","jcf-unselectable chk-area chk-checked");$(this).children("div").children("label").children("input").prop("checked",!0);$(this).children("div").addClass("checked");var n=$(this).children("div").children("label").children("input").val().split("#");AddAdvertiser(oSearch,n[1],n[0]);AddSidebarItem("divAdvertiserAcData","ulSBAdvertiser","liSBAdvertisers","ulAdvertisers",n[1],n[0],"advertiser",$(this).children("div").children("label"),"lblAdvertiser","מפרסם")})});$("#aDeSelectAll").click(function(){$("#advresize").children("ul").children("li").each(function(){var r,i,n,u,t,f;$(this).children("div").children("label").attr("class","");$(this).children("div").children("label").children("div").attr("class","jcf-unselectable chk-area chk-unchecked");$(this).children("div").children("label").children("input").prop("checked",!1);$(this).children("div").removeClass("checked");r=$(this).children("div").children("label").children("input").val().split("#");RemoveAdvertiser(oSearch,r[1]);RemoveSidebarItem("advertiser",r[1],"aRemoveadvertiser_"+r[1],!0,"lblAdvertiser");i=$(this).find("div[class=slide]");i.length>0&&(n=$(i[0]).children("ul").children("li"),$(n).children("div").children("label").attr("class",""),$(n).children("div").children("label").children("div").attr("class","jcf-unselectable chk-area chk-unchecked"),$(n).children("div").children("label").children("input").prop("checked",!1),$(n).children("div").removeClass("checked"),u=$(n).children("div").children("label").children("input").val().split("#"),RemoveBrand(oSearch,u[1]),RemoveSidebarItem("brand",u[1],"aRemovebrand_"+u[1],!0,"lblBrand"),i.length>1&&(t=$(i[1]).children("ul").children("li"),$(t).children("div").children("label").attr("class",""),$(t).children("div").children("label").children("div").attr("class","jcf-unselectable chk-area chk-unchecked"),$(t).children("div").children("label").children("input").prop("checked",!1),$(t).children("div").removeClass("checked"),f=$(t).children("div").children("label").children("input").val().split("#"),RemoveProduct(oSearch,f[1]),RemoveSidebarItem("product",f[1],"aRemoveproduct_"+f[1],!0,"lblProduct")))})});$("#OpenCloseHandler").click(function(){$("#HandlerSlide").hasClass("expanded")?$("#HandlerSlide").removeClass("expanded"):($("#HandlerSlide").addClass("expanded"),$("#divHandlerData").children(".results-area").children(".scrollable-area-wrapper").height()==0&&($("#divHandlerData").children(".results-area").children(".scrollable-area-wrapper").height(253),$("#divHandlerData").children(".results-area").children(".scrollable-area-wrapper").width($("#divHandlerData").width()-5),$("#divHandlerData").children(".results-area").children(".scrollable-area-wrapper").children(".scrollable-area").height(253),$("#divHandlerData").children(".results-area").children(".scrollable-area-wrapper").children(".scrollable-area").width($("#divHandlerData").width()-5),initResizeList()),AttachHandlerClicks(),SetSearchDef_handler())})}function CreateAdvContainer(){AdvContainer={AdvertiserList:[],BrandList:[],AddAdvertiser:function(n){var t=!1;for(i=0;i<this.AdvertiserList.length;i++)if(this.AdvertiserList[i]==n){t=!0;break}t||this.AdvertiserList.push(n)},AddBrand:function(n){var t=!1;for(i=0;i<this.BrandList.length;i++)if(this.BrandList[i]==n){t=!0;break}t||this.BrandList.push(n)},CheckExist:function(n,t){switch(n){case"Advertiser":for(i=0;i<this.AdvertiserList.length;i++)if(this.AdvertiserList[i]==t)return!0;return!1;case"Brand":for(i=0;i<this.BrandList.length;i++)if(this.BrandList[i]==t)return!0;return!1}}}}function OpenAdvertiser(n,t){advLi=$("#Advli_"+n);advLi.hasClass("opened")?t&&advLi.removeClass("opened"):AdvContainer.CheckExist("Advertiser",n)?$("#AdvData_"+n).parent("li").addClass("opened"):$.ajax(document.getElementById("spnBaseUrlSearch").innerHTML+"Update_Brand_Data",{data:{advertiserID:n},success:function(t){$("#AdvData_"+n).html(t);$("#AdvData_"+n).parent("li").addClass("opened");AdvContainer.AddAdvertiser(n);initResizeSpecificList_V2("divData_"+n);$("#AdvData_"+n).parents(".scrollable-area").height(500);$("#AdvData_"+n).parents(".scrollable-area-wrapper").height(500);PushBrand($("#divData_"+n).children("ul"))},error:function(){console.log("Update brand data - ajax error")},dataType:"html",cache:!1,async:!1})}function OpenBrand(n,t,i){brandLi=$("#Brandli_"+n+"_"+t);brandLi.hasClass("opened")?i&&brandLi.removeClass("opened"):AdvContainer.CheckExist("Brand",t)?$("#BrandData_"+n+"_"+t).parent("li").addClass("opened"):$.ajax(document.getElementById("spnBaseUrlSearch").innerHTML+"Update_Product_Data",{cache:!1,data:{brandID:t},success:function(i){$("#BrandData_"+n+"_"+t).html(i);$("#BrandData_"+n+"_"+t).parent("li").addClass("opened");AdvContainer.AddBrand(t);initResizeSpecificList_V2("divData_"+t);PushProduct($("#divData_"+t).children("ul"))},error:function(){console.log("Update product data - ajax error")},dataType:"html",cache:!1,async:!1})}function PushBrand(n){$(n).children("li").each(function(){$(this).children().children("label").click(function(){var f=$(this).parent().find("input[type=checkbox]").attr("name"),u=$(this).parent().find("input[type=checkbox]"),n=u.val().split("#"),r=$(this).attr("class"),t,i;if(r==undefined||r=="")AddBrand(oSearch,n[1],n[0],n[2]),AddSidebarItem("divAdvertiserAcData","ulSBAdvertiser","liSBBrands","ulBrands",n[1],n[0],"brand",$(this),"lblBrand","מותג");else{for(i=0;i<oSearch.advAdvertiser.brand_list.length;i++)if(t=oSearch.advAdvertiser.brand_list[i],t.BrandID==n[1])break;t!=null&&(RemoveBrand(oSearch,n[1]),RemoveSidebarItem("brand",n[1],"aRemovebrand_"+n[1],!0,"lblBrand",t.AdvertiserID))}});$(this).children().children("label").children("div").click(function(){var f=$(this).parent().find("input[type=checkbox]").attr("name"),r=$(this).parent().find("input[type=checkbox]"),n=r.val().split("#"),u=$(this).attr("class"),t,i;if(u.indexOf("chk-unchecked")>-1)AddBrand(oSearch,n[1],n[0],n[2]),AddSidebarItem("divAdvertiserAcData","ulSBAdvertiser","liSBBrands","ulBrands",n[1],n[0],"brand",$(this),"lblBrand","מותג");else{for(i=0;i<oSearch.advAdvertiser.brand_list.length;i++)if(t=oSearch.advAdvertiser.brand_list[i],t.BrandID==n[1])break;t!=null&&(RemoveBrand(oSearch,n[1]),RemoveSidebarItem("brand",n[1],"aRemovebrand_"+n[1],!0,"lblBrand",t.AdvertiserID))}})})}function PushProduct(n){$(n).children("li").each(function(){$(this).children().children("label").click(function(){var r=$(this).parent().find("input[type=checkbox]").attr("name"),i=$(this).parent().find("input[type=checkbox]"),n=i.val().split("#"),t=$(this).attr("class");t==undefined||t==""?(AddProduct(oSearch,n[1],n[0],n[2],n[3]),AddSidebarItem("divAdvertiserAcData","ulSBAdvertiser","liSBProducts","ulProducts",n[1],n[0],"product",$(this),"lblProd","מוצר")):(RemoveProduct(oSearch,n[1]),RemoveSidebarItem("product",n[1],"aRemoveproduct_"+n[1],!0,"lblProd"))});$(this).children().children("label").children("div").click(function(){var r=$(this).parent().find("input[type=checkbox]").attr("name"),t=$(this).parent().find("input[type=checkbox]"),n=t.val().split("#"),i=$(this).attr("class");i.indexOf("chk-unchecked")>-1?(AddProduct(oSearch,n[1],n[0],n[2],n[3]),AddSidebarItem("divAdvertiserAcData","ulSBAdvertiser","liSBProducts","ulProducts",n[1],n[0],"product",$(this),"lblProd","מוצר")):(RemoveProduct(oSearch,n[1]),RemoveSidebarItem("product",n[1],"aRemoveproduct_"+n[1],!0,"lblProd"))})})}function SetSearchDef_advertiser(){ExpandSelected_advertiser();CheckSelected_advertiser()}function CheckSelected_advertiser(){for(var n,t=0;t<oSearch.advAdvertiser.advertiser_list.length;t++)$("#Advertiser_"+oSearch.advAdvertiser.advertiser_list[t].AdvertiserID).parent().children("div").removeClass("chk-unchecked"),$("#Advertiser_"+oSearch.advAdvertiser.advertiser_list[t].AdvertiserID).parent().children("div").addClass("jcf-unselectable chk-area chk-checked"),$("#Advertiser_"+oSearch.advAdvertiser.advertiser_list[t].AdvertiserID).parent("label").addClass("chk-label-active"),$("#Advertiser_"+oSearch.advAdvertiser.advertiser_list[t].AdvertiserID).prop("checked",!0);for(n=0;n<oSearch.advAdvertiser.brand_list.length;n++)$("#Brand_"+oSearch.advAdvertiser.brand_list[n].AdvertiserID+"_"+oSearch.advAdvertiser.brand_list[n].BrandID).parent().children("div").removeClass("chk-unchecked"),$("#Brand_"+oSearch.advAdvertiser.brand_list[n].AdvertiserID+"_"+oSearch.advAdvertiser.brand_list[n].BrandID).parent().children("div").addClass("jcf-unselectable chk-area chk-checked"),$("#Brand_"+oSearch.advAdvertiser.brand_list[n].AdvertiserID+"_"+oSearch.advAdvertiser.brand_list[n].BrandID).parent("label").addClass("chk-label-active"),$("#Brand_"+oSearch.advAdvertiser.brand_list[n].AdvertiserID+"_"+oSearch.advAdvertiser.brand_list[n].BrandID).prop("checked",!0);for(k=0;k<oSearch.advAdvertiser.product_list.length;k++)$("#Product_"+oSearch.advAdvertiser.product_list[k].ProductID).parent().children("div").removeClass("chk-unchecked"),$("#Product_"+oSearch.advAdvertiser.product_list[k].ProductID).parent().children("div").addClass("jcf-unselectable chk-area chk-checked"),$("#Product_"+oSearch.advAdvertiser.product_list[k].ProductID).parent("label").addClass("chk-label-active"),$("#Product_"+oSearch.advAdvertiser.product_list[k].ProductID).prop("checked",!0)}function ExpandSelected_advertiser(){for(var t,n=0;n<oSearch.advAdvertiser.product_list.length;n++)OpenAdvertiser(oSearch.advAdvertiser.product_list[n].AdvertiserID,!1),OpenBrand(oSearch.advAdvertiser.product_list[n].AdvertiserID,oSearch.advAdvertiser.product_list[n].BrandID,!1);for(t=0;t<oSearch.advAdvertiser.brand_list.length;t++)OpenAdvertiser(oSearch.advAdvertiser.brand_list[t].AdvertiserID,!1)}function MediaPageEvents(){setTimeout(function(){CreateAutoCompleteElement("searchOperator","GetValues?type=operator");SetSearchDef_media();AttachMediaClicks()},500);CreateTagContainer();bLoadedTvData=!1;bLoadedPressData=!1;bLoadedInternetData=!1;bLoadedRadioData=!1;bLoadedBillboardData=!1;bLoadedCinemaData=!1}function AttachMediaClicks(){var n=1,t=2,i=5,r=3,f=6,u=4;$("#divSectors").children("ul").children("li").each(function(){$(this).click(function(){var e=$(this).val(),o=$(this).find("a").text();$(this).hasClass("selected")?(SaveValue(document.fr.SelectedSectors,!0,e),AddSector(oSearch,e,o),AddSidebarItem("divMediaData","ulSBMedia","liSBSectors","ulSectors",e,o,"sector",$(this),"lblSector","מגזר")):(SaveValue(document.fr.SelectedSectors,!1,e),RemoveSector(oSearch,e),RemoveSidebarItem("sector",e,"aRemovesector_"+e,!0,"lblSector"));bLoadedTvData&&LoadData(n,"operator","divTVData");bLoadedPressData&&LoadData(t,"operator","divPressData");bLoadedInternetData&&LoadData(i,"operator","divInternetData");bLoadedRadioData&&LoadData(r,"operator","divRadioData");bLoadedBillboardData&&LoadData(u,"operator","divBillboardData");bLoadedCinemaData&&LoadData(f,"operator","divCinemaData")})});$("#divTvOpGroup").children("ul").children("li").each(function(){$(this).click(function(){var t=$(this).val(),i=$(this).find("a").text(),r=$(this).attr("value2");$(this).hasClass("selected")?(SaveValue(document.fr.SelectedTvOperatorGroups,!0,t),AddOperatorGroup(oSearch,t,i,r),AddSidebarItem("divMediaData","ulSBMedia","liSBOpGroups","ulOpGroups",t,i,"operatorgroup",$(this),"lblOpGroup","ערוץ מדיה")):(SaveValue(document.fr.SelectedTvOperatorGroups,!1,t),RemoveOperatorGroup(oSearch,t),RemoveSidebarItem("operatorgroup",t,"aRemoveoperatorgroup_"+t,!0,"lblOpGroup"));bLoadedTvData&&LoadData(n,"operator","divTVData")})});$("#divPressOpGroup").children("ul").children("li").each(function(){$(this).click(function(){var n=$(this).val(),i=$(this).find("a").text(),r=$(this).attr("value2");$(this).hasClass("selected")?(SaveValue(document.fr.SelectedPressOperatorGroups,!0,n),AddOperatorGroup(oSearch,n,i,r),AddSidebarItem("divMediaData","ulSBMedia","liSBOpGroups","ulOpGroups",n,i,"operatorgroup",$(this),"lblOpGroup","ערוץ מדיה")):(SaveValue(document.fr.SelectedPressOperatorGroups,!1,n),RemoveOperatorGroup(oSearch,n),RemoveSidebarItem("operatorgroup",n,"aRemoveoperatorgroup_"+n,!0,"lblOpGroup"));bLoadedPressData&&LoadData(t,"operator","divPressData")})});$("#divInternetOpGroup").children("ul").children("li").each(function(){$(this).click(function(){var n=$(this).val(),t=$(this).find("a").text(),r=$(this).attr("value2");$(this).hasClass("selected")?(SaveValue(document.fr.SelectedInetOperatorGroups,!0,n),AddOperatorGroup(oSearch,n,t,r),AddSidebarItem("divMediaData","ulSBMedia","liSBOpGroups","ulOpGroups",n,t,"operatorgroup",$(this),"lblOpGroup","ערוץ מדיה")):(SaveValue(document.fr.SelectedInetOperatorGroups,!1,n),RemoveOperatorGroup(oSearch,n),RemoveSidebarItem("operatorgroup",n,"aRemoveoperatorgroup_"+n,!0,"lblOpGroup"));bLoadedInternetData&&LoadData(i,"operator","divInternetData")})});$("#divRadioOpGroup").children("ul").children("li").each(function(){$(this).click(function(){var n=$(this).val(),t=$(this).find("a").text(),i=$(this).attr("value2");$(this).hasClass("selected")?(SaveValue(document.fr.SelectedRadioOperatorGroups,!0,n),AddOperatorGroup(oSearch,n,t,i),AddSidebarItem("divMediaData","ulSBMedia","liSBOpGroups","ulOpGroups",n,t,"operatorgroup",$(this),"lblOpGroup","ערוץ מדיה")):(SaveValue(document.fr.SelectedRadioOperatorGroups,!1,n),RemoveOperatorGroup(oSearch,n),RemoveSidebarItem("operatorgroup",n,"aRemoveoperatorgroup_"+n,!0,"lblOpGroup"));bLoadedInternetData&&LoadData(r,"operator","divRadioData")})});$("#divBillboardOpGroup").children("ul").children("li").each(function(){$(this).click(function(){var n=$(this).val(),t=$(this).find("a").text(),i=$(this).attr("value2");$(this).hasClass("selected")?(SaveValue(document.fr.SelectedBillOperatorGroups,!0,n),AddOperatorGroup(oSearch,n,t,i),AddSidebarItem("divMediaData","ulSBMedia","liSBOpGroups","ulOpGroups",n,t,"operatorgroup",$(this),"lblOpGroup","ערוץ מדיה")):(SaveValue(document.fr.SelectedBillOperatorGroups,!1,n),RemoveOperatorGroup(oSearch,n),RemoveSidebarItem("operatorgroup",n,"aRemoveoperatorgroup_"+n,!0,"lblOpGroup"));bLoadedBillboardData&&LoadData(u,"operator","divBillboardData")})});$("#divTVButton").click(function(t){t.target.className!="link"&&($("#divTV").attr("class").indexOf("expanded")==-1?($("#divTV").addClass("expanded"),bLoadedTvData||LoadData(n,"operator","divTVData")):$("#divTV").removeClass("expanded"),t.preventDefault())});$("#divPressButton").click(function(n){n.target.className!="link"&&($("#divPress").attr("class").indexOf("expanded")==-1?($("#divPress").addClass("expanded"),bLoadedPressData||LoadData(t,"operator","divPressData")):$("#divPress").removeClass("expanded"),n.preventDefault())});$("#divInternetButton").click(function(n){n.target.className!="link"&&($("#divInternet").attr("class").indexOf("expanded")==-1?($("#divInternet").addClass("expanded"),bLoadedInternetData||LoadData(i,"operator","divInternetData")):$("#divInternet").removeClass("expanded"),n.preventDefault())});$("#divRadioButton").click(function(n){n.target.className!="link"&&($("#divRadio").attr("class").indexOf("expanded")==-1?($("#divRadio").addClass("expanded"),bLoadedRadioData||LoadData(r,"operator","divRadioData")):$("#divRadio").removeClass("expanded"),n.preventDefault())});$("#divBillboardButton").click(function(n){n.target.className!="link"&&($("#divBillboard").attr("class").indexOf("expanded")==-1?($("#divBillboard").addClass("expanded"),bLoadedBillboardData||LoadData(u,"operator","divBillboardData")):$("#divBillboard").removeClass("expanded"),n.preventDefault())});$("#divCinemaButton").click(function(n){n.target.className!="link"&&($("#divCinema").attr("class").indexOf("expanded")==-1?($("#divCinema").addClass("expanded"),bLoadedCinemaData||LoadData(f,"operator","divCinemaData")):$("#divCinema").removeClass("expanded"),n.preventDefault())});AttachSelectAllOp()}function LoadData(n,t,i){var u="",r;onSearchPhraseMode&&(u=searchPhraseData);r="";switch(n){case 1:r=document.getElementById("SelectedTvOperatorGroups").value;break;case 2:r=document.getElementById("SelectedPressOperatorGroups").value;break;case 3:r=document.getElementById("SelectedRadioOperatorGroups").value;break;case 4:r=document.getElementById("SelectedBillOperatorGroups").value;break;case 5:r=document.getElementById("SelectedInetOperatorGroups").value}$.ajax(document.getElementById("spnBaseUrlSearch").innerHTML+"LoadData",{cache:!1,data:{dataName:t,OperatorTypeID:n,SectorIDs:document.getElementById("SelectedSectors").value,GroupIDs:r,searchPhrase:u},success:function(n){var r,t;$("#"+i).html(n);r=GetScreenWidth();document.getElementById(i).parentElement.style.height="167px";document.getElementById(i).parentElement.parentElement.style.height="167px";document.getElementById(i).parentElement.style.width=r-420+"px";document.getElementById(i).parentElement.parentElement.style.width=r-420+"px";t="";switch(i){case"divTVData":bLoadedTvData=!0;t="divTvResults";break;case"divPressData":bLoadedPressData=!0;t="divPressResults";break;case"divInternetData":bLoadedInternetData=!0;t="divInternetResults";break;case"divRadioData":bLoadedRadioData=!0;t="divRadioResults";break;case"divBillboardData":bLoadedBillboardData=!0;t="divBillResults";break;case"divCinemaData":bLoadedCinemaData=!0;t="divCinemaResults"}initResizeSpecificList(t);$("#"+t).find("ul.media-list").children("li").each(function(){$(this).children("label").click(function(){var i=$(this).parent().find("input[type=checkbox]"),n=i.val().split("#"),t=$(this).attr("class");t==undefined||t==""?(AddOperator(oSearch,n[1],n[0],n[2]),AddSidebarItem("divMediaData","ulSBMedia","liSBOperators","ulOperators",n[1],n[0],"operator",$(this),"lblOp","זכיין")):(RemoveOperator(oSearch,n[1]),RemoveSidebarItem("operator",n[1],"aRemoveoperator_"+n[1],!0,"lblOp"))});$(this).children("label").children("div").click(function(){var t=$(this).parent().find("input[type=checkbox]"),n=t.val().split("#"),i=$(this).attr("class");i.indexOf("chk-unchecked")>-1?(AddOperator(oSearch,n[1],n[0],n[2]),AddSidebarItem("divMediaData","ulSBMedia","liSBOperators","ulOperators",n[1],n[0],"operator",$(this),"lblOp","זכיין")):(RemoveOperator(oSearch,n[1]),RemoveSidebarItem("operator",n[1],"aRemoveoperator_"+n[1],!0,"lblOp"))})})},dataType:"html"})}function SaveValue(n,t,i){var r=n.value;t?r.indexOf(","+i)==-1&&(r+=","+i):r=RemoveFromMarked(r,i);n.value=r}function RemoveFromMarked(n,t){var i=","+n;return i.indexOf(t)>-1&&(strArr=i.split(","+t),i=strArr[0]+strArr[1]),i.charAt(0)==","&&(i=i.substring(1,i.length)),i}function AttachSelectAllOp(){$("#SelectAllTVButton").click(function(){$("#divTVData").children("div").children("ul").children("li").each(function(){AddOperatorItem($(this))})});$("#SelectAllPressButton").click(function(){$("#divPressData").children("div").children("ul").children("li").each(function(){AddOperatorItem($(this))})});$("#SelectAllInternetButton").click(function(){$("#divInternetData").children("div").children("ul").children("li").each(function(){AddOperatorItem($(this))})});$("#SelectAllRadioButton").click(function(){$("#divRadioData").children("div").children("ul").children("li").each(function(){AddOperatorItem($(this))})});$("#SelectAllBillboardButton").click(function(){$("#divBillboardData").children("div").children("ul").children("li").each(function(){AddOperatorItem($(this))})});$("#SelectAllCinemaButton").click(function(){$("#divCinemaData").children("div").children("ul").children("li").each(function(){AddOperatorItem($(this))})});$("#DeSelectAllTVButton").click(function(){$("#divTVData").children("div").children("ul").children("li").each(function(){RemoveOperatorItem($(this))})});$("#DeSelectAllPressButton").click(function(){$("#divPressData").children("div").children("ul").children("li").each(function(){RemoveOperatorItem($(this))})});$("#DeSelectAllInternetButton").click(function(){$("#divInternetData").children("div").children("ul").children("li").each(function(){RemoveOperatorItem($(this))})});$("#DeSelectAllRadioButton").click(function(){$("#divRadioData").children("div").children("ul").children("li").each(function(){RemoveOperatorItem($(this))})});$("#DeSelectAllBillboardButton").click(function(){$("#divBillboardData").children("div").children("ul").children("li").each(function(){RemoveOperatorItem($(this))})});$("#DeSelectAllCinemaButton").click(function(){$("#divCinemaData").children("div").children("ul").children("li").each(function(){RemoveOperatorItem($(this))})})}function AddOperatorItem(n){n.children("label").attr("class","chk-label-active");n.children("label").children("div").attr("class","jcf-unselectable chk-area chk-checked");n.children("label").children("input").prop("checked",!0);var t=n.children("label").children("input").val().split("#");AddOperator(oSearch,t[1],t[0],t[2]);AddSidebarItem("divMediaData","ulSBMedia","liSBOperators","ulOperators",t[1],t[0],"operator",n.children("label"),"lblOp","זכיין")}function RemoveOperatorItem(n){n.children("label").attr("class","");n.children("label").children("div").attr("class","jcf-unselectable chk-area chk-unchecked");n.children("label").children("input").prop("checked",!1);var t=n.children("label").children("input").val().split("#");RemoveOperator(oSearch,t[1]);RemoveSidebarItem("operator",t[1],"aRemoveoperator_"+t[1],!0,"lblOp")}function ChooseOperatorType(n,t){AddOperatorType(oSearch,n,t);UpdateSideBar("operatortype",n,t)}function ChooseAdElement(n,t){AddElement(oSearch,n,t);UpdateSideBar("element",n,t)}function SetSearchDef_media(){for(var i=1,r=2,u=5,f=3,e=6,o=4,s=!1,h=!1,c=!1,l=!1,a=!1,v=!1,t,n=0;n<oSearch.media.sector_list.length;n++)$("#secId_"+oSearch.media.sector_list[n].SectorID).attr("class","selected"),document.getElementById("SelectedSectors").value+=","+oSearch.media.sector_list[n].SectorID;for(n=0;n<oSearch.media.operatorGroup_list.length;n++){$("#opgId_"+oSearch.media.operatorGroup_list[n].OperatorGroupID).attr("class","selected");t="";switch(parseInt(oSearch.media.operatorGroup_list[n].OperatorTypeID)){case i:t="SelectedTvOperatorGroups";break;case r:t="SelectedPressOperatorGroups";break;case u:t="SelectedInetOperatorGroups";break;case f:t="SelectedRadioOperatorGroups";break;case o:t="SelectedBillOperatorGroups";break;case e:t=""}document.getElementById(t).value+=","+oSearch.media.operatorGroup_list[n].OperatorGroupID}for(n=0;n<oSearch.media.operator_list.length;n++)oSearch.media.operator_list[n].OperatorTypeID!=i||s||($("#divTV").addClass("expanded"),LoadData(i,"operator","divTVData"),s=!0),oSearch.media.operator_list[n].OperatorTypeID!=r||h||($("#divPress").addClass("expanded"),LoadData(r,"operator","divPressData"),h=!0),oSearch.media.operator_list[n].OperatorTypeID!=u||c||($("#divInternet").addClass("expanded"),LoadData(u,"operator","divInternetData"),c=!0),oSearch.media.operator_list[n].OperatorTypeID!=f||l||($("#divRadio").addClass("expanded"),LoadData(f,"operator","divRadioData"),l=!0),oSearch.media.operator_list[n].OperatorTypeID!=e||a||($("#divCinema").addClass("expanded"),LoadData(e,"operator","divCinemaData"),a=!0),oSearch.media.operator_list[n].OperatorTypeID!=o||v||($("#divBillboardButton").addClass("expanded"),LoadData(o,"operator","divBillboardData"),v=!0)}function AttachProgramClicks(){CreateTagContainer();$("#divTVButton").click(function(n){if($("#divTV").attr("class").indexOf("expanded")==-1){$("#divTV").addClass("expanded");var t=GetScreenWidth();SetDivDimentions("divTVData",t-410,400);initResizeSpecificList("divTvResults");replaceFormsIn($("#ulPlaceTV"));AttachItemsClick()}else $("#divTV").removeClass("expanded");n.preventDefault()});$("#divPressButton").click(function(n){if($("#divPress").attr("class").indexOf("expanded")==-1){$("#divPress").addClass("expanded");var t=GetScreenWidth();SetDivDimentions("divPressData",t-410,400);initResizeSpecificList("divPressResults");AttachItemsClick()}else $("#divPress").removeClass("expanded");n.preventDefault()});$("#divInternetButton").click(function(n){if($("#divInternet").attr("class").indexOf("expanded")==-1){$("#divInternet").addClass("expanded");var t=GetScreenWidth();SetDivDimentions("divInternetData",t-410,400);initResizeSpecificList("divInternetResults");replaceFormsIn($("#ulPlaceInet"));AttachItemsClick()}else $("#divInternet").removeClass("expanded");n.preventDefault()});$("#divRadioButton").click(function(n){if($("#divRadio").attr("class").indexOf("expanded")==-1){$("#divRadio").addClass("expanded");var t=GetScreenWidth();SetDivDimentions("divRadioData",t-410,400);initResizeSpecificList("divRadioResults");AttachItemsClick()}else $("#divRadio").removeClass("expanded");n.preventDefault()});$("#divBillboardButton").click(function(n){if($("#divBillboard").attr("class").indexOf("expanded")==-1){$("#divBillboard").addClass("expanded");var t=GetScreenWidth();SetDivDimentions("divBillboardData",t-410,400);initResizeSpecificList("divBillboardResults");AttachItemsClick()}else $("#divBillboard").removeClass("expanded");n.preventDefault()});$("#divCinemaButton").click(function(n){if($("#divCinema").attr("class").indexOf("expanded")==-1){$("#divCinema").addClass("expanded");var t=GetScreenWidth();SetDivDimentions("divCinemaData",t-410,400);initResizeSpecificList("divCinemaResults");AttachItemsClick()}else $("#divCinema").removeClass("expanded");n.preventDefault()});AttachItemsClick();AttachSelectAllProg()}function AttachItemsClick(){$("ul.media-list").children("li").each(function(){var n=$(this).parent().attr("id");$(this).children("label").click(function(){var r=$(this).parent().find("input[type=checkbox]"),t=r.val().split("#"),i=$(this).attr("class");n=="ulPlaceTV"||n=="ulPlaceInet"?i==undefined||i==""?(AddPlace(oSearch,t[1],t[0]),AddSidebarItem("divMediaData","ulSBMedia","liSBPlaces","ulPlaces",t[1],t[0],"place",$(this),"lblPlace","אלמנט פרסומי")):(RemovePlace(oSearch,t[1]),RemoveSidebarItem("place",t[1],"aRemoveplace_"+t[1],!0,"lblPlace")):i==undefined||i==""?(AddProgram(oSearch,t[1],t[0],t[2]),AddSidebarItem("divMediaData","ulSBMedia","liSBPrograms","ulPrograms",t[1],t[0],"program",$(this),"lblProg","מקום")):(RemoveProgram(oSearch,t[1]),RemoveSidebarItem("program",t[1],"aRemoveprogram_"+t[1],!0,"lblProg"))});$(this).children("label").children("div").click(function(){var t=$(this).parent().attr("id"),r=$(this).parent().find("input[type=checkbox]"),n=r.val().split("#"),i=$(this).attr("class");t=="ulPlaceTV"||t=="ulPlaceInet"?i.indexOf("chk-unchecked")>-1?(AddPlace(oSearch,n[1],n[0]),AddSidebarItem("divMediaData","ulSBMedia","liSBPlaces","ulPlaces",n[1],n[0],"place",$(this),"lblPlace","אלמנט פרסומי")):(RemovePlace(oSearch,n[1]),RemoveSidebarItem("place",n[1],"aRemoveplace_"+n[1],!0,"lblPlace")):i.indexOf("chk-unchecked")>-1?(AddProgram(oSearch,n[1],n[0],n[2]),AddSidebarItem("divMediaData","ulSBMedia","liSBPrograms","ulPrograms",n[1],n[0],"program",$(this),"lblProg","מקום")):(RemoveProgram(oSearch,n[1]),RemoveSidebarItem("program",n[1],"aRemoveprogram_"+n[1],!0,"lblProg"))})})}function AttachSelectAllProg(){$("#SelectAllTVButton").click(function(){$("#divTVData").children("div").children("ul").children("li").each(function(){AddProgramItem($(this))})});$("#SelectAllPressButton").click(function(){$("#divPressData").children("div").children("ul").children("li").each(function(){AddProgramItem($(this))})});$("#SelectAllInternetButton").click(function(){$("#divInternetData").children("div").children("ul").children("li").each(function(){AddProgramItem($(this))})});$("#SelectAllRadioButton").click(function(){$("#divRadioData").children("div").children("ul").children("li").each(function(){AddProgramItem($(this))})});$("#SelectAllBillboardButton").click(function(){$("#divBillboardData").children("div").children("ul").children("li").each(function(){AddProgramItem($(this))})});$("#SelectAllCinemaButton").click(function(){$("#divCinemaData").children("div").children("ul").children("li").each(function(){AddProgramItem($(this))})});$("#DeSelectAllTVButton").click(function(){$("#divTVData").children("div").children("ul").children("li").each(function(){RemoveProgramItem($(this))})});$("#DeSelectAllPressButton").click(function(){$("#divPressData").children("div").children("ul").children("li").each(function(){RemoveProgramItem($(this))})});$("#DeSelectAllInternetButton").click(function(){$("#divInternetData").children("div").children("ul").children("li").each(function(){RemoveProgramItem($(this))})});$("#DeSelectAllRadioButton").click(function(){$("#divRadioData").children("div").children("ul").children("li").each(function(){RemoveProgramItem($(this))})});$("#DeSelectAllBillboardButton").click(function(){$("#divBillboardData").children("div").children("ul").children("li").each(function(){RemoveProgramItem($(this))})});$("#DeSelectAllCinemaButton").click(function(){$("#divCinemaData").children("div").children("ul").children("li").each(function(){RemoveProgramItem($(this))})})}function AddProgramItem(n){if(logdata("AddProgramItem"),n.children("label").attr("class","chk-label-active"),n.children("label").children("div").attr("class","jcf-unselectable chk-area chk-checked"),n.children("label").children("input").prop("checked",!0),n.children("label").children("input").val()!=undefined){var t=n.children("label").children("input").val().split("#");AddProgram(oSearch,t[1],t[0],t[2]);AddSidebarItem("divMediaData","ulSBMedia","liSBPrograms","ulPrograms",t[1],t[0],"program",n.children("label"),"lblProg","מקום")}}function RemoveProgramItem(n){if(logdata("RemoveProgramItem"),n.children("label").attr("class",""),n.children("label").children("div").attr("class","jcf-unselectable chk-area chk-unchecked"),n.children("label").children("input").prop("checked",!1),n.children("label").children("input").val()!=undefined){var t=n.children("label").children("input").val().split("#");RemoveProgram(oSearch,t[1]);RemoveSidebarItem("program",t[1],"aRemoveprogram_"+t[1],!0,"lblProg")}}function SetSearchDef_program(){var t=!1,r=!1,u=!1,f=!1,e=!1,o=!1,n=GetScreenWidth();for(i=0;i<oSearch.media.operator_list.length;i++)oSearch.media.operator_list[i].OperatorTypeID!=1||t||($("#divTV").addClass("expanded"),SetDivDimentions("divTVData",n-410,400),initResizeSpecificList("divTvResults"),replaceFormsIn($("#ulPlaceTV")),t=!0),oSearch.media.operator_list[i].OperatorTypeID!=2||r||($("#divPress").addClass("expanded"),SetDivDimentions("divPressData",n-410,400),initResizeSpecificList("divPressResults"),r=!0),oSearch.media.operator_list[i].OperatorTypeID!=5||u||($("#divInternet").addClass("expanded"),SetDivDimentions("divInternetData",n-410,400),initResizeSpecificList("divInternetResults"),replaceFormsIn($("#ulPlaceInet")),u=!0),oSearch.media.operator_list[i].OperatorTypeID!=3||f||($("#divRadio").addClass("expanded"),SetDivDimentions("divRadioData",n-410,400),initResizeSpecificList("divRadioResults"),f=!0),oSearch.media.operator_list[i].OperatorTypeID!=6||e||($("#divCinema").addClass("expanded"),SetDivDimentions("divCinemaData",n-410,400),initResizeSpecificList("divCinemaResults"),e=!0),oSearch.media.operator_list[i].OperatorTypeID!=4||o||($("#divBillboardButton").addClass("expanded"),SetDivDimentions("divBillboardData",n-410,400),initResizeSpecificList("divBillboardResults"),o=!0);for(i=0;i<oSearch.media.program_list.length;i++)$("#Program_"+oSearch.media.program_list[i].ProgramID).parent().children("div").removeClass("chk-unchecked"),$("#Program_"+oSearch.media.program_list[i].ProgramID).parent().children("div").addClass("chk-area chk-checked"),$("#Program_"+oSearch.media.program_list[i].ProgramID).parent().addClass("chk-label-active"),$("#Program_"+oSearch.media.program_list[i].ProgramID).prop("checked",!0);for(i=0;i<oSearch.media.place_list.length;i++)$("#Place_"+oSearch.media.place_list[i].PlaceID).parent().children("div").removeClass("chk-unchecked"),$("#Place_"+oSearch.media.place_list[i].PlaceID).parent().children("div").addClass("chk-area chk-checked"),$("#Place_"+oSearch.media.place_list[i].PlaceID).parent().addClass("chk-label-active"),$("#Place_"+oSearch.media.place_list[i].PlaceID).prop("checked",!0)}function SetDivDimentions(n,t,i){document.getElementById(n).parentElement.style.height=i+"px";document.getElementById(n).parentElement.parentElement.style.height=i+"px";document.getElementById(n).parentElement.style.width=t+"px";document.getElementById(n).parentElement.parentElement.style.width=t+"px"}function InitResultsPage(){jQuery(function(){initChildClasses();initResizeList();initCheck();jcf.customForms.replaceAll();initInputs();initPressedState();initScalingNavigation();initItemsZindex();initAddClass();initFixSelectCustomScroll();initAddClasses();initSortable()});MyBrowser.browser=="Firefox"&&setTimeout("InitPaging()",500)}function InitPaging(){document.getElementById("txtPageNum").value=1;document.getElementById("cmbPageSize").value=10;currPageSize=10;$("#cmbPageSize").parent().children("span").find(".center").text(10)}function SetRecordCount(n,t){currPageSize=n.value;Page(1,n.value,parseInt(document.getElementById("ViewBag_TotalRecords").value),t,document.getElementById("ViewType").value)}function GetCurrentPageSize(){var n=currPageSize;return n==0&&(n=parseInt(document.getElementById("cmbPageSize").value)),n}function PageNext(n){var t=parseInt(document.getElementById("txtPageNum").value)+1,i=GetCurrentPageSize();Page(t,i,parseInt(document.getElementById("ViewBag_TotalRecords").value),n,document.getElementById("ViewType").value)}function PagePrev(n){var t=parseInt(document.getElementById("txtPageNum").value)-1,i=GetCurrentPageSize();Page(t,i,parseInt(document.getElementById("ViewBag_TotalRecords").value),n,document.getElementById("ViewType").value)}function CheckPageNum(n){var t,i,r;evt=n||window.event;t=evt.which||evt.keyCode;t==13&&(evt.preventDefault(),evt.returnValue=!1,document.getElementById("txtPageNum").value!=""&&isNumber(document.getElementById("txtPageNum").value)&&(i=document.getElementById("spnBaseUrlResults").innerHTML,parseInt(document.getElementById("txtPageNum").value)>parseInt(document.getElementById("spnTotalPages").innerHTML)&&(document.getElementById("txtPageNum").value=document.getElementById("spnTotalPages").innerHTML),r=GetCurrentPageSize(),Page(document.getElementById("txtPageNum").value,r,document.getElementById("spnTotalRecords").innerHTML,i,document.getElementById("ViewType").value)))}function Page(n,t,i,r,u){var f;switch(u){case"Creative":f="PageToCreative"}$.ajax(r+f,{cache:!1,data:{iPageNum:n,iPageSize:t},success:function(r){$("#divResults").html(r);document.getElementById("txtPageNum").value=n;document.getElementById("spnTotalPages").innerHTML=Math.ceil(i/t).toString();document.getElementById("aNext").style.display=n*t>i?"none":"";document.getElementById("aPrev").style.display=n>1?"":"none";$("html, body").animate({scrollTop:0},"fast")},error:function(){console.log("ERROR on ajax (Page)")},dataType:"html"})}function ResetPaging(){document.getElementById("spnTotalPages").innerHTML=document.getElementById("ViewBag_TotalPages").value;document.getElementById("spnTotalRecords").innerHTML=document.getElementById("ViewBag_TotalRecords").value;document.getElementById("aNext").style.display=parseInt(document.getElementById("ViewBag_TotalPages").value)>1?"":"none";document.getElementById("aPrev").style.display="none";document.getElementById("txtPageNum").value=1;document.getElementById("cmbPageSize").value=10;currPageSize=10;$("#cmbPageSize").parent().children("span").find(".center").text(10)}function AttachPrintClicks(n){$("#"+n).parent().children("label").click(function(){var t=$(this).parent().find("input[type=radio]"),n=$(this).attr("class");n!=undefined&&n!=""&&CheckColumnsLayout(t.attr("id")=="rdLandscape")});$("#"+n).parent().children("div").click(function(){var n=$(this).parent().find("input[type=radio]"),t=$(this).attr("class");t.indexOf("rad-checked")>-1&&CheckColumnsLayout(n.attr("id")=="rdLandscape")});attachedPrintClicks=!0}function CheckColumnsLayout(n){for(var u=n?1100:800,i=getCurrentColumns(),r=0,t=0;t<i.length;t++)i[t]=="CampaignName"||i[t]=="CampaignVersionName"?r+=304:i[t]=="ProductName"?r+=140:i[t]=="ProgramName"||i[t]=="AdvertiserName"||i[t]=="ManagerName"||i[t]=="BrandName"||i[t]=="ProductName"||i[t]=="SubSubBranchName"||i[t]=="BuyerName"?r+=120:i[t]!=""&&(r+=100);r>u?($("#divPrintMsg").show(),$("#aPrint").hide()):($("#divPrintMsg").hide(),$("#aPrint").show())}function ShowPrintDiv(n){var t,i;printMode==""&&(printMode=n);$("#divPrintMsg").hide();attachedPrintClicks||(AttachPrintClicks("rdPortrait"),AttachPrintClicks("rdLandscape"));$("#campaign-modal-background").addClass("active");t=scrollpos();$("#divPrint").css("top",(t.y+100).toString()+"px");i=GetScreenWidth()/2-$("#divPrint").width()/2;$("#divPrint").css("left",i+"px");$("#divPrint").show();(printMode=="group"||printMode=="list")&&CheckColumnsLayout(document.getElementById("rdLandscape").checked)}function HidePrintDiv(){$("#divPrint").hide();$("#campaign-modal-background").removeClass("active")}function DoPrint(){var n=GetScreenWidth(),t=GetScreenHeight(),i=getCurrentColumns(),r=document.getElementById("rdLandscape").checked?"landscape":"portrait";MyBrowser.browser=="Explorer"&&MyBrowser.version<=9?window.open("Results/DoPrint?report="+printMode+"&columns="+i+"&pages="+$("#txtPages").val()+"&layout="+r,"PrintWin","left=1,top=1,width="+n+",height="+t+",scrollbars=yes,resizable"):window.open("Results/DoPrint?report="+printMode+"&columns="+i+"&pages="+$("#txtPages").val()+"&layout="+r,"left=1,top=1,width="+n+",height="+t+",scrollbars=yes,resizable");HidePrintDiv()}function ChangeView(n,t,i){var r,u=!1;switch(n){case"list":i=="list"?r=t+"BackToList":(r=t+"GenerateSmallList",u=!0);break;case"group":r=i=="list"?t+"GroupByList":t+"BackToGroup";break;case"creative":r=t+"CreativeView"}$.ajax(r,{cache:!1,data:{},success:function(t,i,r){var f;if(HideAjaxDiv(),r.getResponseHeader("Content-Type").indexOf("text/html")>-1){$("#spnViewHolder").html(t);switch(n){case"list":document.getElementById("aListView").parentElement.className="selected";document.getElementById("aGroupView").parentElement.className="";document.getElementById("aCreativeView").parentElement.className="";document.getElementById("divToolBar").style.display="none";printMode="list";break;case"group":document.getElementById("aListView").parentElement.className="";document.getElementById("aGroupView").parentElement.className="selected";document.getElementById("aCreativeView").parentElement.className="";document.getElementById("divToolBar").style.display="none";printMode="group";break;case"creative":document.getElementById("aListView").parentElement.className="";document.getElementById("aGroupView").parentElement.className="";document.getElementById("aCreativeView").parentElement.className="selected";document.getElementById("divToolBar").style.display="";ResetPaging();printMode="creative"}u&&t.indexOf("ListNotAllowed")==-1&&(f=getTopLeft(document.getElementById("aListView")),$("#divListSmall").css("left",f.Left),$("#divListSmall").css("top",f.Top),$("#divListSmall").fadeIn("slow",function(){setTimeout("$('#divListSmall').fadeOut(2500);",1e3)}));oSearch=GetSearchObject();t.indexOf("RELOAD SEARCH")>-1&&(CleanAccordionPanels(),LoadSearchData())}else try{f=t;f.redirect&&(top.location.href=f.redirect)}catch(e){logdata("redirect to login error")}}})}function ChangeMedia(n,t){$.ajax({url:document.getElementById("spnBaseUrlResults").innerHTML+"ChangeMedia",type:"POST",data:{operatorTypeID:n},dataType:"text",success:function(n){HideAjaxDiv();$("#"+t).parent().parent().children().each(function(){$(this).removeClass("selected")});$("#"+t).parent().addClass("selected");document.getElementById(t).blur();$("#divResults").html(n)},error:function(){},cache:!1,async:!1})}function CheckQueuedReportStatus(n,t){var i=window.setInterval(function(n,t){bAjaxFlag=!1;$.ajax({url:document.getElementById("spnBaseUrlResults").innerHTML+"CheckQueuedReportStatus",type:"GET",data:{queueID:n,reportType:t},dataType:"text",success:function(n){if(console.log(n),HideAjaxDiv(),n!="NO_FILE_YET")if(window.clearInterval(i),queueTime=0,n.indexOf("__Error: ")>-1){var t=n.substring(n.indexOf("__Error: ")+9,n.length);$("#divErrors").html("<b>חלו שגיאות בתהליך ייצור הקובץ: <\/b>"+t)}else $("#divErrors").html("הקובץ נוצר בהצלחה. ההורדה תתחיל מיד"),location.href=n;else queueTime++,$("#spnTime").html(queueTime)},error:function(){window.clearInterval(i);$("#divErrors").html("<b>חלו שגיאות בתהליך ייצור הקובץ<\/b>")},cache:!1,async:!1});bAjaxFlag=!0},1e3,n,t)}function AttachCampDetClicks(){$("#close-info-popup").click(function(){$("#popup-info").hide()});$("#divColumns").children("div[class=box]").each(function(){$(this).children("div").each(function(){$(this).children(".chk-area").click(function(){var n=$(this).parent().children("input[type=checkbox]").attr("id").substring(3),t=$(this).attr("class");t.indexOf("chk-unchecked")>-1?oColumns.Add(n):oColumns.Remove(n)});$(this).children("label").click(function(){var n=$(this).parent().children("input[type=checkbox]").attr("id").substring(3),t=$(this).attr("class");t==undefined||t==""?oColumns.Add(n):oColumns.Remove(n)})})});$("#ShowGeneral").click(function(){$("#ShowGeneral").addClass("active");$("#ShowTV").removeClass("active");$("#ShowNews").removeClass("active");$("#ShowRadio").removeClass("active");$("#ShowInet").removeClass("active");$("#ShowBillB").removeClass("active")});$("#ShowTV").click(function(){$("#ShowGeneral").removeClass("active");$("#ShowTV").addClass("active");$("#ShowNews").removeClass("active");$("#ShowRadio").removeClass("active");$("#ShowInet").removeClass("active");$("#ShowBillB").removeClass("active")});$("#ShowNews").click(function(){$("#ShowGeneral").removeClass("active");$("#ShowTV").removeClass("active");$("#ShowNews").addClass("active");$("#ShowRadio").removeClass("active");$("#ShowInet").removeClass("active");$("#ShowBillB").removeClass("active")});$("#ShowNews").click(function(){$("#ShowGeneral").removeClass("active");$("#ShowTV").removeClass("active");$("#ShowNews").removeClass("active");$("#ShowRadio").addClass("active");$("#ShowInet").removeClass("active");$("#ShowBillB").removeClass("active")});$("#ShowInet").click(function(){$("#ShowGeneral").removeClass("active");$("#ShowTV").removeClass("active");$("#ShowNews").removeClass("active");$("#ShowRadio").removeClass("active");$("#ShowInet").addClass("active");$("#ShowBillB").removeClass("active")});$("#ShowBillB").click(function(){$("#ShowGeneral").removeClass("active");$("#ShowTV").removeClass("active");$("#ShowNews").removeClass("active");$("#ShowRadio").removeClass("active");$("#ShowInet").removeClass("active");$("#ShowBillB").addClass("active")})}function GetCampaignData(n){bAjaxFlag=!1;$.ajax({url:document.getElementById("spnBaseUrlCampaign").innerHTML+"GetCampaignData",type:"POST",data:{Filtered:n},success:function(n,t,i){var r,u;if(i.getResponseHeader("Content-Type").indexOf("text/html")>-1)$("#divCampaignListHolder").html(n),$(".drop-holder").hide(),replaceFormsIn($("#divCampaignListHolder")),AttachCampDetClicks(),InitPageDefaults(),ResetPagingCamp(),r=n.substring(n.indexOf("### TOTAL PRICE:")+16,n.indexOf("****endData###")),logdata(r),$("#ddTotalPrice").html(numberWithCommas(r));else try{u=n;u.redirect&&(top.location.href=u.redirect)}catch(f){logdata("redirect to login error")}},error:function(n){$("#divAjaxModal").hide();ShowDialog("חלה שגיאה בהצגת פרטי קמפיין");console.log("Failed to load results panel");logdata(n)},cache:!1,async:!0});bAjaxFlag=!0}function numberWithCommas(n){return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}function InitPageDefaults(){document.getElementById("txtPageNum_campdet").value=1;document.getElementById("cmbPageSize_campdet").value=10;currPageSize=10;$("#cmbPageSize_campdet").parent().children("span").find(".center").text(10);$("#divColumns").children("div[class=box]").each(function(){$(this).children("div").each(function(){$(this).children(".chk-area").removeClass("chk-unchecked").addClass("chk-checked");$(this).children("input[type=checkbox]").prop("checked",!0);$(this).children("label").addClass("chk-label-active")})})}function SetRecordCount_campdet(n,t){currPageSize=n.value;Page_campdet(1,n.value,parseInt(document.getElementById("ViewBag_TotalRecords_Camp").value),t,"List")}function GetCurrentPageSize_campdet(){var n=currPageSize;return n==0&&(n=parseInt(document.getElementById("cmbPageSize_campdet").value)),n}function PageNext_campdet(n){var t=parseInt(document.getElementById("txtPageNum_campdet").value)+1,i=GetCurrentPageSize_campdet();Page_campdet(t,i,parseInt(document.getElementById("ViewBag_TotalRecords_Camp").value),n,"List")}function PagePrev_campdet(n){var t=parseInt(document.getElementById("txtPageNum_campdet").value)-1,i=GetCurrentPageSize_campdet();Page_campdet(t,i,parseInt(document.getElementById("ViewBag_TotalRecords_Camp").value),n,"List")}function CheckPageNum_campdet(n){var t,i,r;evt=n||window.event;t=evt.which||evt.keyCode;t==13&&(evt.preventDefault(),evt.returnValue=!1,document.getElementById("txtPageNum_campdet").value!=""&&isNumber(document.getElementById("txtPageNum_campdet").value)&&(i=document.getElementById("spnBaseUrlCampaign").innerHTML,parseInt(document.getElementById("txtPageNum_campdet").value)>parseInt(document.getElementById("spnTotalPages_campdet").innerHTML)&&(document.getElementById("txtPageNum_campdet").value=document.getElementById("spnTotalPages_campdet").innerHTML),r=GetCurrentPageSize_campdet(),Page_campdet(document.getElementById("txtPageNum_campdet").value,r,document.getElementById("spnTotalRecords_campdet").innerHTML,i,"List")))}function Page_campdet(n,t,i,r,u){var f;switch(u){case"List":f="PageTo"}bAjaxFlag=!1;$.ajax(r+f,{cache:!1,data:{iPageNum:n,iPageSize:t},success:function(r){$("#divCampaignList").html(r);initTableLayout();document.getElementById("txtPageNum_campdet").value=n;document.getElementById("spnTotalPages_campdet").innerHTML=Math.ceil(i/t).toString();document.getElementById("aNext_campdet").style.display=n*t>=i?"none":"";document.getElementById("aPrev_campdet").style.display=n>1?"":"none"},error:function(){console.log("ERROR on ajax (Page)");oCol=null},dataType:"html"});bAjaxFlag=!0}function ResetPagingCamp(){document.getElementById("spnTotalPages_campdet").innerHTML=document.getElementById("ViewBag_TotalPages_Camp").value;document.getElementById("spnTotalRecords_campdet").innerHTML=document.getElementById("ViewBag_TotalRecords_Camp").value;document.getElementById("aNext_campdet").style.display=parseInt(document.getElementById("ViewBag_TotalPages_Camp").value)>1?"":"none";document.getElementById("aPrev_campdet").style.display="none";document.getElementById("txtPageNum_campdet").value=1;document.getElementById("cmbPageSize_campdet").value=10;currPageSize=10;$("#cmbPageSize_campdet").parent().children("span").find(".center").text(10)}function Sort(n,t,i){$.ajax(document.getElementById("spnBaseUrlCampaign").innerHTML+"Sort",{cache:!1,data:{sColName:n,sDir:i,iPageSize:document.getElementById("cmbPageSize_campdet").value},success:function(n){$("#divCampaignList").html(n);prevaTag!=""&&document.getElementById(prevaTag)&&(document.getElementById(prevaTag).removeAttribute("class"),document.getElementById(prevaTag).className="btn");document.getElementById(t).removeAttribute("class");document.getElementById(t).className="btn btn-sort in-work";initTableLayout();prevaTag=t;document.getElementById("txtPageNum_campdet").value=1;document.getElementById("aNext_campdet").style.display="";document.getElementById("aPrev_campdet").style.display="none";HideFilters()},dataType:"html"})}function AddMoreColumns(){var n=getTopLeft(document.getElementById("aAddMore"));document.getElementById("divAddColumns").style.display=="none"?(document.getElementById("divAddColumns").style.left=(n.Left-$("#aAddMore").parent().width()).toString()+"px",document.getElementById("divAddColumns").style.top=(n.Top+$("#aAddMore").parent().parent().height()).toString()+"px",document.getElementById("divAddColumns").style.display="",document.getElementById("divColumns").style.display="",$("#divColumns").children("div[class=box]").each(function(){$(this).children("div").each(function(){var n=$(this).children("input[type=checkbox]").attr("id");n!=undefined&&(n=n.substring(3),$(this).children("input[type=checkbox]").prop("checked")&&oColumns.Add(n))})})):(document.getElementById("divAddColumns").style.display="none",document.getElementById("divColumns").style.display="none")}function SetColObject(n,t,i){$.ajax({url:t+"SetColumnsFromJS",type:"POST",data:{objType:i,columnData:JSON.stringify(n)},dataType:"text",success:function(){},error:function(){console.log("Failed to update columns object on server")},cache:!1,async:!1})}function UpdateColumnsDisplay(n,t,i,r){switch(i){case"list":SetColObject(oColumns,n,i);break;case"group":SetColObject(oGroupColumns,n,i)}$.ajax({url:n+t,type:"POST",data:{},success:function(n){$("#divCampaignList").html(n);initTableLayout();document.getElementById("spnTotalPages_campdet").innerHTML=document.getElementById("ViewBag_TotalPages_Camp").value;document.getElementById("spnTotalRecords_campdet").innerHTML=document.getElementById("ViewBag_TotalRecords_Camp").value;document.getElementById("aNext_campdet").style.display=parseInt(document.getElementById("ViewBag_TotalPages_Camp").value)>1?"":"none";document.getElementById("aPrev_campdet").style.display="none";document.getElementById("txtPageNum_campdet").value=1;document.getElementById("cmbPageSize_campdet").value=10;currPageSize=10;$("#cmbPageSize_campdet").parent().children("span").find(".center").text(10);$("#"+r).css("display","none")},error:function(){},cache:!1,async:!1,dataType:"html"})}function ShowFilters(n,t,i,r){document.getElementById("divAddFilters").style.display==""&&HideFilters();$.ajax({url:r+"GetFilterData",data:{columnName:t,isGroup:i},success:function(u){$("#divFilterData").html(u);var f=getTopLeft(document.getElementById(n));document.getElementById("divAddFilters").style.left=f.Left.toString()+"px";document.getElementById("divAddFilters").style.top=(f.Top+$("#"+n).parent().parent().height()).toString()+"px";document.getElementById("divAddFilters").style.display="";document.getElementById("divFilters").style.display="";document.getElementById("divFilters").style.zIndex=1e3;document.getElementById("divFilters").style.right="-250px";$("#divFilterData").width(203);$("#divFilterData").height(184);$("#divFilterData").parent().width(203);$("#divFilterData").parent().height(184);$("#tab-content-campaign").height()+200<$("#divFilters").height()&&($("#divFilters").height($(".tab-content").height()+150),$("#divFilterData").height(20),$("#divFilterData").parent().height(20),setTimeout("$('#divRange').css('display', 'none');",5));$("#aSortAsc").attr("href","javascript: Sort('"+t+"', '"+n+"', 'asc')");$("#aSortDesc").attr("href","javascript: Sort('"+t+"', '"+n+"', 'desc')");$("#aCommitFilter").attr("href","javascript: Filter('"+t+"',"+i+",'"+r+"')");replaceFormsIn($("#divFilterData"));RefreshScrolls();document.getElementById("divRangeErr").style.display="none";document.getElementById("txtRangeFrom").value="";document.getElementById("txtRangeTo").value="";document.getElementById("txtRangeFrom").onblur=function(){};document.getElementById("txtRangeTo").onblur=function(){};t=="TransmitDate"&&(document.getElementById("txtRangeFrom").onblur=function(){this.value=MaskDate(this.value)},document.getElementById("txtRangeTo").onblur=function(){this.value=MaskDate(this.value)});switch(t){case"CampaignVersionName":case"ProgramName":case"ChannelName":case"SectorName":case"OperatorName":setTimeout("$('#divRange').css('display', 'none');",5);default:$("#divRange").css("display","")}FilterObject.ItemCollection=[];$("#divFilterData").children("div[class=row]").each(function(){var n=$(this).children("input[type=checkbox]").val();n!=undefined&&FilterObject.Add(n)});$("#divFilterData").children("div").children("div").each(function(){$(this).click(function(){var n=$(this).parent().children("input[type=checkbox]").val(),t=$(this).attr("class");t.indexOf("chk-unchecked")>-1?FilterObject.Add(n):FilterObject.Remove(n)})});$("#divFilterData").children("div").children("label").each(function(){$(this).click(function(){var n=$(this).parent().children("input[type=checkbox]").val(),t=$(this).attr("class");t==undefined||t==""?FilterObject.Add(n):FilterObject.Remove(n)})});document.getElementById("txtFilter").value="";CreateAutoCompleteElement("txtFilter","GetFilterValues")},error:function(){},cache:!1,async:!1,dataType:"html"})}function HideFilters(){document.getElementById("divAddFilters").style.display="none";document.getElementById("divFilters").style.display="none"}function Filter(n,t,i){var r=!0,u="",f,e;document.getElementById("divRangeErr").style.display="none";document.getElementById("txtRangeFrom").value!=""&&(n!="TransmitDate"?isNumber(document.getElementById("txtRangeFrom").value)||(r=!1,u="יש להזין מספרים בלבד"):isDate(document.getElementById("txtRangeFrom").value)||(r=!1,u="יש להזין תאריך dd/MM/yyyy"));document.getElementById("txtRangeTo").value!=""&&(n!="TransmitDate"?isNumber(document.getElementById("txtRangeTo").value)||(r=!1,u="יש להזין מספרים בלבד"):isDate(document.getElementById("txtRangeTo").value)||(r=!1,u="יש להזין תאריך dd/MM/yyyy"));r?(f="",e="",document.getElementById("txtRangeFrom").value!=""&&document.getElementById("txtRangeTo").value!=""?(e=document.getElementById("txtRangeFrom").value+"_"+document.getElementById("txtRangeTo").value,f=""):(e="",f=JSON.stringify(FilterObject)),$.ajax(i+"Filter",{cache:!1,data:{columnName:n,filterData:f,isGroup:t,range:e},success:function(n){$("#divCampaignList").html(n);initTableLayout();document.getElementById("spnTotalPages_campdet").innerHTML=document.getElementById("ViewBag_TotalPages_Camp").value;document.getElementById("spnTotalRecords_campdet").innerHTML=document.getElementById("ViewBag_TotalRecords_Camp").value;document.getElementById("txtPageNum_campdet").value=1;document.getElementById("aNext_campdet").style.display=parseInt(document.getElementById("ViewBag_TotalPages_Camp").value)>1?"":"none";document.getElementById("aPrev_campdet").style.display="none";HideFilters()},dataType:"html"})):(document.getElementById("divRangeErr").innerHTML=u,document.getElementById("divRangeErr").style.display="")}function MarkFilters(n){$("#divFilterData").children("div").children("div").each(function(){var t;n?($(this).parent().children("input[type=checkbox]").prop("checked",!0),t=$(this).parent().children("input[type=checkbox]").val(),FilterObject.Add(t),$(this).removeClass("chk-unchecked"),$(this).addClass("chk-checked")):($(this).parent().children("input[type=checkbox]").prop("checked",!1),t=$(this).parent().children("input[type=checkbox]").val(),FilterObject.Remove(t),$(this).removeClass("chk-checked"),$(this).addClass("chk-unchecked"))});$("#divFilterData").children("div").children("label").each(function(){n?$(this).addClass("chk-label-active"):$(this).removeClass("chk-label-active")})}function ShowOperatorData(n){switch(n){case 0:$("#ShowGeneral").addClass("active");$("#ShowTV").removeClass("active");$("#ShowNews").removeClass("active");$("#ShowRadio").removeClass("active");$("#ShowInet").removeClass("active");$("#ShowBillB").removeClass("active");break;case 1:$("#ShowGeneral").removeClass("active");$("#ShowTV").addClass("active");$("#ShowNews").removeClass("active");$("#ShowRadio").removeClass("active");$("#ShowInet").removeClass("active");$("#ShowBillB").removeClass("active");break;case 2:$("#ShowGeneral").removeClass("active");$("#ShowTV").removeClass("active");$("#ShowNews").addClass("active");$("#ShowRadio").removeClass("active");$("#ShowInet").removeClass("active");$("#ShowBillB").removeClass("active");break;case 3:$("#ShowGeneral").removeClass("active");$("#ShowTV").removeClass("active");$("#ShowNews").removeClass("active");$("#ShowRadio").addClass("active");$("#ShowInet").removeClass("active");$("#ShowBillB").removeClass("active");break;case 5:$("#ShowGeneral").removeClass("active");$("#ShowTV").removeClass("active");$("#ShowNews").removeClass("active");$("#ShowRadio").removeClass("active");$("#ShowInet").addClass("active");$("#ShowBillB").removeClass("active");break;case 4:$("#ShowGeneral").removeClass("active");$("#ShowTV").removeClass("active");$("#ShowNews").removeClass("active");$("#ShowRadio").removeClass("active");$("#ShowInet").removeClass("active");$("#ShowBillB").addClass("active")}$.ajax(document.getElementById("spnBaseUrlCampaign").innerHTML+"FilterByMedia",{data:{operatorTypeID:n},success:function(n,t,i){var r,u;if(i.getResponseHeader("Content-Type").indexOf("text/html")>-1)$("#divCampaignList").html(n),initTableLayout(),InitPageDefaults(),r=document.getElementById("ViewBag_TotalRecords_Camp").value,document.getElementById("spnTotalRecords_campdet").innerHTML=r,document.getElementById("txtPageNum_campdet").value=1,document.getElementById("spnTotalPages_campdet").innerHTML=document.getElementById("ViewBag_TotalPages_Camp").value,document.getElementById("aNext_campdet").style.display=r<10?"none":"",document.getElementById("aPrev_campdet").style.display="none";else try{u=n;u.redirect&&(top.location.href=u.redirect)}catch(f){logdata("redirect to login error")}},error:function(){console.log("ShowOperatorData - ajax error")},cache:!1,async:!1})}function CloseInfo(){$("#popup-info").hide()}function CloseCreativeDiv(){document.getElementById(videoPlayerID)&&$("#"+videoPlayerID).parent().html("");$("#campaign-modal-background").removeClass("active");$("#gallery-popup").hide();$("#popup-info").hide();$("#divDownload").hide()}function ViewCampaignFiles(n){var t="-1";bAjaxFlag=!1;$.ajax(document.getElementById("spnBaseUrlCampaign").innerHTML+"GetRelevantVersion",{data:{campaignID:n},success:function(n){t=n;ShowCreativeDiv(t,0,!0)},error:function(){console.log("ViewCampaignFiles - ajax error")},dataType:"html",cache:!1,async:!0});bAjaxFlag=!0}function ShowCreativeDiv(n,t,i){t==""&&(t=OperatorTypeEnum.All);bAjaxFlag=!1;$.ajax(document.getElementById("spnBaseUrlCampaign").innerHTML+"ShowCreativeWindow",{data:{campaignVersionID:n,operatorTypeID:t,Filter:i},success:function(n){var i=scrollpos(),r;n.indexOf("###GalleryPopup")>-1?($("#gallery-popup").html(n),$("#gallery-popup").css("top",(i.y+100).toString()+"px"),r=GetScreenWidth()/2-$("#gallery-popup").width()/2,$("#gallery-popup").css("left",r+"px"),$("#campaign-modal-background").addClass("active"),$("#gallery-popup").show(),setTimeout(function(){initCarousel();initSlideShow();fixVideoBoxHeight()},100),ResetHtmlContainer(),SetFirstGalleryFile(),SetGalleryClicks(),SetMediaLinksClick(),HideAjaxDiv(),setTimeout(function(){$(".video-slide").not(".active").each(function(){$(this).css("display","none")})},150),setTimeout(function(){var n;switch(t){case OperatorTypeEnum.TV.toString():n=FileTypeEnum.TV;break;case OperatorTypeEnum.Press.toString():n=FileTypeEnum.Press;break;case OperatorTypeEnum.Radio.toString():n=FileTypeEnum.Radio;break;case OperatorTypeEnum.Billboards.toString():n=FileTypeEnum.Billboards;break;case OperatorTypeEnum.Internet.toString():n=FileTypeEnum.Internet;break;default:n=FileTypeEnum.All}$("#media_"+n).click()},150)):($("#popup-info").html(n),$("#popup-info").css("top",(i.y+100).toString()+"px"),$("#popup-info").css("left","25%"),$("#popup-info").show())},error:function(){console.log("ShowCreativeDiv - ajax error")},dataType:"html",cache:!1,async:!0});bAjaxFlag=!0}function ShowSpecificMedia(n){$.ajax(document.getElementById("spnBaseUrlCampaign").innerHTML+"GetFilesByMedia",{data:{fileTypeID:n},success:function(n){$("#gallery-popup").html(n);var t=GetScreenWidth()/2-$("#gallery-popup").width()/2;$("#gallery-popup").css("left",t+"px");$("#gallery-popup").show();setTimeout(function(){initCarousel();initSlideShow();fixVideoBoxHeight()},100);ResetHtmlContainer();SetFirstGalleryFile();SetGalleryClicks();SetMediaLinksClick()},error:function(){console.log("ShowSpecificMedia - ajax error")},dataType:"html",cache:!1,async:!1})}function fixVideoBoxHeight(){var n=$("#divVideoBox").height();n==0&&$("#divVideoBox").height(352)}function SetFirstGalleryFile(){var n=$("#slideset").children("div").children("span").first().html().split("#");prevclick=n[0];currentFileShown=prevclick;prevFileShown=prevclick;currentFileMode=n[3]==1?"old":"new"}function ResetHtmlContainer(){oHtmlContainer.Data=[];$(".video-box").children(".video-slide").each(function(){oHtmlContainer.Add($(this).attr("id"),$(this).html())})}function SetGalleryClicks(){$("#slideset").children("div").children("a").click(function(){var i=$(this).parent("div").children("span").html(),n=i.split("#"),t;currentFileShown=n[0];currentFileMode=n[3]==1?"old":"new";t=oHtmlContainer.Find("divDisplay_"+n[0]);t!=null&&($("#player_"+prevclick).remove(),document.getElementById("divDisplay_"+n[0]).innerHTML=t.html);document.getElementById("divDisplay_"+prevclick).style.display="none";document.getElementById("divDisplay_"+currentFileShown).style.display="block";prevclick=n[0]})}function SetMediaLinksClick(){$(".gallery").children("ul").children("li").click(function(){var n=$(this).val(),t=$(this).find("a").text();$(".gallery li").find("a").removeClass("selected");$(this).find("a").addClass("selected");ShowSpecificMedia(n)})}function PlayMediaFile(n,t,i,r){currentFileShown=r;switch(i){case FileTypeEnum.Radio.toString():case FileTypeEnum.TV.toString():case FileTypeEnum.BillboardsAvi.toString():case FileTypeEnum.VideoAds.toString():case FileTypeEnum.FacebookAds.toString():t.indexOf("facebook.com")==-1&&t.indexOf("Panel/ViewAd")==-1?$.ajax(document.getElementById("spnBaseUrlCampaign").innerHTML+"GetMPObjectTag",{data:{filePath:t,fileTypeID:i,fileID:r},success:function(i){$("#"+n).html(i);t.indexOf(".mp4")>-1&&InitVideoPlayer()},error:function(){console.log("PlayMediaFile - ajax error")},dataType:"html",cache:!1,async:!1}):window.open(t,"_blank")}}function DownloadFile(){$.ajax({type:"GET",url:document.getElementById("spnBaseUrlCampaign").innerHTML+"DownloadFile",data:{fileID:currentFileShown,fileMode:currentFileMode},cache:!1,success:function(n){$("#divDisplay_"+currentFileShown).html("");$("#divDownload").html(n);var t=scrollpos();logdata("x"+t.y);$("#divDownload").css("top",(t.y+200).toString()+"px");$("#divDownload").css("left","25%");$("#divDownload").show()},dataType:"html"})}function ConfirmDownload(n,t,i,r){CancelDownload();location.href=document.getElementById("spnBaseUrlCampaign").innerHTML+"DownloadFileConfirmed?fileID="+n+"&oldMode="+t+"&endDate="+i+"&filesRemained="+r}function CancelDownload(){$("#divDownload").hide();$("#divDownload").html("")}function SetDatePicker(){var n=["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"];$(function(){$("#datepicker").datepicker($.datepicker.regional.he);$("#FromDate").datepicker({defaultDate:"+1w",monthNamesShort:n,changeMonth:!0,changeYear:!0,numberOfMonths:1,minDate:"01/01/2008",onClose:function(n){$("#ToDate").datepicker("option","minDate",n);AddDates(oSearch,n,null);AddSidebarData("divTimesData","dlTimes","dl","ddDates","dd",n+" - "+$("#ToDate").val(),!1,"")}});$("#FromDate").mask("99/99/9999");$("#ToDate").datepicker({defaultDate:"+1w",monthNamesShort:n,changeMonth:!0,changeYear:!0,numberOfMonths:1,minDate:"01/01/2008",onClose:function(n){$("#FromDate").datepicker("option","maxDate",n);AddDates(oSearch,null,n);AddSidebarData("divTimesData","dlTimes","dl","ddDates","dd",$("#FromDate").val()+" - "+n,!1,"")}});$("#ToDate").mask("99/99/9999");$("#txtFromTime").mask("99:99");$("#txtTillTime").mask("99:99");$("#txtFromHour").mask("99:99");$("#txtTillHour").mask("99:99")});$("#DateRange").change(function(){var n=$("option:selected",this);n.parent()[0].id=="show_picker"?($(".date-row").show(),$("#divTimeDef").show()):($(".date-row").hide(),$("#divTimeDef").hide());AddDateRange(oSearch,this.value);SetDatesForSideBar(this.value)})}function SetDatesForSideBar(n){var t,i,f,e,r,u;t=new Date;i=new Date;switch(n){case"1":i.setDate(t.getDate()+1);break;case"2":case"10":t.setDate(i.getDate()-1);break;case"3":t.setDate(i.getDate()-3);break;case"11":t.setDate(i.getDate()-30);break;case"4":t.setDate(i.getDate()-7);break;case"5":t.setDate(1);break;case"6":t.setDate(1);t.setMonth(0);break;case"7":t.setDate(1);t.setMonth(0);t.setYear(i.getFullYear()-1);i=new Date(t.getFullYear(),11,31);break;case"8":t.setDate(1);t.setMonth(0);t.setYear(i.getFullYear()-2);i=new Date(t.getFullYear(),11,31);break;case"9":t.setDate(1);t.setMonth(0);t.setYear(i.getFullYear()-3);i=new Date(t.getFullYear(),11,31)}r=t.getDate();u=t.getMonth()+1;r<10&&(r="0"+r);u<10&&(u="0"+u);f=r+"/"+u+"/"+t.getFullYear();r=i.getDate();u=i.getMonth()+1;r<10&&(r="0"+r);u<10&&(u="0"+u);e=r+"/"+u+"/"+i.getFullYear();AddSidebarData("divTimesData","dlTimes","dl","ddDates","dd",f+" - "+e,!1,"")}function ShowHoursDef(){$("#divFromTime").css("display")=="none"?($("#txtFromTime").val(oSearch.times.FromTime),$("#txtTillTime").val(oSearch.times.TillTime),$("#divFromTime").animate({height:"show"},"slow"),$("#divTillTime").animate({height:"show"},"slow"),oSearch.times.WithHours=!0):($("#divFromTime").hide(),$("#divTillTime").hide(),oSearch.times.WithHours=!1)}function ShowCustomSliceDiv(){if(bShowCustomDiv){bAddedSlice&&document.getElementById("spnInfo").style.display==""&&(document.getElementById("spnInfo").style.display="none",document.getElementById("aEditCustomSlice").style.display="none");document.getElementById("CustomSliceData").value="";document.getElementById("divEditCustom").style.display="none";bShowCustomDiv=!1;oSearch.times.customSlice="";var n="מותאם אישית: "+document.getElementById("spnInfo").innerHTML;RemoveSidebarData("divTimesData","ddCustomSlice",n,"<br>",!0)}else document.getElementById("spnInfo").style.display==""&&(document.getElementById("spnInfo").style.display="none",document.getElementById("aEditCustomSlice").style.display="none"),document.getElementById("divEditCustom").style.display="",bShowCustomDiv=!0}function AddCustomSlice(){if(ValidateHours("txtFromHour","txtTillHour")){document.getElementById("spnInfo").innerHTML=document.getElementById("txtFromHour").value+" - "+document.getElementById("txtTillHour").value;document.getElementById("divEditCustom").style.display="none";document.getElementById("spnInfo").style.display="";document.getElementById("aEditCustomSlice").style.display="";bAddedSlice=!0;oSearch.times.customSlice={SliceID:999,SliceName:"custom",StartTime:document.getElementById("txtFromHour").value,EndTime:document.getElementById("txtTillHour").value};var n="מותאם אישית: "+document.getElementById("txtFromHour").value+" - "+document.getElementById("txtTillHour").value;AddSidebarData("divTimesData","dlTimes","dl","ddCustomSlice","dd",n,!1,"<br>")}}function EditCustomSlice(){document.getElementById("spnInfo").style.display==""&&(document.getElementById("spnInfo").style.display="none",document.getElementById("aEditCustomSlice").style.display="none");document.getElementById("divEditCustom").style.display="";bShowCustomDiv=!0}function SetTimeBlurEvents(){document.getElementById("txtFromTime").addEventListener("blur",function(){SetHours(this)});document.getElementById("txtTillTime").addEventListener("blur",function(){SetHours(this)})}function SetHours(n){var t=document.getElementById("chkIncludeTime").checked,r=n.name=="txtFromTime"?"00:00":"23:59",i=n.name=="txtFromTime"?"FromTime":"TillTime",u=n.name=="txtFromTime"?"משעה":"עד שעה",f=new RegExp("^(([0-9])|([0-1][0-9])|([2][0-3])):(([0-9])|([0-5][0-9]))$");n.value!="__:__"&&n.value!=""?f.test(n.value)?(AddTime(oSearch,t,i,n.value),document.getElementById("divTime").innerHTML=""):(document.getElementById("divTime").innerHTML="שעה לא חוקית. יש להזין שעה בפורמט hh:mm לשדה '"+u+"'",AddTime(oSearch,t,i,r)):AddTime(oSearch,t,i,r)}function AttachTimesClicks(){$("#lblExcelSN").length>0&&($("#lblExcelSN").click(function(){$(this).children("input[type=checkbox]").prop("checked")?SetReportMode("excel",oSearch,0):SetReportMode("excel",oSearch,1)}),$("#lblExcelSN").children("div").click(function(){$(this).parent().children("input[type=checkbox]").prop("checked")?SetReportMode("excel",oSearch,0):SetReportMode("excel",oSearch,1)}),console.log($("#IsExcelSN").length));AllDaysCheckUncheck();$("#divCustom").children(".chk-area").click(function(){ShowCustomSliceDiv()});$("#lblCustom").click(function(){ShowCustomSliceDiv()});$("#divTimeDef").children(".chk-area").click(function(){ShowHoursDef()});$("#lblTimeDef").click(function(){ShowHoursDef()});$(".jcf-class-chks").parent("div").children().click(function(){var t,r;if($(this).prop("tagName")!="SPAN"){t=$(this).parent().attr("id");r=t.indexOf("_");t=t.substring(r+1);var f=document.getElementById("SliceData_"+t),i=f.value.split("#"),n=i[1].split("-"),u=$(this).parent("div").find("input[type=hidden]").val()+" "+n[0]+" - "+n[1],e=n[0]+" - "+n[1]+" "+$(this).parent("div").find("input[type=hidden]").val();$(this).parent("div").children("div").attr("class").indexOf("chk-unchecked")>-1?(AddSlice(oSearch,i[0],$(this).parent("div").find("input[type=hidden]").val(),n[0],n[1],!1),AddSidebarData("divTimesData","dlTimes","dl","ddSlices","dd",u,!0,"<br>")):(RemoveSlice(oSearch,i[0]),RemoveSidebarData("divTimesData","ddSlices",u,"<br>",!0),RemoveSidebarData("divTimesData","ddSlices",e,"<br>",!0))}});$(".box").children().click(function(){var n=$(this).children("input[type=checkbox]").val(),t;(n==undefined||n==null)&&(n=$(this).parent().children("input[type=checkbox]").val());t=$(this).parent().find("label").text();$(this).hasClass("chk-unchecked")||$(this).parent().children("div").hasClass("chk-unchecked")?(AddDays(oSearch,n),AddSidebarData("divTimesData","dlTimes","dl","ddDays","dd",t,!0,", ")):(RemoveDays(oSearch,n),RemoveSidebarData("divTimesData","ddDays",t,", ",!1))});$("#chkAllSlices").parent().children().click(function(){$(this).parent("div").children("div").hasClass("chk-unchecked")?($(".jcf-class-chks").each(function(){var t,i;if($(this).prop("tagName")!="SPAN"){t=$(this).parent().attr("id");i=t.indexOf("_");t=t.substring(i+1);var u=document.getElementById("SliceData_"+t),r=u.value.split("#"),n=r[1].split("-"),f=$(this).parent("div").find("input[type=hidden]").val()+" "+n[0]+" - "+n[1],e=n[0]+" - "+n[1]+" "+$(this).parent("div").find("input[type=hidden]").val();$(this).parent("div").children("div").attr("class").indexOf("chk-unchecked")>-1&&(AddSlice(oSearch,r[0],$(this).parent("div").find("input[type=hidden]").val(),n[0],n[1],!1),AddSidebarData("divTimesData","dlTimes","dl","ddSlices","dd",f,!0,"<br>"))}$(this).removeClass("chk-unchecked");$(this).addClass("chk-checked");$(this).parent().children("label").addClass("chk-label-active");$(this).parent().children("input").prop("checked",!0)}),$("#divTimesData").parent().parent().css("max-height",$("#divTimesData").height())):$(".jcf-class-chks").each(function(){var n,i;if($(this).prop("tagName")!="SPAN"){n=$(this).parent().attr("id");i=n.indexOf("_");n=n.substring(i+1);var u=document.getElementById("SliceData_"+n),r=u.value.split("#"),t=r[1].split("-"),f=$(this).parent("div").find("input[type=hidden]").val()+" "+t[0]+" - "+t[1],e=t[0]+" - "+t[1]+" "+$(this).parent("div").find("input[type=hidden]").val();$(this).parent("div").children("div").attr("class").indexOf("chk-unchecked")==-1&&(RemoveSlice(oSearch,r[0]),RemoveSidebarData("divTimesData","ddSlices",f,"<br>",!0),RemoveSidebarData("divTimesData","ddSlices",e,"<br>",!0))}$(this).removeClass("chk-checked");$(this).addClass("chk-unchecked");$(this).parent().children("label").removeClass("chk-label-active");$(this).parent().children("input").prop("checked",!1)})})}function AllDaysCheckUncheck(){$('input[id="day-8"]').parent("div").children().click(function(){$(this).parent("div").children("div").hasClass("chk-unchecked")?($(".box").children("div").attr("class","jcf-unselectable chk-area chk-checked chk-focus"),$(".box").find("label").addClass("chk-label-active"),$(".box").find("input").prop("checked",!0),oSearch.times.Days="1,2,3,4,5,6,7",AddSidebarData("divTimesData","dlTimes","dl","ddDays","dd","א, ב, ג, ד, ה, ו, שבת",!1,"")):($(".box").children("div").attr("class","jcf-unselectable chk-area chk-unchecked"),$(".box").find("label").removeClass("chk-label-active"),$(".box").find("input").prop("checked",!1),oSearch.times.Days="",AddSidebarData("divTimesData","dlTimes","dl","ddDays","dd","",!1,""))})}function getSpanWithClass(n){for(var i=document.getElementsByTagName("span"),t=0;t<i.length;t++)if((" "+i[t].className+" ").indexOf(" "+n+" ")>-1)return i[t]}function SetSearchDef_times(){var e,u,n,o,t,s,f,r,c,h;if(document.getElementById("DateRange").value=oSearch.times.DateRange,e=$("#DateRange option:selected").text(),u=getSpanWithClass("center"),u&&(u.innerHTML=e),document.getElementById("DateRange").value=="10"?($(".date-row").show(),$("#divTimeDef").show(),oSearch.times.WithHours&&(lblTimeDef.click(),$("#txtFromTime").val(oSearch.times.FromTime),$("#txtTillTime").val(oSearch.times.TillTime),ShowHoursDef())):(document.getElementById("chkIncludeTime").checked=!1,$("#divTimeDef").hide()),oSearch.times.FromDate!=null&&(n=oSearch.times.FromDate,n=n.replace("/Date(","").replace(")/",""),n=new Date(n*1),o=n.getDate()+"/"+(n.getMonth()+1)+"/"+n.getFullYear(),$("#FromDate").val(o)),oSearch.times.ToDate!=null&&(t=oSearch.times.ToDate,t=t.replace("/Date(","").replace(")/",""),t=new Date(t*1),s=t.getDate()+"/"+(t.getMonth()+1)+"/"+t.getFullYear(),$("#ToDate").val(s)),f=oSearch.times.Days,f!="")for(r=f.split(","),i=0;i<r.length;i++)document.getElementById("day-"+r[i]).checked=!0,c="day-"+r[i],$(".box").find($("input:checked").parent("div").children("div").attr("class","jcf-unselectable chk-area chk-checked"));for(i=0;i<oSearch.times.TSlist.length;i++)$("#rowSlice_"+oSearch.times.TSlist[i].SliceID).find($("#chkSlice_"+oSearch.times.TSlist[i].SliceID).parent("div").children("div").removeClass("chk-unchecked")),$("#rowSlice_"+oSearch.times.TSlist[i].SliceID).find($("#chkSlice_"+oSearch.times.TSlist[i].SliceID).parent("div").children("div").addClass("jcf-unselectable chk-area chk-checked")),$("#rowSlice_"+oSearch.times.TSlist[i].SliceID).find($("#chkSlice_"+oSearch.times.TSlist[i].SliceID).attr("checked","checked"));oSearch.times.customSlice!=null&&($("#divCustom").children("div").removeClass("chk-unchecked"),$("#divCustom").children("div").addClass("chk-checked"),h=oSearch.times.customSlice.StartTime+" - "+oSearch.times.customSlice.EndTime,document.getElementById("spnInfo").innerHTML=h,document.getElementById("spnInfo").style.display="",document.getElementById("aEditCustomSlice").style.display="",$("#chkCustom").attr("checked","checked"),bAddedSlice=!0,bShowCustomDiv=!0,document.getElementById("CustomSliceData").value=oSearch.times.customSlice.StartTime+"-"+oSearch.times.customSlice.EndTime,document.getElementById("txtFromHour").value=oSearch.times.customSlice.StartTime,document.getElementById("txtTillHour").value=oSearch.times.customSlice.EndTime)}var name1="ענף",name2="תת ענף",name3="תת ענף משני",BranchContainer,CampaignContainer,currentPriceType,AdvContainer,attachedPrintClicks,PrintMeasures,printMode,queueTime,oColumns,currPageSize,prevaTag,FilterObject,prevclick,videoPlayerID,bShowCustomDiv,bAddedSlice;$("#SelectBranches").click(function(){$("ul.branch-list").children("li").each(function(){$(this).find("div").removeClass("chk-unchecked");$(this).find("div").addClass("jcf-unselectable chk-area chk-checked");$(this).find("label").addClass("chk-label-active");$(this).find("input[type=checkbox]").prop("checked",!0);var i=$(this).find("input[type=checkbox]").attr("name"),t=$(this).find("input[type=checkbox]"),n=t.val().split("#");AddBranch(oSearch,n[1],n[0]);AddSidebarItem("divBranchData","ulSBBranch","liSBBranches","ulBranches",n[1],n[0],"branch",$(this),"lblBranch",name1)});$("ul.branch-list").children("li").children("ul").children("li").each(function(){$(this).find("div").removeClass("chk-unchecked");$(this).find("div").addClass("jcf-unselectable chk-area chk-checked");$(this).find("label").addClass("chk-label-active");$(this).find("input[type=checkbox]").prop("checked",!0);var i=$(this).find("input[type=checkbox]").attr("name"),t=$(this).find("input[type=checkbox]"),n=t.val().split("#");AddSubBranch(oSearch,n[1],n[0]);AddSidebarItem("divBranchData","ulSBBranch","liSBSubBranches","ulSubBranches",n[1],n[0],"subbranch",$(this),"lblSubBranch",name2)});$("ul.branch-list").children("li").children("ul").children("li").children("ul").children("li").each(function(){$(this).find("div").removeClass("chk-unchecked");$(this).find("div").addClass("jcf-unselectable chk-area chk-checked");$(this).find("label").addClass("chk-label-active");$(this).find("input[type=checkbox]").prop("checked",!0);var i=$(this).find("input[type=checkbox]").attr("name"),t=$(this).find("input[type=checkbox]"),n=t.val().split("#");AddSubSubBranch(oSearch,n[1],n[0]);AddSidebarItem("divBranchData","ulSBBranch","liSBSubSubBranches","ulSubSubBranches",n[1],n[0],"subsubbranch",$(this),"lblSubSubBranch",name3)})});$("#DeSelectBranches").click(function(){$("ul.branch-list").children("li").each(function(){$(this).find("div").attr("class","jcf-unselectable chk-area chk-unchecked");$(this).find("label").removeClass("chk-label-active");$(this).find("input[type=checkbox]").prop("checked",!1);var t=$(this).find("input[type=checkbox]"),n=t.val().split("#");RemoveBranch(oSearch,n[1]);RemoveSidebarItem("branch",n[1],"aRemovebranch_"+n[1],!0,"lblBranch")});$("ul.branch-list").children("li").children("ul").children("li").each(function(){$(this).find("div").attr("class","jcf-unselectable chk-area chk-unchecked");$(this).find("label").removeClass("chk-label-active");$(this).find("input[type=checkbox]").prop("checked",!1);var t=$(this).find("input[type=checkbox]"),n=t.val().split("#");RemoveSubBranch(oSearch,n[1]);RemoveSidebarItem("subbranch",n[1],"aRemovesubbranch_"+n[1],!0,"lblSubBranch")});$("ul.branch-list").children("li").children("ul").children("li").children("ul").children("li").each(function(){$(this).find("div").attr("class","jcf-unselectable chk-area chk-unchecked");$(this).find("label").removeClass("chk-label-active");$(this).find("input[type=checkbox]").prop("checked",!1);var t=$(this).find("input[type=checkbox]"),n=t.val().split("#");RemoveSubSubBranch(oSearch,n[1]);RemoveSidebarItem("subsubbranch",n[1],"aRemovesubsubbranch_"+n[1],!0,"lblSubSubBranch")})});var reportTypeEnum={List:1,Group:2,Infosys:3,MediaBuyer:4,NewCampaigns:5,HyperLinkList:6,ListSN:7},priceTypeEnum={PriceList:1,IfatFactorPrice:2},reportType=reportTypeEnum.Group,groupFieldCount=20,ratingTrpCount=10;currentPriceType=0;var bLoadedTvData=!1,bLoadedPressData=!1,bLoadedInternetData=!1,bLoadedRadioData=!1,bLoadedBillboardData=!1,bLoadedCinemaData=!1;currPageSize=0;attachedPrintClicks=!1;PrintMeasures={Measures:[],AddMeasure:function(n){var t=!1;for(i=0;i<this.Measures.length;i++)if(this.Measures[i]==n){t=!0;break}t||this.Measures.push(n)},RemoveMeasure:function(n){for(i=0;i<this.Measures.length;i++)if(this.Measures[i]==n){this.Measures.splice(i,1);break}}};printMode="";queueTime=0;oColumns={ColumnsCollection:[],Add:function(n){var t=!1,r;for(i=0;i<this.ColumnsCollection.length;i++)if(r=this.ColumnsCollection[i],r==n){t=!0;break}t||this.ColumnsCollection.push(n)},Remove:function(n){for(i=0;i<this.ColumnsCollection.length;i++)this.ColumnsCollection[i]==n&&this.ColumnsCollection.splice(i,1)}};currPageSize=0;prevaTag="";FilterObject={ItemCollection:[],Add:function(n){var t=!1,r;for(i=0;i<this.ItemCollection.length;i++)if(r=this.ItemCollection[i],r==n){t=!0;break}t||this.ItemCollection.push(n)},Remove:function(n){for(i=0;i<this.ItemCollection.length;i++)this.ItemCollection[i]==n&&this.ItemCollection.splice(i,1)}};var oHtmlContainer={Data:[],Add:function(n,t){var r=!1,u;for(i=0;i<this.Data.length;i++)if(u=this.Data[i],u.id==n){r=!0;break}r||this.Data.push({id:n,html:t})},Find:function(n){var r=null,t;for(i=0;i<this.Data.length;i++)if(t=this.Data[i],t.id==n){r=t;break}return r}},OperatorTypeEnum={All:0,TV:1,Press:2,Radio:3,Billboards:4,Internet:5,Cinema:6},FileTypeEnum={All:0,Press:1,Radio:2,TV:3,Internet:4,Billboards:5,BillboardsAvi:6,VideoAds:7,MobileBanner:8,FacebookAds:9};prevclick="";videoPlayerID="";var currentFileShown=-1,prevFileShown=-1,currentFileMode="";bShowCustomDiv=!1;bAddedSlice=!1