
var msg = "Welcome to OceanSide Publications website! We are medical publishers of the Allergy & Asthma Proceedings and the American Journal of Rhinology as well as allergy, asthma and medical textbooks.";
var spacer = "     ";
var pos = 0;
function ScrollMessage() {
   window.status = msg.substring(pos, msg.length) + spacer + msg.substring(0, pos);
   pos++;
   if (pos > msg.length) pos = 0;
   window.setTimeout("ScrollMessage()",200);
}
ScrollMessage();











function setAsDate(element)
{
	today = new Date();
	if (today.getDate() < 10) day = "0"; else day = "";
	day += today.getDate();
	if (today.getMonth() + 1 < 10) month = "0"; else month = "";
	month += today.getMonth() + 1;
	year = today.getYear();
	todayString = month + "/" + day + "/" + year;

	element.value = todayString;	
}

/** Validate ***/
var i = 0;
validateArray = new Array();
validateArray[i++] = new validateMember("First_Name", "#Section1", "First Name is required");
validateArray[i++] = new validateMember("Last_Name", "#Section1", "Last Name is required");
validateArray[i++] = new validateMember("Member_Number", "#Section1", "Member Number is required");
validateArray[i++] = new validateMember("Social_Security_Number", "#Section1", "Social Security Number is required");
validateArray[i++] = new validateMember("Address", "#Section1", "Address is required");
validateArray[i++] = new validateMember("City", "#Section1", "City is required");
validateArray[i++] = new validateMember("State", "#Section1", "State is required");
validateArray[i++] = new validateMember("Zip", "#Section1", "Zip is required");
validateArray[i++] = new validateMember("Home_Phone", "#Section1", "Home Phone is required");
validateArray[i++] = new validateMember("Mom_Maiden_Name", "#Section1", "Mother's Maiden Name is required");
validateArray[i++] = new validateMember("email", "#Section1", "Email is required");
validateArray[i++] = new validateMember("Agreement_and_Diclosure", "#Section_Agree", "You must read and accept the Agreement & Disclosure for NBCU OnLine");
validateArray[i++] = new validateMember("Activate_Bill_Payment_Service", "#Section2", "If you do not want to activate the Bill Payer you must select NO");
validateArray[i++] = new validateMember("Internet_Banking_Acknowledgement", "#Section3", "You must read and accept the Internet Banking Acknowledgement for NBCU OnLine");
validateArray[i++] = new validateMember("Account_Authorization", "#Section3", "Your Authorization is required");
validateArray[i++] = new validateMember("Signature_Authorization", "#Section3", "Your Electronic Signature is required");
validateArray[i++] = new validateMember("Authorization_Date", "#Section3", "Proper date is required");



function validateMember(element, location, warning)
{
	this.element = element;
	this.location = location;
	this.warning = warning;
}

function LTrim(str) {
 for (var i=0; str.charAt(i)==" " || str.charAt(i)=="\n" || str.charAt(i)=="\t"; i++);
 return str.substring(i,str.length);
}

/****************************
Return true if given element has an option selected
*****************************/
function isRadioSelected(element)
{
	for (var i = 0; i< element.length; i++)
	{
		if (element[i].checked) return true;
	}
	return false;
}


/**************************
 Validate the elements in validateArray
**************************/
function doubleCheck()
{
	for (var i = 0; i < validateArray.length; i++)
	{
		element = validateArray[i].element;
		if ( (document.all[element].type == "text" && LTrim(document.all[element].value) == "") ||
		     (document.all[element].type == "checkbox" && !document.all[element].checked) ||
 		     (typeof document.all[element].type == "undefined" && ! isRadioSelected(document.all[element]))  ) //radio
		{
			window.location = validateArray[i].location;
			alert(validateArray[i].warning );	
			return false;
		}
	}
	return true;
}








