// fix IE6 flicker issue
try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}


// Suckerfish dropdowns in donate box
sfHover = function() {
	var sfEls = document.getElementById("donate_box").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


// Jump menus
function jumpMenuAffiliates(form) {
	var goAffiliate = document.getElementById('oi_dropdown').selectedIndex;
	if ( goAffiliate == 0 ) {
		alert( "Please select a location!" );
	} else {
		gosite = document.getElementById('oi_dropdown').options[ goAffiliate ].value;
		window.location.assign(gosite);
	}
}
function jumpMenuStates(form) {
	var goCal = document.getElementById('statesDropdown').selectedIndex;
	if ( goCal == 0 ) {
		alert( "Please select a location!" );
	} else {
		gohere = document.getElementById('statesDropdown').options[ goCal ].value;
		window.location.assign(gohere);
	}
}


// random image function for masthead
function loadHomeImgs(imgNum) {
	// config variables
	var r = 11; // total number of image sets
	var sessiononly = false; // rotate only on a new session?
	var folder = ''; // folder within top_imgs that holds the image sets
	// check for existing images
	if (!document.imgrotate) {
		if (sessiononly) {
			// check for a cookie
			n = getCookie('imgset');
			if (n) {
				n = parseInt(n);
			} else {
				// get random number
				n = (Math.floor(Math.random()*r) + 1);
				// set cookie
				setCookie('imgset', n);
			}
		} else {
			n = (Math.floor(Math.random()*r) + 1);
		}
		// write the images to an array
		document.imgrotate = new Array(
			'<img id="topimg1" name="topimg1" src="/images/home/banner_images/'+folder+'top_img'+n+'-1.jpg" alt="" />'
		);
	}
	// write image
	document.write(document.imgrotate[imgNum]);
}


// function to pass variable to Convio signup page
function delineate(str) {
	theleft = str.indexOf("=") + 1;
	theright = str.lastIndexOf("&");
	return(str.substring(theleft, theright));
}
