﻿// JScript File

function confirmSave()
{
    return confirm("Are you sure you want to save?");
}
function confirmDelete()
{
    return confirm("Are you sure you want to delete?");
}
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 HideOpenContentDiv(divId, DlistName, ImageName, title, titleLabel, imgPath)
{
    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 = imgPath + ImageName; }
    }
    
    var objTitle = document.getElementById("ctl00_ContentPlaceHolder1_PagePart1_" + titleLabel);
    if (objTitle != null) {
        objTitle.innerHTML = title;
    }
}
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 HideOpenContentDivSpecial(divId, DlistName, ImageName, title, titleLabel, imgPath) {
    var objContactDive = document.getElementById("divGContact");
    var objDive = document.getElementById(divId);
    var objDL = document.getElementById("ctl00_ContentPlaceHolder1_PagePart1_" + DlistName);
    var objImgBox = document.getElementById("SlMainBanner");
    var Divs = objDL.getElementsByTagName("div");
    
    objContactDive.className = "close";
    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 = imgPath + ImageName; }
    }

    var objTitle = document.getElementById("ctl00_ContentPlaceHolder1_PagePart1_" + titleLabel);
    if (objTitle != null) {
        objTitle.innerHTML = title;
    }
}
function HideOpenDivSpecial(divId, DlistName) {
    var objContactDive = document.getElementById(divId);
    var objDL = document.getElementById("ctl00_ContentPlaceHolder1_PagePart1_" + DlistName);
    var Divs = objDL.getElementsByTagName("div");

    objContactDive.className = "open";
    for (var i = 0; i < Divs.length; i++) {
        Divs[i].className = "close";
    }
}
function LcProcOpenOrClose(divId)
{
    var objContactDive = document.getElementById(divId);
    if (Request.QueryString("id").Count > 0)
    {
        objContactDive.className="close";
    }
    else
    {
        objContactDive.className="open";
    }
}
