﻿function highlightStyle(tagName) {
    var oldStyle = document.getElementById(tagName).style.border;
    document.getElementById(tagName).style.border = 'dashed 5px red';
    alert('Highlighting');
    document.getElementById(tagName).style.border = oldStyle;
}
var selClient;
var selGallery;
function deleteImage(idClient, idGallery, idImage) {
    if (confirm("Are you sure that you want to delete this image?") == true) {
        selClient = idClient;
        selGallery = idGallery;
        mpo.deleteGalleryImage(idClient, idGallery, idImage, deleteImageSuccessful);
    }
}
function deleteImageSuccessful(result) {
    window.status = result;
    getGalleryImages(selClient, selGallery);
}
var selPR;
function deleteEVPR(idClient, idPressRelease, idVideo) {
    if (confirm("Are you sure that you want to delete this video?") == true) {
        selClient = idClient;
        selPR = idPressRelease;
        mpo.deleteVideo(idClient, idPressRelease, idVideo, deleteEVPRSuccessFul);
    }
}
function deleteEVPRSuccessFul(result) {
    window.status = result;
    loadVideos(selClient, selPR);
}
function deleteEIPR(idClient, idPressRelease, idImage) {
    if (confirm("Are you sure that you want to delete this image?") == true) {
        selClient = idClient;
        selPR = idPressRelease;
        mpo.deleteImage(idClient, idPressRelease, idImage, deleteEIPRSuccessFul);
    }
}
function deleteEIPRSuccessFul(result) {
    window.status = result;
    loadImages(selClient, selPR);
}
function loadClientGalleryImage(idClient, idGallery, idImagePos) {
    loaderClient("divResult");
    mpo.loadClientGalleryImage(idClient, idGallery, idImagePos, showInResults);
}
function showInClientSearch(result) {
    document.getElementById("divClientSearch").innerHTML = result;
}
function showClientSearch() {
    document.getElementById("divClientSearch").style.display = "block";
    document.getElementById("divClientSearchWrap").style.display = "block";
}
function hideClientSearch() {
    document.getElementById("divClientSearchWrap").style.display = "none";
}
function searchClient(idClient, term, skip, take) {
    showClientSearch();
    loaderClient("divClientSearch");
    mpo.clientSearch(idClient, term, skip, take, showInClientSearch);
}
function closeClientSearch() {
    /*document.getElementById("divClientContent").style.display = "block";*/
    document.getElementById("divClientSearch").style.display = "none";
    /*document.getElementById("lnkShowCS").style.display = "inline";*/
}
function submitContactFormSuccess(result) {
    if (result == 1) {
        document.getElementById("divEmailSender").innerHTML = "<div class='divSuccess' style='margin:20px;'>Email sent successfully</div>";
    }
    else {
        alert(result);
        document.getElementById("cmdSubmit").disabled = false;
    }
}
function submitContactForm(IDPressOffice, Name, EmailAddress, Subject, Comment, ctrl) {
    ctrl.disabled = true;
    mpo.submitContactForm(IDPressOffice, Name, EmailAddress, Subject, Comment, submitContactFormSuccess)
}
function smLoader(idElement) {
    document.getElementById(idElement).innerHTML = "<img src='../images/loaderSmall.gif' title='Loading...' />&nbsp;Loading...";
}
function showInSMPR(result) {
    document.getElementById("divSMPR").innerHTML = result;
}
function loadSMPR(idPressOffice, skip, take) {
    smLoader("divSMPR");
    mpo.loadSMPR(idPressOffice, skip, take, showInSMPR);
}
function showInSMEvent(result) {
    document.getElementById("divSMEvent").innerHTML = result;
}
function loadSMEvent(idPressOffice, skip, take) {
    smLoader("divSMEvent");
    mpo.loadSMEvent(idPressOffice, skip, take, showInSMEvent);
}
function showInSMPeople(result) {
    document.getElementById("divSMPeople").innerHTML = result;
}
function loadSMPeople(idPressOffice, skip, take) {
    smLoader("divSMPeople");
    mpo.loadSMPeople(idPressOffice, skip, take, showInSMPeople);
}
function showInSMLogo(result) {
    document.getElementById("divSMLogo").innerHTML = result;
}
function loadSMLogo(idPressOffice, skip, take) {
    smLoader("divSMLogo");
    mpo.loadSMLogo(idPressOffice, skip, take, showInSMLogo);
}
function showInSMCSI(result) {
    document.getElementById("divSMCSI").innerHTML = result;
}
function loadSMCSI(idPressOffice, skip, take) {
    smLoader("divSMCSI");
    mpo.loadSMCSI(idPressOffice, skip, take, showInSMCSI);
}
function showInSMGallery(result) {
    document.getElementById("divSMGallery").innerHTML = result;
}
function loadSMGallery(idPressOffice, skip, take) {
    smLoader("divSMGallery");
    mpo.loadSMGallery(idPressOffice, skip, take, showInSMGallery);
}
function loaderAlert() {
    var el = document.getElementById("divLoaderAlert");
    el.style.display = (el.style.display != 'none' ? 'none' : '');
}
function showInMenuHolder(result) {
    loaderAlert();
    document.getElementById("divMenuHolder").innerHTML = result;
}
function changeMenuPos(idPressOffice, idPage, direction, pageName) {
    loaderAlert();
    mpo.changeMenuPos(idPressOffice, idPage, direction, pageName, showInMenuHolder);
}
function showInSearchResult(result) {
    document.getElementById("divSearchResult").innerHTML = result;
}
function doSearch() {
    $("#divSearchPanel").slideDown("slow");
    loader("divSearchResult");
    mpo.HomePageSearch(document.getElementById("txtSearch").value, showInSearchResult);
}
function showInChangeLog(result) {
    if (result == "TRUE") {
        location.reload(true);
    } else {
        document.getElementById("divChangeLog").innerHTML = result;
    }
}
function undoStyleChange(idChangeLog) {
    mpo.undoStyleChange(idChangeLog, showInChangeLog);
}