﻿// JScript File

//---------- Add category -----------------



function CreateCategoryTopic() 
{
     if (document.getElementById("txtNameCategoryTopic").value == "")
     {
     document.getElementById("messageCategoryTopic").innerHTML = "لطفا نام تالار را وارد نمایید.";
     document.getElementById("messageCategoryTopic").style.color = "Red";
     }
     else  if (document.getElementById("txtSortCategoryTopic").value == "")
     {
     document.getElementById("messageCategoryTopic").innerHTML = "لطفا ترتیب تالار را وارد نمایید.";
     document.getElementById("messageCategoryTopic").style.color = "Red";
     }
     else
     {
     document.getElementById("btnAddCategoryTopic").style.cursor = "wait";   
     document.body.style.cursor = "wait"; 
     document.getElementById("messageCategoryTopic").style.color = "";
     document.getElementById("messageCategoryTopic").innerHTML = "...در حال ثبت اطلاعات. لطفا چند لحظه صبر کنید<IMG SRC='../../WGSModules/Topic/Image/indicator.gif' />";
     var sentData = "";
     sentData=document.getElementById("txtNameCategoryTopic").value;
     sentData +="|"+document.getElementById("hidAddShow").value;
     sentData +="|"+document.getElementById("txtSortCategoryTopic").value;
     sentData = 1 + "#" + sentData;
     DoServerActionAddCategoryTopic(sentData,'');
     
     }
}


function NoActiveCategoryTopic(Param,Active)
{
        var sentData = "";
        sentData += Param;
        sentData += "|" + Active;
        sentData = 3 + "#" + sentData
        DoServerActionAddCategoryTopic(sentData,'');
        document.getElementById('divChkActCategoryTopic'+Param).innerHTML= "<IMG SRC='../../WGSModules/Topic/Image/indicator.gif' />";
}
function SelectOOrC(Param,Active)
{

        var sentData = "";
        sentData += Param;
        sentData += "|" + Active;
        sentData = 7 + "#" + sentData
        DoServerActionAddCategoryTopic(sentData,'');
        document.getElementById('divImgSelectOOrC'+Param).innerHTML= "<IMG SRC='../../WGSModules/Topic/Image/indicator.gif' />";

}

function EditThisCategoryTopic(Param)
{
        document.getElementById('trMainCategoryTopic'+Param).style.display="none";
        //document.getElementById('divImgCategoryTopic'+Param).innerHTML= "<IMG SRC='../images/indicator.gif' />";        
        document.getElementById('trEditCategoryTopic'+Param).style.display="block";
        document.getElementById('txtNameEditCategoryTopic'+Param).value = document.getElementById('txtHidCatTopic'+Param).value;
        document.getElementById('txtSortEditCategoryTopic'+Param).value = document.getElementById('txtHidSortCatTopic'+Param).value;
}

function CancelEditCategoryTopic(Param)
{
   document.getElementById('trMainCategoryTopic'+Param).style .display ="block";
   document.getElementById('trEditCategoryTopic'+Param).style.display="none";
   document.getElementById('divImgCategoryTopic'+Param).innerHTML="<img src='../../WGSModules/Topic/Image/Crystal_Clear_app_advancedsettings-16.gif' border=0 onclick='EditThisCategoryTopic("+Param+")' />";
}

function SaveEditCategoryTopic(Param)
{
     document.getElementById("btnSaveEdit"+Param).style.cursor = "wait";   
     document.body.style.cursor = "wait"; 
     document.getElementById("messageCategoryTopic").style.color = "";
     document.getElementById("messageCategoryTopic").innerHTML = "...در حال ثبت اطلاعات. لطفا چند لحظه صبر کنید<IMG SRC='../../Topic/Image/Crystal_Clear_app_advancedsettings-16.gif' />";
     
     document.getElementById("txtHidCatTopic"+Param).value=document.getElementById("txtNameEditCategoryTopic"+Param).value;
     document.getElementById("txtHidSortCatTopic"+Param).value=document.getElementById("txtSortEditCategoryTopic"+Param).value;
     
     var sentData = "";
     sentData=Param;
     sentData+="|"+document.getElementById("txtNameEditCategoryTopic"+Param).value;
     sentData+="|"+document.getElementById("txtSortEditCategoryTopic"+Param).value;
     sentData = 4 + "#" + sentData;
     DoServerActionAddCategoryTopic(sentData,'');
}

function DeleteThisCategoryTopic(Param)
{       
        delParam = Param;
        document.getElementById('divDeleteCategoryTopic'+Param).innerHTML= "<IMG SRC='../../WGSModules/Topic/Image/indicator.gif' />";
        document.getElementById('DivMessageDelCategoryTopic').style.display = "block";
} 
function OkDelCategoryTopic()
{
        document.getElementById('DivReadBeforeOkCategoryTopic').style.display = "none";
        document.getElementById('DivReadAfterOkCategoryTopic').style.display = "block";
        var sentData = "";
        sentData = delParam;
        sentData = 2 + "#" + sentData
        DoServerActionAddCategoryTopic(sentData,'');
}
function CancelDelCategoryTopic()
{
            document.getElementById('divDeleteCategoryTopic'+delParam).innerHTML= "<img src='../../WGSModules/Topic/Image/icon-delete.gif' border=0 onclick='DeleteThisCategoryTopic("+delParam+")' />";
            document.getElementById('DivMessageDelCategoryTopic').style.display = "none";
}
var idsemd;
function SelectImageDe(IdDeIMG)
{
        idsemd=IdDeIMG;
        var sentData = "";
        sentData = IdDeIMG;
        sentData = 5 + "#" + sentData
        DoServerActionAddCategoryTopic(sentData,'');
        document.getElementById('DivSelectPic').style.display = "block";
        document.getElementById('ImgSele').innerHTML = "در حال دریافت اطلاعات.....<IMG SRC='../../WGSModules/Topic/Image/indicator.gif' />";
        document.getElementById('divImgSelectIMG'+IdDeIMG).innerHTML = "<IMG SRC='../../WGSModules/Topic/Image/indicator.gif' />";
        
}
function OKPicselectde(NameIcon,IcTalar)
{
        var sentData = "";
        sentData = NameIcon;
        sentData += "|" + IcTalar;
        sentData = 6 + "#" + sentData
        DoServerActionAddCategoryTopic(sentData,'');
        document.getElementById('DivSelectPic').style.display = "block";
        document.getElementById('ImgSele').innerHTML = "در حال ارسال اطلاعات.....<IMG SRC='../../WGSModules/Topic/Image/indicator.gif' />";
}
function CancelSelectDiv()
{
 document.getElementById('DivSelectPic').style.display = "none";
 document.getElementById('divImgSelectIMG'+idsemd).innerHTML = "<img src='../../Images/ChangeIcon.png' border='0' onclick='SelectImageDe("+idsemd+")' />";
}
//--------- بازگشت اطلاعات-------
     var strData1 = "";
     var strData2 = "";
     var strData3 = "";
     var strData4 = "";
     var strData5 = "";
