function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}

	//img_on	= newImage("/pics/index_nav/index_con.gif");
	//img_off	= newImage("/pics/index_nav/index_con.gif");
}

/* Sign Petition */

function parseForm (frm) {

	var string = '';

	for (i = 0; i < frm.elements.length; i++) {
		elm = frm.elements[i]
		
		if (elm.type == 'checkbox') {
			if (elm.checked) {
				string += '&'+ frm.elements[i].name +'='+ encodeURIComponent(frm.elements[i].value);
			}
		} else if (elm.type == 'radio') {
			if (elm.checked) {
				string += '&'+ frm.elements[i].name +'='+ encodeURIComponent(frm.elements[i].value);
			}
		} else if (elm.type == 'select') {
			if (elm.selectedindex >= 0) {
				string += '&'+ frm.elements[i].name +'='+ encodeURIComponent(frm.elements[i].options[elm.selectedIndex].value);
			}
		} else {
			string += '&'+ frm.elements[i].name +'='+ encodeURIComponent(frm.elements[i].value);
		}
	
	}

	return string

}

function signPetition(frm) {
	var regexp = new RegExp("^[^@]+@[^@]+\.[^@]+$","g");
	
	if (self.document.petition.email.value == '') {
		alert ("Please enter a valid email address");
	}else if (regexp.exec(self.document.petition.email.value) == null) {
		alert ("Please enter a valid email address");
	}else {		
		//self.document.petition.submit();	
		processSigning(frm);
	}
}

function processSigning(frm) {
	url = '/include/add_to_mailinglist.php';
	url += '?'+ parseForm(frm);
	
	loadXMLDoc(url);	
}


function petitionSigned(r) {
	document.getElementById('form_cell').style.display = 'none';
	document.getElementById('form_thanks').style.display = 'block';
}

function errorMsg (r) {
	alert (r);
}

/* Pop Up Window */

function PopWin(HEIGHT,WIDTH,URL) {
		var PopWin = window.open(URL,'PopWin',"width="+ WIDTH +",height="+ HEIGHT +",scrollbars=0,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
		PopWin.focus()
	}

/* Navigation */


