﻿function showPublisherPanel(pnlID,publisherID){
    PageMethods.GetPublisherInfo(publisherID,pnlID,showPublisherPanelHTML)
}

function showPublisherPanelHTML(val){
var divID="PPDiv" + val[0];
var cmbID="PPCmb" + val[0];
var tblID="PPTbl" + val[0];
var tot="";
    tot+="<table cellspacing=0 cellpadding=0 border=0 style=float:left;margin-left:2px;margin-bottom:3px;><tr><td style=background-color:#fafafa;><table class=PPTable cellspacing=0 cellpadding=0 border=0 id=" + tblID + ">";
    tot+="<tr class=PPTr value=0><td style=\"width:68%\">&nbsp;::" + val[1] + "</td><td style=\"width:8%\" class=PPImgDetail title=Detay onclick=\"PublisherPanelDetail('"+val[0]+"')\" /></td><td style=\"width:8%\" class=PPImgRefresh title=Yenile onclick=\"getNewsList('"+divID+"',"+val[0]+",document.getElementById('"+cmbID+"').value,20,1)\" /></td><td style=\"width:8%\" title='Aç/Kapat' class=PPImg onclick=PublisherPanelToggle(this)></td><td style=\"width:8%\" title=Kapat class=PPImgClose onclick=\"closeNewsList(this,"+val[0]+")\"></td></tr>";
    tot+="<tr><td colspan=5>"
        tot+="<table cellspacing=0 cellpadding=0 style=\"width:100%\">"
        tot+="<tr class=PPTrTr><td style=\"width:25%\">&nbsp;&nbsp;Bölüm</td><td style=\"width:75%\"><select id=" + cmbID + " class=PPCmb onchange=\"getNewsList('"+divID+"',"+val[0]+",this.value,20,1)\">"+val[2]+"</select></td></tr>";
        tot+="<tr><td colspan=2><div id=" + divID + " class=PPDiv></div></td></tr>";
        tot+="</table>";
    tot+="</td></tr>";
    tot+="</table>";
    tot+="</td><td class=\"icsShadowRight\"></td></tr><tr><td class=\"icsShadowBottom\"></td><td class=\"icsShadowCorner\"><div class=\"icsShadow\"></div></td></tr></table>";
    $('#'+val[3]).append(tot);

    var sectionID=document.getElementById(cmbID).value
    if(sectionID=="")sectionID=0;
    getNewsList(divID,val[0],sectionID,20,1)
}    


function PublisherPanelToggle(obj){
$('#'+obj.parentNode.parentNode.parentNode.id).find("tr:eq(1)").slideToggle("fast");
if($(obj).css("backgroundImage").indexOf("open.png")==-1){
    $(obj).css("backgroundImage","url('_image/news/open.png')");
    $(obj.parentNode).addClass("PPTrClose");
}else{
    $(obj.parentNode).removeClass("PPTrClose");
    $(obj).css("backgroundImage","url('_image/news/expand.png')")
}
}


function PublisherPanelDetail(publisherID){
window.location='haberler.aspx?p='+publisherID;
}



function closeNewsList(obj,newsID){
    $("#bPA"+newsID).css("display","");
    $(obj).parent().parent().parent().parent().parent().parent().remove();
    //$(obj.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode).remove();
}



function bPAClick(defObj){
    showPublisherPanel("ppPanel1",defObj.id.substr(3));
    defObj.style.display="none";
}

function pnlPublisherAddClose(){
    //$("#pnlPublisherAdd").hide("normal");
    $("#pnlPublisherAdd").slideUp("normal");
}

function pnlPublisherAddShow(){
    //$("#pnlPublisherAdd").show("normal");
    $("#pnlPublisherAdd").slideDown("normal");
}
$(document).ready(function() {
    $("#tdPublisherAdd").find("input").addClass("btnPubAdd");
    $("#tdPublisherAdd").find("input").hover(
		    function() {$(this).css({color:"#ffffff",backgroundColor:"#FFAA55",borderColor:"#FFAA55"});}
		    , 
		    function() {$(this).css({color:"",backgroundColor:"",borderColor:""});}
    );
    $("#tdPublisherAdd").find("input").click(
    function(){bPAClick(this);}
    )

    $("#bPA23").click();
    $("#bPA8").click();
    $("#bPA7").click();
    $("#bPA5").click();
    
});

