// GOOGLE ANALYTICS
var GA_siteID = new String('UA-10986772-1');
var GA_siteDomain = new String('nea.org');
var neanav = new String();
var neasearch = new String();
// MULTIMEDIA PAGE
var MM_mediaURL = new String();
var MM_None = new String('<center>YOUR BROWSER DO NOT HAVE ANY MEDIA PLAYER PLUGIN INSTALLED</center>');
var MM_Real = new String();
var MM_Quick = new String();
var MM_WinM = new String();
var MM_PlugIns = new Array();
function StopMedia(mediaType, movieName){
    try{
        var movie = document.getElementById(movieName);
    
        if(parseInt(mediaType) == 0)
            movie.SetVariable("stopS", 1);
        else if(parseInt(mediaType) == 1){
            if(navigator.appName.indexOf("Microsoft") != -1){
                neaVideoPlayer.stopVideo();
            }
            else{
                window.document.neaVideoPlayer.stopVideo();
            }
        }
    }
    catch(err){
    }
}
function MM_openLayer(linkType, mediaTitle, mediaReporter, mediaDesc, mediaDuration){
    $("#mm_layer_shadow").css("display","block");
    $("#vidlayer").css("display","block");
    
    $("#mm_mediaTitle").text(mediaTitle);
    $("#mediaDesc").text(mediaDesc);
    $("#mediaReporter").html(mediaReporter);
    $("#mediaDuration").html(mediaDuration);
    document.getElementById('cMediaType').value = linkType;
}
function MM_closeLayer(){
    if(pluginlist.indexOf('Flash') != -1){
        if(parseInt(document.getElementById('cMediaType').value) == 0)
            StopMedia(0, 'neaAudioPlayer');
        else if(parseInt(document.getElementById('cMediaType').value) == 1)
            StopMedia(1, 'neaVideoPlayer');
    }
    
    $("#mm_layer_shadow").css("display","none");
    $("#vidlayer").css("display","none");
}
function MM_setMediaURL(mediaLink, mediaType, mediaDesc, mediaDuration, mediaReporter, mediaTitle){
    var kWords = new Array('None', 'Windows Media Player', 'RealPlayer', 'QuickTime');
    var kFound = 0;
    var i = new Number();
    var inHtml = new String();
    
    if(mediaLink != null && mediaLink != ''){
        MM_mediaURL = mediaLink;
        var MM_None = new String('<center>YOUR BROWSER DO NOT HAVE ANY MEDIA PLAYER PLUGIN INSTALLED</center>');
        var MM_PlugIns = new Array(MM_None, MM_WinM, MM_Real, MM_Quick);
        
        if(mediaType.toLowerCase() == 'audio'){
            if(pluginlist.indexOf('Flash') != -1){
                var so = new SWFObject("/assets/img/content/audioPlayer.swf", "neaAudioPlayer", "250", "40", "8");
                so.addParam("swliveconnect", "true");
                so.addVariable("MM_mediaURL", MM_mediaURL);
                so.write("mediaPlace");
                MM_openLayer(0, mediaTitle, mediaReporter, mediaDesc, mediaDuration);
            }
        }
    }
}
// Search engine identification function
function SetSearchID(cLocation){
    var splitQMark = cLocation.split('?');
    var url = new String(splitQMark[0].toLowerCase());
    var params = new String(splitQMark[1]);
    var aplitHttp = url.split('http://');
    var noHttp = new String(aplitHttp[1]);
    var stp = noHttp.split('/');
    var breadCrumb = new String();
    
    for(var i = 1; i < stp.length - 1; i++){
        // 'Home' instead of 'Tools' or 'Grants'
        if(stp[i].toLowerCase() == 'tools' || stp[i].toLowerCase() == 'grants')
            breadCrumb += 'home/';
        else
            breadCrumb += stp[i] + '/';
    }
    
    // Filter search by type (params)
    var splitAmp = params.split('&');
    
    for(var i = 0; i < splitAmp.length; i++){
        var strParam = new String(splitAmp[i]);
        var stpEqual = strParam.split('=');
        
        if(params.indexOf('t') != -1){
            if(stpEqual[1] == 'Lesson+Plan' || stpEqual[1] == 'Works4Me' || stpEqual[1] == 'Grant/Award'){
                if(stpEqual[1] == 'Grant/Award'){
                    var strGA = new String(stpEqual[1]);
                    var sptGA = strGA.split('/');
                    var strUnion = sptGA[0] + '&' + sptGA[1];
                    
                    breadCrumb += strUnion + '/search';
                }
                else
                    breadCrumb += stpEqual[1] + '/search';
            }
        }
        else{
            breadCrumb += 'search';
            break;
        }
    }
    
    return(breadCrumb);
}
// Right Rail components identification function (used for GA)
var neamodule = new String();
function GenerateRrId(RRName, RRHeadLine){
    var allHiddens = document.getElementsByTagName('input');
    var compHiddens = new Array();
    var idCounter = new Number();
    var gotID = new String();
    
    for(var i = 0; i < allHiddens.length; i++){
        if(allHiddens[i].value == RRName){
            idCounter++;
        }
    }
    
    gotID = RRName + '_' + idCounter + '/' + RRHeadLine;
    return(gotID);
}
/* all NEA.org pages use nea.js */
var NEA = {};
// flash constructor
NEA.Fla = function(file, h){
    this.file = file;
    this.h = h;
}
NEA.Fla.prototype.place = 'banner';
// different ones, have to change these to .prototype
// (and change usage below to point at the object instance)
NEA.Fla.w = 960;
NEA.Fla.path = "";
// collection of objects
NEA.flash = {
    academy: new NEA.Fla("NEA_Academy_Flash.swf",184),
    assoc: new NEA.Fla("NEA_Association_Flash.swf",199),
    org: new NEA.Fla("/assets/img/template/ME/mea_banner.swf",239),
    working: new NEA.Fla("NEA_Working_Flash.swf",184),
    tour: new NEA.Fla("NEA_Tour.swf",409),
    queue : []
}
// different place
NEA.flash['tour'].place = 'tour-swf';
// collect these from the calling page
NEA.writeFlash = function(idx){
    NEA.flash.queue[NEA.flash.queue.length] = idx;
}
NEA.png = {};
// courtesy of http://ajaxcookbook.org/png-alpha-transparency/
NEA.png.createPNGImage = function(src, width, height) {
    if (navigator.userAgent.indexOf("MSIE") != -1) {
        var element = document.createElement("div");
        element.style.filter = "progid:DXImageTransform.Microsoft." +
                               "AlphaImageLoader(src='" + src + "')";
        // element.style.filters(1) = "DXImageTransform.Microsoft.Alpha".Opacity[50];
    } else {
        var element = document.createElement("img");
        element.src = src;
    }
    element.style.width = width + "px";
    element.style.height = height + "px";
    return element;
}
NEA.video = {};
NEA.video.art = {
    path: "_res/images/design/",
    icon: "icon-play.png",
    loading: "icon-load.gif"
};
NEA.video.txt = {
    close: '<span class="err"><br />(<a href="javascript:NEA.video.close()">close</a>)</span>',
    mask:     '<div id="vidlayer"></div>',
    box:     '<div id="vidbox"><p id="icon-load"><img src="'
                + NEA.video.art.path + NEA.video.art.loading + '" alt="Loading..." /> Loading...</p></div>'
}
NEA.video.set = function(item,tag){
    $(item).hover(function(){
        $(item).find(tag).addClass('play-over');
    },function(){
        $(item).find(tag).removeClass('play-over');
    })
};
NEA.video.get = function(obj){
    $.ajax({
        type: "GET",
        url: $(obj).attr('href'),
        timeout : 2000,
        global : false,
        data : encodeURI(new Date()), // prevent cache
        error: function(){
            $('#icon-load').empty().append('Loading movie failed. If this continues, please contact NEA for assistance.').addClass('vid-error').append(NEA.video.txt.close);
        },
        success: function(data){
            //$('#vidlayer').fadeTo("fast",0.5) // broken in 1.1.3 in IE
            $('#icon-load').remove();
            $('#vidbox').html(data);
            $('#btn-close').click(function(){
                NEA.video.close();
            })
        }
    });
};
NEA.video.close = function(){
    $('#vidlayer').remove();
    $('#vidbox').remove();
};
NEA.video.addLayer = function(obj){
    $('body').append(NEA.video.txt.mask).append(NEA.video.txt.box).find('#vidbox #icon-load').append(NEA.video.txt.close);
    $('#vidbox').css('top',$().scrollTop() + 20 + 'px');
    NEA.video.get(obj);
};
$(document).ready(function(){
    /* Begin Add Class Last on More NEA Panel*/
    $("ul#morews-list li:last-child").addClass("last");
    $("ul#morews-list li:last-child").prev().addClass("last");
    /* Begin Add Class Last on More NEA Panel*/
    /* Begin Share and Embed */
    $("#embed-footer").click(function () { 
      $("#embed-top").css("visibility","visible");
      if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
          $("#EmbedText").text("This code has been copied to your clipboard");
          CopyToClipboard("EmbedInput");
          EmbedSelectText();
      }
      return false;
    });
    $("#close-embed").click(function () { 
      $("#embed-top").css("visibility","hidden");
      return false;
    });
    /* End Share and Embed */
    // ************* all pages
    // this inserts an empty div to allow dual bg colors
    $('body').prepend("<div id='bg-extra'><\/div>");
    
    // better styles on HRs
    $('hr').wrap('<div class="hr"><\/div>');
    // remove hr blurb from blurb page where it interferes
    // note: should not do this type of browser detection, really
    if (!(parseInt($.browser.version) < 6 && $.browser.msie == true)) {
        $('.drill hr.blurb').parents("div.hr").remove();
    }
    else {
        // ie5 only fix for width of nav drop-downs
        $('link').each(function(){
            if ($(this).attr('href').indexOf('academy.css') != -1) {
                $('body').addClass('academy');
            }
        })
    }
    // last list item cleanup (UI only touch)
    $("#nav-main li:last-child").addClass("last");
    $("#site-info li:last-child").addClass("last");
    $("#nav-section li:last-child").addClass("last");
    // home pages only
    $('#content-col-a li:last-child a', $('body.home')).addClass('last');
    $('#content-col-b li:last-child a', $('body.home')).addClass('last');
    $('#content-rail li:last-child a', $('body.home')).addClass('last');
    
    // all drills
    $('#nav-utils li:first-child a').addClass('last');
    // VIDEO OVERLAYS
    // compliant browsers
    $('a.video').each(function(){
        var src = $(this).find('img').attr('src');
        $(this).find('img').attr('src',NEA.video.art.path + NEA.video.art.icon).addClass('play');
        NEA.video.set(this,'img');
        $(this).css('backgroundImage','url(' + src + ')').click(function(event){
            NEA.video.addLayer(this);
            event.preventDefault();
        })
        
    });
    // enable video overlays and pop-up layers for IE only
    if ($.browser.msie) {
        $('a.video img.play').remove();
        var play = NEA.png.createPNGImage(NEA.video.art.path + NEA.video.art.icon, 57, 57);
            $('a.video').append(play).find('div').addClass('play')
        $('a.video').each(function(){
            NEA.video.set(this,'div');
        })
    };
    // init drop down menus for browsers which do not support LI hovers
    // if browser ie statement below not really needed except for testing w/ cc's removed
    /*@cc_on
    /*@if (@_jscript_version < 5.7) // ie6 and lower only
    if ($.browser.msie) {
        $("#nav-main > li").hover(function(){
            $(this).addClass("o");
        },function(){
            $(this).removeClass("o");
        })
    }
    // browsers which don't support child selectors 
    $('#nav-section .sub > a.on').addClass("on-sub");
    // handle headers post-blurb
    $('#content-blurb + h2').addClass('post-blurb');
    $('hr.blurb + h2').addClass('post-blurb');
    $('#content-blurb + img + h2').addClass('post-img');
    
    // http://www.mister-pixel.com/#Content__state=is_that_simple
    try {
        document.execCommand("BackgroundImageCache", false, true);
    } catch(err) {}
    /*@end
    @*/
    
    // test for and activate tabs
    var tabs = false;
    if ($('#tab-1').get(0)){ // test for tab script
        $('#tab-1').tabs();
        $('#tab-1 li:gt(0)').addClass('no-edge');
        tabs = true;
    };
    
    // only resize content div height if not on a tab page
    if (!tabs) {
        var sectionHeight = 0;
        var contentHeight = 0;
        $("#nav-section>li").each(function(){
            sectionHeight += $(this).height();
        });
        contentHeight = $('#content-cols').height();
    
        if (contentHeight < sectionHeight) {
            sectionHeight = sectionHeight - contentHeight;
            sectionHeight = contentHeight + sectionHeight;
            $('#content-cols').css('height',sectionHeight);
        }
    }
    $('a[@rel=external]').after('<span class="external">&nbsp;</span>');
    // Flash objects must be written to the page after the DOM mods or IE6 doesn't fire
    //             jQuery document.ready event 
    ///        THEREFORE THIS IF STATEMENT MUST BE LAST IN THE READY BLOCK!!!
    if (NEA.flash.queue.length > 0) {
        var x = 0;
        while (x < NEA.flash.queue.length) {
             var fla = new SWFObject(NEA.Fla.path + NEA.flash[NEA.flash.queue[x]].file, 'flash'+x, NEA.Fla.w, NEA.flash[NEA.flash.queue[x]].h, '8');
                 fla.addParam('wmode','transparent');
                 fla.write(NEA.flash[NEA.flash.queue[x]].place);
            x++;
        }
    }
});
/**
 * From the dimensions plugin: not including the whole thing, too much for too little, but thanks guys
 * Returns how many pixels the user has scrolled to the bottom (scrollTop).
 * Works on containers with overflow: auto and window/document.
 *
 * @example $("#testdiv").scrollTop()
 * @result 100
 *
 * @name scrollTop
 * @type Number
 * @cat Plugins/Dimensions
 */
