// JavaScript Document
var MyBooks=new Array();
var count=0;
var booklist="<em>Books: </em><br>";

function ClearBooks(){
	document.getElementById('blist').innerHTML="";
}

function ShowBooks(){
	var allbooks=MyBooks.join("<br>");
	booklist="<em>Books: </em><br>"+allbooks;
	document.getElementById('blist').innerHTML=booklist;
	var allbookslist=MyBooks.join(", ");
	document.books.hiddenlist.value=allbookslist;
}

function NewBook(form){

  	MyBooks[count]=form.title.value;
        count++;	
	ClearBooks();
	ShowBooks();
	document.books.title.value='';
}

function checkform(){
	if(document.books.asrusername.value==''){
			alert("You Must Enter Your name to Submit this Form.");
			return false;}
	else if(!document.books.branch[0].checked&&!document.books.branch[1].checked&&!document.books.branch[2].checked&&
		!document.books.branch[3].checked&&!document.books.branch[4].checked&&!document.books.branch[5].checked&&
		!document.books.branch[6].checked){
			alert("You Must Select a Branch to Submit this Form.");
			return false;}
	else if(document.books.emailname.value==''){
			alert("You Must Enter Your Email to Submit this Form.");
			return false;}
	if(document.books.hiddenlist.value!=''&&document.books.title.value!=''){
			MyBooks[count]=document.books.title.value;
			var allbookslist=MyBooks.join(", ");
			document.books.hiddenlist.value=allbookslist;			
			}
	else if(document.books.hiddenlist.value==''){
			if(document.books.title.value==''){
			alert("You Must Enter at Least One Book to Submit this Form.");
			return false;}
			else {var allbookslist=document.books.title.value;
				document.books.hiddenlist.value=allbookslist;}
			}
return true;
}