function createElemCatTopiCcc(elemText) 
    {
       var tmpArray = elemText.split("|");
       
       for (var i=0;i<tmpArray.length;i++)
       {
          
          switch(i){
                case 0 :
                    strData1 = tmpArray[i];
                break;
                case 1 :
                    strData2 = tmpArray[i];
                break;
                case 2 :
                    strData3 = tmpArray[i];
                break;
                case 3 :
                    strData4 = tmpArray[i];
                break;
                case 4 :
                    strData5 = tmpArray[i];
                break;
           }
       }
        
       return false;
    }
    
function ReceiveDataFromServerAddCategoryTopic(strData)
{
    createElemCatTopiCcc(strData);
    if (strData1 == 1)
    {
     
      document.getElementById("messageCategoryTopic").innerHTML = "تالار جدید ثبت گردید.";
      document.getElementById("divMainCategoryTopic").innerHTML = strData2; 
      //document.getElementById("divAllListCategoryTopic").innerHTML = strData3;
      document.getElementById("btnAddCategoryTopic").style.cursor = "Default";   
      document.body.style.cursor = "default"; 
      document.getElementById("fillAddcategort").innerHTML =strData4;
      document.getElementById("divCategAddmoj").innerHTML =strData5;
      
    }
    if (strData1 == 2)
    {
      document.getElementById('DivReadBeforeOkCategoryTopic').style.display = "block";
      document.getElementById('DivReadAfterOkCategoryTopic').style.display = "none";
      document.getElementById('DivMessageDelCategoryTopic').style.display = "none";
      document.getElementById('trMainCategoryTopic'+strData2).style.display = "none";
      document.getElementById("fillAddcategort").innerHTML =strData3;
      document.getElementById("divCategAddmoj").innerHTML =strData4;
     // document.getElementById('divEditCategory'+strData2).style.display = "none";
    }
    if (strData1 == 3)
    {
           document.getElementById('divChkActCategoryTopic'+strData3).innerHTML= strData2;
           if (strData4 == 0)
           {
                document.getElementById('tdSortTopic'+strData3).style.color= "red";
                document.getElementById('tdCategoryTopic'+strData3).style.color= "red";
              
           }
           else
           {
                document.getElementById('tdCategoryTopic'+strData3).style.color= "";
                document.getElementById('tdSortTopic'+strData3).style.color= "";
           }
           document.getElementById("divAllListCategoryTopic").innerHTML = strData5;
           document.body.style.cursor = "default";
     }
       if (strData1 == 7)
    {
           document.getElementById('divImgSelectOOrC'+strData3).innerHTML= strData2;
           
           document.body.style.cursor = "default";
     }
     
    if (strData1 == 4)
    {
    
        document.getElementById('tdCategoryTopic'+strData2).innerHTML ="نام تالار :&nbsp;"+document.getElementById("txtNameEditCategoryTopic"+strData2).value;
        document.getElementById('tdSortTopic'+strData2).innerHTML ="ترتیب:&nbsp;"+document.getElementById("txtSortEditCategoryTopic"+strData2).value;;
        document.getElementById('trMainCategoryTopic'+strData2).style .display ="block";
        document.getElementById('trEditCategoryTopic'+strData2).style.display="none";
        document.getElementById("messageCategoryTopic").innerHTML = "تالار ویرایش گردید.";
        document.getElementById("btnSaveEdit"+strData2).style.cursor = "Default";   
        document.body.style.cursor = "default"; 
        document.getElementById('divImgCategoryTopic'+strData2).innerHTML="<img src='../../WGSModules/Topic/Image/Crystal_Clear_app_advancedsettings-16.gif' border=0 onclick='EditThisCategoryTopic("+strData2+")' />";
        document.getElementById("txtNameEditCategoryTopic"+Param).value=document.getElementById("txtHidCatTopic"+Param).value;
        document.getElementById("txtSortEditCategoryTopic"+Param).value=document.getElementById("txtHidSortCatTopic"+Param).value;
     
       
    }
   
   if (strData1 == 5)
    {
       document.getElementById('ImgSele').innerHTML=strData2;
        document.getElementById('divImgSelectIMG'+idsemd).innerHTML = "<img src='../../Images/ChangeIcon.png' border='0' onclick='SelectImageDe("+idsemd+")' />";
    }
   if (strData1 == 6)
    {
       
        document.getElementById('DivSelectPic').style.display = "none";
    }

}

//-----------End Add category---------------------------------

//----------- Add Sub category-----------------------------


function CreateSubCategoryTopic()
{

 if (document.getElementById("txtSubCategory").value == "")
     {
     document.getElementById("messageSubCategoryTopic").innerHTML = "لطفا نام زیر مجموعه را وارد نمایید.";
     document.getElementById("messageSubCategoryTopic").style.color = "Red";
     }
     else if (document.getElementById("txtSortSubCatTo").value == "")
     {
     document.getElementById("messageSubCategoryTopic").innerHTML = "لطفا ترتیب زیر مجموعه را وارد نمایید.";
     document.getElementById("messageSubCategoryTopic").style.color = "Red";
     }
    
     else
     {
     document.getElementById("btnAddSubcategory").style.cursor = "wait";   
     document.body.style.cursor = "wait"; 
     document.getElementById("messageSubCategoryTopic").style.color = "";
     document.getElementById("messageSubCategoryTopic").innerHTML = "...در حال ثبت اطلاعات. لطفا چند لحظه صبر کنید<IMG SRC='../../WGSModules/Product/indicator.gif' />";
     var sentData = "";
     
     sentData = document.getElementById("txtSubCategory").value;
     sentData +="|"+ document.getElementById("txtDesCategory").value;
     sentData +="|"+document.getElementById("drpCategoryTopic2").value;
     sentData +="|"+document.getElementById("hidAddShow").value;
     sentData +="|"+document.getElementById("txtSortSubCatTo").value;
     sentData = 1 + "#" + sentData;
     DoServerActionAddSubCategoryTopic(sentData,'');

     }

}

