function checkUserSelect()
{
 var shareStatusCnt = document.sharebookspage.sharestatus.length;
	for(iCnt=0; iCnt<shareStatusCnt; iCnt++)
	{
		if(document.sharebookspage.sharestatus[iCnt].checked)
		{			
			if(document.sharebookspage.sharestatus[iCnt].value == "All")
			{
				window.location.href="viewall.jsp";
			}
			else if(document.sharebookspage.sharestatus[iCnt].value == "Specific")
			{
				window.location.href="viewspecific.jsp";
			}
		}
	}
}

function checkEmailValid(email){
	//console.log(email);
	reg = /^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i;
	if (!email.match(reg)) {
		alert("E-mail address is not valid.");
	}
	else{
		$.post(
			"addEmailSignup.html",
			{email: email},
			function(data){
				if(data==true){
					alert(email + " has been added.");
				}
				else{
					alert("Internal error. E-mail address has not been added.");
				}
			},
			"json"
		);

	}
}
