// JavaScript Document

//Rollovers
function swapImage(imageID, imagePath) {
	var imgID;
	imgID = document.getElementById(imageID);
	imgID.src = imagePath;
}

//Popup
var childpop
childpop = null
function childPop(file) {
	    
	    if (childpop != null) {
		childpop.close()
		}
		
		childpop = window.open (file,'childone','height=525,width=610,scrollbars=1,resizable=1,toolbar=1,location=1,status=1');
	}

//Form Validation for Update My Info
function validate(form) {
	var msg="";
	if (form.b_org_name.value == "") msg += "  * Organization Name\n";
	if (form.c_contact_name.value == "") msg += "  * Contact Name\n";
	if ((form.f_email.value.indexOf('@') == -1) || 
		(form.f_email.value.length < 8)) msg += "  * E-mail\n";
	if (msg == "") {
		return true;
	} else {
		alert("Please enter in the following information in order to update your information:\n" + msg);
		return false;
	}
}


//Form Validation for Qualifier Form
function validate2(form) {
	var msg="";
	if (form.a_name.value == "") msg += " * Name\n";
	if (form.b_organization.value == "") msg += " * Organization\n";
	if ((form.d_email.value.indexOf('@') == -1) || 
		(form.d_email.value.length < 8)) msg += " * E-mail\n";
	if (form.e_phone.value == "") msg += " * Telephone\n";
	if (msg == "") {
		return true;
	} else {
		alert("Please ensure you correctly enter the following information before submitting your request:\n" + msg);
		return false;
	}
}

//Form Validation for Qualifier Form
function validate3(form) {
	var msg="";
	if (form.a_name.value == "") msg += " * Name\n";
	if (form.c_organization.value == "") msg += " * Organization\n";
	if (form.d_address.value == "") msg += " * Street Address\n";
	if (form.f_city.value == "") msg += " * City\n";
	if (form.g_state.selectedIndex == 0) msg += " * State\n";
	if ((form.e_email.value.indexOf('@') == -1) || 
		(form.e_email.value.length < 8)) msg += " * E-mail\n";
	if (form.h_phone.value == "") msg += " * Telephone\n";
	if (msg == "") {
		return true;
	} else {
		alert("Please ensure you correctly enter the following information before submitting your request:\n" + msg);
		return false;
	}
}



// Accordion

$(document).ready(function(){

	$(".accordion h3:first").addClass("active");
	$(".accordion p:not(:first)").hide();
		$(".accordion h3").click(function(){
				$(this).next("p").slideDown("slow").siblings("p:visible").slideUp("slow");
				$(this).addClass("active");
				$(this).siblings("h3").removeClass("active");
			});

});