function NoActiveSubCategoryTopic(Param,Active)
{
        var sentData = "";
        sentData += Param;
        sentData += "|" + Active;
        sentData = 2 + "#" + sentData
        DoServerActionAddSubCategoryTopic(sentData,'');
        document.getElementById('divChkActSubCategoryTopic'+Param).innerHTML= "<IMG SRC='../../WGSModules/Product/indicator.gif' />";
}

function EditThisSubCategoryTopic(Param)
{
        document.getElementById('trMainSubCategoryTopic'+Param).style.display="none";
        document.getElementById('trMainSubCategoryTopic2'+Param).style.display="none";
        //document.getElementById('divImgCategoryTopic'+Param).innerHTML= "<IMG SRC='../images/indicator.gif' />";        
        document.getElementById('trEditSubCategoryTopic'+Param).style.display="block";
        document.getElementById('trEditSubCategoryTopic2'+Param).style.display="block";
        //document.getElementById('trEditSubCategoryTopic2'+Param).style.display="block";
        document.getElementById('txtNameEditSubCategoryTopic'+Param).value = document.getElementById('txtHidSubCatTopic'+Param).value;
        document.getElementById('txtSortEditSubCategoryTopic'+Param).value = document.getElementById('txtHidSortSubCatTopic'+Param).value;
        document.getElementById('txtDesEditSubCategoryTopic'+Param).value = document.getElementById('txtHidDesSubCatTopic'+Param).value;
}

function CancelEditSubCategoryTopic(Param)
{
   document.getElementById('trMainSubCategoryTopic'+Param).style .display ="block";
   document.getElementById('trMainSubCategoryTopic2'+Param).style .display ="block";
   document.getElementById('trEditSubCategoryTopic'+Param).style.display="none";
   document.getElementById('trEditSubCategoryTopic2'+Param).style.display="none";
   document.getElementById('divImgSubCategoryTopic'+Param).innerHTML="<img src='../../WGSModules/Topic/Image/Crystal_Clear_app_advancedsettings-16.gif' border=0 onclick='EditThisSubCategoryTopic("+Param+")' />";
}

function SaveEditSubCategoryTopic(Param)
{
     document.getElementById("btnSaveEditSub"+Param).style.cursor = "wait";   
     document.body.style.cursor = "wait"; 
     document.getElementById("messageSubCategoryTopic").style.color = "";
     document.getElementById("messageSubCategoryTopic").innerHTML = "...در حال ثبت اطلاعات. لطفا چند لحظه صبر کنید<IMG SRC='../../WGSModules/Topic/Image/indicator.gif' />";
     
     document.getElementById("txtHidSubCatTopic"+Param).value=document.getElementById("txtNameEditSubCategoryTopic"+Param).value;
     document.getElementById("txtHidSortSubCatTopic"+Param).value=document.getElementById("txtSortEditSubCategoryTopic"+Param).value;
      document.getElementById("txtHidDesSubCatTopic"+Param).value=document.getElementById("txtDesEditSubCategoryTopic"+Param).value;
     
     var sentData = "";
     sentData=Param;
     sentData+="|"+document.getElementById("txtNameEditSubCategoryTopic"+Param).value;
     sentData+="|"+document.getElementById("txtSortEditSubCategoryTopic"+Param).value;
     sentData+="|"+document.getElementById("txtDesEditSubCategoryTopic"+Param).value;
     sentData = 4 + "#" + sentData;
     DoServerActionAddSubCategoryTopic(sentData,'');
}

function DeleteThisSubCategoryTopic(Param)
{       
        delParam = Param;
        document.getElementById('divDeleteSubCategoryTopic'+Param).innerHTML= "<IMG SRC='../images/indicator.gif' />";
        document.getElementById('DivMessageDelSubCategoryTopic').style.display = "block";
} 
function OkDelSubCategoryTopic()
{
        document.getElementById('DivReadBeforeOkSubCategoryTopic').style.display = "none";
        document.getElementById('DivReadAfterOkSubCategoryTopic').style.display = "block";
        var sentData = "";
        sentData =delParam;
        sentData = 3 + "#" + sentData
        DoServerActionAddSubCategoryTopic(sentData,'');
}
function CancelDelSubCategoryTopic()
{
            document.getElementById('divDeleteSubCategoryTopic'+delParam).innerHTML= "<img src='../../WGSModules/Administrator/icon-delete.gif' border=0 onclick='DeleteThisSubCategoryTopic("+delParam+")' />";
            document.getElementById('DivMessageDelSubCategoryTopic').style.display = "none";
}

