﻿// 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 confirmSaveCloseEditor(ObjId)
{
    var Rsult = confirm("Are you sure you want to save & close?");
    if (Rsult == true) 
    {
        __doPostBack(ObjId,'');
    }
    else
    {
        return Rsult;
    }
}

function HideOpenServiceDiv(divId)
{
    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 CloseAllServicesDivAndOpen(DlistName,divId)
{
    
    var objDive = document.getElementById(divId);        
    var objDL = document.getElementById(DlistName);
    var Divs = objDL.getElementsByTagName("div");
    for(var i=0;i<Divs.length;i++)
    {       
        if(objDive != Divs[i])
            Divs[i].className="close";
    }    
    if (objDive != null)
    {        
        if (objDive.className == "open") { objDive.className = "close"; } else { objDive.className = "open"; }    
    }
}
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";
        }
    }
}
//function HideOpenTestimonialDiv(divId, DlistName)
//{
//    var objDive = document.getElementById(divId);
//    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 (objDive != null)
//    {
//        if (objDive.className == "open") { objDive.className = "close"; } else { objDive.className = "open"; }
//    }
//}
function HideOpenTestimonialDiv(divId)
{
    var objDive = document.getElementById(divId);
    if (objDive != null)
    {
        if (objDive.className == "open") { objDive.className = "close"; } else { objDive.className = "open"; }    
    }
}