jQuery.fn.scrollTop = function() {
    if ( this[0] == window || this[0] == document )
        return self.pageYOffset ||
            jQuery.boxModel && document.documentElement.scrollTop ||
            document.body.scrollTop;
    return this[0].scrollTop;
};
/* Oshyn side... */
function TopMarginZ(div){
    var contentRail = document.getElementById(div);
    
    contentRail.setAttribute('style', 'margin-top:0px;');
    contentRail.style.marginTop = '0px';
}
function LessonsSubmit(doReplace, CatLink){
    var CurrentURL = new String(document.location);
    var form = document.getElementById('LessonsCats');
    var spt = CurrentURL.split('?');
    var EncCat = new String(escape(CatLink.innerHTML));
    var url = spt[0] + '?opt1=' + EncCat;
    if(doReplace == true)
        document.location.replace(url);
    else
        document.location = url;
}
function CategorySubmit(doReplace, CatLink){
    var CurrentURL = new String(document.location);
    var form = document.getElementById('LessonsCats');
    var EncCat = new String(escape(CatLink.innerHTML));
    
    if(CurrentURL.indexOf('&opt2') != -1){
        var spt = CurrentURL.split('&opt2');
        CurrentURL = spt[0];
    }
    
    CurrentURL += '&opt2=' + EncCat;
    
    if(doReplace == true)
        document.location.replace(CurrentURL);
    else
        document.location = CurrentURL;
}
//Open Content sharing
function openContentShaing(url){
    $("#contentsharing").css("display","block");
    $("#contentsharinglayer").css("display","block");
    var scriptUrl = "http://" + window.location.hostname + "/content-include.xml?load=http://" + window.location.hostname + url;
    var script = "<script type='text/javascript' src='"+ scriptUrl +"'></script>";
    var scriptLoad = "<div id='container' />\n<script type='text/javascript' #defer='defer'>load('container','" + window.location.hostname + "');</script>";
    $("#copy").val(script+"\n"+scriptLoad);
}
function closeContentSharing(){
    $("#contentsharing").css("display","none");
    $("#contentsharinglayer").css("display","none");
}
// EMAIL A FRIEND
function openEmailAFriend(){
    $("#emailAFriedbox").css("display","block");
    $("#emailAFriedlayer").css("display","block");
    $("#articleUrl").val(window.location);
    $("#senderRedirect").val(window.location);
}
function openEmailAFriendConfirmation(){
    $("#emailAFriedbox").css("display","none");
    $("#emailAFriedboxConfirmation").css("display","block");
    $("#emailAFriedlayer").css("display","block");
}
function closeEmailAFriend(){
    $("#emailAFriedbox").css("display","none");
    $("#emailAFriedlayer").css("display","none");
    $("#emailAFriedboxConfirmation").css("display","none");
}
function checkRequired(){
    if ($("#senderEmail").val() == '')
    {
        //alert("Please put a your email address");
        $("#senderEmail").css("background","#FFFFA0");
        return false;
    }else {
        $("#senderEmail").css("background","#FFFFFF");
    }
    if ($("#senderFriend").val() == '')
    {
        //alert("Please put your friend email address");
        $("#senderFriend").css("background","#FFFFA0");
        return false;
    }else {
        $("#senderFriend").css("background","#FFFFFF");
    }
    return true;
}
$(document).ready(function(){
    $("#emailAFriendForm").submit(function(){
        if (checkRequired()) {
            var submitUrl = $("#submitTo").val();
            var senderFriendVal = $("#senderFriend").val();
            var senderMessageVal = $("#senderMessage").val();
            var senderEmailVal = $("#senderEmail").val();
            var articleUrlVal = $("#articleUrl").val();
            var mailTemplate = "<DIV style='FONT-SIZE: 11px; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-ALIGN: left'><P><A style='COLOR: #000' href='${senderEmail}'>${senderEmail}</A> thought you would be interested in the following article from the National Education Association</P><P style='MARGIN: 30px 0px'>${senderMessage}</P><P>To View this article on the web, go to <A style='COLOR: #d59709' href='${articleUrl}'>${articleUrl}</A></P></DIV>";
            //alert(submitUrl);
            $.post(submitUrl,{senderFriend: senderFriendVal, senderMessage: senderMessageVal, senderEmail: senderEmailVal, articleUrl: articleUrlVal, template: mailTemplate }, function(data) {
                //Thank you
                //alert("thank you");
                openEmailAFriendConfirmation();
            });
        }
        return false;
    });
});
// VIDEO
function loadVideo(videoLoad,videoSkin,videoPlayer){
    var so = new SWFObject(videoPlayer, "neaVideoPlayer", "330", "295", "9");
    so.addParam("menu", "false");
        
    if(videoLoad != null)
        so.addVariable("urlVideo", videoLoad);
    
    if(videoSkin!= null)
        so.addVariable("urlSkin", videoSkin);
    
    so.write("mediaPlace");
}
function showVideo(title,description,reportBy,duration,video,skin,videoPlayer){
    var nav_AppCodeName = new String(navigator.appCodeName);
    var nav_AppVersion = new String(navigator.appVersion);
    var nav_Platform = new String(navigator.platform);
    var mediaPlace = document.getElementById('mediaPlace');
    var mediaError = new String('<span style="color:#330000; font-size:12px;">THE CURRENT VERSION OF FIREFOX IS KNOW THAT CAUSES FLASH ASSETS TO DO NOT DISPLAY ON INTEL BASED MACINTOSH COMPUTERS. PLEASE UPGRADE TO THE MOST RECENT VERSION OF FIREFOX<br /><br /></span><a href="" style="color:#333; font-size:12px;" target="_blank">https://bugzilla.mozilla.org/show_bug.cgi?id=356694</a><br />');
    nav_AppCodeName = nav_AppCodeName.toLowerCase();
    nav_AppVersion = nav_AppVersion.toLowerCase();
    nav_Platform = nav_Platform.toLowerCase();
    
    if(nav_AppCodeName.indexOf('mozilla') != -1 && nav_AppVersion.indexOf('5.0') != -1 && nav_Platform.indexOf('macintel') != -1){
        mediaPlace.innerHTML = mediaError;
        MM_openLayer(1, title, reportBy, description, duration);
    }
    else{
        loadVideo(video, skin, videoPlayer);
        MM_openLayer(1, title, reportBy, description, duration);
    }    
    
    //loadVideo(video, skin, videoPlayer);
    //MM_openLayer(1, title, reportBy, description, duration);
    
    /*
    $("#vidbox").css("display","block");
    $("#vidlayer").css("display","block");
    $("#vid-title").text(title);
    $("#vid-description").text(description);
    $("#vid-reportByAndRest").html(reportBy);
    $("#vid-duration").html(duration);
    loadVideo(video,skin,videoPlayer);
    */
}
function closeVideo(){
    MM_closeLayer();
    /*
    StopMedia(1, 'neaVideoPlayer');
    $("#vidbox").css("display","none");
    $("#vidlayer").css("display","none");
    */
}
function getVideoString(url,FMServer){
    var lastSlash = url.lastIndexOf("/");
    if (lastSlash == -1)
        return "";
    var fileName = url.substr(lastSlash+1,url.length);
    
    var lastDot = fileName.lastIndexOf(".");
    if (lastDot == -1)
        return "";
    var extension = fileName.substr(lastDot+1,fileName.length);
    var onlyFileName = fileName.substr(0,lastDot);
    if (extension.toLowerCase() == "flv")
        return FMServer + onlyFileName;
    else if (extension.toLowerCase() == "mp3")
        return FMServer + extension + ":" + onlyFileName;
    else if (extension.toLowerCase() == "mp4" || extension.toLowerCase() == "mov" || extension.toLowerCase() == "avi")
        return FMServer + extension + ":" + onlyFileName + "." + extension;
    else 
        return "nop";  
}
// COMMENTS
function validateCommentForm(thisForm) {
    var hasError = false;
    with (thisForm)  {
        if (txtName.value == null || txtName.value == "")   {
            hasError = true;
            txtName.style.background='#FFFFA0';
        }else{
            txtName.style.background='#FFFFFF';
        }       
        if (txtContent.value == null || txtContent.value == "")  {
            hasError = true;
            txtContent.style.background='#FFFFA0';
        }else{
            txtContent.style.background='#FFFFFF';
        }       
        
        if (recaptcha_response_field.value == null || recaptcha_response_field.value == "")  {
            hasError = true;
            parent.captcha_iframe.document.getElementsByName('recaptcha_response_field')[0].style.background='#FFFFA0';
        }else{
            parent.captcha_iframe.document.getElementsByName('recaptcha_response_field')[0].style.background='#FFFFFF';
        }  
        return !hasError;
    }
}
function SetContentName(coFilePath) { 
    var urlPath = window.location.pathname;
    var varContent = document.getElementById('commentfile');
    varContent.value =  coFilePath;               
    var varRedirect = document.getElementById('redirect');
    varRedirect.value = urlPath;
}
// RIGHT COGIX
function renderResults(results, server, place, name){
    $("#pollbox").css("display","block");
    $("#polllayer").css("display","block");
    $("#poll-title").text('NEA Survey Results');
    var resultsFrame = "<iframe src=\"" + server + "/servlet/viewsflash?cmd=getresults&spotname=" +  place + "&pollid=" + place + "!" + name + "\" frameborder=0 marginwidth=0 marginheight=0 scrolling=\"auto\" width=\"600\" height=\"250\"></iframe>"
    document.getElementById('resultsPlaceHolder').innerHTML =  resultsFrame; 
}
function renderContentResults(results){
    $("#pollbox").css("display","block");
    $("#polllayer").css("display","block");
    $("#poll-title").text('NEA Survey Results');
   var doc = document.getElementById("iframePoll").contentWindow.document;
   var xmlResults = doc.getElementById(results);  
   var data = xmlResults.innerHTML;
   
  document.getElementById('resultsPlaceHolder').innerHTML =  data; 
}
function closeResults(){
    $("#pollbox").css("display","none");
    $("#polllayer").css("display","none");
}
// START STATE DROPDOWN
function validateStateForm(thisForm)
{
    with (thisForm)
    {
        var errMsg1 = document.getElementById('errMsg1State');
        errMsg1.firstChild.nodeValue= '';
        var tar = '';
        if (cbxState.value != null && cbxState.value != "" && cbxState.value != "Select a State")
            if (tar == 'new')
                window.open(cbxState.value);
            else
                window.location = cbxState.value;
          else
             errMsg1.firstChild.nodeValue= 'Please select a state.';
     return  false;
    }
}
function getStateName(categories)
{
     var catName = '';
     var tokens = categories.split(';');
     for (i=0; i<tokens.length; i++)
     {
          var parts = tokens[i].split(':');
          if (parts.length == 2)
               if (parts[0] == 'State Affiliates')
                    return parts[1];
     }
     parts = categories.split(':');
     if (parts.length == 2)
          if (parts[0] == 'State Affiliates')
               return parts[1];
     return '';
}
function getAttributeFromAnchor(attributeName, anchorText)
{
     if (attributeName == 'title') 
     {
          from = anchorText.indexOf('>');  
          to = anchorText.lastIndexOf('<');  
          if (from+1 < to && from > -1 && to > -1)
               return anchorText.substr(from+1, to-from-1);
     }
     else if (attributeName = 'href')
     {
          from = anchorText.indexOf('href=\"') + 6;
          to = anchorText.indexOf('\"', from);
     
          if (from < to && from > -1 && to > -1)
               return anchorText.substr(from, to-from);
     }
     return '';
}
function fillDropDown(locs) {
     var allStates = new Array(0);
     var i =0;
     // Clears the content of the dropdown.
     document.frmStates.cbxState.options.length = 0;
     // Ads default item into the dropdown.
     var oOption = document.createElement("OPTION");    
     oOption.text='Select a State';    
     oOption.value='';  
     oOption.selected = 'selected';
     //document.frmStates.cbxState.add(oOption); 
    try {
        document.frmStates.cbxState.add(new Option('Select a State', ''), null); 
    } catch(e) {
        document.frmStates.cbxState.add(new Option('Select a State', '')); 
    }
     for (i=0; i < locs.length; i++)
     {
          var state = locs[i];
          var oOption = document.createElement("OPTION");    
          var stateName;
          var stateUrl;
          
          // Checks if a page is from RedDot CMS or regular link.
          if (state[0] != null && state[0] != '')
               stateName = getStateName(state[0]);
          else if (state[1].indexOf('http://') != -1) // If its regular link, check that it has 'http://' in order to add it.
               stateName = getAttributeFromAnchor('title', state[1]); //oOption.text = getAttributeFromAnchor('title', state[1]);    
 
          // gets the destination URL from the page anchor.
            stateUrl = getAttributeFromAnchor('href', state[1]);
          // Ads the item into the dropdown only if a Stata was found.
          if (stateName != null && stateName != '') //if (oOption.text!= null && oOption.text != '')
               allStates.push(stateName + ';' + stateUrl); //document.frmStates.cbxState.add(oOption);   
     }
allStates.sort();
for (i=0; i < allStates.length; i++)
{
var parts = allStates[i].split(';');
var oOption = document.createElement("OPTION");    
oOption.text = parts[0];
oOption.value = parts[1];
//document.frmStates.cbxState.add(oOption); 
 try {
        document.frmStates.cbxState.add(new Option(parts[0], parts[1]), null); 
    } catch(e) {
      document.frmStates.cbxState.add(new Option(parts[0], parts[1])); 
    }   
}
     return false;
}
// CF Form validation
function verifyPledgeForm(thisForm) {
 var hasError = false;
    with (thisForm)  {
        if (planning.value == null || planning.value == "")   {
            hasError = true;
            planning.style.background='#FFFFA0';
        }       
        if (name.value == null || name.value == "")  {
            hasError = true;
            name.style.background='#FFFFA0';
        }
        
        if (city.value == null || city.value == "")  {
            hasError = true;
            city.style.background='#FFFFA0';
        }
        if (state.value == null || state.value == "" || state.value == "Choose one")  {
            hasError = true;
            state.style.background='#FFFFA0';
        }
        return !hasError;
    }
}
// Wizzard for JS RSS
function generateCode(basePath){
    /*
    document.wizard.code.value = "";
    if (document.wizard.target.checked){
        document.wizard.code.value = '<script language="JavaScript">nopen=2006<'+'/script>\n'
    }
    document.wizard.code.value= document.wizard.code.value +'<script language="JavaScript" src="';
    document.wizard.code.value= document.wizard.code.value + basePath + document.wizard.feed.options[document.wizard.feed.selectedIndex].value;
    document.wizard.code.value= document.wizard.code.value + '"></';
    document.wizard.code.value= document.wizard.code.value + 'script>';
    msg=open("","DisplayWindow","toolbar=yes,directories=no,menubar=yes,scrollbars=yes");
    msg.document.write(document.wizard.code.value);
    */
}
// JQUERY plugin for autocomplete
jQuery.autocomplete = function(input, options) {
    // Create a link to self
    var me = this;
    // Create jQuery object for input element
    var $input = $(input).attr("autocomplete", "off");
    // Apply inputClass if necessary
    if (options.inputClass) $input.addClass(options.inputClass);
    // Create results
    var results = document.createElement("div");
    // Create jQuery object for results
    var $results = $(results);
    $results.hide().addClass(options.resultsClass).css("position", "absolute");
    if( options.width > 0 ) $results.css("width", options.width);
    // Add to body element
    $("body").append(results);
    input.autocompleter = me;
    var timeout = null;
    var prev = "";
    var active = -1;
    var cache = {};
    var keyb = false;
    var hasFocus = false;
    var lastKeyPressCode = null;
    // flush cache
    function flushCache(){
        cache = {};
        cache.data = {};
        cache.length = 0;
    };
    // flush cache
    flushCache();
    // if there is a data array supplied
    if( options.data != null ){
        var sFirstChar = "", stMatchSets = {}, row = [];
        // no url was specified, we need to adjust the cache length to make sure it fits the local data store
        if( typeof options.url != "string" ) options.cacheLength = 1;
        // loop through the array and create a lookup structure
        for( var i=0; i < options.data.length; i++ ){
            // if row is a string, make an array otherwise just reference the array
            row = ((typeof options.data[i] == "string") ? [options.data[i]] : options.data[i]);
            // if the length is zero, don't add to list
            if( row[0].length > 0 ){
                // get the first character
                sFirstChar = row[0].substring(0, 1).toLowerCase();
                // if no lookup array for this character exists, look it up now
                if( !stMatchSets[sFirstChar] ) stMatchSets[sFirstChar] = [];
                // if the match is a string
                stMatchSets[sFirstChar].push(row);
            }
        }
        // add the data items to the cache
        for( var k in stMatchSets ){
            // increase the cache size
            options.cacheLength++;
            // add to the cache
            addToCache(k, stMatchSets[k]);
        }
    }
    $input
    .keydown(function(e) {
        // track last key pressed
        lastKeyPressCode = e.keyCode;
        switch(e.keyCode) {
            case 38: // up
                e.preventDefault();
                moveSelect(-1);
                break;
            case 40: // down
                e.preventDefault();
                moveSelect(1);
                break;
            case 9:  // tab
            case 13: // return
                if( selectCurrent() ){
                    // make sure to blur off the current field
                    $input.get(0).blur();
                    e.preventDefault();
                }
                break;
            default:
                active = -1;
                if (timeout) clearTimeout(timeout);
                timeout = setTimeout(function(){onChange();}, options.delay);
                break;
        }
    })
    .focus(function(){
        // track whether the field has focus, we shouldn't process any results if the field no longer has focus
        hasFocus = true;
    })
    .blur(function() {
        // track whether the field has focus
        hasFocus = false;
        hideResults();
    });
    hideResultsNow();
    function onChange() {
        // ignore if the following keys are pressed: [del] [shift] [capslock]
        if( lastKeyPressCode == 46 || (lastKeyPressCode > 8 && lastKeyPressCode < 32) ) return $results.hide();
        var v = $input.val();
        if (v == prev) return;
        prev = v;
        if (v.length >= options.minChars) {
            $input.addClass(options.loadingClass);
            requestData(v);
        } else {
            $input.removeClass(options.loadingClass);
            $results.hide();
        }
    };
     function moveSelect(step) {
        var lis = $("li", results);
        if (!lis) return;
        active += step;
        if (active < 0) {
            active = 0;
        } else if (active >= lis.size()) {
            active = lis.size() - 1;
        }
        lis.removeClass("ac_over");
        $(lis[active]).addClass("ac_over");
        // Weird behaviour in IE
        // if (lis[active] && lis[active].scrollIntoView) {
        //     lis[active].scrollIntoView(false);
        // }
    };
    function selectCurrent() {
        var li = $("li.ac_over", results)[0];
        if (!li) {
            var $li = $("li", results);
            if (options.selectOnly) {
                if ($li.length == 1) li = $li[0];
            } else if (options.selectFirst) {
                li = $li[0];
            }
        }
        if (li) {
            selectItem(li);
            return true;
        } else {
            return false;
        }
    };
    function selectItem(li) {
        if (!li) {
            li = document.createElement("li");
            li.extra = [];
            li.selectValue = "";
        }
        var v = $.trim(li.selectValue ? li.selectValue : li.innerHTML);
        input.lastSelected = v;
        prev = v;
        $results.html("");
        $input.val(v);
        hideResultsNow();
        if (options.onItemSelect) setTimeout(function() { options.onItemSelect(li) }, 1);
    };
    // selects a portion of the input string
    function createSelection(start, end){
        // get a reference to the input element
        var field = $input.get(0);
        if( field.createTextRange ){
            var selRange = field.createTextRange();
            selRange.collapse(true);
            selRange.moveStart("character", start);
            selRange.moveEnd("character", end);
            selRange.select();
        } else if( field.setSelectionRange ){
            field.setSelectionRange(start, end);
        } else {
            if( field.selectionStart ){
                field.selectionStart = start;
                field.selectionEnd = end;
            }
        }
        field.focus();
    };
    // fills in the input box w/the first match (assumed to be the best match)
    function autoFill(sValue){
        // if the last user key pressed was backspace, don't autofill
        if( lastKeyPressCode != 8 ){
            // fill in the value (keep the case the user has typed)
            $input.val($input.val() + sValue.substring(prev.length));
            // select the portion of the value not typed by the user (so the next character will erase)
            createSelection(prev.length, sValue.length);
        }
    };
    function showResults() {
        // get the position of the input field right now (in case the DOM is shifted)
        var pos = findPos(input);
        // either use the specified width, or autocalculate based on form element
        var iWidth = (options.width > 0) ? options.width : $input.width();
        // reposition
        $results.css({
            width: parseInt(iWidth) + "px",
            top: (pos.y + input.offsetHeight) + "px",
            left: pos.x + "px"
        }).show();
    };
    function hideResults() {
        if (timeout) clearTimeout(timeout);
        timeout = setTimeout(hideResultsNow, 200);
    };
    function hideResultsNow() {
        if (timeout) clearTimeout(timeout);
        $input.removeClass(options.loadingClass);
        if ($results.is(":visible")) {
            $results.hide();
        }
        if (options.mustMatch) {
            var v = $input.val();
            if (v != input.lastSelected) {
                selectItem(null);
            }
        }
    };
    function receiveData(q, data) {
        if (data) {
            $input.removeClass(options.loadingClass);
            results.innerHTML = "";
            // if the field no longer has focus or if there are no matches, do not display the drop down
            if( !hasFocus || data.length == 0 ) return hideResultsNow();
            if ($.browser.msie) {
                // we put a styled iframe behind the calendar so HTML SELECT elements don't show through
                // $results.append(document.createElement('iframe'));
            }
            results.appendChild(dataToDom(data));
            // autofill in the complete box w/the first match as long as the user hasn't entered in more data
            if( options.autoFill && ($input.val().toLowerCase() == q.toLowerCase()) ) autoFill(data[0][0]);
            showResults();
        } else {
            hideResultsNow();
        }
    };
    function parseData(data) {
        if (!data) return null;
        var parsed = [];
        var rows = data.split(options.lineSeparator);
        for (var i=0; i < rows.length; i++) {
            var row = $.trim(rows[i]);
            if (row) {
                parsed[parsed.length] = row.split(options.cellSeparator);
            }
        }
        return parsed;
    };
    function dataToDom(data) {
        var ul = document.createElement("ul");
        var num = data.length;
        // limited results to a max number
        if( (options.maxItemsToShow > 0) && (options.maxItemsToShow < num) ) num = options.maxItemsToShow;
        for (var i=0; i < num; i++) {
            var row = data[i];
            if (!row) continue;
            var li = document.createElement("li");
            if (options.formatItem) {
                li.innerHTML = options.formatItem(row, i, num);
                li.selectValue = row[0];
            } else {
                li.innerHTML = row[0];
                li.selectValue = row[0];
            }
            var extra = null;
            if (row.length > 1) {
                extra = [];
                for (var j=1; j < row.length; j++) {
                    extra[extra.length] = row[j];
                }
            }
            li.extra = extra;
            ul.appendChild(li);
            $(li).hover(
                function() { $("li", ul).removeClass("ac_over"); $(this).addClass("ac_over"); active = $("li", ul).indexOf($(this).get(0)); },
                function() { $(this).removeClass("ac_over"); }
            ).click(function(e) { e.preventDefault(); e.stopPropagation(); selectItem(this) });
        }
        return ul;
    };
    function requestData(q) {
        if (!options.matchCase) q = q.toLowerCase();
        var data = options.cacheLength ? loadFromCache(q) : null;
        // recieve the cached data
        if (data) {
            receiveData(q, data);
        // if an AJAX url has been supplied, try loading the data now
        } else if( (typeof options.url == "string") && (options.url.length > 0) ){
            $.get(makeUrl(q), function(data) {
                data = parseData(data);
                addToCache(q, data);
                receiveData(q, data);
            });
        // if there's been no data found, remove the loading class
        } else {
            $input.removeClass(options.loadingClass);
        }
    };
    function makeUrl(q) {
        var url = options.url + "?q=" + encodeURI(q);
        for (var i in options.extraParams) {
            url += "&" + i + "=" + encodeURI(options.extraParams[i]);
        }
        return url;
    };
    function loadFromCache(q) {
        if (!q) return null;
        if (cache.data[q]) return cache.data[q];
        if (options.matchSubset) {
            for (var i = q.length - 1; i >= options.minChars; i--) {
                var qs = q.substr(0, i);
                var c = cache.data[qs];
                if (c) {
                    var csub = [];
                    for (var j = 0; j < c.length; j++) {
                        var x = c[j];
                        var x0 = x[0];
                        if (matchSubset(x0, q)) {
                            csub[csub.length] = x;
                        }
                    }
                    return csub;
                }
            }
        }
        return null;
    };
    function matchSubset(s, sub) {
        if (!options.matchCase) s = s.toLowerCase();
        var i = s.indexOf(sub);
        if (i == -1) return false;
        return i == 0 || options.matchContains;
    };
    this.flushCache = function() {
        flushCache();
    };
    this.setExtraParams = function(p) {
        options.extraParams = p;
    };
    this.findValue = function(){
        var q = $input.val();
        if (!options.matchCase) q = q.toLowerCase();
        var data = options.cacheLength ? loadFromCache(q) : null;
        if (data) {
            findValueCallback(q, data);
        } else if( (typeof options.url == "string") && (options.url.length > 0) ){
            $.get(makeUrl(q), function(data) {
                data = parseData(data)
                addToCache(q, data);
                findValueCallback(q, data);
            });
        } else {
            // no matches
            findValueCallback(q, null);
        }
    }
    function findValueCallback(q, data){
        if (data) $input.removeClass(options.loadingClass);
        var num = (data) ? data.length : 0;
        var li = null;
        for (var i=0; i < num; i++) {
            var row = data[i];
            if( row[0].toLowerCase() == q.toLowerCase() ){
                li = document.createElement("li");
                if (options.formatItem) {
                    li.innerHTML = options.formatItem(row, i, num);
                    li.selectValue = row[0];
                } else {
                    li.innerHTML = row[0];
                    li.selectValue = row[0];
                }
                var extra = null;
                if( row.length > 1 ){
                    extra = [];
                    for (var j=1; j < row.length; j++) {
                        extra[extra.length] = row[j];
                    }
                }
                li.extra = extra;
            }
        }
        if( options.onFindValue ) setTimeout(function() { options.onFindValue(li) }, 1);
    }
    function addToCache(q, data) {
        if (!data || !q || !options.cacheLength) return;
        if (!cache.length || cache.length > options.cacheLength) {
            flushCache();
            cache.length++;
        } else if (!cache[q]) {
            cache.length++;
        }
        cache.data[q] = data;
    };
    function findPos(obj) {
        var curleft = obj.offsetLeft || 0;
        var curtop = obj.offsetTop || 0;
        while (obj = obj.offsetParent) {
            curleft += obj.offsetLeft
            curtop += obj.offsetTop
        }
        return {x:curleft,y:curtop};
    }
}
jQuery.fn.autocomplete = function(url, options, data) {
    // Make sure options exists
    options = options || {};
    // Set url as option
    options.url = url;
    // set some bulk local data
    options.data = ((typeof data == "object") && (data.constructor == Array)) ? data : null;
    // Set default values for required options
    options.inputClass = options.inputClass || "ac_input";
    options.resultsClass = options.resultsClass || "ac_results";
    options.lineSeparator = options.lineSeparator || "\n";
    options.cellSeparator = options.cellSeparator || "|";
    options.minChars = options.minChars || 1;
    options.delay = options.delay || 400;
    options.matchCase = options.matchCase || 0;
    options.matchSubset = options.matchSubset || 1;
    options.matchContains = options.matchContains || 0;
    options.cacheLength = options.cacheLength || 1;
    options.mustMatch = options.mustMatch || 0;
    options.extraParams = options.extraParams || {};
    options.loadingClass = options.loadingClass || "ac_loading";
    options.selectFirst = options.selectFirst || false;
    options.selectOnly = options.selectOnly || false;
    options.maxItemsToShow = options.maxItemsToShow || -1;
    options.autoFill = options.autoFill || false;
    options.width = parseInt(options.width, 10) || 0;
    this.each(function() {
        var input = this;
        new jQuery.autocomplete(input, options);
    });
    // Don't break the chain
    return this;
}
jQuery.fn.autocompleteArray = function(data, options) {
    return this.autocomplete(null, options, data);
}
jQuery.fn.indexOf = function(e){
    for( var i=0; i<this.length; i++ ){
        if( this[i] == e ) return i;
    }
    return -1;
};
function formatItem(row) {
    return row[0];
    //return row[0] + "<br><i>" + row[1] + "</i>";
}
 
