<!-- //
n0 = new Image();
n0.src = "/resources/images/nav_information_over.gif";
n1 = new Image();
n1.src = "/resources/images/nav_support_over.gif";
n2 = new Image();
n2.src = "/resources/images/nav_programs_over.gif";
n3 = new Image();
n3.src = "/resources/images/nav_getinvolved_over.gif";
n4 = new Image();
n4.src = "/resources/images/nav_donate_over.gif";

n5 = new Image();
n5.src = "/resources/images/nav_information_on.gif";
n6 = new Image();
n6.src = "/resources/images/nav_support_on.gif";
n7 = new Image();
n7.src = "/resources/images/nav_programs_on.gif";
n8 = new Image();
n8.src = "/resources/images/nav_getinvolved_on.gif";
n9 = new Image();
n9.src = "/resources/images/nav_donate_on.gif";

var onID = "";

function initNav() {
	onID = "nav_" + arrNav[0];
	if($(onID)) {
		$(onID).setAttribute("src","/resources/"+lang+"/images/"+onID+"_on.gif");
		}
		
	if($('globalnav')) {
		globalNavItems = $('globalnav').childElements();
		
		globalNavItems.each(function(item) {
			
			Event.observe(item,'mouseover',function() {
				navImage = item.down();												
				currID = navImage.identify();
				navOver(currID);
				}.bind(item));
	
			Event.observe(item,'mouseout',function() {
				navImage = item.down();
				currID = navImage.identify();
				navOut(currID);
				}.bind(item));
			});
		 }
		 
	expandNav();
	}
	
function expandNav() {
	currPage = "";
	arrNav.each(function (s, index) {
		if(s != "" && index != "0") {
			thisPage = "sn-" + s;
			if($(thisPage)) {
				if($(thisPage).down(1)) {
					$(thisPage).down(1).style.display="block";
					}
				currPage = thisPage;
				}
			}
		});
	
	if(currPage != "") {
		$(currPage).firstChild.addClassName("on");
		}
	}

function navOver(id) {
	if(onID != id) {
		$(id).setAttribute("src","/resources/"+lang+"/images/"+id+"_over.gif");
		}
	}

function navOut(id) {
	if(onID != id) {
		$(id).setAttribute("src","/resources/"+lang+"/images/"+id+"_off.gif");
		}
	}	



function clearField(id,txt) {
	if($(id).value == txt) {
		$(id).value = "";
		}	
	}

var currFontSize = 1;

function setFontSize(size) {
	var ccn = $w($('container').className);
	ccn.each(function(s) {
		$('container').removeClassName(s);  
		});
	
	$('container').addClassName(size);
	
	// Show font size buttons as disabled if we've reached min. or max. sizes
	if($('btnDecFontSize')) {
		if(size == "size1") {
			$('btnDecFontSize').setAttribute("src","/resources/icons/style_delete_disabled.png");
			}
		else {
			$('btnDecFontSize').setAttribute("src","/resources/icons/style_delete.png");
			}
			
		if(size == "size4") {
			$('btnIncFontSize').setAttribute("src","/resources/icons/style_add_disabled.png");
			}
		else {
			$('btnIncFontSize').setAttribute("src","/resources/icons/style_add.png");
			}	
		}
		
	// Set a cookie to remember user's font size preference
	setCookie('bcnosFS',size,365);
	}

function changeFontSize(dir) {
	if(dir == "up") {
		currFontSize = currFontSize+1;
		}
	if(currFontSize > 4) {
		currFontSize = 4;
		}

	if(dir == "down") {
		currFontSize = currFontSize-1;
		}
	
	if(currFontSize < 1) {
		currFontSize = 1;
		}
	
	currSize = "size"+currFontSize.toString();
	
	setFontSize(currSize);
	}
	

function getCookie(c_name) {
	if (document.cookie.length>0) {
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1) { 
			c_start=c_start + c_name.length+1; 
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) {
				c_end=document.cookie.length; 
				}
			return unescape(document.cookie.substring(c_start,c_end));
			} 
		}
	return "";
	}

function setCookie(c_name,value,expiredays) {
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString()+";path=/");
	}

/* ===== Start Email This Page functions ===== */
var etpTitle = "";
function setETPTitle() {
	if($('ttlETP')) {
		etpTitle = $('contentWrap').select('h1');	
		etpTitle = etpTitle[0].innerHTML;
		$('ttlETP').insert(etpTitle, "after");
		}
	}

function resetEmailThisPage() {
	$('resultMsg').replace('<div id="resultMsg"></div>');
	$('frmEmailPage').style.display="block";
	$('frmEmailPage').reset();
	document.forms['frmEmailPage'].pageTitle.value = etpTitle;
	}

var etpState = "up";
function toggleEmailThisPage() {

	if(etpState == "up") {
		new Effect.MoveBy('emailThisPage', 744, 0, { duration: 0.4 });
		new Effect.MoveBy('emailThisPage', -40, 0, { duration: 0.3, queue:'end' });
		etpState = "down";
		}
	else {
		new Effect.MoveBy('emailThisPage', -704, 0, { duration: 0.4 });
		etpState = "up";
		}
		
	//$('emailThisPage').toggle();
	// Center the email form
	vpw = document.viewport.getWidth();
	
	$('emailThisPage').style.left = ((vpw-475)/2)+"px";
	resetEmailThisPage();
	}

function handleEmailResponse(json) {
	$('frmEmailPage').style.display = json[0];
	$('resultMsg').replace('<div id="resultMsg"></div>');
	$('resultMsg').insert(json[1]);
	}

function emailPage() {
	new Ajax.Request('/resources/emailpage.php', {
 		onSuccess: function(transport){
     		var json = transport.responseText.evalJSON();
			handleEmailResponse(json);
			},
		parameters: Form.serialize(document.forms['frmEmailPage']) 	
		});
	}
/* ===== End Email This Page functions ===== */


function initPage() {
	// Call anything here to initialize page state
	initNav();
	
	userFontSize = getCookie('bcnosFS');
	if(userFontSize != null && userFontSize != "") {
		setFontSize(userFontSize);
		}
	
	// Initialize Email This Page title
	setETPTitle();
	}

Event.observe(window,'load',initPage);	
// -->