﻿//TODO: Supply app root path for javascript

function EditPopup(sTxtId) {
    var oTxt = document.getElementById(sTxtId);
    /*
    if (oTxt) {
        alert('yes:' + oTxt.value);
    }
    else {
        alert('no txt');
    }
    */
    var oFrm = document.createElement("form");
    oFrm.setAttribute("action", "../cms/htmlEdit/html_edit.aspx");
    oFrm.setAttribute("method", "post");
    oFrm.setAttribute("target", "htmlEdit");
    var oVal = document.createElement("input");
    oVal.setAttribute("name", sTxtId);
    oVal.setAttribute("type", "hidden");
    oVal.setAttribute("value", oTxt.value);
    oFrm.appendChild(oVal);
    document.appendChild(oFrm);
    window.open("", "htmlEdit");
    oFrm.submit();
    document.removeChild(oFrm);
}

function SetHtmlAreaValue(sTxtId, sValue) {
    var oTxt = document.getElementById(sTxtId);
    oTxt.value = sValue;
    var sDivId = GetParentId(sTxtId) + 'divDisplay';
    var oDiv = document.getElementById(sDivId);
    oDiv.innerHTML = sValue;
}