// MAIL TO FROM ACTUAL NEA.ORG
function emailto(e,d){
    location='mailto:'+e+'@'+d;} 
// MAIL TO FROM ACTUAL NEA.ORG
// Validation Submit Your Ti Form
function validateMailForm(thisForm) {
hasError = false;
    with (thisForm){
        if (senderName.value == null || senderName.value == ""){
            senderName.style.background='#FFFFA0';
            hasError = true;
        } else {
            senderName.style.background='#FFFFFF';                 
        }
        if (senderEmail.value == null || senderEmail.value == ""){ 
            senderEmail.style.background='#FFFFA0';
            hasError = true;
        } else {
            senderEmail.style.background='#FFFFFF';                 
        }
        return !hasError;
     }
}
// Login validation
function validateLoginForm(thisForm) {
    var hasError = false;
    with (thisForm)  {
        if (txt1.value == null || txt1.value == "")   {
            hasError = true;
            txt1.style.background='#FFFFA0';
        }       
        if (txt2.value == null || txt2.value == "")  {
            hasError = true;
            txt2.style.background='#FFFFA0';
        }
        
        return !hasError;
    }
}
// Drop Down for Documents
function fillDropDownDocuments(items){
     var i =0;
     // Clears the content of the dropdown.
     document.frmPDF.listPDF.options.length = 0;
     // Ads default item into the dropdown.
     var oOption = document.createElement("OPTION");    
     oOption.text='Select a Document';    
     oOption.value='';  
     oOption.selected = 'selected';
//     document.frmPDF.listPDF.add(oOption); 
    try {
        document.frmPDF.listPDF.add(oOption, null); 
    } catch(e) {
        document.frmPDF.listPDF.add(oOption); 
    }
    items.sort();
    for (i=0; i < items.length; i++)
    {
        var item = items[i];
        var oOption = document.createElement("OPTION");    
        oOption.text = item[0] + ' (' + item[3] + ' KB)';
        oOption.value = item[1];
      
  //document.frmPDF.listPDF.add(oOption);   
    
    oOption.setAttribute('id', DocIcon_GetCSS(oOption.value));
try {
        document.frmPDF.listPDF.add(oOption, null); 
    } catch(e) {
        document.frmPDF.listPDF.add(oOption); 
    }
    }
     return false;
}
function validateDocumentDropDownForm(thisForm)
{
    var errMsg = document.getElementById('errMsg1');
    with (thisForm)
    {
        errMsg.firstChild.nodeValue = '';
        if (listPDF.value != null && listPDF.value != "" && listPDF.value != "Select a Document") {
            window.open(listPDF.value);
        }
        else {
           errMsg.firstChild.nodeValue = 'Please select a document.';
           return  false;
        }
    }
}
// for slideshow
 var ss={
      lis: null, //object of all li's calculated on load
      curslide: 0, //current slide number
      maxslides: 0, //max number of slides
      playon: -1, //status of play button
      controls: -1, //status of controls button
      showslides: function(){ //called by right rail event
        ss.lis=$(".slide"); //object of all li's
        ss.maxslides=ss.lis.length; //last slide number
          var x=parseInt($("#ssduration").attr("value"))
        if (x==0) {x=ss.maxslides*2} //default to 2 seconds between slides if no duration
        ss.seconds=(x/ss.maxslides)*1000; //seconds between slides
        ss.writeControl(ss.maxslides);  //put in controls for the number of slides
        $('#slidemaxno').html(ss.maxslides); // put in of x
        ss.gotoslide(0);  //start with first slide
        ss.moveit();  //move to dhtml div      
      },
      writeControl: function(x){
        if (ss.controls>0) {return}
        ss.controls=1;
        var tx=document.createTextNode('PLAY  >');
        var node=document.createElement('td');
        node.appendChild(tx);
        node.id="ssplaybut";
        document.getElementById('sscontrolrow').appendChild(node)  
        for (var i=0;i<x; i++){
          var id="ct"+i;
          var node=document.createElement('td');
          node.id=id;
          node.className="slidebut";
          document.getElementById('sscontrolrow').appendChild(node)
        }
        var tx=document.createTextNode('CLOSE');
        var node=document.createElement('td');
        node.appendChild(tx);
        node.id="ssclosebut";
        document.getElementById('sscontrolrow').appendChild(node) 
        $('#ssclosebut').bind('click',function(event){ss.closeslides();});  //listen to close button
        $('#ssplaybut').bind('click',function(event){ss.playslides();});  //listen to play button
        $('.slidebut').bind('click',function(event){ss.gotoslide(this.id.substring(2));});  //listen for slide buttons
 
      },
      gotoslide: function(x){
        //turn off current display and turn on x display
        var slideid="#"+ss.lis[ss.curslide].id  //get id from object array
        $(slideid).hide()
        var sscontrolid="#ct"+ss.curslide
        $(sscontrolid).removeClass('activebut')
        ss.curslide=x;
        var slideid="#"+ss.lis[x].id
        $(slideid).show()
        var sscontrolid="#ct"+x
        $(sscontrolid).addClass('activebut')
        $('#slideno').html(parseInt(x)+1) //change x of x
      },
      nextslide: function(){ //given curslide, increment to next
        var x=parseInt(ss.curslide)+1;
        if (x<ss.maxslides){
          ss.gotoslide(x)
        }
        if (x==ss.maxslides-1){
          ss.playon=-1 //change state of switch
          ss.stopslides();
        }
      },
      playslides: function(){
        ss.playon=-ss.playon //change state of switch
        if (ss.playon==1){
          $('#ssplaybut').text("PAUSE ||"); //change button to PAUSE from PLAY
          var x=$("#ssaudiourl").attr("value")
          if (x!=undefined){  
            ss.soundplayer(x); //play sound
          }
          ss.gotoslide(0); //reset current slide to start
          ss.intervalss=window.setInterval(ss.nextslide, ss.seconds);    //start timer
        }else{
          ss.stopslides();
        }
      },
      stopslides: function(){
        window.clearInterval(ss.intervalss)//stop setInterval
        $('#ssplaybut').text("PLAY  >"); //change button from pause to play
        ss.soundplayer(""); //turn off sound
      },
      closeslides: function(){
        ss.stopslides();
        //hide dhtml layer but without the video divs
        $("#mm_layer_shadow div.top").css("display","none");
        $("#mm_layer_shadow div.content").css("display","none");
        $("#mm_layer_shadow").css("display","none");
        $("#vidlayer").css("display","none");
        var x=document.getElementById('slidemain')
        document.getElementById('slidewrap').appendChild(x);
        //and display them
        $("#slidewrap").css("display","none");
      },
      moveit: function(){
        //disply dhtml layer but without the video divs
        $("#mm_layer_shadow div.top").css("display","none");
        $("#mm_layer_shadow div.content").css("display","none");
        $("#mm_layer_shadow").css("display","block");
        $("#vidlayer").css("display","block");
        var x=document.getElementById('slidemain')
        document.getElementById('mm_layer').appendChild(x);
        //and display them
        $("#slidewrap").css("display","block");
      },
      soundplayer: function(sound){// add the swf sound to player object, flashobject
          flashobject='<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"' + '\n' +
             'codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab\"' + '\n' +
             'width=0 height=0 id=untitled>' + '\n' +
            '<param name=movie value=\"' + sound + '\">' + '\n' +
            '<param name=quality value=low>' + '\n' +
            '<embed name=\"' + this.playerID + '\"' + '\n' +
               'src=\"' + sound + '\" quality=low ' + '\n' +
               ' width=0 height=0 type=\"application/x-shockwave-flash\"' + '\n' +
            '</embed></object>'
       // add the string to an element sndplayer at end of page with innerHTML method
           document.getElementById("sndplayer").innerHTML=flashobject;    
      },      
      lastFunction: function(){} //just a placeholder
  }//end of ss
 
