// JavaScript Document
//following is hack for IE so drop down navigation works in IE 5
sfHover = function() {
	var sfEls = document.getElementById("nav").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);
//end IE 5 hack

var err_color = '#ffcccc';
var ok_color = '#ffffff';

function bulletin_selected_dropdown(option) {
	if (option == "letter_to_editor") {
		email_prefix = "bulletin";
		//email_prefix = "jlott1";
		document.getElementById("mlto").value = email_prefix;
		document.getElementById("mlheader_subject").value = "Bulletin E-mail: Letter to the Editor";
		document.getElementById("bulletin_suggestion_instructions").innerHTML = "The <i>Bulletin</i> welcomes letters to the editor addressing topics covered in the magazine or issues relating to the College. Our <a href=\"wp-content/themes/swarthmore_bulletin/includes/special_pages/files/letters_policy.pdf\">letters policy</a> suggests that that letters be limited to 300 words. All letters must be signed and may be edited for clarity and space. You may submit a letter using this form or send it as an attachment to <a href=\"mailto:bulletin@swarthmore.edu\">bulletin@swarthmore.edu</a>.";
		}
	else if (option == "article_idea") {
		email_prefix = "bulletin";
		//email_prefix = "jlott1";
		document.getElementById("mlto").value = email_prefix;
		document.getElementById("mlheader_subject").value = "Bulletin E-mail: Article Idea";
		document.getElementById("bulletin_suggestion_instructions").innerHTML = "The editors welcome suggestions for articles that meet our <a href=\"wp-content/themes/swarthmore_bulletin/includes/special_pages/files/editorial_guidelines.pdf\">editorial guidelines</a>. Story concepts and goals should be discussed in detail with the editors before a project is launched. Submit a brief proposal using this form or e-mail longer proposals and supporting documents to <a href=\"mailto:bulletin@swarthmore.edu\">bulletin@swarthmore.edu</a>.";
		}
	else if (option == "class_note") {
		email_prefix = "sbreen1";
		//email_prefix = "sbreen1";
		document.getElementById("mlto").value = email_prefix;
		document.getElementById("mlheader_subject").value = "Bulletin E-mail: Class Note";
		document.getElementById("bulletin_suggestion_instructions").innerHTML = "Class Notes are intended to keep classmates in touch with each other and the College. Most class columns are written by class secretaries elected by their classmates. Notes submitted here will be forwarded to your class secretary by the class notes editor.";
		}
	else if (option == "books_and_arts") {
		email_prefix = "jmerril1,cbrevar1";
		//email_prefix = "jlott1";
		document.getElementById("mlto").value = email_prefix;
		document.getElementById("mlheader_subject").value = "Bulletin E-mail: Books & Arts Submission";
		document.getElementById("bulletin_suggestion_instructions").innerHTML = "Review copies of books, CDs, etc. should be sent directly to the <i>Bulletin</i> at the address below. Capsule reviews will be written by our staff and the items will be donated to the College library. We also welcome news of films, exhibits, musical accomplishments, etc.,which may be submitted using this form or sent as attachments to <a href=\"mailto:bulletin@swarthmore.edu\">bulletin@swarthmore.edu</a>.<br /><br />Books + Arts<br />Swarthmore College Bulletin<br />500 College Avenue<br />Swarthmore PA 19081<br />";
		}
	else {
		document.getElementById("mlto").value = "";
		document.getElementById("mlheader_subject").value = "";
		document.getElementById("bulletin_suggestion_instructions").innerHTML = "";
		}
	}

function requiredname_fix() {
	document.bulletin_suggestion_form.requiredname.style.backgroundColor = ok_color;
	}
function requiredyear_affiliation_fix() {
	document.bulletin_suggestion_form.requiredyear_affiliation.style.backgroundColor = ok_color;
	}
function requiredemail_fix() {
	document.bulletin_suggestion_form.requiredemail.style.backgroundColor = ok_color;
	}
function dropdown_fix() {
	document.select_option.select_dropdown.style.backgroundColor = ok_color;
	}





function checkBulletinForm() {
	if (document.select_option.select_dropdown.selectedIndex != "0") {
		if (document.bulletin_suggestion_form.requiredname.value != "") {
			if (document.bulletin_suggestion_form.requiredyear_affiliation.value != "") {
				if (document.bulletin_suggestion_form.requiredemail.value != "") {
					if ((document.bulletin_suggestion_form.requiredemail.value.indexOf(".") >= "1") && (document.bulletin_suggestion_form.requiredemail.value.indexOf("@") > "0")) {
						
						}
						else {
							alert("Please provide a valid e-mail address.");
							document.bulletin_suggestion_form.requiredemail.focus();
							document.bulletin_suggestion_form.requiredemail.style.backgroundColor = err_color;
							return false;
							}
					
					}
					else {
						alert("Please provide your e-mail address.");
						document.bulletin_suggestion_form.requiredemail.focus();
						document.bulletin_suggestion_form.requiredemail.style.backgroundColor = err_color;
						return false;
						}
				}
				else {
					alert("Please provide your Class Year or Affiliation.");
					document.bulletin_suggestion_form.requiredyear_affiliation.focus();
					document.bulletin_suggestion_form.requiredyear_affiliation.style.backgroundColor = err_color;
					return false;
					}
			}
			else {
				alert("Please provide your name.");
				document.bulletin_suggestion_form.requiredname.focus();
				document.bulletin_suggestion_form.requiredname.style.backgroundColor = err_color;
				return false;
				}
		}
		else {
			alert("Please select the appropriate option from the drop down menu.");
			document.select_option.select_dropdown.focus();
			document.select_option.select_dropdown.style.backgroundColor = err_color;
			return false;
		}
	
	}