function toggleLMS()
{
		if (document.getElementById("lmsHelp").offsetHeight != 0) {
		new Effect.BlindUp(document.getElementById('lmsHelp'), {duration:0.2});
		} else {
		new Effect.BlindDown(document.getElementById('lmsHelp'), {duration:0.2});	
		}
}

function toggleInstructorForm(radioButton)
{
	
	
	if (radioButton.value == 1)
	{
		if (document.getElementById("CourseConnect").offsetHeight != 0) {
		new Effect.BlindUp(document.getElementById('CourseConnect'), {duration:0.2});
		}
		new Effect.BlindDown(document.getElementById('CourseCartridge'), {duration:0.2});
	}
	
	if (radioButton.value == 2)
	{
		if (document.getElementById("CourseCartridge").offsetHeight != 0) {
		new Effect.BlindUp(document.getElementById('CourseCartridge'), {duration:0.2});
		}
		new Effect.BlindDown(document.getElementById('CourseConnect'), {duration:0.2});
	}
	
	
	
	
	//else if (document.getElementById("checkCC").offsetHeight != 0)
	//{
		//new Effect.BlindUp(document.getElementById('checkCC'), {duration:0.2});
	//}
	
}

function updateCourses(selectInfo)
{
	new Ajax.Request('/scripts/getCourses.php', {
		method:'get',
			parameters:"id=" + selectInfo.value,
			onSuccess: function(transport){
				//document.instructorForm.course.innerHTML = transport.responseText;
				document.getElementById("courseDiv").innerHTML=transport.responseText;
			},
			onFailure:function(){ alert('Something went wrong...') }
		});
}

function updateDisciplines(selectInfo)
{
	new Ajax.Request('/scripts/getDisciplines.php', {
		method:'get',
			parameters:"id=" + selectInfo.value,
			onSuccess: function(transport){
				document.instructorForm.discipline.innerHTML = transport.responseText;
			},
			onFailure:function(){ alert('Something went wrong...') }
		});
}

function updateCartridgesDisciplines(selectInfo)
{
	new Ajax.Request('/scripts/getCartridgesDisciplines.php', {
		method:'get',
			parameters:"id=" + selectInfo.value,
			onSuccess: function(transport){
				//alert(transport.responseText);
				//document.instructorForm.cartDiscipline.innerHTML = transport.responseText;
				document.getElementById("cartDisciplineDiv").innerHTML=transport.responseText;
			},
			onFailure:function(){ alert('Something went wrong...') }
		});
}

function updateCartridgesTexts(selectInfo)
{
	new Ajax.Request('/scripts/getCartridgesTexts.php', {
		method:'get',
			parameters:"id=" + selectInfo.value,
			onSuccess: function(transport){
				//alert(transport.responseText);
				//document.instructorForm.text.innerHTML = transport.responseText;
				document.getElementById("cartTextDiv").innerHTML=transport.responseText;
			},
			onFailure:function(){ alert('Something went wrong...') }
		});
}



function clearField(fieldInfo)
{ 
	if (fieldInfo.value == " keyword search")
	{ fieldInfo.value = ""; }
}

function validateSearch(formInfo)
{
	if (formInfo.query.value == "" || formInfo.query.value == " keyword search")
	{
		alert("Type in a search query");
		return false;
	}
	return true;
}

function blindDownDiv(div)
{
	if (!document.getElementById(div).display || document.getElementById(div).display == "none")
	{ 
		document.getElementById(div).display = "block";
		new Effect.BlindDown(document.getElementById(div), {duration:0.5});
	}
	else if (document.getElementById(div).display == "block")
	{ 
		document.getElementById(div).display = "none";
		new Effect.BlindUp(document.getElementById(div), {duration:0.5});
	}
}

function blindDownHome(div1, div2, div3)
{
	if (!document.getElementById(div1).display || document.getElementById(div1).display == "none")
	{ 
		document.getElementById(div3).style.height = "auto";
		document.getElementById(div1).display = "none";
		new Effect.BlindUp(document.getElementById(div1), {duration:0.5});
		document.getElementById(div2).display = "block";
		new Effect.BlindDown(document.getElementById(div2), {duration:0.5});
	}
}


var selectedSubTab = 0;
var selectedContent = 0;