// MULTIMEDIA PAGE: CHECK FLASH VERSION
function MM_CheckFlashVersion(reqVerStr,msg){
  with(navigator){
    var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
    var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
    if (!isIE || !isWin){  
      var flashVer = -1;
      if (plugins && plugins.length > 0){
        var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
        desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
        if (desc == "") flashVer = -1;
        else{
          var descArr = desc.split(" ");
          var tempArrMajor = descArr[2].split(".");
          var verMajor = tempArrMajor[0];
          var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
          var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
          flashVer =  parseFloat(verMajor + "." + verMinor);
        }
      }
      // WebTV has Flash Player 4 or lower -- too low for video
      else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;
      var verArr = reqVerStr.split(",");
      var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
  
      if (flashVer < reqVer){
        if (confirm(msg))
          window.location = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
      }
    }
  } 
}
// 4th LEVEL BREADCRUMBS WORKAROUND
var bcContent = new String('');
var allChars = new String('Back to: ');
var allBCs_U = new Array();
var allBCs_H = new Array();
var allBCs_L = new Array();
var bcContainer = new String('nav-crumbs');
var maxChars = new Number(150);
var maxCharsH = new Number(25);
function subHeadline(orgHeadline){
    //var newHeadline = new String(orgHeadline.substr(0, maxCharsH) + '...');
    var newHeadline = new String();
    var TmpChars = new String();
    var HeadlineWords = orgHeadline.split('%20');
    
    for(var w = 0; w < HeadlineWords.length; w++){
        TmpChars += unescape(HeadlineWords[w]) + ' ';
        
        if(w > 0)
            newHeadline += unescape(HeadlineWords[w - 1]) + ' ';
        
        //alert(TmpChars + '\n\n ----- \n\n' + HeadlineChars + '\n\n ----- \n\n' + parseInt(TmpChars.length)+ ' >= ' + maxCharsH);
        if(parseInt(TmpChars.length) >= maxCharsH){
            break;
        }
    }
    
    newHeadline = newHeadline.substr(0, newHeadline.length - 1) + '...';
    return(newHeadline);
}
function writeBC(){
    var Target = document.getElementById(bcContainer);
    var hLine = new String();
    var nhLine = new String();
    var isLnk = new Number();
    //var BCenabled = document.getElementById('BCenabled');
    
    //if(parseInt(BCenabled.value) == 1){
        bcContent = 'Back to: ';
        //alert("length:" + allBCs_H.length );
        for(var bc = 0; bc < allBCs_H.length; bc++){
            hLine = allBCs_H[bc];
            isLnk = allBCs_L[bc];
            //alert("Step:" + bc + "<br/>Hl:" + hLine + "<br/>Lnk:" + isLnk )
            nhLine = hLine + '';
            if(bc > 0){
                bcContent += ' / ';
                
                if(allChars.length > maxChars){
                    if(hLine.length > maxCharsH){
                        nhLine = subHeadline(hLine) + '';
                    }
                }
                else{
                    nhLine = hLine + '';
                }
            }
            //else
                //nhLine = hLine + '';
            
            if(isLnk == 1){
                bcContent += '<a href="' + allBCs_U[bc] + '" title="' + allBCs_H[bc] + '">' + nhLine + '</a>';
            }
            else{
                bcContent += '<span title="' + allBCs_H[bc] + '">' + nhLine + '</span>';
            }
            //alert(nhLine);
        }
        Target.innerHTML = unescape(bcContent);
    //}
}
function AddBC(URL, Headline, isLink){
    var newH = new Number();
    
    allChars += Headline + ' / ';
    
    allBCs_U.push(URL);
    allBCs_H.push(Headline);
    allBCs_L.push(parseInt(isLink));
}
// ICONS FOR DOCUMENT LINKS
var DocIcon_FileExts = new Array('PDF', 'DOC', 'DOCX', 'RTF', 'TXT', 'PPT', 'PPS', 'PPTX', 'PPSX', 'XLS', 'XLSX', 'ODT', 'ODS', 'ODG', 'ODP', 'JPG', 'GIF', 'PNG');
var DocIcon_Word_WA = new Number(0);
function DocIcon_ExistExtIcon(cExt){
    var mExt = cExt.toLowerCase();
    var sExt = new String();
    var exist = new Boolean(false);
    
    for(var i = 0; i < DocIcon_FileExts.length; i++){
        sExt = DocIcon_FileExts[i];
        sExt = sExt.toUpperCase();
        
        if(cExt == sExt){
            return true;
            break;
        }
    }
    
    return false;
}
function DocIcon_SetLinkIcon(DocURL, DocTXT, DocSZE){
    var AnchorHREF = new String(DocURL.toUpperCase());
    var SptURL = AnchorHREF.split('.');
    var DocExt = new String(SptURL[SptURL.length - 1]);
    var Content = new String();
    
    if(DocIcon_ExistExtIcon(DocExt) == false)
        DocExt = 'Generic';
    
    if(DocIcon_Word_WA == 0){
        Content = '<a href="' + DocURL + '" id="Anchor_' + DocExt + '">' + unescape(DocTXT) + '</a>&nbsp;<span class="FileSizeTxt">(' + DocSZE + ' KB)</span>';
    }
    else if(parseInt(DocIcon_Word_WA) == 1){
        if(DocExt == 'DOCX'){
            Content = '<span id="Anchor_' + DocExt + '"><span><a href="' + DocURL + '">' + unescape(DocTXT) + '</a>&nbsp;(' + DocSZE + ' KB)';
        }
        else{
            Content = '<a href="' + DocURL + '" id="Anchor_' + DocExt + '">' + unescape(DocTXT) + '</a>&nbsp;<span class="FileSizeTxt">(' + DocSZE + ' KB)</span>';
        }
    }
            
    document.write(Content);
}
function DocIcon_GetCSS(DocURL){
    var AnchorHREF = new String(DocURL.toUpperCase());
    var SptURL = AnchorHREF.split('.');
    var DocExt = new String(SptURL[SptURL.length - 1]);
    var CSSID = new String();
    
    if(DocIcon_ExistExtIcon(DocExt) == false)
        DocExt = 'Generic';
        
    CSSID = 'Anchor_' + DocExt;
    return(CSSID);
}
/*
<button onclick="alert('got it')" value="this works">more</button>
<button onclick="ss.showslides('got it')" value="time">ss.showslides</button>
<button onclick="ss.ray('got it')" value="time">ss.ray.js</button>
<button onclick="ray('got it')" value="time">test</button>
*/
/* This function control the pagination stuff*/
function pagination(pageOperation, itemsNames){
    var totalLength = parseInt(document.getElementById("hiddenTotalLength").value);
    var elementsPerPage = parseInt(document.getElementById("hiddenMaxLength").value);
    var initialBanchElement = parseInt(document.getElementById("hiddenCurrentComment").value);
    pageOperation = parseInt(pageOperation);    
    
    //calculate the increment
    var increment = parseInt((pageOperation) * (elementsPerPage));
    
    //set the init and end index
    var initIndex = initialBanchElement + increment;
    var endIndex = initIndex + elementsPerPage - 1;
    //Increment Controls
    if(pageOperation == 1){                
        if(initIndex > totalLength){
            initIndex = 1;
            endIndex = elementsPerPage; 
        }else if(endIndex > totalLength){
            endIndex = totalLength;
        }
    }else{
    //Decrement Controls
        if(initIndex < 1){                        
            if(totalLength % elementsPerPage == 0){
                initIndex = totalLength + 1 - elementsPerPage;
            }else{
                initIndex = totalLength + 1 - (totalLength % elementsPerPage);
            }
            endIndex = totalLength;
        }    
    }    
    document.getElementById("hiddenCurrentComment").value = initIndex;
 
    showCurrentPage(initIndex,endIndex, totalLength, elementsPerPage, itemsNames);
    
    
    //Calculate number of pages
    if(totalLength%elementsPerPage==0){
        var totalPages = parseInt(totalLength/elementsPerPage);
    }
    else{
        var totalPages = parseInt(totalLength/elementsPerPage) + 1;
    }
    
    //Set the number page
    var currentPage = document.getElementById("commentsPageOf").innerHTML;
    currentPage = parseInt(currentPage); 
    currentPage = currentPage + pageOperation;
    if(currentPage==0){
        currentPage = totalPages;
    }
    if(currentPage>totalPages){
        currentPage = 1;
    }
    
    document.getElementById("commentsPageOf").innerHTML = currentPage;      
}
function showCurrentPage(initIndex,endIndex,totalLength, elementsPerPage, itemsNames){
    initIndex = initIndex - 1;
    endIndex = endIndex + 1;
    var printedElement = 1;
    for(var i = 1; i<= totalLength; i++){
        if(i > initIndex && i < endIndex){
        
            if(printedElement % 2 == 0){
                document.getElementById("container" + i).className = "highlight";
                document.getElementById("container" + i).style.display="block";
            }
            else{
                document.getElementById("container" + i).className = "";
                document.getElementById("container" + i).style.display="block";
            }
            
            printedElement++;
            
        }else{
            document.getElementById("container" + i).style.display="none";
        }        
    }
    
    //Enable disable links
    if((initIndex + 1) == 1){
        document.getElementById("commentsPrev").innerHTML = "Most Recent";
    }else{
        document.getElementById("commentsPrev").innerHTML = "<a href = 'javascript:void(0)' onclick=pagingByPage(1,'" + itemsNames+ "')>Most Recent</a>";
    }
    
    if((endIndex - 1) == totalLength){
        
        document.getElementById("commentsNext").innerHTML = "Next " + itemsNames;
        
    }else{
        
        //Calculate the quantity of remaining pages
        if(((endIndex - 1) + elementsPerPage) <= totalLength){
            document.getElementById("commentsNext").innerHTML = "<a href = 'javascript:void(0)' onclick=pagination(1,'" + itemsNames+ "') >Next " + elementsPerPage + " " + itemsNames +"</a>";
        }
        else{
            var difference = totalLength - (endIndex - 1);
            document.getElementById("commentsNext").innerHTML = "<a href = 'javascript:void(0)' onclick=pagination(1,'" + itemsNames+ "') >Next " + difference + " " + itemsNames +"</a>";
        }
        
        
    }
    
    //Administer the ranges at the top of the page
    document.getElementById("commentsIndicatorElements").innerHTML = (initIndex + 1) + " - "  + (endIndex - 1);
}
//Controls the paging by page number
function pagingByPage(pressedPageNumber, itemsNames){
    var totalLength = parseInt(document.getElementById("hiddenTotalLength").value);
    var elementsPerPage = parseInt(document.getElementById("hiddenMaxLength").value);
    //var initialBanchElement = parseInt(document.getElementById("hiddenCurrentComment").value);
    pressedPageNumber = parseInt(pressedPageNumber);
    
    if(pressedPageNumber == 1){
        var initIndex = pressedPageNumber;
    }
    else{
        var initIndex = 1;
        //Calculate the initial comment of the page
        for(var i = 1 ; i < pressedPageNumber ; i++){
            var initIndex = initIndex + elementsPerPage; 
        }      
    }    
    
        //Calculate the end comment
        var endIndex = initIndex + elementsPerPage - 1;
        if(endIndex > totalLength){
            endIndex = totalLength;
        }        
        //Set the initIndex in page
        document.getElementById("hiddenCurrentComment").value = initIndex;
               
        //Show current page
        showCurrentPage(initIndex,endIndex, totalLength, elementsPerPage, itemsNames);
        
        //Set page number
        document.getElementById("commentsPageOf").innerHTML = pressedPageNumber;      
}
// SUBSCRIPTION TO NEWSLETTERS
function ValidateEmail(emailInput, ValidationChars, ErrorTagID, Prefix){
    var content = new String(emailInput.value);
    var vChars = ValidationChars.split(';');
    var passNo = new Number();
    var vChar = new String();
    var SNL_DoneA = document.getElementById(Prefix + 'SNL_DoneA');
    var ErrorTag = document.getElementById(ErrorTagID);
    
    for(var v = 0; v < vChars.length; v++){
        vChar = vChars[v];
        
        if(content.indexOf(vChar) != -1){
            passNo++;
        }
    }
    
    if(passNo == vChars.length){
        emailInput.className = '';
        SNL_DoneA.value = 1;
        ErrorTag.style.display = 'none';
        ErrorTag.innerHTML = '';
    }
    else{
        emailInput.className = 'InvalidInput';
        SNL_DoneA.value = 0;
        ErrorTag.style.display = 'block';
        ErrorTag.innerHTML = 'ENTER A VALID E-MAIL ADDRESS';
    }
}
function ValidateEmpty(TxtInput, MinChars, MaxChars, InvalidChars, ErrorTagID, DoneHiddenID){
    var content = TxtInput.value;
    var iChars = InvalidChars.split(';');
    var vChar = new String();
    var vCharTxt = new String();
    
    var SNL_Done = document.getElementById(DoneHiddenID);
    //alert(SNL_Done);
    var results = document.getElementById('_results');
    var ErrorTag = document.getElementById(ErrorTagID);
    
    if(content.length >= MinChars && content.length <= MaxChars){
        SNL_Done.value = 1;
        
        for(var v = 0; v < iChars.length; v++){
            vChar = iChars[v];
            vCharTxt += vChar + ' ';
            
            if(content.indexOf(vChar) != -1){
                TxtInput.className = 'InvalidInput';
                SNL_Done.value = 0;
            }
        }
        
        if(parseInt(SNL_Done.value) == 1){
            TxtInput.className = '';
            ErrorTag.style.display = 'none';
            ErrorTag.innerHTML = '';
        }
        else{
            TxtInput.className = 'InvalidInput';
            ErrorTag.style.display = 'block';
            ErrorTag.innerHTML = 'AVOID USING INVALID CHARACTERS: ' + vCharTxt;
        }
    }
    else{
        TxtInput.className = 'InvalidInput';
        SNL_Done.value = 0;
        ErrorTag.style.display = 'block';
        ErrorTag.innerHTML = 'ENTER NO LESS THAN ' + MinChars + ' AND NO MORE THAN ' + MaxChars;
    }
}
function SNL_DoCheckBox(SpanTag){
    var MaxTrials = new Number(3);
    var Trial = new Number();
    var iElem = SpanTag.parentNode;
    var CheckBox = iElem.childNodes[Trial];
    var StrBox = String(CheckBox);
    var BoxPos = new Number();
    
    StrBox = StrBox.toLowerCase();
    
    while(Trial < MaxTrials){
        CheckBox = iElem.childNodes[Trial];
        StrBox = String(CheckBox);
        
        if (StrBox.indexOf('HTMLInputElement') != -1) {
            break;
        }
        else {
            Trial++;
        }
    }
    
    if(CheckBox.checked == false)
        CheckBox.checked = true;
    else
        CheckBox.checked = false;
}
function VerifySubmit(Frm, Prefix){
    var Form = Frm;
    
    var Obj = new String();
    var ObjType = new String();
    var CheckedOnce = new Boolean(false);
    var SNL_DoneA = document.getElementById(Prefix + 'SNL_DoneA');
    
    if(Prefix == ''){
        var SNL_DoneB = document.getElementById(Prefix + 'SNL_DoneB');
        var SNL_DoneC = document.getElementById(Prefix + 'SNL_DoneC');
    }
    
    var inputMail = Form.emailAddress;
    
    if(Prefix == ''){
        var inputFirst = document.getElementById('firstName');
        var inputLast = document.getElementById('lastName');
    }
    
    var Objs = Form.getElementsByTagName('input');
    for(var o = 0; o < Objs.length; o++){
        if(Objs[o].name == 'newsletter'){
            if(Objs[o].checked == true){
                CheckedOnce = true;
                break;
            }
        }
    }    
    
    if(Prefix == ''){            // Subscribe
        if(parseInt(SNL_DoneA.value) == 1 && parseInt(SNL_DoneB.value) == 1 && parseInt(SNL_DoneC.value) == 1){
            if(CheckedOnce == true){
                return(true);
            }
            else{
                alert('PLEASE SELECT AT LEAST ONE NEWSLETTER');
            }
        }
        else{
            if(parseInt(SNL_DoneA.value) != 1){
                alert('PLEASE ENTER (CORRECTLY) YOUR EMAIL ADDRESS');
                inputMail.focus();
            }
            else if(parseInt(SNL_DoneB.value) != 1){
                alert('PLEASE ENTER (CORRECTLY) YOUR FIRST NAME');
                inputFirst.focus();
            }
            else if(parseInt(SNL_DoneC.value) != 1){
                alert('PLEASE ENTER (CORRECTLY) YOUR LAST NAME');
                inputLast.focus();
            }
        }
    }
    else if(Prefix == 'un'){    // Unsubscribe
        if(parseInt(SNL_DoneA.value) == 1){
            if(CheckedOnce == true){
                return(true);
            }
            else{
                alert('PLEASE SELECT AT LEAST ONE NEWSLETTER');
            }
        }
        else{
            if(parseInt(SNL_DoneA.value) != 1){
                alert('PLEASE ENTER (CORRECTLY) YOUR EMAIL ADDRESS');
                inputMail.focus();
            }
        }
    }
    
    return(false);
}
// Download Flash Player
function SMap_DownFP(){
    window.open('http://www.adobe.com/go/EN_US-H-GET-FLASH','','left=0,top=0,width=screen.availWidth,height=screen.availHeight,toolbar=1,resizable=1');
}
// Special Chars WorkAround for the Breadcrumbs
function BC_Init(){
    var AllInputs = document.getElementsByTagName('input');
    var BC_TXT = new Array();
    var BC_HTML = new Array();
    var BC_URL = new Array();
    var HID = new String();
    var EscStr = new String();
    var Target = document.getElementById('nav-crumbs');
    var Content = new String();
    
    for(var i = 0; i < AllInputs.length; i++){
        HID = AllInputs[i].id;
        
        if(HID == 'BC_H'){
            EscStr = escape(AllInputs[i].value);
            BC_HTML.push(EscStr);
            BC_TXT.push(AllInputs[i].value);
        }
        else if(HID == 'BC_U'){
            EscStr = AllInputs[i].value;
            BC_URL.push(EscStr);
        }
    }
    
    for(var bc = 0; bc < BC_HTML.length; bc++){
        var URL = new String(BC_URL[bc]);
        
        if(URL != '')
            AddBC(URL, BC_HTML[bc], 1);
        else
            AddBC(URL, BC_HTML[bc], 0);
        
        //alert(BC_TXT[bc] + '\n\n' + BC_HTML[bc] + '\n\n' + BC_URL[bc]);
    }
    writeBC();
}
// Special Chars WorkAround for GA
function GA_SpecialCharsWA(){
    var GA_NAV_ID = document.getElementById('GA_NAV_ID');
    
    neanav = GA_NAV_ID.value;
}
// Special Chars WorkAround for GA (Right Rail Comps)
function GA_RR_SpecialCharsWA(ModID){
    var Mod = new String();
    var Esc = escape(ModID);
    var Tit = document.getElementById(ModID).value;
    
    Mod = 'rr_' + GenerateRrId(ModID, Tit);
    
    return(Mod);
}
// Special Chars WorkAround for GA (Right Rail Comps)
function GA_EV_SpecialCharsWA(ModID){
    var Mod = new String();
    var Esc = escape(ModID);
    var Tit = document.getElementById(ModID).value;
    
    Mod = 'ev_' + GenerateRrId(ModID, Tit);
    
    return(Mod);
}
// SHARE MENU
function EmbedSelectText(){
    var EmbedInput = document.getElementById('EmbedInput');
    EmbedInput.select();
    //setTimeout('EmbedSelectText()', 1);
}
function toggleDiv(id,flagit) {
    if (flagit=="1"){
        window.document.getElementById(id).style.visibility='visible'
    }
    else
        if (flagit=="0"){
            window.document.getElementById(id).style.visibility='hidden'
        }
        EmbedSelectText();
} 
function PopWin(CenterScr, FullScr, PosX, PosY, WinW, WinH, WinName, WinURL, DirBar, LocBar, MenuBar, IsResizable, ScrollBars, StatusBar, ToolBar){
    var WName = new String();
    var WWidth = new Number();
    var WHeight = new Number();
    var TMode = new Number();
    var WDirBar = new Number();
    var WLocBar = new Number();
    var WMenuBar = new Number();
    var WIsResizable = new Number();
    var WScrollBars = new Number();
    var WStatusBar = new Number();
    var WToolBar = new Number();    
    if(WinName.length > 0) WName = WinName;    
    if(FullScr == true){
        TMode = 1;
        WHeight = screen.availHeight - 10;
        WWidth = screen.availWidth - 10;
    }
    else{
        WWidth = parseInt(WinW);
        WHeight = parseInt(WinH);
    }    
    if(DirBar == true) WDirBar = 1;
    if(LocBar == true) WLocBar = 1;
    if(MenuBar == true) WMenuBar = 1;
    if(IsResizable == true) WIsResizable = 1;
    if(ScrollBars == true) WScrollBars = 1;
    if(StatusBar == true) WStatusBar = 1;
    if(ToolBar == true) WToolBar = 1;    
    // Min and max width and height values
    if(WHeight < 100) WHeight = 100;
    if(WWidth < 100) WWidth = 100;    
    if(WHeight > screen.availHeight) WHeight = screen.availHeight - 10;
    if(WWidth > screen.availWidth) WWidth = screen.availWidth - 10;    
    // Min and Max X and Y positions
    if(PosX < 0) PosX = 0;
    if(PosY < 0) PosY = 0;    
    if(CenterScr == true){
        PosX = parseInt((screen.availWidth / 2) - (WWidth / 2));
        PosY = parseInt((screen.availHeight / 2) - (WHeight / 2) - 25);
    }    
    var PWin = window.open(WinURL, WName, 'channelmode=' + TMode + ',directories=' + WDirBar + ',fullscreen=' + TMode + ',height=' + WHeight + ',left=' + PosX + ',location=' + WLocBar + ',menubar=' + WMenuBar + ',resizable=' + WIsResizable + ',scrollbars=' + WScrollBars + ',status=' + WStatusBar + ',titlebar=0,toolbar=' + WToolBar + ',top=' + PosY + ',width=' + WWidth);
    PWin.moveTo(PosX, PosY);
}
function SetEmbedCode(url){
    var scriptUrl = "http://" + window.location.hostname + "/content-include.xml?load=" + url;
    var script = "<script type='text/javascript' src='"+ scriptUrl +"'></script>";
    var scriptLoad = "<div id='container' ></div>\n<script type='text/javascript'>load('container','" + window.location.hostname + "');</script>";
    $("#EmbedInput").val(script+"\n"+scriptLoad);    
}
// ----------------------------------------------------------------------------

