
// BUSINESS SIGN-UP PAGE

   function hideBusinessSignup() {

	target = document.getElementById('step1');
	target.style.display = 'none';

	target = document.getElementById('step2');
	target.style.display = 'none';

	target = document.getElementById('step3');
	target.style.display = 'none';

	target = document.getElementById('step4');
	target.style.display = 'none';

	target = document.getElementById('step5');
	target.style.display = 'none';

	target = document.getElementById('step6');
	target.style.display = 'none';

	target = document.getElementById('step7');
	target.style.display = 'none';

	target = document.getElementById('step8');
	target.style.display = 'none';

	target = document.getElementById('step9');
	target.style.display = 'none';

	target = document.getElementById('step10');
	target.style.display = 'none';

	target = document.getElementById('step11');
	target.style.display = 'none';

   }


   function businessSignup(step) {

	if (step == 'goStep0') {

	  target = document.getElementById('step0');
	  target.style.display = 'block';

	  target = document.getElementById('step1');
	  target.style.display = 'none';

	} else if (step == 'goStep1') {

	  target = document.getElementById('step0');
	  target.style.display = 'none';

	  target = document.getElementById('step1');
	  target.style.display = 'block';

	  target = document.getElementById('step2');
	  target.style.display = 'none';

	} else if (step == 'goStep2') {

	  var myRegexp = /^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/;
	  if (document.getElementById('primaryEmail').value) {
	    email = document.getElementById('primaryEmail').value;
	  }

	  if (!document.getElementById('businessName').value) {
	    entryError = 'Please enter your Business Name before continuing...';
	  } else if (!document.getElementById('contactName').value) {
	    entryError = 'Please enter the Business Contact Name before continuing...';
	  } else if (!document.getElementById('primaryPhone').value) {
	    entryError = 'Please enter the Business Phone Number before continuing...';
	  } else if (!document.getElementById('businessCategory').value) {
	    entryError = 'Please select a Business Category before continuing...';
/*
	  } else if (!document.getElementById('primaryEmail').value) {
	    entryError = 'Please enter the Primary Email Address before continuing...';
*/
	  } else if (document.getElementById('primaryEmail').value && !myRegexp.test(email)) {
	    entryError = 'Please enter a valid Email Address OR Leave this field blank before continuing...';

	  } else {
	    entryError = 'ok';
	  }

	  if (entryError == 'ok') {

	    target = document.getElementById('step1');
	    target.style.display = 'none';

	    target = document.getElementById('step2');
	    target.style.display = 'block';

	    target = document.getElementById('step3');
	    target.style.display = 'none';
	  } else {
	    alert(entryError);
	  }

	} else if (step == 'goStep3') {
	  target = document.getElementById('step2');
	  target.style.display = 'none';

	  target = document.getElementById('step3');
	  target.style.display = 'block';

	  target = document.getElementById('step4');
	  target.style.display = 'none';

	} else if (step == 'goStep4') {

	  if (!document.getElementById('accountPassword1').value) {
	    entryError = 'Please enter a Password...';
	  } else if (document.getElementById('accountPassword1').value != document.getElementById('accountPassword2').value) {
	    entryError = 'Please be sure to enter the same password in both boxes before continuing...';
	  } else if (document.getElementById('accountPassword1').value.length < 4) {
	    entryError = 'Please choose a password with 4 or more characters before continuing...';
	  } else if (document.getElementById('accountPassword1').value.length > 10) {
	    entryError = 'Please choose a password with 10 or fewer characters before continuing...';
	  } else {
	    entryError = 'ok';
	  }

	  if (entryError == 'ok') {

	    dataToSend = "?bussName="+escape(document.getElementById('businessName').value);
	    dataToSend += "&contact1="+escape(document.getElementById('contactName').value);
	    dataToSend += "&phone1="+escape(document.getElementById('primaryPhone').value);
	    dataToSend += "&email1="+escape(document.getElementById('primaryEmail').value);
	    dataToSend += "&web="+escape(document.getElementById('webAddress').value);
	    dataToSend += "&cat="+escape(document.getElementById('businessCategory').value);
	    dataToSend += "&ref="+escape(document.getElementById('referralCode').value);
	    dataToSend += "&pass1="+escape(document.getElementById('accountPassword1').value);
	    dataToSend += "&step=A";

	    ajaxResponse = makeRequest('_Lib/admin/addBusiness.php', dataToSend);
	    //alert('Your information has been added to the database. Please note your Business Partner ID is'+ajaxResponse);

	    p = document.getElementById('insertNewIDhere');
	    text = document.createTextNode('Your Business Partner ID is: ');
	    p.appendChild(text);
	    strong = document.createElement('strong');
	    text = document.createTextNode(ajaxResponse);
	    strong.appendChild(text);
	    p.appendChild(strong);

	    input = document.getElementById('businessName2');
	    input.value = document.getElementById('businessName').value;

	    input = document.getElementById('phone2');
	    input.value = document.getElementById('primaryPhone').value;

	    input = document.getElementById('contact2');
	    input.value = document.getElementById('contactName').value;

	    input = document.getElementById('email2');
	    input.value = document.getElementById('primaryEmail').value;

	    input = document.getElementById('bpID');
	    input.value = ajaxResponse;

	    target = document.getElementById('step3');
	    target.style.display = 'none';

	    target = document.getElementById('step4');
	    target.style.display = 'block';
          } else {
            alert(entryError);
          }

	} else if (step == 'goStep5') {

	  target = document.getElementById('step4');
	  target.style.display = 'none';

	  target = document.getElementById('step5');
	  target.style.display = 'block';

	} else if (step == 'goStep6') {

	  dataToSend = "?address1="+escape(document.getElementById('address1').value);
	  dataToSend += "&address2="+escape(document.getElementById('address2').value);
	  dataToSend += "&city="+escape(document.getElementById('city').value);
	  dataToSend += "&state="+escape(document.getElementById('state').value);
	  dataToSend += "&zip="+escape(document.getElementById('zip').value);
	  dataToSend += "&phone2="+escape(document.getElementById('phone2').value);
	  dataToSend += "&fax="+escape(document.getElementById('fax').value);
	  dataToSend += "&tty="+escape(document.getElementById('tty').value);
	  dataToSend += "&contact2="+escape(document.getElementById('contact2').value);
	  dataToSend += "&email2="+escape(document.getElementById('email2').value);
	  dataToSend += "&step=B";
	  dataToSend += "&bpID="+document.getElementById('bpID').value;

	  ajaxResponse = makeRequest('_Lib/admin/addBusiness.php', dataToSend);

	  if (ajaxResponse == 'OK') {

	    target = document.getElementById('step5');
	    target.style.display = 'none';

	    target = document.getElementById('step6');
	    target.style.display = 'block';

	  } else {
	    alert('This script encountered a problem while accessing the database');
	  }

	} else if (step == 'goStep7') {

	  dataToSend = "?aboutUs="+escape(document.getElementById('aboutUs').value);
	  dataToSend += "&step=C";
	  dataToSend += "&bpID="+document.getElementById('bpID').value;

	  ajaxResponse = makeRequest('_Lib/admin/addBusiness.php', dataToSend);

	  if (ajaxResponse == 'OK') {

	    target = document.getElementById('step6');
	    target.style.display = 'none';

	    target = document.getElementById('step7');
	    target.style.display = 'block';

	  } else {
	    alert('This script encountered a problem while accessing the database');
	  }

	} else if (step == 'goStep8') {

	  dataToSend = "?productsServices="+escape(document.getElementById('productsServices').value);
	  dataToSend += "&step=D";
	  dataToSend += "&bpID="+document.getElementById('bpID').value;

	  ajaxResponse = makeRequest('_Lib/admin/addBusiness.php', dataToSend);

	  if (ajaxResponse == 'OK') {

	    target = document.getElementById('step7');
	    target.style.display = 'none';

	    target = document.getElementById('step8');
	    target.style.display = 'block';

	  } else {
	    alert('This script encountered a problem while accessing the database');
	  }

	} else if (step == 'goStep9') {

	  dataToSend = "?directions="+escape(document.getElementById('directions').value);
	  dataToSend += "&mapLink="+escape(document.getElementById('mapLink').value);
	  dataToSend += "&step=E";
	  dataToSend += "&bpID="+document.getElementById('bpID').value;

	  ajaxResponse = makeRequest('_Lib/admin/addBusiness.php', dataToSend);

	  if (ajaxResponse == 'OK') {

	    target = document.getElementById('step8');
	    target.style.display = 'none';

	    target = document.getElementById('step9');
	    target.style.display = 'block';

	  } else {
	    alert('This script encountered a problem while accessing the database');
	  }

	} else if (step == 'goStep10') {

	  dataToSend = "?monOpen="+escape(document.getElementById('monOpen').value);
	  dataToSend += "&monClose="+escape(document.getElementById('monClose').value);
	  dataToSend += "&tueOpen="+escape(document.getElementById('tueOpen').value);
	  dataToSend += "&tueClose="+escape(document.getElementById('tueClose').value);
	  dataToSend += "&wedOpen="+escape(document.getElementById('wedOpen').value);
	  dataToSend += "&wedClose="+escape(document.getElementById('wedClose').value);
	  dataToSend += "&thuOpen="+escape(document.getElementById('thuOpen').value);
	  dataToSend += "&thuClose="+escape(document.getElementById('thuClose').value);
	  dataToSend += "&friOpen="+escape(document.getElementById('friOpen').value);
	  dataToSend += "&friClose="+escape(document.getElementById('friClose').value);
	  dataToSend += "&satOpen="+escape(document.getElementById('satOpen').value);
	  dataToSend += "&satClose="+escape(document.getElementById('satClose').value);
	  dataToSend += "&sunOpen="+escape(document.getElementById('sunOpen').value);
	  dataToSend += "&sunClose="+escape(document.getElementById('sunClose').value);
	  dataToSend += "&hoursVary="+escape(document.getElementById('hoursVary').value);
	  dataToSend += "&step=F";
	  dataToSend += "&bpID="+document.getElementById('bpID').value;

	  ajaxResponse = makeRequest('_Lib/admin/addBusiness.php', dataToSend);

	  if (ajaxResponse == 'OK') {

	    target = document.getElementById('step9');
	    target.style.display = 'none';

	    target = document.getElementById('step10');
	    target.style.display = 'block';

	  } else {
	    alert('This script encountered a problem while accessing the database');
	  }

	} else if (step == 'goStep11') {

	  if (document.getElementById('wheelYes').checked == true) {
	    wheelValue = document.getElementById('wheelYes').value;
	  } else {
	    wheelValue = document.getElementById('wheelNo').value;
	  }
	  dataToSend = "?wheelchairAccess="+wheelValue;

	  if (document.getElementById('ttyYes').checked == true) {
	    ttyValue = document.getElementById('ttyYes').value;
	  } else {
	    ttyValue = document.getElementById('ttyNo').value;
	  }
	  dataToSend += "&ttyAccess="+ttyValue;

	  if (document.getElementById('aslYes').checked == true) {
	    aslValue = document.getElementById('aslYes').value;
	  } else {
	    aslValue = document.getElementById('aslNo').value;
	  }
	  dataToSend += "&aslKnowledge="+aslValue;

	  if (document.getElementById('parkingYes').checked == true) {
	    parkingValue = document.getElementById('parkingYes').value;
	  } else {
	    parkingValue = document.getElementById('parkingNo').value;
	  }
	  dataToSend += "&parkingAvailable="+parkingValue;

	  if (document.getElementById('relayYes').checked == true) {
	    relayValue = document.getElementById('relayYes').value;
	  } else {
	    relayValue = document.getElementById('relayNo').value;
	  }
	  dataToSend += "&acceptRelay="+relayValue;
	  dataToSend += "&step=G";
	  dataToSend += "&bpID="+document.getElementById('bpID').value;

	  ajaxResponse = makeRequest('_Lib/admin/addBusiness.php', dataToSend);
	  if (ajaxResponse == 'OK') {

	    target = document.getElementById('step10');
	    target.style.display = 'none';

	    target = document.getElementById('step11');
	    target.style.display = 'block';

	  } else {
	    alert('This script encountered a problem while accessing the database');
	  }
	}

   }


// BPP TESTIMONIALS

   function showAllTestimonials() {

     targetDiv = document.getElementById('bppTestimonials');

     for (x = 0; x < targetDiv.childNodes.length; x++) {
       targetDiv.childNodes[x].style.display = 'block';
     }

     targetDiv.lastChild.style.display = 'none';

   }