function showSubNav(tab)
{
	document.getElementById("tab" + selectedSubTab).className = "";
	document.getElementById("subTab" + selectedSubTab + selectedContent).className = "";
	document.getElementById("books-subnav" + selectedSubTab).style.display = "none";
	document.getElementById("books-content" + selectedSubTab + selectedContent).style.display = "none";
	selectedContent = 0;
	selectedSubTab = tab;
	document.getElementById("tab" + selectedSubTab).className = "selected";
	document.getElementById("subTab" + selectedSubTab + selectedContent).className = "selected";
	document.getElementById("books-subnav" + selectedSubTab).style.display = "block";
	document.getElementById("books-content" + selectedSubTab + selectedContent).style.display = "block";
}

function showBookContent(subTab)
{
	document.getElementById("subTab" + selectedSubTab + selectedContent).className = "";
	document.getElementById("books-content" + selectedSubTab + selectedContent).style.display = "none";
	selectedContent = subTab;
	document.getElementById("subTab" + selectedSubTab + selectedContent).className = "selected";
	document.getElementById("books-content" + selectedSubTab + selectedContent).style.display = "block";
}

function validateRegister(formInfo)
{
	var outTxt = "";

	if (formInfo.FIRSTNAME.value == "")
	{ outTxt += "Fill in your First Name.\n"; }
	if (formInfo.LASTNAME.value == "")
	{ outTxt += "Fill in your Last name.\n"; }
	if (formInfo.COMPANY.value == "")
	{ outTxt += "Fill in your Company name.\n"; }
	if (formInfo.TITLE.value == "")
	{ outTxt += "Fill in your Title.\n"; }
	if (!formInfo.EMAIL.value.match(/.+@.+\..+/))
	{ outTxt += "Your email is invalid.\n"; }
	if (formInfo.PHONE.value == "")
	{ outTxt += "Fill in your Phone.\n"; }

	if (outTxt != "")
	{
		alert("The following information is incorrect:\n" + outTxt);
		return false;
	}
	return true;
	
}


function validateInstructorForm(formInfo)
{
	var outTxt = "";

	if (formInfo.firstName.value == "")
	{ outTxt += "Fill in your first name.\n"; }
	if (formInfo.lastName.value == "")
	{ outTxt += "Fill in your last name.\n"; }
	if (formInfo.phone.value == "")
	{ outTxt += "Fill in a phone number.\n"; }
	if (!formInfo.email.value.match(/.+@.+\..+/))
	{ outTxt += "Your email is invalid.\n"; }
	if (formInfo.courseName.value == "")
	{ outTxt += "Fill in a course name.\n"; }
	if (formInfo.classStartDate.value == "")
	{ outTxt += "Fill in a class start date.\n"; }
	if (formInfo.lmsAdmin.value == "")
	{ outTxt += "Fill in LMS administrator\n"; }
	if (!formInfo.lmsAdminEmail.value.match(/.+@.+\..+/))
	{ outTxt += "Your LMS administrator email is invalid\n"; }

	if (formInfo.selectIF[0].checked) {  
		
		if (formInfo.lms.value == "")
		{ outTxt += "Select LMS.\n"; }
		
		if (formInfo.cartDiscipline.value == "")
		{ outTxt += "Select Discipline.\n"; }
		
		if (formInfo.text.value == "")
		{ outTxt += "Select Text.\n"; }
		
	} else {
		
		if (formInfo.connectLms.value == "")
		{ outTxt += "Select LMS.\n"; }
		
		if (formInfo.discipline.value == "")
		{ outTxt += "Select Discipline.\n"; }
		
		if (formInfo.course.value == "")
		{ outTxt += "Select Course.\n"; }
				
	}
		
	if (outTxt != "")
	{
		alert("The following information is incorrect:\n" + outTxt);
		return false;
	}
	return true;
	
}