var idsemdSubMaj;
function SelectImageDeSubMaj(IdDeIMGSubMaj)
{
        idsemdSubMaj=IdDeIMGSubMaj;
        var sentData = "";
        sentData = IdDeIMGSubMaj;
        sentData = 5 + "#" + sentData
        DoServerActionAddSubCategoryTopic(sentData,'');
        document.getElementById('DivSelectPicSubMaj').style.display = "block";
        document.getElementById('ImgSeleSubMaj').innerHTML = "در حال دریافت اطلاعات.....<IMG SRC='../../WGSModules/Topic/Image/indicator.gif' />";
        //document.getElementById('divImgSelectIMG'+IdDeIMG).innerHTML = "<img src='../../WGSModules/Topic/Image/ChangeIcon.png' border='0' onclick='SelectImageDe("+IdDeIMG+")' />";
        document.getElementById('divImgSelectIMGSubMaj'+IdDeIMGSubMaj).innerHTML = "<IMG SRC='../../WGSModules/Topic/Image/indicator.gif' />";
        
}
function OKPicselectdeSubMaj(NameIconSubMaj,IcTalarSubMaj)
{
        var sentData = "";
        sentData = NameIconSubMaj;
        sentData += "|" + IcTalarSubMaj;
        sentData = 6 + "#" + sentData
        DoServerActionAddSubCategoryTopic(sentData,'');
        document.getElementById('DivSelectPicSubMaj').style.display = "block";
        document.getElementById('ImgSeleSubMaj').innerHTML = "در حال ارسال اطلاعات.....<IMG SRC='../../WGSModules/Topic/Image/indicator.gif' />";
}
function CancelSelectDivSubMaj()
{
 document.getElementById('DivSelectPicSubMaj').style.display = "none";
 document.getElementById('divImgSelectIMGSubMaj'+idsemdSubMaj).innerHTML = "<img src='../../Images/ChangeIcon.png' border='0' onclick='SelectImageDe("+idsemdSubMaj+")' />";
}

//--------- بازگشت اطلاعات-------
     var strData1 = "";
     var strData2 = "";
     var strData3 = "";
     var strData4 = "";
     var strData5 = "";
function createElemSubCategory(elemText) 
    {
       var tmpArray = elemText.split("|");
       
       for (var i=0;i<tmpArray.length;i++)
       {
          
          switch(i){
                case 0 :
                    strData1 = tmpArray[i];
                break;
                case 1 :
                    strData2 = tmpArray[i];
                break;
                case 2 :
                    strData3 = tmpArray[i];
                break;
                case 3 :
                    strData4 = tmpArray[i];
                break;
                case 4 :
                    strData5 = tmpArray[i];
                break;
           }
       }
        
       return false;
    }
    
function ReceiveDataFromServerAddSubCategoryTopic(strData)
{
    createElemSubCategory(strData);
    if (strData1 == 1)
    {
      document.getElementById("messageSubCategoryTopic").innerHTML = "زیرگروه جدید ثبت گردید.";
      document.getElementById("divMainSubCategoryTopic").innerHTML = strData2; 
      document.getElementById("divAllListSubCategoryTopic").innerHTML = strData3;
      document.getElementById("divCategAddmoj").innerHTML = strData4;
      document.getElementById("divDrpSubCat2").innerHTML = strData5;
      document.getElementById("btnAddSubcategory").style.cursor = "Default";   
      document.body.style.cursor = "Default";  
    }
    if (strData1 == 2)
    {
           document.getElementById('divChkActSubCategoryTopic'+strData3).innerHTML= strData2;
           if (strData4 == 0)
           {
           
                document.getElementById('tdSortSubTopic'+strData3).style.color= "red";
                document.getElementById('tdSubCategoryTopic'+strData3).style.color= "red";
                document.getElementById('tdDesSubCategoryTopic'+strData3).style.color= "red";
              
           }
           else
           {
                document.getElementById('tdSortSubTopic'+strData3).style.color= "";
                document.getElementById('tdSubCategoryTopic'+strData3).style.color= "";
                document.getElementById('tdDesSubCategoryTopic'+strData3).style.color= "";
           }
           document.getElementById("divAllListSubCategoryTopic").innerHTML = strData5;
           document.body.style.cursor = "default";
     }
    if (strData1 == 3)
    {
      document.getElementById('DivReadBeforeOkSubCategoryTopic').style.display = "block";
      document.getElementById('DivReadAfterOkSubCategoryTopic').style.display = "none";
      document.getElementById('DivMessageDelSubCategoryTopic').style.display = "none";
      document.getElementById('trMainSubCategoryTopic'+strData2).style.display = "none";
      document.getElementById('trMainSubCategoryTopic2'+strData2).style.display = "none";
      document.getElementById('trMainMemSubCategoryTopic'+strData2).style.display = "none";
      document.getElementById("divCategAddmoj").innerHTML = strData3;
      document.getElementById("divDrpSubCat2").innerHTML = strData4;
    }
    
      if (strData1 == 4)
    {
    //document.getElementById('tdSubCategoryTopic'+strData2).dir ="rtl";
        document.getElementById('tdSubCategoryTopic'+strData2).innerHTML ="نام زیر مجموعه : &nbsp;"+document.getElementById("txtNameEditSubCategoryTopic"+strData2).value;
        document.getElementById('tdSortSubTopic'+strData2).innerHTML ="ترتیب:"+document.getElementById("txtSortEditSubCategoryTopic"+strData2).value;
        document.getElementById('tdDesSubCategoryTopic'+strData2).innerHTML =" توضیحات:&nbsp;" +document.getElementById("txtDesEditSubCategoryTopic"+strData2).value;
        document.getElementById('trMainSubCategoryTopic'+strData2).style .display ="block";
        document.getElementById('trMainSubCategoryTopic2'+strData2).style .display ="block";
        document.getElementById('trEditSubCategoryTopic'+strData2).style.display="none";
        document.getElementById('trEditSubCategoryTopic2'+strData2).style.display="none";
        document.getElementById("messageSubCategoryTopic").innerHTML = "تالار ویرایش گردید.";
        document.getElementById("btnSaveEditSub"+strData2).style.cursor = "Default";   
        document.body.style.cursor = "default"; 
        document.getElementById('divImgSubCategoryTopic'+strData2).innerHTML="<img src='../../WGSModules/Topic/Image/Crystal_Clear_app_advancedsettings-16.gif' border=0 onclick='EditThisSubCategoryTopic("+strData2+")' />";
        document.getElementById("txtNameEditSubCategoryTopic"+strData2).value=document.getElementById("txtHidSubCatTopic"+strData2).value;
        document.getElementById("txtSortEditSubCategoryTopic"+strData2).value=document.getElementById("txtHidSortSubCatTopic"+strData2).value;
        document.getElementById("txtDesEditSubCategoryTopic"+strData2).value=document.getElementById("txtHidDesSubCatTopic"+strData2).value;
     
       
    }
    
   if (strData1 == 5)
    {
       document.getElementById('ImgSeleSubMaj').innerHTML=strData2;
       document.getElementById('divImgSelectIMGSubMaj'+idsemdSubMaj).innerHTML = "<img src='../../Images/ChangeIcon.png' border='0' onclick='SelectImageDe("+idsemdSubMaj+")' />";
    }
   if (strData1 == 6)
    {
        document.getElementById('DivSelectPicSubMaj').style.display = "none";
    }
 
}

