﻿// GIC Underwriters - JavaScript
// GIC Underwriters - JavaScript
function slideSwitch() {
    var active = $('#slideshow img.ads_active');

    if (active.length == 0) active = $('#slideshow img:last');

    var next = active.next().length ? active.next() : $('#slideshow img:first');
    active.addClass('last_active');

    next.css({ opacity: 0.0 })
        .addClass('ads_active')
        .animate({ opacity: 1.0 }, 1000, function () {
            active.removeClass('ads_active last_active');
        });
    active.removeClass('ads_active');
}
$(function () {
    setInterval("slideSwitch()", 5000);
});
function clearMsg(obj) {
    if (obj.value == $(obj).attr('message')) {
        obj.value = "";
        $(obj).css('color','#000');
    }
}
function checkBlur(obj) {
    if (obj.value == "") {
        obj.value = $(obj).attr('message');
        $(obj).css('color','#888');
    }
}
function showDiv(objName) {
    var objDiv = document.getElementById(objName);
    objDiv.style.display = 'block';
}
function hiddenDiv(objName) {
    var objDiv = document.getElementById(objName);
    objDiv.style.display = 'none';
}
$(document).ready(function () {
    $("#btSecEdit").click(function (event) {
        var secId = $("#MainContent_lsSecAll").val();
        if (secId !== null) {
            $.ajax({
                type: "POST",
                url: "granadaWebServices.asmx/getSectionById",
                data: "{'strSecId':'" + secId + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (msg) {
                    var strResult = eval('(' + msg.d + ')');
                    var objName = document.getElementById("MainContent_txEditSecName");
                    objName.value = strResult.name;
                    var objDesc = document.getElementById("MainContent_txEditSecDesc");
                    objDesc.value = strResult.desc;
                },
                error: AjaxFailed
            });
        } else {
            alert('Select one item to edit, Thank you');
            var secEditWindows = document.getElementById('divEditSec');
            secEditWindows.style.display = 'none';
        }
    });
});
function AjaxSucceeded(result) {
    alert(result.d);
}
function AjaxFailed(result) {
    alert(result.status + ' ' + result.statusText);
}
