// -- contact email function (thwart the spambots...):
function contact() {
var lhs1 = "contact";
var rhs1 = "allianceforpatientaccess.org";
   document.write("<a href=\"mailto");
   document.write(":" + lhs1 + "@");
   document.write(rhs1 + "\">" + lhs1 + "@" + rhs1 + "<\/a>");
}

function contactred() {
var lhs1 = "contact";
var rhs1 = "allianceforpatientaccess.org";
   document.write("<a class=\"red\" href=\"mailto");
   document.write(":" + lhs1 + "@");
   document.write(rhs1 + "\">" + lhs1 + "@" + rhs1 + "<\/a>");
}

function dcharles() {
var vorn = "dcharles";
var hinten = "allianceforpatientaccess.org";
   document.write("<a href=\"mailto");
   document.write(":" + vorn + "@");
   document.write(hinten + "\">" + vorn + "@" + hinten + "<\/a>");
}

function contactbox() { //contact link in sidebar
var f = "contact";
var s = "allianceforpatientaccess.org";
   document.write("<a href=\"mailto");
   document.write(":" + f + "@");
   document.write(s + "\"  id=\"contactbox\">" + f + "@" + s + "<\/a>");
}

// -- required form fields for "Contact" form:
function checkContactFields() {
missinginfo = "";
if (document.formContact.name.value == "") {
missinginfo += "\n     -  name";
}
if (document.formContact.address.value == "") {
missinginfo += "\n     -  address";
}
if ((document.formContact.email.value == "") ||
(document.formContact.email.value.indexOf('@') == -1) ||
(document.formContact.email.value.indexOf('.') == -1)) {
missinginfo += "\n     -  valid email";
}
if (document.formContact.phone.value == "") {
missinginfo += "\n     -  phone";
}
if (document.formContact.fax.value == "") {
missinginfo += "\n     -  fax";
}
if (document.formContact.profession.value == "") {
missinginfo += "\n     -  profession";
}
if (document.formContact.reason.value == "") {
missinginfo += "\n     -  reason for contact";
}
if (missinginfo != "") {
missinginfo ="Please fill in the following fields:\n" +
missinginfo + "\n\nThanks!";
alert(missinginfo);
return false;
}
else return true;
}

//---- show/hide div on contact.php (for "other" field):
function showExtra(theCombo) {
		//get a reference to the control
		var myText = document.getElementById("otherInfo");

		//now check to what the new selection is
		if (theCombo.options[theCombo.selectedIndex].value == "Other") {
			myText.style.display = "";
		}
		else {
			myText.value="";
			myText.style.display = "none";
		}
	}

// -- Open Admin Window:
function openwindow(theURL){
	LeftPosition = (screen.width) ? (screen.width)-510 : 0;
	height = (screen.height) ? (screen.height)*.75 : 550;
	settings = 'height='+height+',width=650,top=0,left='+LeftPosition+',scrollbars=yes,menubar=yes,resizable=yes'
	win = window.open(theURL,'viewit',settings)
}