//-----------End Add Subcategory------------------------------------

//---------- Add Majmoe--------------------------------


function GetAddMojFa(param)
{
   document.getElementById("imgsub").innerHTML="<img src='../../WGSModules/Topic/Image/indicator.gif' />";
   document.getElementById("imgsub").style.display = "block";
   var valueID =document.getElementById("drpCattegory"+param).value;
   //valueID+="|"+ document.getElementById("drpCattegory"+param).value;
   //alert(valueID)
   valueID=4+"#"+valueID;
   DoServerActionAddZirTalar(valueID,'');        
}

function CreateZirTalar()
{

 if (document.getElementById("txtZirTalar").value == "")
     {
     document.getElementById("messageZirTalar").innerHTML = "لطفا نام کالا را وارد نمایید.";
     document.getElementById("messageZirTalar").style.color = "Red";
     }
     else
     {
     document.getElementById("btnAddZirTalar").style.cursor = "wait";   
     document.body.style.cursor = "wait"; 
     document.getElementById("messageZirTalar").style.color = "";
     document.getElementById("messageZirTalar").innerHTML = "...در حال ثبت اطلاعات. لطفا چند لحظه صبر کنید<IMG SRC='../../WGSModules/Product/indicator.gif' />";
     var sentData = "";
     
     sentData = document.getElementById("txtZirTalar").value;
     
     //sentData +="|"+ document.getElementById("txtDesZirTalar").value;
     sentData +="|"+ document.getElementById("txtsortZirtalar").value;
     sentData +="|"+document.getElementById("drpSubCat2").value;
     sentData +="|"+document.getElementById("hidAddShow").value;
     //sentData += "|" + document.getElementById("txtDesProduct").value;
     sentData = 1 + "#" + sentData;
     DoServerActionAddZirTalar(sentData,'');
     
     }

}

function NoActiveZirTalar(Param,Active)
{
        var sentData = "";
        sentData += Param;
        sentData += "|" + Active;
        sentData = 2 + "#" + sentData
        DoServerActionAddZirTalar(sentData,'');
        document.getElementById('divChkActZirTalar'+Param).innerHTML= "<IMG SRC='../../WGSModules/Product/indicator.gif' />";
}
function EditThisZirTalarTopic(Param)
{
        document.getElementById('trMainZirTalar'+Param).style.display="none";
        //document.getElementById('divImgCategoryTopic'+Param).innerHTML= "<IMG SRC='../images/indicator.gif' />";        
        document.getElementById('trEditZirTalarTopic'+Param).style.display="block";
        document.getElementById('txtNameEditZirTalarTopic'+Param).value = document.getElementById('txtHidZirTalarTopic'+Param).value;
        document.getElementById('txtSortEditZirTalarTopic'+Param).value = document.getElementById('txtHidSortZirTalarTopic'+Param).value;
}

function CancelEditZirTalarTopic(Param)
{
   document.getElementById('trMainZirTalar'+Param).style .display ="block";
   document.getElementById('trEditZirTalarTopic'+Param).style.display="none";
   document.getElementById('divImgZirTalarTopic'+Param).innerHTML="<img src='../../WGSModules/Topic/Image/Crystal_Clear_app_advancedsettings-16.gif' border=0 onclick='EditThisZirTalarTopic("+Param+")' />";
}

function SaveEditZirTalarTopic(Param)
{
     document.getElementById("btnSaveEditZirTalar"+Param).style.cursor = "wait";   
     document.body.style.cursor = "wait"; 
     document.getElementById("messageZirTalar").style.color = "";
     document.getElementById("messageZirTalar").innerHTML = "...در حال ثبت اطلاعات. لطفا چند لحظه صبر کنید<IMG SRC='../../WGSModules/Topic/Image/indicator.gif' />";
     
     document.getElementById("txtHidZirTalarTopic"+Param).value=document.getElementById("txtNameEditZirTalarTopic"+Param).value;
     document.getElementById("txtHidSortZirTalarTopic"+Param).value=document.getElementById("txtSortEditZirTalarTopic"+Param).value;
     
     var sentData = "";
     sentData=Param;
     sentData+="|"+document.getElementById("txtNameEditZirTalarTopic"+Param).value;
     sentData+="|"+document.getElementById("txtSortEditZirTalarTopic"+Param).value;
     sentData = 5 + "#" + sentData;
     DoServerActionAddZirTalar(sentData,'');
}



function DeleteThisZirTalar(Param)
{       
        delParam = Param;
        document.getElementById('divDeleteZirTalar'+Param).innerHTML= "<IMG SRC='../../WGSModules/Topic/Image/indicator.gif'  />";
        document.getElementById('DivMessageDelZirTalar').style.display = "block";
} 
function OkDelZirTalar()
{
        document.getElementById('DivReadBeforeOkZirTalar').style.display = "none";
        document.getElementById('DivReadAfterOkZirTalar').style.display = "block";
        var sentData = "";
        sentData = delParam;
        sentData = 3 + "#" + sentData
        DoServerActionAddZirTalar(sentData,'');
}
var idsemdMaj;
function SelectImageDeMaj(IdDeIMGMaj)
{
        idsemdMaj=IdDeIMGMaj;
        var sentData = "";
        sentData = IdDeIMGMaj;
        sentData = 6 + "#" + sentData;
        DoServerActionAddZirTalar(sentData,'');
        document.getElementById('DivSelectPicMaj').style.display = "block";
        document.getElementById('ImgSeleMaj').innerHTML = "در حال دریافت اطلاعات.....<IMG SRC='../../WGSModules/Topic/Image/indicator.gif' />";
        document.getElementById('divImgSelectIMGMaj'+IdDeIMGMaj).innerHTML = "<IMG SRC='../../WGSModules/Topic/Image/indicator.gif' />";
        
}
function OKPicselectdeMaj(NameIconMaj,IcTalarMaj)
{
        var sentData = "";
        sentData = NameIconMaj;
        sentData += "|" + IcTalarMaj;
        sentData = 7 + "#" + sentData
        DoServerActionAddZirTalar(sentData,'');
        document.getElementById('DivSelectPicMaj').style.display = "block";
        document.getElementById('ImgSeleMaj').innerHTML = "در حال ارسال اطلاعات.....<IMG SRC='../../WGSModules/Topic/Image/indicator.gif' />";
}
function NoActiveZirTalarAddSubPageI(Param,Active)
{
        var sentData = "";
        sentData += Param;
        sentData += "|" + Active;
        sentData = 8 + "#" + sentData
        DoServerActionAddZirTalar(sentData,'');
        document.getElementById('divChkActAddTopZirTalar'+Param).innerHTML= "<IMG SRC='../../WGSModules/Product/indicator.gif' />";
}
function CancelSelectDivMaj()
{
 document.getElementById('DivSelectPicMaj').style.display = "none";
 document.getElementById('divImgSelectIMGMaj'+idsemdMaj).innerHTML = "<img src='../../Images/ChangeIcon.png' border='0' onclick='SelectImageDe("+idsemdMaj+")' />";
}


