<!--
function checkAll(checkname, exby) {
    var eles=exby.form.elements;
    for (i = 0; i < eles.length; i++){
        if (eles[i].name&&eles[i].name==checkname){
            eles[i].checked = exby.checked? true:false;
        }
    }
}

function clearMe(formfield){
    if (formfield.defaultValue==formfield.value)
        formfield.value = ""
}

function amIBlank(formfield, defaultText){
    if (formfield.value=="")
        formfield.value = defaultText
}

function confirmPost()
{
    var agree=confirm("Are you sure you want to send these emails?");
    if (agree)
        return true ;
    else
        return false ;
}

function confirmDeleteFromEvent()
{
    var agree=confirm("* PLEASE CONFIRM YOU WANT TO REMOVE * \n * ALL SELECTED USERS FROM THIS EVENT *");
    if (agree) {
        var agree2 = confirm("* ARE YOU REALLY SURE ? *");
        
        if (agree2) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}

function confirmRsvpFromEvent()
{
    var agree=confirm("* PLEASE CONFIRM YOU WANT TO RSVP * \n * ALL SELECTED USERS FROM THIS EVENT *");
    if (agree) {
        var agree2 = confirm("* ARE YOU REALLY SURE ? *");
        
        if (agree2) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}

function numbersOnly(evt)
{
    var charCode = (evt.which) ? evt.which : event.keyCode

    if (charCode > 31 && (charCode < 48 || charCode > 57))
        return false;
    
    return true;
}

function popup(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,left = 140,top = 50');");
} 

function popupEmail(URL,email_type) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL+'?email_type='+email_type, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,left = 140,top = 50');");
}

function forgottenPassword()
{
    var email=document.login.email.value;
    if ( email != "" )
    {
        document.login.submit();
        return true ;
    }
    else
    {
        alert( "You must enter an email address to have password details sent." );
        return false ;
    }
}

var srcFrame;
//External content into a layer
function loadOuter(doc) {
    srcFrame = document.getElementById("hiddenContent");
    srcFrame.src = doc;

    if ( document.getElementById("last_type").value == doc )
    {
        srcFrame.contentWindow.location.reload(true);
    }
    document.getElementById("last_type").value = doc;

    if (!srcFrame.onload) {
		setTimeout("transferHTML()", 1000)
    }
}

function transferHTML(){
    srcContent='';
    if (srcFrame.contentDocument){
        srcContent=srcFrame.contentDocument.getElementsByTagName("BODY")[0].innerHTML;
    }
    else if (srcFrame.contentWindow){
        srcContent=srcFrame.contentWindow.document.body.innerHTML;
    }
    //document.getElementById("outerDisplay").innerHTML = srcContent

    //alert(srcContent);
    

    srcContent = srcContent.replace("</PRE>","");
    srcContent = srcContent.replace("</pre>","");
    
    srcContent = srcContent.replace(/&lt;/g,"<");
    srcContent = srcContent.replace(/&gt;/g,">");
    srcContent = srcContent.replace(/lt;/g,"<");
    srcContent = srcContent.replace(/gt;/g,"<");
    srcContent = srcContent.replace(/\\"/g,"\"");
    
    lines = srcContent.split("\n");
    
    mySubject = "";
    myContent = "";
    for(var i=0; i < lines.length; i++) {
        if ( lines[i].search(">") > -1 )
        {
            if ( lines[i].search("<pre") > -1 || lines[i].search("<PRE") > -1 )
            {
                lines[i] = lines[i].substring(lines[i].search(">")+1,lines[i].length);
            }
        }

        


        if ( lines[i].search("SUBJECT") > -1 )
        {
            mySubject = lines[i];
            mySubject = mySubject.replace("SUBJECT: ","")
        }
        else
        {
            myContent += lines[i] + '\n';
        }
    }

    //document.getElementById("email_content").value = srcContent
    document.frmNames2.subject.value = mySubject;
    document.frmNames2.email_content.value = myContent
}

var swapCodes   = new Array(8211, 8212, 8216, 8217, 8220, 8221, 8226, 8230); // dec codes from char at
var swapStrings = new Array("--", "--", "'",  "'",  '"',  '"',  "*",  "...");  

function cleanWordClipboard(input) {
    // debug for new codes
    // for (i = 0; i < input.length; i++)  alert("'" + input.charAt(i) + "': " + input.charCodeAt(i));
    
    var output = input;
    for (i = 0; i < swapCodes.length; i++) {
        var swapper = new RegExp("\\u" + swapCodes[i].toString(16), "g"); // hex codes
        output = output.replace(swapper, swapStrings[i]);
    }
    return output;
}


//-->