// Salary Map Functions
var SMap_SWFPath = new String('http://127.0.0.1/nea/salary_map/SalaryMap.swf');
// Initialize the map
function SMap_Init(){
    
    var so = new SWFObject(SMap_SWFPath, "NEA_SalaryMap", "100%", "100%", "9");
    so.addParam("swliveconnect", "false");
    so.addParam("menu","false");
    so.addParam("align", "top");
    so.addParam("quality", "best");
    so.addParam("bgcolor", "#ffffff");
    so.addParam("wmode", "transparent");
    so.addParam("allowFullScreen", "true");
    so.write("MapSWF");
}
// Get the GMaps API Key
function SMap_GetKey(){
    var SMapGKey = document.getElementById('SMapGKey');
    
    return(SMapGKey.value);
}
// Returns the current mode
function SMap_GetMode(){
    var SMapOnSmartE = document.getElementById('SMapOnSmartE');
    
    return(SMapOnSmartE.value);
}
// Returns the necessary image URL for the tool window
function SMap_GetToolIco(Tool){
    var SMapTools = document.getElementById('SMapTools');
    var ToolsStr = SMapTools.value;
    var Tools = eval('(' + ToolsStr + ')');
    var ToolSrc = new String();
    
    eval('ToolSrc = Tools[0].Tool' + Tool);
    
    return(ToolSrc);
}
// Read the JSON data
function SMap_ReadData(){
    var SMapData = document.getElementById('SMapData');
    var JObj = eval('(' + SMapData.value + ')');
    
    return(JObj);
}
// Save the JSON data
function SMap_SaveData(JStr){
    var SMapData = document.getElementById('SMapData');
    
    SMapData.value = JStr;
    
    return(true);
}
// Copy the value of the source parameter to the clipboard (IE Only)
function CopyToClipboard(CopySrc){
    var TxtSrc = document.getElementById(CopySrc);
    
    Copied = TxtSrc.createTextRange();
    Copied.execCommand("Copy");
}
/* for GA Google Analytics for multiple sites */
/* Quickfix by JC: Added support for indexOf for arrays */
[].indexOf || (Array.prototype.indexOf = function(v,n){
  n = (n==null)?0:n; var m = this.length;
  for(var i = n; i < m; i++)
    if(this[i] == v)
       return i;
  return -1;
});
window.onload = function() {
  var domains = ["nea.org", "neamb.com"]
  var xx=parent.document.location.hostname.split('.')
  domains.splice(domains.indexOf(xx[xx.length-2]+'.'+xx[xx.length-1]), 1);
  var s=''
  for (i=0;i<domains.length;i++){
    var s=s+'a[href*='+domains[i]+'],'
  }
  $(s).attr("onClick","pageTracker._link(this.href); return false;");
};

/* Email Address Validation */
function validateEmail(email) {
    var emailValue = document.getElementById(email).value;
    var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

    if (!filter.test(emailValue)) {
        document.getElementById('emailnotvalid').style.display = 'block';
        email.focus
        return false;
    } else {
        document.getElementById('emailnotvalid').style.display = 'none';
        return true;
    }
}