function CancelDelZirTalar()
{
   document.getElementById('divDeleteZirTalar'+delParam).innerHTML= "<img src='../../WGSModules/Administrator/icon-delete.gif' border=0 onclick='DeleteThisZirTalar("+delParam+")' />";
   document.getElementById('DivMessageDelZirTalar').style.display = "none";
}
function AccessMember(idAccess){
  document.getElementById("DivAccessMember").style.display = "block";
  document.getElementById("DivAcc").innerHTML="در حال ارسال اطلاعات.....<IMG SRC='../../WGSModules/Topic/Image/indicator.gif' />";
  var sentData = "";
  sentData += idAccess;
  sentData = 9 + "#" + sentData
  DoServerActionAddZirTalar(sentData,'');
}
 function ChangeActiveAllTopicMaj(AddToG,IdToG){
    document.getElementById("DivAcc").innerHTML="<IMG SRC='../../WGSModules/Topic/Image/indicator.gif' />";
    var sentData = "";
    sentData=AddToG;
    sentData += "|" + IdToG;
    sentData = 11 + "#" + sentData;
    DoServerActionAddZirTalar(sentData,'');
 }

function DelMemAccessMajoe(User,IdTopic,Add,IdMem){
    document.getElementById("checkMemAccM"+IdMem).innerHTML="<IMG SRC='../../WGSModules/Topic/Image/indicator.gif' />";
    var sentData = "";
    sentData=User;
    sentData += "|" + IdTopic;
    sentData += "|" + Add;
    sentData += "|" + IdMem;
    sentData = 10 + "#" + sentData;
    DoServerActionAddZirTalar(sentData,'');
}

     var strData1 = "";
     var strData2 = "";
     var strData3 = "";
     var strData4 = "";
        function createElemAddmojmoe2(elemText) 
    {
       //var row = document.createElement("tr");
       var tmpArray = elemText.split("|");
       
       for (var i=0;i<tmpArray.length;i++)
       {
          
          switch(i){
                case 0 :
                    strData1 = tmpArray[i];
                break;
                case 1 :
                    strData2 = tmpArray[i];
                break;
                case 2 :
                    strData3 = tmpArray[i];
                break;
                case 3 :
                    strData4 = tmpArray[i];
                break;
           }
       }
        
       return false;
       
    }  

function ReceiveDataFromServerZirTalar(strData)
{
    createElemAddmojmoe2(strData);    
 
        if(strData1 == 8)
        {
        document.getElementById("divDrpSubCat2").innerHTML = strData2;
        document.getElementById("imgsub").style.display = "none";
        }       
        if (strData1 == 1)
         {
           document.getElementById("messageZirTalar").innerHTML = "زیرتالارجدید ثبت گردید.";
           document.getElementById("divMainZirTalar").innerHTML = strData3; 
           document.getElementById("divMainZirTalar").innerHTML = strData2;
           document.getElementById("btnAddZirTalar").style.cursor = "Default";   
           document.body.style.cursor = "Default";  
        }
        if (strData1 == 2)
         {
            document.getElementById('divChkActZirTalar'+strData3).innerHTML= strData2;
           if (strData4 == 0)
             {
               document.getElementById('tdZirTalar'+strData3).style.color= "red"; 
               document.getElementById('tdSortZirtalarTopic'+strData3).style.color= "red";  
              }
           else
             {
               document.getElementById('tdZirTalar'+strData3).style.color= "";
                document.getElementById('tdSortZirtalarTopic'+strData3).style.color= "";
             }
           document.getElementById("divAllListZirTalar").innerHTML = strData5;
           document.body.style.cursor = "default";
         }
    if (strData1 == 3)
    {
      document.getElementById('DivReadBeforeOkZirTalar').style.display = "block";
      document.getElementById('DivReadAfterOkZirTalar').style.display = "none";
      document.getElementById('DivMessageDelZirTalar').style.display = "none";
      document.getElementById('trMainZirTalar'+strData2).style.display = "none";
      document.getElementById('trMainMemZirTalar'+strData2).style.display = "none";
    }
    
   if (strData1 == 5)
    {
        document.getElementById('tdZirTalar'+strData2).innerHTML ="نام زیر تالار :"+document.getElementById("txtNameEditZirTalarTopic"+strData2).value;
        document.getElementById('tdSortZirtalarTopic'+strData2).innerHTML ="ترتیب:"+document.getElementById("txtSortEditZirTalarTopic"+strData2).value;
        document.getElementById('trMainZirTalar'+strData2).style .display ="block";
        document.getElementById('trEditZirTalarTopic'+strData2).style.display="none";
        document.getElementById("messageZirTalar").innerHTML = "زیر تالار ویرایش گردید ";
        document.getElementById("btnSaveEditZirTalar"+strData2).style.cursor = "Default";   
        document.body.style.cursor = "default"; 
        document.getElementById('divImgZirTalarTopic'+strData2).innerHTML="<img src='../../WGSModules/Topic/Image/Crystal_Clear_app_advancedsettings-16.gif' border=0 onclick='EditThisCategoryTopic("+strData2+")' />";
        document.getElementById("txtNameEditZirTalarTopic"+Param).value=document.getElementById("txtHidCatTopic"+Param).value;
        document.getElementById("txtSortEditZirTalarTopic"+Param).value=document.getElementById("txtHidSortCatTopic"+Param).value;
    }
    if (strData1 == 6)
    {
       document.getElementById('ImgSeleMaj').innerHTML=strData2;
       document.getElementById('divImgSelectIMGMaj'+idsemdMaj).innerHTML = "<img src='../../Images/ChangeIcon.png' border='0' onclick='SelectImageDe("+idsemdMaj+")' />";
    }
   if (strData1 == 7)
    {
        document.getElementById('DivSelectPicMaj').style.display = "none";
    }
   if (strData1 == 9)
    {
       if(strData3==1)
        document.getElementById('divChkActAddTopZirTalar'+strData2).innerHTML="<input type='checkbox' id='chkActiveAddSuZirTalar"+strData2+"' checked='checked' onclick='NoActiveZirTalarAddSubPageI("+strData2+",0)' title='کردن افزودن موضوع غیر فعال'/>"
       else   
         document.getElementById('divChkActAddTopZirTalar'+strData2).innerHTML="<input type='checkbox' id='chkActiveAddSuZirTalar"+strData2+"' onclick='NoActiveZirTalarAddSubPageI("+strData2+",1)' title='کردن افزودن موضوع غیر فعال'/>"
    }
   if (strData1 == 10)
    {
      document.getElementById("DivAcc").innerHTML=strData2;
    }
     if (strData1 == 11)
    {
      document.getElementById("DivAcc").innerHTML=strData3;
    }
   if (strData1 == 12)
    {
      document.getElementById("DivAcc").innerHTML=strData3;
    }
}

