/* PROMPT FOR SAVE */

var editor1 = new Array();
var origHTML = new Array();
var loaded = false;

function RegisterEditor (e) {
    editor1[editor1.length] = window.document.getElementById(e);
    }
    
function RegisterButton (b) {
    var btn = window.document.getElementById(b);
    if (btn != null) {
        btn.onclick = NoPrompt;
        }
    }

function NoPrompt() {
    editor1 = new Array();
    }

function GetEditorHTML() {
    setTimeout("GetEditorHTML_Delay();",2000);
    }
    
function GetEditorHTML_Delay () {
    for (var i = 0; i < editor1.length; i++) {
        if (editor1[i] != null) {
            origHTML[i] = editor1[i].getHTML();
            }
        }
    loaded = true;
    }
    
function PromptForSave() { 
    if (loaded) {
        for (var i = 0; i < editor1.length; i++) {
            if (editor1[i] != null) {
                if (origHTML[i] != undefined) {
                    if (origHTML[i] != editor1[i].getHTML()) {
                        return 'YOUR CHANGES HAVE NOT BEEN SAVED'; 
                        }
                    }
                }
            }
        }
    }



/* CONFIRMATION PROMPTS */

function ConfirmPublish(page) { 
var sMsg = 'Are you sure you want to publish changes?';
if (confirm(sMsg))  { 
     window.location = page + "?publish=y";
     } 
} 


function ConfirmUndo(page) { 
var sMsg = 'Are you sure you want to undo the previous publish (any unpublished changes will be lost)?';
if (confirm(sMsg))  { 
     window.location = page + "?undo=y";
     } 
} 


function ConfirmDiscard(page) { 
var sMsg = 'Are you sure you want to discard all unpublished changes?';
if (confirm(sMsg))  { 
     window.location = page + "?discard=y";
     } 
} 


function ConfirmDeletePage(page,deletepage) { 
var sMsg = 'Are you sure you want to delete this page?';
if (confirm(sMsg))  { 
     window.location = page + "?deletepage=" + deletepage;
     } 
} 


function ConfirmDeleteUser(page,deleteuser) { 
var sMsg = 'Are you sure you want to delete this user?';
if (confirm(sMsg))  { 
     window.location = page + "?deleteuser=" + deleteuser;
     } 
} 


function ConfirmDelete(page,deleteobject) { 
var sMsg = 'Are you sure you want to delete this object?';
if (confirm(sMsg))  { 
     window.location = page + "?deleteobject=" + deleteobject;
     } 
    } 



/* RESIZE IFRAME FOR EMAIL AND STATS */


function ResizeFrame() {

    var f;
    var h;

    f = window.document.getElementsByTagName('iframe');
        
    if (f.length > 0) {
        h = window.document.getElementsByTagName('html')[0];
        f[0].style.height = (h.clientHeight - 28) + 'px';
    };

}


/* MISC */

function get_address_subject( to, subject ) {

// used to obscure email addresses

document.write('<');
document.write('a href=');
document.write('"');
document.write('mai');
document.write('lto:');
document.write( to );
document.write('&#64;');
document.write('pathfinderwebsolutions');
document.write('&#46;');
document.write('com');

document.write('?');
document.write('subject=');
document.write( subject );

document.write('"');
document.write('>');
document.write( to );
document.write('&#64;');
document.write('pathfinderwebsolutions');
document.write('&#46;');
document.write('com');
document.write('<');
document.write('/a');
document.write('>');

}


function get_address_subject_class( to, subject, css_class ) {

// used to obscure email addresses

document.write('<');
document.write('a class="');
document.write( css_class );
document.write('"large" href=');
document.write('"');
document.write('mai');
document.write('lto:');
document.write( to );
document.write('&#64;');
document.write('pathfinderwebsolutions');
document.write('&#46;');
document.write('com');

document.write('?');
document.write('subject=');
document.write( subject );

document.write('"');
document.write('>');
document.write( to );
document.write('&#64;');
document.write('pathfinderwebsolutions');
document.write('&#46;');
document.write('com');
document.write('<');
document.write('/a');
document.write('>');

}


function get_address( to ) {

// used to obscure email addresses

document.write('<');
document.write('a href=');
document.write('"');
document.write('mai');
document.write('lto:');
document.write( to );
document.write('&#64;');
document.write('pathfinderwebsolutions');
document.write('&#46;');
document.write('com');
document.write('"');
document.write('>');
document.write( to );
document.write('&#64;');
document.write('pathfinderwebsolutions');
document.write('&#46;');
document.write('com');
document.write('<');
document.write('/a');
document.write('>');

}


function object_fix() {

// ActiveX click-or-press-space-to-activate fix

theObjects = document.getElementsByTagName("object");

for (var i = 0; i < theObjects.length; i++) {
    theObjects[i].outerHTML = theObjects[i].outerHTML;
    }

}

