
  function writeFinalResults() {
  
    var finalOutput='<h2>Booking Information</h2>';
    if(document.getElementById('rdoNewBook').checked==true) {
      finalOutput+='New Booking';
    } else if(document.getElementById('rdoModifyBook').checked==true) {
      finalOutput+='Modify Existing Booking, Confirmation No: ' +  document.getElementById('txtModifyConfirm').value;
    } else if(document.getElementById('rdoCancelBook').checked==true) {
      finalOutput+='Cancel Existing Booking, Confirmation No: ' +  document.getElementById('txtCancelConfirm').value;
    }
    finalOutput+='<h2>Conference Requestor</h2>';
    finalOutput+='Your name: ' +  document.getElementById('txtYourName').value + '<br />';
    finalOutput+='Company: ' +  document.getElementById('txtCompany').value + '<br />';
    finalOutput+='Phone: ' +  document.getElementById('txtPhoneNumber').value + ', Ext:' +  document.getElementById('txtPhoneExt').value + '<br />';
    finalOutput+='Fax: ' +  document.getElementById('txtFaxNumber').value + '<br />';
    finalOutput+='Email: ' +  document.getElementById('txtEmail').value + '<br />';
    if(document.getElementById('rdoCancelBook').checked==false) {
    
      finalOutput+='<h2>Billing Information</h2>';
      finalOutput+='Attention To: ' +  document.getElementById('txtAttention').value + '<br />';
      finalOutput+='Department: ' +  document.getElementById('txtDept').value + '<br />';
      finalOutput+='Address: <br /><div style="padding-left:20px">' +  document.getElementById('txtBillAddress').value.replace(/\n/g,'<br />') + '</div><br />';
      
      finalOutput+='<h2>Conference Information</h2>';
      finalOutput+='Title: ' + document.getElementById('txtTitle').value + '<br />';
      finalOutput+='Cost Center: ' + document.getElementById('txtCostCtr').value + '<br />';
      finalOutput+='Date: ' + document.getElementById('txtDate').value + '<br />';
      finalOutput+='Set Up Time: ' + document.getElementById('txtSetupTime').value + '<br />';
      finalOutput+='Conference Time: ' + document.getElementById('cboStartHour').options[document.getElementById('cboStartHour').selectedIndex].value + ':' + document.getElementById('cboStartMin').options[document.getElementById('cboStartMin').selectedIndex].value + ' ' + document.getElementById('cboStartAP').options[document.getElementById('cboStartAP').selectedIndex].value + '-' + document.getElementById('cboEndHour').options[document.getElementById('cboEndHour').selectedIndex].value + ':' + document.getElementById('cboEndMin').options[document.getElementById('cboEndMin').selectedIndex].value + ' ' + document.getElementById('cboEndAP').options[document.getElementById('cboEndAP').selectedIndex].value + '<br />';
      finalOutput+='Time Zone: ' + document.getElementById('cboTimeZone').options[document.getElementById('cboTimeZone').selectedIndex].value + '<br />';
      
      finalOutput+='<h2>Conference Configuration</h2>Transmission Speed: ' +  document.getElementById('cboSpeed').value + '<br />';
      
      finalOutput+='Features: <br /><div style="padding-left:20px">';
      if(document.getElementById('chkCallLaunch').checked==true)  {
        finalOutput+='Call Launch (CL)<br />';
      }
      
      if(document.getElementById('rdoQuad').checked==true)  {
        finalOutput+='Quad Screen (CP)<br />';
      } else if(document.getElementById('rdoSplit').checked==true)  {
        finalOutput+='Split Screen (CP)<br />';
      } else if(document.getElementById('rdoLecture').checked==true)  {
        finalOutput+='Lecture Mode (CP)<br />';
      } else if(document.getElementById('rdo9Way').checked==true) {
      	finalOutput+='9-Way<br />';
      }
      finalOutput+='</div><br />';
     
      
      
      finalOutput+='<h2>Conference Configuration - Additional Services</h2>';
      
      if(document.getElementById('chkMeetGreet').checked==true)  {
        finalOutput+='Meet &amp; Greet<br />';
      }
      if(document.getElementById('chkLiveAssist').checked==true)  {
        finalOutput+='Live Assist<br />';
      }
      if(document.getElementById('chkMtgMonitor').checked==true)  {
        finalOutput+='Meeting Monitor<br />';
      }
      finalOutput+='Recording services? ';
      if(document.getElementById('chkRecSvcs').checked==true) {
        finalOutput+='Yes <br />DVD Copies: ' + document.getElementById('txtDVDNoCopies').value + '<br />';
      } else {
        finalOutput+='No<br />';
      }
      
      finalOutput+='Audio Port Required? '; 
      if(document.getElementById('rdoAudioPortYes').checked==true) {
        finalOutput+='Yes<br />Domestic participants: ' + document.getElementById('txtDomParticipants').value + '<br />International participants: ' +  document.getElementById('txtIntParticipants').value + '<br />Moderator&#8217;s name: ' +  document.getElementById('txtModerator').value + '<br />';
      } else if(document.getElementById('rdoAudioPortNo').checked==true) {
        finalOutput+='No';
      }
      
      finalOutput+='<h2>Host Site Information</h2>';
	  finalOutput+='Site Name: ' +  document.getElementById('txtSiteName').value + '<br />';
	  finalOutput+='Participant/Site Contact: '  + document.getElementById('txtSiteContact').value + '<br />';
	  finalOutput+='Phone: ' +  document.getElementById('txtSitePhone').value + ', Ext: ' + document.getElementById('txtSitePhoneExt').value + '<br />';
	  if(document.getElementById('chkCallLaunch').checked==true) {
	 	finalOutput+='Video#/ISDN#: ' + document.getElementById('txtSiteEndPoint').value + '<br />';
     } 
      finalOutput+='<h2>Sites Information - Guest Sites</h2>';
      for(var tmploop=0;document.getElementById('cboGuests').options.length>tmploop;tmploop++) {
        finalOutput+=document.getElementById('cboGuests').options[tmploop].value + '<br /><br />';
      }
      
      finalOutput+='<h2>Special Requests</h2>';
      if(document.getElementById('txtSpecial').value!='') {
        finalOutput+=document.getElementById('txtSpecial').value;
      } else {
        finalOutput+='None';
      }
      
      
    }
    document.getElementById('step10inside').innerHTML=finalOutput;
    
  }
  
  function addGuestVideoSite() {
    var tmpSite='';
    var tmpSiteV='';
    tmpSite+='Guest company name: ' + document.getElementById('txtGuestName').value + ' / ';
    tmpSite+='Contact name: ' + document.getElementById('txtGuestContact').value + ' / ';
    tmpSite+='Contact phone: ' + document.getElementById('txtGuestPhone').value + ', Ext:' + document.getElementById('txtGuestPhoneExt').value;
      
    tmpSiteV+='Guest company name: ' + document.getElementById('txtGuestName').value + '<br />';
    tmpSiteV+='Contact name: ' + document.getElementById('txtGuestContact').value + '<br />';
    tmpSiteV+='Contact phone: ' + document.getElementById('txtGuestPhone').value + ', Ext:' + document.getElementById('txtGuestPhoneExt').value + '<br />';
    tmpSiteV+='Video room phone: ' + document.getElementById('txtGuestVideoPhone').value + ', Ext:' + document.getElementById('txtGuestVideoPhoneExt').value;
      if(document.getElementById('chkCallLaunch').checked==true) {
        tmpSiteV+='<br />Video#/ISDN#: ' +  document.getElementById('txtGuestEndPoint').value + '';
      }
      
      tmpSiteV+='<br />';
      var tmpSiteOption=document.createElement("OPTION");
      tmpSiteOption.value=tmpSiteV;
      tmpSiteOption.text=tmpSite;
      document.getElementById('cboGuests').options.add(tmpSiteOption);
    
  }
  function removeVideoSite() {
    document.getElementById('cboVideoSites').options[document.getElementById('cboVideoSites').selectedIndex]=null;
  }
  function removeGuestVideoSite() {
    document.getElementById('cboGuests').options[document.getElementById('cboGuests').selectedIndex]=null;
  }
  function toggleAudioPortPanel() {
    if(document.getElementById('rdoAudioPortNo').checked==true) {
      document.getElementById('dvAudioPortPanel1').style.display='none';
    } else if(document.getElementById('rdoAudioPortYes').checked==true) {
      document.getElementById('dvAudioPortPanel1').style.display='';
    } else {
      document.getElementById('dvAudioPortPanel1').style.display='none';
    }
  }
  function toggleDVDPanel() {
  	if(document.getElementById('chkRecSvcs').checked==true) {
  		document.getElementById('pnlDVDdetails').style.display='';
  	} else {
  		document.getElementById('pnlDVDdetails').style.display='none';
  	}
  }
  function toggleNextBack(flowDirection,currentPanel,nextPanel) {

    if(flowDirection=='forward') {
      if(currentPanel=='step1' && nextPanel=='step2') {
      	nextPanel=fwdPanel1To2();
      }
      if(currentPanel=='step3' && nextPanel=='step4') {
      	nextPanel=fwdPanel3To4();
      }
      if(currentPanel=='step4' && nextPanel=='step5') {
      	nextPanel=fwdPanel4To5();
      }
      if(currentPanel=='step5' && nextPanel=='step6') {
      	fwdPanel5To6();
      }
      if(currentPanel=='step6' && nextPanel=='step7') {
        nextPanel=fwdPanel6To7();
        
      }
      if(currentPanel=='step7' && nextPanel=='step8') {
        nextPanel=fwdPanel7To8();
        
      }
      if(currentPanel=='step2' && nextPanel=='step3') {
        nextPanel=fwdPanel2To3();
      }
      if(currentPanel=='step8' && nextPanel=='step9') {
      	nextPanel=fwdPanel8To9();
      }
      if(nextPanel=='step10') {
        writeFinalResults();
      }
      
    } else if(flowDirection=='backward') {
      if(currentPanel=='step9' && nextPanel=='step8') {
        nextPanel=bckPanel9To8();
      }
      if(currentPanel=='step10' && nextPanel=='step9') {
        nextPanel=bckPanel10To9();
      }
    }
      if(nextPanel!='error') {
	      document.getElementById(currentPanel).style.display='none';
	      document.getElementById(nextPanel).style.display='none';
	      document.getElementById(currentPanel).style.display='none';
	      document.getElementById(nextPanel).style.display='';
      }
  
  }
    function bckPanel10To9() {
        if(document.getElementById('rdoCancelBook').checked==true) {
            return 'step2';
        } else {
            return 'step9';
        }   
    }
  function bodySetup() {
    document.getElementById('btnSubmit').disabled=false;
    initiatePanels();
    toggleAudioPortPanel();
    toggleDVDPanel();
  }
  function bckPanel9To8() {
	return 'step8';
  }
  function fwdPanel5To6() {
  	if(document.getElementById('chkCallLaunch').checked==true) {
  		document.getElementById('trVideoSiteInformation4').style.display='none';
  		document.getElementById('trGuestInformation5').style.display='none';
  	} else {
  		document.getElementById('trVideoSiteInformation4').style.display='';
  		document.getElementById('trGuestInformation5').style.display='';
  		
  	}
  }
  function fwdPanel6To7() {
  	var strError='The following fields are required on this form:\r\n';
  	if(document.getElementById('chkRecSvcs').checked==true) {
  		strError+='Number of DVD copies\r\nMailing address for DVD\'s\r\n';
  	}
  	if(document.getElementById('rdoAudioPortYes').checked==true) {
  		strError+='Domestic audio ports\r\nInternational audio ports\r\n';
  	}
  	if((document.getElementById('chkRecSvcs').checked==true && (document.getElementById('txtDVDNoCopies').value=='' || document.getElementById('txtDVDAddress').value=='')) || (document.getElementById('rdoAudioPortYes').checked==true && (document.getElementById('txtDomParticipants').value=='' || document.getElementById('txtIntParticipants').value==''))) {
  		alert(strError);
  		return 'error';
  	}
  	
    if(document.getElementById('chkCallLaunch').checked==true) {
      document.getElementById('trVideoSiteInformation4').style.display='';
    } else {
      document.getElementById('trVideoSiteInformation4').style.display='none';
    }
    return 'step7';
  }
  function fwdPanel1To2() {
  	var strError='The following fields are required for this form:\r\n';
  	strError+='Confirmation number\r\n';
  	strError+='Please correct these fields and click \'Next\' to continue.';
  	
  	if((document.getElementById('rdoModifyBook').checked==true && document.getElementById('txtModifyConfirm').value=='') || (document.getElementById('rdoCancelBook').checked==true && document.getElementById('txtCancelConfirm').value=='')) {
  		alert(strError);
  		return 'error';
  	} else {
		// JR adding code to note that they have entered data and should be warned when leaving form
		catchleaving=true;
		
  		return 'step2';
  	}
  }
  function fwdPanel3To4() {
  	var strError='The following fields are required for this form:\r\nAttention To\r\nDepartment\r\nAddress\r\nPlease correct these fields and click \'Next\' to continue.';
  	if(document.getElementById('txtAttention').value=='' ||  document.getElementById('txtDept').value=='' || document.getElementById('txtBillAddress').value=='') {
  		alert(strError);
  		return 'error';
  	}
  	return 'step4';
  }
  function fwdPanel4To5() {
  	var strError='The following fields are required for this form:\r\nTitle\r\nDate\r\nSet Up Time\r\nPlease correct these fields and click \'Next\' to continue.';
  	if(document.getElementById('txtTitle').value=='' || document.getElementById('txtDate').value=='' || document.getElementById('txtSetupTime').value=='') {
  		alert(strError);
  		return 'error';
  	} else {
  		return 'step5';
  	}
  }
  function fwdPanel7To8() {
  var strError='The following fields are required for this form:\r\nSite Name\r\nParticipant/Site Contact\r\nPhone Number\r\n';
  if(document.getElementById('chkCallLaunch').checked==true) {
  	strError+='Video#/ISDN #\r\n';
  }
  strError+='Please correct these fields and click \'Next\' to continue';
  if(document.getElementById('txtSiteName').value=='' || document.getElementById('txtSiteContact').value=='' || document.getElementById('txtSitePhone').value=='' || (document.getElementById('chkCallLaunch').checked==true && document.getElementById('txtSiteEndPoint').value=='')) {
  	alert(strError);
  	return 'error';
  }
    if(document.getElementById('chkCallLaunch').checked==true) {
      document.getElementById('trGuestInformation5').style.display='';
    } else {
      document.getElementById('trGuestInformation5').style.display='none';
    }
    return 'step8';

  }
  function fwdPanel8To9() {
  var strError='The following fields are required for this form:\r\nYou must add at least 1 guest site\r\nPlease correct these fields and click \'Next\' to continue';
  	
  	if(document.getElementById('cboGuests').options.length==0) {
  		alert(strError);
  		return 'error';
  	} else {
  		return 'step9';
  	}
  }
  function fwdPanel9To10() {
    writeFinalResults();
  }
	  function verifyEmails(control) {
    var tmpemails=trim(document.getElementById(control).value).split('\r\n');
    var emailregex=new RegExp('^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$');
    for(var tmpemail in tmpemails) {
      if(emailregex.test(tmpemails[tmpemail])==false) {
        return false;
      }
    }
    return true;

  }
  function fwdPanel2To3() {
  	var strError='The following fields are required for this form:\r\nYour name\r\nCompany\r\nPhone\r\nEmail\r\nPlease correct these fields and click \'Next\' to continue.';
  	var checkEmail=verifyEmails('txtEmail');
  	if(document.getElementById('txtYourName').value=='' || document.getElementById('txtCompany').value=='' || document.getElementById('txtPhoneNumber').value=='' || document.getElementById('txtEmail').value=='' || checkEmail==false) {
  		alert(strError);
  		return 'error';
  	}
    if(document.getElementById('rdoCancelBook').checked==true) {
      return 'step10';
    } else {
      return 'step3';
    }
  }
  function initiatePanels() {
    var panelsAr=new Array("step1","step2","step3","step4","step5","step6","step7","step8","step9","step10","step11");
    for(singlePanel in panelsAr) {
      document.getElementById(panelsAr[singlePanel]).style.display='none';
    }
    document.getElementById('step1').style.display='';
  }
