if (document.images){
hom_on = new Image();	hom_on.src = view_path + "images/home_on.gif";
boa_on = new Image();	boa_on.src = view_path + "images/board_on.gif";
pas_on = new Image();	pas_on.src = view_path + "images/past_on.gif";
med_on = new Image();	med_on.src = view_path + "images/media_on.gif";
mis_on = new Image();	mis_on.src = view_path + "images/mission_on.gif";
vol_on = new Image();	vol_on.src = view_path + "images/volunteer_on.gif";
nws_on = new Image();	nws_on.src = view_path + "images/nws_on.gif";
con_on = new Image();	con_on.src = view_path + "images/contact_on.gif";
}



//anti-spam email functions

function infomail() {
	user = "info";
	site = "jeffersonawards.org";
	document.write('<a href=\"mailto:' + user + '@' + site + '\">');
	document.write('<span style="color:#00194c; text-decoration:underline;">' + user + '@' + site + '</span></a>');
}

function sbeardmail() {
	user = "s.beard";
	site = "jeffersonawards.org";
	document.write('<a href=\"mailto:' + user + '@' + site + '\">');
	document.write(user + '@' + site + '</a>');
}

function dbartellomail() {
	user = "d.bartello";
	site = "jeffersonawards.org";
	document.write('<a href=\"mailto:' + user + '@' + site + '\">');
	document.write(user + '@' + site + '</a>');
}

function dcainemail() {
	user = "d.caine";
	site = "jeffersonawards.org";
	document.write('<a href=\"mailto:' + user + '@' + site + '\">');
	document.write(user + '@' + site + '</a>');
}

function tcoylemail() {
	user = "t.coyle";
	site = "jeffersonawards.org";
	document.write('<a href=\"mailto:' + user + '@' + site + '\">');
	document.write(user + '@' + site + '</a>');
}

function pdillmail() {
	user = "p.dill";
	site = "jeffersonawards.org";
	document.write('<a href=\"mailto:' + user + '@' + site + '\">');
	document.write(user + '@' + site + '</a>');
}

function mfidancemail() {
	user = "m.fidance";
	site = "jeffersonawards.org";
	document.write('<a href=\"mailto:' + user + '@' + site + '\">');
	document.write(user + '@' + site + '</a>');
}

function janasnycmail() {
	user = "janasnyc";
	site = "msn.com";
	document.write('<a href=\"mailto:' + user + '@' + site + '\">');
	document.write(user + '@' + site + '</a>');
}

function nleonardmail() {
	user = "n.leonard";
	site = "jeffersonawards.org";
	document.write('<a href=\"mailto:' + user + '@' + site + '\">');
	document.write(user + '@' + site + '</a>');
}

function jmitchellmail() {
	user = "j.mitchell";
	site = "jeffersonawards.org";
	document.write('<a href=\"mailto:' + user + '@' + site + '\">');
	document.write(user + '@' + site + '</a>');
}

function gmooremail() {
	user = "g.moore";
	site = "jeffersonawards.org";
	document.write('<a href=\"mailto:' + user + '@' + site + '\">');
	document.write(user + '@' + site + '</a>');
}

function mnastamail() {
	user = "m.nasta";
	site = "jeffersonawards.org";
	document.write('<a href=\"mailto:' + user + '@' + site + '\">');
	document.write(user + '@' + site + '</a>');
}

function dsherbacowmail() {
	user = "d.sherbacow";
	site = "jeffersonawards.org";
	document.write('<a href=\"mailto:' + user + '@' + site + '\">');
	document.write(user + '@' + site + '</a>');
}

function ewackerlinmail() {
	user = "e.wackerlin";
	site = "jeffersonawards.org";
	document.write('<a href=\"mailto:' + user + '@' + site + '\">');
	document.write(user + '@' + site + '</a>');
}
	
//end anti-spam


function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=325,left = 640,top = 362.5');");
}

function clearTabs(set,total){
    for(i=1;i<=total;i++){
        tab = id2elem(set+'_t'+i);
        
        tab.className = "";
        section = id2elem(set+'_s'+i);
        section.style.display = "none";
    }
}

function filterNonNumeric(field) {
	var result = new String();
	var numbers = "0123456789";
	var chars = field.value.split(""); // create array 
	for (i = 0; i < chars.length; i++) {
	if (numbers.indexOf(chars[i]) != -1) result += chars[i];
	}
	if (field.value != result) field.value = result;
}

function displaynameFilter(field) {
	var result = new String();
	var vals = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var chars = field.value.split(""); // create array 
	for (i = 0; i < chars.length; i++) {
	if (vals.indexOf(chars[i]) != -1) result += chars[i];
	}
	if (field.value != result) field.value = result;
}

function emailLookup(val) {
	var fldval = $(val).value;
	var pars = 'v='+fldval;
	var URL = '/ola/ajax/emaillookup/';
	
	if (!fldval == '') {
    	var myAjax = new Ajax.Request(
		URL, 
		{
			asynchronous: true, 
			method: 'post', 
			parameters: pars, 
			onLoading: showLookup,
			onSuccess: showEmailSearchResults
		});
	}
}