//-------------------- End Add Majmoe------------------------------------

//-------------------- Active Fa---------------------------


function NoActiveWebUser()
{
var Active=0;
        if (ckcactiveUpload.checked ==true)
        {
        Active=0;
        }
        else
        {
        Active=1;
        }
        
        var sentData = "";
        //sentData += Param;
        sentData +=  Active;
        sentData = 1 + "#" + sentData
        DoServerActionWebUser(sentData,'');
        document.getElementById('divChkActWebUser').innerHTML= "<IMG SRC='../WGSModules/Topic/Image/indicator.gif' />";
}

//--------- بازگشت اطلاعات-------
     var strData1 = "";
     var strData2 = "";
     var strData3 = "";
     var strData4 = "";
     var strData5 = "";
function createElemWebUser(elemText) 
    {
       var tmpArray = elemText.split("|");
       
       for (var i=0;i<tmpArray.length;i++)
       {
          
          switch(i){
                case 0 :
                    strData1 = tmpArray[i];
                break;
                case 1 :
                    strData2 = tmpArray[i];
                break;
                case 2 :
                    strData3 = tmpArray[i];
                break;
                case 3 :
                    strData4 = tmpArray[i];
                break;
                case 4 :
                    strData5 = tmpArray[i];
                break;
           }
       }
        
       return false;
    }
    
function ReceiveDataFromServerWebUser(strData)
{
    createElemWebUser(strData);
    if (strData1 == 1)
    {
    if (strData2 == 0)
    {
      document.getElementById('divChkActWebUser').innerHTML=" غیرفعال<input id='ckcactiveUpload'  onchange='NoActiveWebUser()' type='checkbox'  onclick='return ckcactiveUpload_onclick()'  />"
      document.getElementById('divChkActWebUser').style.color= "red";           
          
     }
     else if (strData2 == 1)
     {
     document.getElementById('divChkActWebUser').innerHTML= "فعال<input id='ckcactiveUpload' onchange='NoActiveWebUser()' type='checkbox' checked onclick='return ckcactiveUpload_onclick()'  /> "
     document.getElementById('divChkActWebUser').style.color= ""; 
     }
                          
          
     }
     
}


function ckcactiveUpload_onclick() 
{
        var Active=0;     
        var sentData = "";
        //sentData += Param;
        sentData +=  Active;
        sentData = 1 + "#" + sentData
        DoServerActionWebUser(sentData,'');
        document.getElementById('divChkActWebUser').innerHTML= "<IMG SRC='../WGSModules/Topic/Image/indicator.gif' />";
}

//-----------End Active Fa-------------------------------

//---------------DataList Subject-----------------------


function DeleteSubjectTopic(Param)
{       
        delParam = Param;
        document.getElementById('divDeleteSubjectTopic'+Param).innerHTML= "<IMG SRC='../WGSModules/Topic/Image/indicator.gif' />";
        document.getElementById('DivMessageDelSubjectTopic').style.display = "block";
} 
function OkDelSubjectTopic()
{
        document.getElementById('DivReadBeforeOkSubjectTopic').style.display = "none";
        document.getElementById('DivReadAfterOkSubjectTopic').style.display = "block";
        var sentData = "";
        sentData = delParam;
        sentData = 1 + "#" + sentData
        DoServerActionAddSubjectTopic(sentData,'');
}
function CancelDelSubjectTopic()
{
            document.getElementById('divDeleteSubjectTopic'+delParam).innerHTML= "<img src='../WGSModules/Administrator/icon-delete.gif' border=0 onclick='DeleteSubjectTopic("+delParam+")' />";
            document.getElementById('DivMessageDelSubjectTopic').style.display = "none";
}
//--------- بازگشت اطلاعات-------
     var strData1 = "";
     var strData2 = "";
     var strData3 = "";
     var strData4 = "";
     var strData5 = "";
function createElemSubject(elemText) 
    {
       var tmpArray = elemText.split("|");
       
       for (var i=0;i<tmpArray.length;i++)
       {
          
          switch(i){
                case 0 :
                    strData1 = tmpArray[i];
                break;
                case 1 :
                    strData2 = tmpArray[i];
                break;
                case 2 :
                    strData3 = tmpArray[i];
                break;
                case 3 :
                    strData4 = tmpArray[i];
                break;
                case 4 :
                    strData5 = tmpArray[i];
                break;
           }
       }
        
       return false;
    }
    
