//Validates that email address field contains an '@' char
function valEmail(email){

	var temp;

	if (email!=""){
		for (i=0;i < email.length;i++){
			temp = email.substring(i,i+1);
			if (temp=='@'){
				return true;		
			}
		}
		return false;
	}else{
		return true;
	}

}

//Create random four digit to make id
function randomNo(type){

	no1 = Math.round(Math.random()*100);
	no2 = Math.round(Math.random()*100);
	if (type==0){	
		return ("BOOK"+ no1 +no2)
	}else{
		return ("CON"+ no1 +no2)
	}
}


function valNum(field, chars){
	
	var test;
	
	for (i=0;i < field.length; i++){
		test = field.substring(i,i+1);

		if ( test > "9"){
			if (chars == 1) {
				if(test != "-" ){
					return  false;
				}
			}else{
				return false;
			}
		}
	}
	return true;
}