
// Anti-Spam Email Displayer- By JavaScriptKit.com
// Visit JavaScript Kit (http://javascriptkit.com) for this script and more.
// This notice must stay intact for use
// (!Modified by AL A. on 2-22-05)
// NOTE: The following 'styles' are used in the 'function' and
// must be declared in a separate style sheet, or in the <head> section
// of your page.
//
//<style type="text/css">
// .emtext{
// color: black;
// font-family: arial, verdana, ms sans serif;
// font-weight: bold;
// font-size: 12pt;
// line-height: 1.5;
// }
// .emform{
// background-color: #66cc00;
// color: black;
// font-family: arial, verdana, ms sans serif;
// font-weight: bold;
// font-size: 12pt;
// line-height: 1.5;
// </style>

//    Naturally, you can modify these styles to suit your taste

// ----Begin Arrays----------

var legcontacts=new Array() // Array for Legion Emails
//Specify 'display text' and corresponding 'email account name'.
legcontacts[0]=["Legion Post 102", "legion"]
legcontacts[1]=["Legion Cmdr.", "legcmdr"]
legcontacts[2]=["Legion Jr. Cmdr.", "legadv"]


var auxcontacts=new Array() // Array for Auxiliary Emails
//Specify 'display text' and corresponding 'email account name'.
auxcontacts[0]=["Auxiliary Unit 102", "auxiliary"]
auxcontacts[1]=["Auxiliary Secretary", "auxsec"]

var salcontacts=new Array() // Array for S.A.L Emails
//Specify 'display text' and corresponding 'email account name'.
salcontacts[0]=["S.A.L. Squadron 102", "sal"]
salcontacts[1]=["S.A.L. Adjutant", "saladj"]
salcontacts[2]=["S.A.L. Legion Adviser", "saladv"]


var clubcontacts=new Array() // Array for Club Emails
//Specify 'display text' and corresponding 'email account name'.
clubcontacts[0]=["Anoka Legion", "anokaleg"]
clubcontacts[1]=["Anoka Legion Club", "club102"]

var alrcontacts=new Array() // Array for Club Emails
//Specify 'display text' and corresponding 'email account name'.
alrcontacts[0]=["Chapter 102", "alr102"]


var webcontacts=new Array() // Array for Web-Related Emails
//Specify 'display text' and corresponding 'email account name'.
webcontacts[0]=["Webmaster", "webmaster"]
webcontacts[1]=["ADD Event Item", "news"]
webcontacts[2]=["ADD News Item", "news"]


//-------- End Arrays ------------------

//Specify caption text to display within SELECT menu.
// Only applicable if you're using the form option:

var menucap="CONTACT US"   // Modified by calling 'displaycontact'
var domaddr="anokalegion.org"  // Name of your domain
var septype=" | "  // Type of separator you want for multiple text display

// ------- Begin Function -------------------

function displaycontact(emailarray, displaymethod, menucap)
{
if (displaymethod=="text")
{
    document.write('<span class="emtext">\n')

    if (typeof emailarray[0]=="object")
    { //if array passed consists of multiple elements
        for (i=0; i<emailarray.length; i++)
        {
        var separator=(i<emailarray.length-1)? septype : ""
        document.write('<a href="mailto:' + (emailarray[i][1]) + '@' + domaddr + '">'+ emailarray[i][0] + '</a>' + separator)
        }
    }
    else //else if it is a single array element
        document.write('<a href="mailto:' + (emailarray[1]) + '@' + domaddr +'">'+ emailarray[0] + '</a>')
    document.write('</span>')
}
else if (displaymethod=="form")
{
    document.write('<form>\n')
    document.write('<select size="1" onChange="jumptooption(this)" class="emform">\n')
    document.write('<option value="caption">' + menucap + '</option>\n')
    for (i=0; i<emailarray.length; i++)
        document.write('<option value="mailto:' + (emailarray[i][1]) + '@' + domaddr + '">' + emailarray[i][0] + ' </option>\n')
    document.write('</select></form>\n')
}
}

function jumptooption(themenu)
{
if (themenu.options[themenu.selectedIndex].value !="caption")
location=themenu.options[themenu.selectedIndex].value
}

// ------------- End Function --------------------

//USAGE INSTRUCTION:
// displaycontact(1st paramter, "2nd paramter", "3rd paramter")

//1st parameter: Input the name of the array containing the list of email addresses.
//To display one single email, input the corresponding array element (arrayname[1]).

//2nd parameter: Input either "form" or "text."
//"form" will display email in drop down menu.
//"text" in plain text. Only "text" mode supports displaying of single email address!

//3rd parameter: If in "form" mode, enter a 'Caption' for the <SELECT> tag.
// If "text" mode, simply enter ( "" ).

//SAMPLE USAGES:

//displaycontact(arrayname, "text", "") [Display all in the array.]
//displaycontact(arrayname, "form", "Contact Us")
//displaycontact(arrayname[2], "text", "") [Display a Single Contact.]

// --- End of 'setem.js' ----