function ReceiveDataFromServerAddSubjectTopic(strData)
{
    createElemSubject(strData);
    if (strData1 == 1)
    {
      document.getElementById('DivReadBeforeOkSubjectTopic').style.display = "block";
      document.getElementById('DivReadAfterOkSubjectTopic').style.display = "none";
      document.getElementById('DivMessageDelSubjectTopic').style.display = "none";
      document.getElementById('divAllSubjectTopic'+strData2).style.display = "none";
    }
   if (strData1 == 2)
    {
     document.getElementById("MeDivMembers").innerHTML=strData2; 
    }
   if (strData1 == 3)
    {
     document.getElementById("MeDivMembers").innerHTML=strData3; 
    } 
  if (strData1 == 4)
    {
     document.getElementById("MeDivMembers").innerHTML=strData3; 
    } 
 
}

//----------End Datalist Subject--------------------------

//----------Datalist Topic------------------------


function DeleteCommentTopic(Param)
{       
        delParam = Param;
        document.getElementById('divDeleteCommentTopic'+Param).innerHTML= "<IMG SRC='../../WGSModules/Topic/Image/indicator.gif' />";
        document.getElementById('DivMessageDelCommentTopic').style.display = "block";
} 
function OkDelCommentTopic()
{
        document.getElementById('DivReadBeforeOkCommentTopic').style.display = "none";
        document.getElementById('DivReadAfterOkCommentTopic').style.display = "block";
        var sentData = "";
        sentData = delParam;
        sentData = 1 + "#" + sentData
        DoServerActionAddCommentTopic(sentData,'');
}
function CancelDelCommentTopic()
{
            document.getElementById('divDeleteCommentTopic'+delParam).innerHTML= "<img src='../../WGSModules/Administrator/icon-delete.gif' border=0 onclick='DeleteCommentTopic("+delParam+")' />";
            document.getElementById('DivMessageDelCommentTopic').style.display = "none";
}

function ActiveTopicjava(param)
{
         var sentData = "";
        sentData = param;
        sentData = 2 + "#" + sentData
        DoServerActionAddCommentTopic(sentData,'');
}

//--------- بازگشت اطلاعات-------
     var strData1 = "";
     var strData2 = "";
     var strData3 = "";
     var strData4 = "";
     var strData5 = "";
function createElemComment(elemText) 
    {
       var tmpArray = elemText.split("|");
       
       for (var i=0;i<tmpArray.length;i++)
       {
          
          switch(i){
                case 0 :
                    strData1 = tmpArray[i];
                break;
                case 1 :
                    strData2 = tmpArray[i];
                break;
                case 2 :
                    strData3 = tmpArray[i];
                break;
                case 3 :
                    strData4 = tmpArray[i];
                break;
                case 4 :
                    strData5 = tmpArray[i];
                break;
           }
       }
        
       return false;
    }
    
function ReceiveDataFromServerAddCommentTopic(strData)
{
    createElemComment(strData);

    if (strData1 == 1)
    {
      document.getElementById('DivReadBeforeOkCommentTopic').style.display = "block";
      document.getElementById('DivReadAfterOkCommentTopic').style.display = "none";
      document.getElementById('DivMessageDelCommentTopic').style.display = "none";
      document.getElementById('divDataCommentTopic'+strData2).style.display = "none";

    }
     if (strData1 == 1)
    {
       if(strData2==1)
       {
       }
       else
       {
       }
      document.getElementById('tbldelete').style.display = "block";
      document.getElementById('divDataCommentTopic').style.display = "none";
   
    }
    
 
}

//----------End Datalist Topic--------------------------

//--------- Start End Topic----------------------


function DeleteSubjectTopicEndTopic(Param)
{       
        delParam = Param;
        document.getElementById('divDeleteEndofSubjectTopic'+Param).innerHTML= "<IMG SRC='../../WGSModules/Topic/Image/indicator.gif' />";
        document.getElementById('DivMessageDelEndofSubjectTopic').style.display = "block";
} 
function OkDelSubjectTopicEndTopic()
{
        document.getElementById('DivReadBeforeOkEndofSubjectTopic').style.display = "none";
        document.getElementById('DivReadAfterOkEndofSubjectTopic').style.display = "block";
        var sentData = "";
        sentData = delParam;
        sentData = 1 + "#" + sentData
        DoServerActionAddEndofSubject(sentData,'');
}
function CancelDelSubjectTopicEndTopic()
{
            document.getElementById('divDeleteEndofSubjectTopic'+delParam).innerHTML= "<img src='../../WGSModules/Administrator/icon-delete.gif' border=0 onclick='DeleteSubjectTopicEndTopic("+delParam+")' />";
            document.getElementById('DivMessageDelEndofSubjectTopic').style.display = "none";
}
//--------- بازگشت اطلاعات-------
     var strData1 = "";
     var strData2 = "";
     var strData3 = "";
     var strData4 = "";
     var strData5 = "";
function createElemSubjectEndTopicFa(elemText) 
    {
       var tmpArray = elemText.split("|");
       
       for (var i=0;i<tmpArray.length;i++)
       {
          
          switch(i){
                case 0 :
                    strData1 = tmpArray[i];
                break;
                case 1 :
                    strData2 = tmpArray[i];
                break;
                case 2 :
                    strData3 = tmpArray[i];
                break;
                case 3 :
                    strData4 = tmpArray[i];
                break;
                case 4 :
                    strData5 = tmpArray[i];
                break;
           }
       }
        
       return false;
    }
    
function ReceiveDataFromServerAddEndofSubject(strData)
{
    createElemSubjectEndTopicFa(strData);

    if (strData1 == 1)
    {
      document.getElementById('DivReadBeforeOkEndofSubjectTopic').style.display = "block";
      document.getElementById('DivReadAfterOkEndofSubjectTopic').style.display = "none";
      document.getElementById('DivMessageDelEndofSubjectTopic').style.display = "none";
      document.getElementById('divAllEndofSubjectTopic'+strData2).style.display = "none";
    }
    
 
}

//-----------End End Topic----------------------

