﻿// JScript File

function confirmSave()
{
    return confirm("Are you sure you want to save?");
}
function confirmSaveClose()
{
    return confirm("Are you sure you want to save & close?");
}
function confirmCancel()
{
    return confirm("Are you sure you want to Cancel?");
}
function confirmSubmit()
{
    return confirm("Are you sure you want to submit changes?");
}
function deleteConfermation(GridName)
{
    var grid = $find("ctl00_ContentPlaceHolder1_" + GridName);
    var MasterTable = grid.get_masterTableView();
    var selectedRows = MasterTable.get_selectedItems();
    
    if (selectedRows.length > 0)
    {
        return confirm("Are you sure you want to delete?");
    }
    else
    {
        return false;
    }
}
function confirmSaveEditor(ObjId)
{
    var Rsult = confirm("Are you sure you want to save?");
    if (Rsult == true) 
    {
        __doPostBack(ObjId,'');
    }
    else
    {
        return Rsult;
    }
}
function confirmSaveEditorWOAjx(ObjId)
{
    var Rsult = confirm("Are you sure you want to save?");
    if (Rsult == true) 
    {
        //__doPostBack(ObjId,'');
    }
    else
    {
        return Rsult;
    }
}
function confirmSaveCloseEditor(ObjId)
{
    var Rsult = confirm("Are you sure you want to save & close?");
    if (Rsult == true) 
    {
        __doPostBack(ObjId,'');
    }
    else
    {
        return Rsult;
    }
}
function confirmSaveCloseEditorWOAjx(ObjId)
{
    var Rsult = confirm("Are you sure you want to save & close?");
    if (Rsult == true) 
    {
        //__doPostBack(ObjId,'');
    }
    else
    {
        return Rsult;
    }
}
function HideOpenTestimonialDiv(divId, DlistName, ImageName)
{
    var objDive = document.getElementById(divId);
    var objDL = document.getElementById("ctl00_ContentPlaceHolder1_PagePart1_" + DlistName);
    var objImgBox = document.getElementById("SlMainBanner");
    var Divs = objDL.getElementsByTagName("div");
    for(var i=0;i<Divs.length;i++)
    {
      Divs[i].className="close";
    } 
    if (objDive != null)
    {
        if (objDive.className == "open") { objDive.className = "close"; } else { objDive.className = "open"; }  
        if (objImgBox != null) { objImgBox.src="admin/images/TestimonialsUplodImgs/" + ImageName; }   
    }
}
function HideOpenServiceDiv(divId, DlistName, ImageName)
{
    var objDive = document.getElementById(divId);
    var objDL = document.getElementById("ctl00_ContentPlaceHolder1_PagePart1_" + DlistName);
    var objImgBox = document.getElementById("SlMainBanner");
    var Divs = objDL.getElementsByTagName("div");
    for(var i=0;i<Divs.length;i++)
    {
      Divs[i].className="close";
    } 
    if (objDive != null)
    {
        if (objDive.className == "open") { objDive.className = "close"; } else { objDive.className = "open"; }  
        if (objImgBox != null) { objImgBox.src="admin/images/ServicesUplodImgs/" + ImageName; }   
    }
    
//    var objDive = document.getElementById(divId);
//    if (objDive != null)
//    {
//        if (objDive.className == "open") { objDive.className = "close"; } else { objDive.className = "open"; }    
//    }
}
function OpenAllServicesDiv(DlistName)
{
    var objDL = document.getElementById("ctl00_ContentPlaceHolder1_PagePart1_" + DlistName);
    var Divs = objDL.getElementsByTagName("div");
    for(var i=0;i<Divs.length;i++)
    {
      Divs[i].className="open";
//              if(inps[i].type==="checkbox" && inps[i].checked){
//                 arr.push(inps[i].id);
//              }
    } 
}
function CloseAllServicesDiv(DlistName)
{
    var objDL = document.getElementById("ctl00_ContentPlaceHolder1_PagePart1_" + DlistName);
    var Divs = objDL.getElementsByTagName("div");
    for(var i=0;i<Divs.length;i++)
    {
      Divs[i].className="close";
//              if(inps[i].type==="checkbox" && inps[i].checked){
//                 arr.push(inps[i].id);
//              }
    } 
}
function LcProc_RunBodyFunctions()
{
    var objHdTestId=document.getElementById("ctl00_ContentPlaceHolder1_PagePart1_HiddenFieldTestimobialId");  
    if (objHdTestId != null)
    {
        if (objHdTestId.value != "0")
        {
            var objDL = document.getElementById("ctl00_ContentPlaceHolder1_PagePart1_DLTestimonialsFour");
            var Divs = objDL.getElementById("divServiceContent" + objHdTestId.value); 
            Divs.className="open";
        }
    }
}