function showEmailSearchResults (response) {
	var SEARCH_GOOD = 0;
	var SEARCH_FAILED = 1;
    var responseCode = response.responseText;
	
    //alert(responseCode);
    if (responseCode == SEARCH_GOOD) {
		//alert('Good Displayname');
		$('email-error').style.display = 'block';
		$('email-error').addClassName('formsuccess').update('You Can Use The Email Address Provided!');
    } else {
		//alert('email already in the system');
		$('email-error').style.display = 'block';
		$('email-error').addClassName('formerror').update('The Email Address Provided Has Already Been Registered');
		$('email').focus();
    }
}


function displaynameLookup(val) {
	var fldval = $(val).value;
	var pars = 'v='+fldval;
	var URL = '/ola/ajax/displaynamelookup/';
	
	if (!fldval == ''){
    	var myAjax = new Ajax.Request(
		URL, 
		{
			asynchronous: true, 
			method: 'post', 
			parameters: pars, 
			onLoading: showLookup,
			onSuccess: showNameSearchResults
		});
	}
}

function showLookup () {
	$('loading').style.display = 'block';
	
}

function showNameSearchResults (response) {
	var SEARCH_GOOD = 0;
	var SEARCH_FAILED = 1;
    var responseCode = response.responseText;
	
    //alert(responseCode);
    if (responseCode == SEARCH_GOOD) {
		//alert('Good Displayname');
		$('username-error').style.display = 'block';
		$('username-error').addClassName('formsuccess').update('Your Choosen Display Name is Available!');
    } else {
		//alert('Displayname already in the system');
		$('username-error').style.display = 'block';
		$('username-error').addClassName('formerror').update('Your Choosen Display Name is Already Taken');
		$('displayname').focus();
    }
}

function verifyPass () {
	var pwd1 = $('password').value;
	var pwd2 = $('pwd2').value;
	
	if (pwd1 != pwd2){
		$('password2-error').update('Passwords Do NOT Match!');
		$('password').focus();
	}
}

function videohover(num,dir){
    title = id2elem('title'+num);
    thumb = id2elem('thumb'+num);
    if (dir==1){
       //title.style.display = 'block';
       thumb.style.border = '1px solid #090';
    }else{
       //title.style.display = 'none';
       thumb.style.border = '1px solid #999';
    }    
}

function setscrollwidth(holderid, tNum, tWidth, border, margins){
    holder = id2elem(holderid);
    hWidth = ((tNum+1)*tWidth)+(2*border)+(2*margins);
    holder.style.width = hWidth+'px';
}

function tabswitch(set,tNum,total){
    clearTabs(set,total);
    tab = id2elem(set+'_t'+tNum);
    
    tab.className = 'on';
    section = id2elem(set+'_s'+tNum);
    section.style.display = "block";
}
function roll(sname,rname){
    sname = id2elem(sname);
    sname.src = rname.src;
}
function id2elem(id) {
	if (typeof(id) != 'string') {
		return id;
	}
	if (document.getElementById) {
		id = document.getElementById(id);
	} else if (document.all) {
		id=document.all[id];
	} else {
		id = null;
	}
	return id;
}
function popup(url,width,height){
    nw = window.open(url,"newwindow","width="+width+",height="+height+",status=0,toolbar=0,menubar=0,scrollbars=1,resizable=1,location=0");
    nw.focus();
}





function checkForm(){
if (document.subscribeForm.elements['Email Address'].value.length > 0){
 return true;
 }
else{
 alert('Please enter your email address.');
 document.subscribeForm.elements['Email Address'].focus();
 return false;
 }
}

function addContact() {
	
	var fData = $("#contact").serialize();
	var cUrl = def_path + 'ajax/addcontact';
	
	$('#contact_form').fadeOut("fast");

	var myAjax = $.ajax ({
		 type: "POST",
		 url: cUrl,
		 data: fData,
		 dataType: "text",
		 success: function() {
		  $("#thankyou").fadeIn('fast');
		}
	});
		
}

function addNomination(frm) {
	
	var fData = $("#"+frm).serialize();
	var cUrl = def_path + 'ajax/addnomination';
	
	$('#introtext').fadeOut("fast");
	$('#nominationform').fadeOut("fast");

	var myAjax = $.ajax ({
		 type: "POST",
		 url: cUrl,
		 data: fData,
		 dataType: "text",
		 success: function() {
		  $("#results").fadeIn('fast');
		}
	});
		
}


// for drop-down menus
if (!document.layers&&!document.all&&!document.getElementById)
event="test"
function showtip(current,e,text){

if (document.all||document.getElementById){
thetitle=text.split('<br>')
if (thetitle.length>1){
thetitles=''
for (i=0;i<thetitle.length;i++)
thetitles+=thetitle[i]
current.title=thetitles
}
else
current.title=text
}

else if (document.layers){
document.tooltip.document.write('<layer bgColor="white" style="border:1px solid black;font-size:12px;">'+text+'</layer>')
document.tooltip.document.close()
document.tooltip.left=e.pageX+5
document.tooltip.top=e.pageY+5
document.tooltip.visibility="show"
}
}
function hidetip(){
if (document.layers)
document.tooltip.visibility="hidden"
}

function change(id, newClass)
{
	identity=document.getElementById(id);
	identity.className=newClass;
}

