/****************************************************************
*                                                               *
*	For use with ProChoiceAmerica.org and affiliated websites   *
*                                                               *
*	written by Michael Rathmann                                 *
*	(c)RathmannDesign.com. All rights reserved.                 *
*                                                               *
****************************************************************/

var loaded = new Array();

function F_loadRollover(image,imageName) {
	if (image && image.src &&
		(null == image.out || typeof(image.out) == typeof(void(0)))) {
		s = image.src;
		image.out = new Image();
		image.out.src = s;
		image.over = new Image();
		if (imageName.lastIndexOf('/') >= 0 || imageName.lastIndexOf('\\') >= 0) {
			s = imageName;
		} else {
			i = s.lastIndexOf('/');
			if (i<0) i = s.lastIndexOf('\\');
			if (i<0) { s = imageName; }
			else	 { s = s.substring(0,i+1) + imageName; }
		}
		image.over.src = s;
		loaded[image.name] = image;
	}
}

function F_roll(imageName,over) {
	if (document.images) {
	if (over) { imageObject = "over"; }
	else	  { imageObject = "out"; }
	image = loaded[imageName];
	if (image) {
		ref = eval("image."+imageObject);
		if (ref) image.src = eval("image."+imageObject+".src");
	}
	if (window.event)
		window.event.cancelBubble = true;
	}
}

//	Browser Check Variables
var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);

var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
	&& (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
	&& (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_nav4up = (is_nav && (is_major >= 4));
var is_nav6up = (is_nav && (is_major >= 5));

var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie3    = (is_ie && (is_major < 4));
var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);

function handleFocus(form) { form.id = "fieldon"; }

function handleBlur(form) { form.id = "fieldoff"; }

var chasm = screen.availWidth;
var mount = screen.availHeight;
var width = 0;
var height = 0;

var paux = null;
function formWindow(width,height) {
	if (paux != null && paux.open) paux.close();
	paux = window.open('','form','resizable=yes,toolbar=no,scrollbars=yes,status=yes,width=' + width + ',height=' + height + ',left=' + ((chasm - width - 10) * .5) + ',top=' + ((mount - height - 30) * .5));
} function pdfWindow(width,height) {
	if (paux != null && paux.open) paux.close();
	paux = window.open('','pdf','resizable=yes,toolbar=no,scrollbars=yes,status=yes,width=' + width + ',height=' + height + ',left=' + ((chasm - width - 10) * .5) + ',top=' + ((mount - height - 30) * .5));
} function popWindow(width,height) {
	if (paux != null && paux.open) paux.close();
	paux = window.open('','popup','resizable=no,toolbar=no,scrollbars=yes,status=yes,width=' + width + ',height=' + height + ',left=' + ((chasm - width - 10) * .5) + ',top=' + ((mount - height - 30) * .5));
} function auxWindow(width,height) {
	if (paux != null && paux.open) paux.close();
	paux = window.open('','aux','resizable=no,toolbar=no,scrollbars=no,status=yes,width=' + width + ',height=' + height + ',left=' + ((chasm - width - 10) * .5) + ',top=' + ((mount - height - 30) * .5));
} function campaignWindow(target,width,height) {
	if (paux != null && paux.open) paux.close();
	paux = window.open(target,'campaign','resizable=no,toolbar=no,scrollbars=no,status=no,width=' + width + ',height=' + height + ',left=' + ((chasm - width - 10) * .5) + ',top=' + ((mount - height - 30) * .5));
}

function eradic() {
	if (paux != null && paux.open) paux.close();
}

function validateEmail(form) {
	alertStart = "In order to continue, please ";

	if (!form.contactEmail.value) {
		alert(alertStart + "enter your email address.");
		form.contactEmail.focus(); return false;
	} var str = form.contactEmail.value;
	if (!isEmail(str)) {
		alert("'" + str + "' is an invalid email address! Please reenter.");
		form.contactEmail.focus(); form.contactEmail.select(); return false;
	}

	popWindow(489,360);
	return true; //change this to return false to disable
}

function isEmail(str) {
	if (str.length <= 6) { return false; }
	else { return ((str != "") && (str.indexOf("@") != -1) && (str.indexOf(".") != -1)); }
}