function validateContactUs(formInfo)
{
	var outTxt = "";

	if (formInfo.projectType && formInfo.projectType.value == "")
	{ outTxt += "Select who you would like to contact.\n"; }
	if (formInfo.firstName && formInfo.firstName.value == "")
	{ outTxt += "Fill in your First Name.\n"; }
	if (formInfo.lastName && formInfo.lastName.value == "")
	{ outTxt += "Fill in your Last name.\n"; }
	if (formInfo.school && formInfo.school.value == "")
	{ outTxt += "Fill in a School.\n"; }
	if (formInfo.department && formInfo.department.value == "")
	{ outTxt += "Fill in a Department.\n"; }
	if (formInfo.courseName && formInfo.courseName.value == "")
	{ outTxt += "Fill in a Course Name.\n"; }
	if (formInfo.enrollment && formInfo.enrollment.value == "")
	{ outTxt += "Fill in the Enrollment.\n"; }
	if (formInfo.classStartDate && formInfo.classStartDate.value == "")
	{ outTxt += "Fill in a Class Start Date.\n"; }
	if (formInfo.phone && formInfo.phone.value == "")
	{ outTxt += "Fill in a Phone Number.\n"; }
	if (formInfo.email && !formInfo.email.value.match(/.+@.+\..+/))
	{ outTxt += "Your email is invalid.\n"; }
	if (formInfo.state && formInfo.state.value == "")
	{ outTxt += "Select a State.\n"; }

	if (outTxt != "")
	{
		alert("The following information is incorrect:\n" + outTxt);
		return false;
	}
	return true;
	
}

function validateMoreInformation(formInfo)
{
	var outTxt = "";

	if (formInfo.name.value == "")
	{ outTxt += "Fill in your Name.\n"; }
	if (formInfo.address.value == "")
	{ outTxt += "Fill in your Address.\n"; }
	if (formInfo.city.value == "")
	{ outTxt += "Fill in your City.\n"; }
	if (formInfo.state.value == "")
	{ outTxt += "Select your State.\n"; }
	if (formInfo.zipCode.value == "")
	{ outTxt += "Fill in your Zip Code.\n"; }
	if (formInfo.phone.value == "")
	{ outTxt += "Fill in your Phone Number.\n"; }
	if (!formInfo.email.value.match(/.+@.+\..+/))
	{ outTxt += "Your email is invalid.\n"; }

	if (outTxt != "")
	{
		alert("The following information is incorrect:\n" + outTxt);
		return false;
	}
	return true;
	
}

function validateNewsletter(formInfo)
{
	var outTxt = "";

	if (!formInfo.email.value.match(/.+@.+\..+/))
	{ outTxt += "Your email is invalid.\n"; }
	if (formInfo["fieldcontents[45031]"].value == "")
	{ outTxt += "Fill in your First Name.\n"; }
	if (formInfo["fieldcontents[45032]"].value == "")
	{ outTxt += "Fill in your Last Name.\n"; }
	if (formInfo["fieldcontents[45034]"].value == "")
	{ outTxt += "Fill in your School or Organization.\n"; }
	if (formInfo["fieldcontents[46603]"].value == "")
	{ outTxt += "Fill in your Department.\n"; }

	if (outTxt != "")
	{
		alert("The following information is incorrect:\n" + outTxt);
		return false;
	}
	return true;
	
}

function validateFirstDayClass(formInfo)
{
	var outTxt = "";

	if (formInfo.lastName.value == "")
	{ outTxt += "Fill in your Last Name.\n"; }
	if (formInfo.schoolName.value == "")
	{ outTxt += "Fill in your School Name.\n"; }
	if (formInfo.department.value == "")
	{ outTxt += "Fill in your Department.\n"; }
	if (formInfo.schoolZipCode.value == "")
	{ outTxt += "Fill in your School Zip Code.\n"; }
	if (formInfo.textbookTitle.value == "")
	{ outTxt += "Fill in the Custom Textbook Title.\n"; }
	if (formInfo.courseName.value == "")
	{ outTxt += "Fill in your Course Name & Number.\n"; }
	if (formInfo.classStartDate.value == "")
	{ outTxt += "Fill in your Class Start Date.\n"; }
	if (!formInfo.email.value.match(/.+@.+\..+/))
	{ outTxt += "Your email is invalid.\n"; }
	if (formInfo.componentIsbn.value == "")
	{ outTxt += "Fill in the custom component ISBN.\n"; }

	if (outTxt != "")
	{
		alert("The following information is incorrect:\n" + outTxt);
		return false;
	}
	return true;
	
}


function sendMail(user,domain)
{
	locationstring = "mailto:" + user + "@" + domain;
	window.location = locationstring;
}

