
$(document).ready(function () {
	
	$('#signIn').corners("20px");

});

	function valSignUp() {
		if(document.signUp.username.value == "") {
			document.getElementById("error_box").innerHTML = "Please enter a username!";
			return false;
		}
		
		if(document.signUp.password.value == "") {
			document.getElementById("error_box").innerHTML = "Please enter a password!";
			return false;
		}	
		
		if(document.signUp.password.value != document.signUp.password2.value) {
			document.getElementById("error_box").innerHTML = "Please make sure that your passwords match!";
			return false;
		}	
		
		if(document.signUp.email.value == "") {
			document.getElementById("error_box").innerHTML = "Please enter an email!";
			return false;
		}	
		
		if(document.signUp.born.value == "NULL") {
			document.getElementById("error_box").innerHTML = "Please enter your birth year!";
			return false;
		}
		
		if(document.signUp.hearAbout.value == "NULL") {
			document.getElementById("error_box").innerHTML = "Please tell us how you heard about Stories that Soar!";
			return false;
		}
		
		if(document.signUp.hearAbout.value == "library") {
			if(document.signUp.myLibrary.value == "NULL") {
				document.getElementById("error_box").innerHTML = "Please tell us which library is yours!";
				return false;
			}
		}	
		
		return true;
	}
	
	function activitySwitch(actType) {
		var xmlHttp;
		try
		  {
		  // Firefox, Opera 8.0+, Safari
		  xmlHttp=new XMLHttpRequest();
		  }
		catch (e)
		  {
		  // Internet Explorer
		  try
			{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
		  catch (e)
			{
			try
			  {
			  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			  }
			catch (e)
			  {
			  alert("Your browser does not support AJAX!");
			  return false;
			  }
			}
		  }
		  xmlHttp.onreadystatechange=function()
			{
			if(xmlHttp.readyState==4)
			  {
				  document.getElementById('activity_box').innerHTML = xmlHttp.responseText;
			  }
			}
			xmlHttp.open("GET","javascripts/ajax/php/signIn.php?activity="+actType,true);
  	 		xmlHttp.send(null);
 	 }
	 
	 function toggleLib() {
	 	var howIHeard = document.signUp.hearAbout.value;
		if(howIHeard == "library") {
			document.signUp.myLibrary.style.display = "block";
		}else{
			document.signUp.myLibrary.style.display = "none";
		}
	 }