<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>CFMX 7 CFForms Flash</title>
	<meta http-equiv="Cache-Control" content="no-Cache">
	<meta http-equiv="Pragma" content="no-Cache">
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<style>
	<!--
	.cursorhand {cursor: pointer; cursor: hand;}
	.cursordefault {cursor: default}
	-->
	</style>
</head>
<table width="950" border="0">
  <tr>
    <td align="left"><img src="../mmug/images/poweredbycfmx7.gif"></td>
  </tr>
</table>
<body>
<!--- MSG 6-2-2006 believe it or not, the code in lines 22 - 29, 65 - 73, and 443 - 444 is a way to disable all the tabs except the first one  --->
<cfset startIdx = 1>
<cfsavecontent variable="onLoad">
	if(tabsInit.text != 0) {
		 initTabs();
	}
</cfsavecontent>

<cfsavecontent variable="disableTabs">{(tabsInit.text != '')?tabsInit.dispatchEvent({type:'change'}):''}</cfsavecontent>

<cfform format="flash" onload="formOnLoad();" name="myform">
   <cfformitem type="script">
	function formOnLoad() {
		// Do anything that you need to do in the onload Event          
		// call the function that is in charge of applying the styles 
		applyStyles();
	}
	
	function applyStyles() {
		_global.styles.CheckBox.setStyle("fillColors", [0x006699, 0xffffff]);
		_global.styles.RadioButton.setStyle("fillColors", [0x006699, 0xffffff]);
		_global.styles.Form.setStyle("color", 0x000000);
		_global.styles.Button.setStyle("borderThickness", 1);
		_global.styles.Page.setStyle("backgroundColor", 0xE5F0F9);
		_global.styles.Page.setStyle("color", 0xffffff);
		_global.styles.Page.setStyle("headerColors", [0x277DC6,0x50ABF7]);
		_global.styles.HBox.setStyle("backgroundColor", 0x006699);
		_global.styles.HBox.setStyle("marginTop", 10);
		_global.styles.HBox.setStyle("marginBottom", 10);
		_global.styles.HBox.setStyle("marginLeft", 10);
		_global.styles.Accordion.setStyle("fillColors", [0x277DC6,0x50ABF7]);
		_global.styles.Accordion.setStyle("selectedFillColors", [0xff6600,0xffcc00]);
		_global.styles.Accordion.setStyle("themeColor", 0x0066cc);
		_global.styles.Accordion.setStyle("color", 0x0ffffff);
		_global.styles.TextArea.setStyle("fontSize",14);
		_global.styles.TextInput.setStyle("fontSize",9);
		//set the font color and button labels of all alerts
		_global.styles.Alert.setStyle("color", 0x0066CC);
		_global.styles.Alert.setStyle("themeColor", "#F79401");
		mx.controls.Alert.buttonWidth = 100;
		//set the style of the title only with a named style declaration
		mx.controls.Alert.titleStyleDeclaration = "windowStyles";
	}

	function initTabs() {
		tbnFP["tabBar"]._tab1.enabled=false;
		tbnFP["tabBar"]._tab2.enabled=false;
		tbnFP["tabBar"]._tab3.enabled=false;
		tbnFP["tabBar"]._tab4.enabled=false;
		tbnFP["tabBar"]._tab5.enabled=false;
		tbnFP["tabBar"]._tab6.enabled=false;
		tbnFP["tabBar"]._tab7.enabled=false;
		cbxRequired();
	}
	
	var myClickHandler = function (evt) {
        if (evt.detail == mx.controls.Alert.OK) {		
        	//done
        }
	}

	function moveTab(iBtn) {
		switch (iBtn) {
			case 0:
				tbnFP.selectedIndex = 0;
				break;
			case 1:
				readyToContinue(1);
				break;
			case 2:
				readyToContinue(2);
				break;
			case 3:
				readyToContinue(3);
				break;
			case 4:
				readyToContinue(4);
				break;
			case 5:
				readyToContinue(5);
				break;
			case 6:
				readyToContinue(6);
				break;
			case 7:
				readyToContinue(7);
				break;
			case 8:
				readyToContinue(8);				
				break;
		}
	}
	
	function readyToContinue(iTab) {
		var msg = "";
		//create the alert
		var myAlert = "";
		//change the size
		//myAlert.width = 280;
		//myAlert.height = 280;
		//change this alert's style only
		myAlert.setStyle("fontStyle", "italic");
		myAlert.setStyle("panelBorderStyle","default");
		myAlert.setStyle("cornerRadius","0");
		switch (iTab) {
			case 1:
				if (mx.validators.Validator.isStructureValid(this, 'myform')) {
					tbnFP.selectedIndex = 1;
					tbnFP.dispatchEvent({type:'change'});
				} else {
					if (FirstName.text=="") {
						msg = msg + FirstName.errorString + '\n\n';
					}
					if (LastName.text=="") {
						msg = msg + LastName.errorString + '\n\n';
					}
					if (!cbxTest.selected && !cbxTest2.selected) {
						msg = msg + 'Please check whether you like poptarts and/or pizza for breakfast' + '\n\n';
					}
					if (msg!="") {
						mx.controls.Alert.show(msg, "Alert! Required Field(s) Missing", mx.controls.Alert.OK, this, myClickHandler);
						tbnFP.selectedIndex = 0;
						tbnFP.dispatchEvent({type:'change'});
					} else {
						tbnFP["tabBar"]._tab1.enabled=true;
						tbnFP.selectedIndex = 1;
						tbnFP.dispatchEvent({type:'change'});
					}
				}
				break;
			case 2:
				if (mx.validators.Validator.isStructureValid(this, 'myform')) {
					tbnFP.selectedIndex = 2;
					tbnFP.dispatchEvent({type:'change'});
				} else {
					if (WrittenAgree.selectedData==undefined) {
						msg = msg + "You must answer the question - Do you have a written rental agreement?" + '\n\n';
					}
					if (msg!="") {
						mx.controls.Alert.show(msg, "Alert! Required Field(s) Missing", mx.controls.Alert.OK, this, myClickHandler);
						tbnFP.selectedIndex = 1;
						tbnFP.dispatchEvent({type:'change'});
					} else {
						tbnFP["tabBar"]._tab2.enabled=true;
						tbnFP.selectedIndex = 2;
						tbnFP.dispatchEvent({type:'change'});
					}
				}
				break;
			case 3:
				if (mx.validators.Validator.isStructureValid(this, 'myform')) {
					tbnFP.selectedIndex = 3;
					tbnFP.dispatchEvent({type:'change'});
				} else {
					if (TrainProg.selectedData==undefined) {
						msg = msg + "You must answer the question - Do you have written Employee Training procedures?" + '\n\n';
					}
					if (TrainProg.selectedData==1 && TrainProgDesc.text=="") {
						msg = msg + "Please describe the Employee Training procedures" + '\n\n';
					}
					if (msg!="") {
						mx.controls.Alert.show(msg, "Alert! Required Field(s) Missing", mx.controls.Alert.OK, this, myClickHandler);
						tbnFP.selectedIndex = 2;
						tbnFP.dispatchEvent({type:'change'});
					} else {
						tbnFP["tabBar"]._tab3.enabled=true;
						tbnFP.selectedIndex = 3;
						tbnFP.dispatchEvent({type:'change'});
					}
				}
				break;
			case 4:
				if (mx.validators.Validator.isStructureValid(this, 'myform')) {
					tbnFP.selectedIndex = 4;
					tbnFP.dispatchEvent({type:'change'});
				} else {
					if (Equip.selectedData==undefined) {
						msg = msg + "You must answer the question - Do you have Equipment?" + '\n\n';
					}
					if (Equip.selectedData==1 && EquipDesc.text=="") {
						msg = msg + "Please list the equipment" + '\n\n';
					}
					if (msg!="") {
						mx.controls.Alert.show(msg, "Alert! Required Field(s) Missing", mx.controls.Alert.OK, this, myClickHandler);
						tbnFP.selectedIndex = 3;
						tbnFP.dispatchEvent({type:'change'});
					} else {
						tbnFP["tabBar"]._tab4.enabled=true;
						tbnFP.selectedIndex = 4;
						tbnFP.dispatchEvent({type:'change'});
					}
				}
				break;
			case 5:
				if (mx.validators.Validator.isStructureValid(this, 'myform')) {
					tbnFP.selectedIndex = 5;
					tbnFP.dispatchEvent({type:'change'});
				} else {
					if (SubCon.selectedData==undefined) {
						msg = msg + "You must answer the question - Do you subcontract any work?" + '\n\n';
					}
					if (SubCon.selectedData==1 && SubConDesc.text=="") {
						msg = msg + "You must answer the question - What do you subcontract?" + '\n\n';
					}
					if (msg!="") {
						mx.controls.Alert.show(msg, "Alert! Required Field(s) Missing", mx.controls.Alert.OK, this, myClickHandler);
						tbnFP.selectedIndex = 4;
						tbnFP.dispatchEvent({type:'change'});
					} else {
						tbnFP["tabBar"]._tab5.enabled=true;
						tbnFP.selectedIndex = 5;
						tbnFP.dispatchEvent({type:'change'});
					}
				}
				break;
			case 6:
				if (mx.validators.Validator.isStructureValid(this, 'myform')) {
					tbnFP.selectedIndex = 6;
					tbnFP.dispatchEvent({type:'change'});
				} else {
					if (LossClaim.selectedData==undefined) {
						msg = msg + "You must answer the question - Have you had any claims/losses?" + '\n\n';
					}
					if (LossClaim.selectedData==1 && LossDate1.text=="") {
						msg = msg + "Please indicate the Loss Date" + '\n\n';
					}
					if (LossClaim.selectedData==1 && LossLine1.text=="") {
						msg = msg + "Please indicate the Line of Coverage" + '\n\n';
					}
					if (LossClaim.selectedData==1 && ClaimDate1.text=="") {
						msg = msg + "Please indicate the Date of Claim" + '\n\n';
					}
					if (LossClaim.selectedData==1 && ClaimAmt1.text=="") {
						msg = msg + "Please indicate the Amount of Claim" + '\n\n';
					}
					if (LossClaim.selectedData==1 && ClaimDesc1.text=="") {
						msg = msg + "Please indicate the Description of Occurence/Claim" + '\n\n';
					}
					if (msg!="") {
						mx.controls.Alert.show(msg, "Alert! Required Field(s) Missing", mx.controls.Alert.OK, this, myClickHandler);
						tbnFP.selectedIndex = 5;
						tbnFP.dispatchEvent({type:'change'});
					} else {
						tbnFP["tabBar"]._tab6.enabled=true;
						tbnFP.selectedIndex = 6;
						tbnFP.dispatchEvent({type:'change'});
					}
				}
				break;
			case 7:
				if (mx.validators.Validator.isStructureValid(this, 'myform')) {
					tbnFP.selectedIndex = 7;
					tbnFP.dispatchEvent({type:'change'});
				} else {
					if (ExpRad.selectedData==undefined) {
						msg = msg + "You must answer the question - Is there any exposure to radioactive/nuclear materials?" + '\n\n';
					}
					if (msg!="") {
						mx.controls.Alert.show(msg, "Alert! Required Field(s) Missing", mx.controls.Alert.OK, this, myClickHandler);
						tbnFP.selectedIndex = 6;
						tbnFP.dispatchEvent({type:'change'});
					} else {
						tbnFP["tabBar"]._tab7.enabled=true;
						tbnFP.selectedIndex = 7;
						tbnFP.dispatchEvent({type:'change'});
					}
				}
				break;
			case 8:
				if (mx.validators.Validator.isStructureValid(this, 'myform')) {
						mx.controls.Alert.show("Successful Validation!", "Congratulations", mx.controls.Alert.OK, this, myClickHandler);
				} else {
					if (EqpRent.selectedData==undefined) {
						msg = msg + "You must answer the question - Equipment Rental Operations including but not limited to contractors equipment, household equipment, and furniture rental operations?" + '\n\n';
					}
					if (msg!="") {
						mx.controls.Alert.show(msg, "Alert! Required Field(s) Missing", mx.controls.Alert.OK, this, myClickHandler);
						tbnFP.selectedIndex = 7;
						tbnFP.dispatchEvent({type:'change'});
					} else {
						mx.controls.Alert.show("Successful Validation!", "Congratulations", mx.controls.Alert.OK, this, myClickHandler);
					}
				}
				break;
		}
	}

	function clearClaimFields() {
		if (LossClaim.selectedData==0) {
			LossDate1.text = "";
			LossLine1.text = "";
			ClaimDate1.text = "";
			ClaimAmt1.text = "";
			ClaimDesc1.text = "";
		}
	}

	function cbxRequired() {
		if (!cbxTest.selected && !cbxTest2.selected) {
			this.fgpContactInfo.required = true;
		} else {
			this.fgpContactInfo.required = false;
		}
	}
		
	function toggleRequired(iTab) {
		switch (iTab) {
			case 2:
				if (TrainProg.selectedData==1) {
					this.fgpTrainProgDesc.required = true;
				} else {
					this.fgpTrainProgDesc.required = false;
				}
				break;
			case 3:
				if (Equip.selectedData==1) {
					this.fgpEquipDesc.required = true;
				} else {
					this.fgpEquipDesc.required = false;
				}
				break;
			case 4:
				if (SubCon.selectedData==1) {
					this.fgpSubConDesc.required = true;
				} else {
					this.fgpSubConDesc.required = false;
				}
				break;
			case 5:
				if (LossClaim.selectedData==1) {
					this.fgpLoss.required = true;
					this.fgpLossDesc.required = true;
				} else {
					this.fgpLoss.required = false;
					this.fgpLossDesc.required = false;
					clearClaimFields();
				}
				break;
		}
	}
	</cfformitem>
	<cfformgroup id="tbnFP" type="tabnavigator" label="Application" width="995">
		<!--- tab 0 --->
		<cfformgroup type="page" label="Contact Information">
			<cfformgroup type="horizontal" label="First Name">
				<cfinput type="text" name="FirstName" width="125" required="yes" message="Please provide your First Name">
				<cfinput type="text" name="LastName" width="175" label="Last Name" required="yes" message="Please provide your Last Name">
				<cfformgroup id="fgpContactInfo" type="horizontal" label="Breakfast Choice">
					<cfinput type="Checkbox" name="cbxTest" width="175" onclick="cbxRequired()" label="I like Poptarts" message="Please check this box if you like poptarts">
					<cfinput type="Checkbox" name="cbxTest2" width="175" onclick="cbxRequired()" label="I like Pizza" message="Please check this box if you like pizza">
				</cfformgroup>
			</cfformgroup>
            <cfinput type="Button" name="btn1" value="Continue" onclick="moveTab(1)"> 
		</cfformgroup>
		<!--- tab 1 --->
		<cfformgroup type="page" label="Business Nature">
			<cfformgroup type="horizontal" label="Do you have a written rental agreement?">
				<cfinput type="radio" name="WrittenAgree" label="Yes" value="1" required="Yes" message="You must answer the question - Do you have a written rental agreement?">
				<cfinput type="radio" name="WrittenAgree" label="No" value="0" required="Yes" message="You must answer the question - Do you have a written rental agreement?">
			</cfformgroup>
            <cfinput type="Button" name="btn2" value="Continue" onclick="moveTab(2)"> 
		</cfformgroup>
		<!--- tab 2 --->
		<cfformgroup type="page" label="Safety/Training">
			<cfformgroup type="horizontal" label="Do you have written Employee Training procedures?">
				<cfinput type="radio" name="TrainProg" onClick="{(TrainProg.selectedData == 1)?toggleRequired(2):null}" label="Yes" value="1" required="Yes" message="You must answer the question - Do you have written Employee Training procedures?">
				<cfinput type="radio" name="TrainProg" onClick="{(TrainProg.selectedData == 0)?toggleRequired(2):null}" label="No" value="0" required="Yes" message="You must answer the question - Do you have written Employee Training procedures?">
			</cfformgroup>
			<cfformgroup id="fgpTrainProgDesc" type="horizontal" label="Please describe the Employee Training procedures :" 
					visible="{(TrainProg.selectedData == 1)?true:false}" 
					height="{(TrainProg.selectedData == 1)?50:0}">
				<cftextarea name="TrainProgDesc" width="300"></cftextarea>
			</cfformgroup>	
            <cfinput type="Button" name="btn3" value="Continue" onclick="moveTab(3)"> 
		</cfformgroup>		
		<!--- tab 3 --->
		<cfformgroup type="page" label="Equipment List" style="verticalGap:4">
			<cfformgroup type="horizontal" label="Do you have Equipment?">
				<cfinput type="radio" name="Equip" onClick="{(Equip.selectedData == 1)?toggleRequired(3):null}" label="Yes" value="1" required="Yes" message="You must answer the question - Do you have Do you have Equipment?">
				<cfinput type="radio" name="Equip" onClick="{(Equip.selectedData == 0)?toggleRequired(3):null}" label="No" value="0" required="Yes" message="You must answer the question - Do you have Do you have Equipment?">
			</cfformgroup>
			<cfformgroup id="fgpEquipDesc" type="horizontal" label="Please List the Equipment :">
				<cftextarea name="EquipDesc" width="300"></cftextarea>
			</cfformgroup>	
            <cfinput type="Button" name="btn4" value="Continue" onclick="moveTab(4)"> 
        </cfformgroup>
		<!--- tab 4 --->
		<cfformgroup type="page" label="General Information">
			<cfformgroup type="horizontal" label="Do you subcontract any work?">
				<cfinput type="radio" name="SubCon" onClick="{(SubCon.selectedData == 1)?toggleRequired(4):null}" label="Yes" value="1" required="Yes" message="You must answer the question - Do you subcontract any work?">
				<cfinput type="radio" name="SubCon" onClick="{(SubCon.selectedData == 0)?toggleRequired(4):null}" label="No" value="0" required="Yes" message="You must answer the question - Do you subcontract any work?">
			</cfformgroup>
			<cfformgroup id="fgpSubConDesc" type="horizontal" label="What do you subcontract?"
				visible="{(SubCon.selectedData == 1)?true:false}" 
				height="{(SubCon.selectedData == 1)?22:0}">	
				<cfinput type="text" name="SubConDesc" width="150">
			</cfformgroup>
            <cfinput type="Button" name="btn5" value="Continue" onclick="moveTab(5)"> 
		</cfformgroup>		
		<!--- tab 5 --->
		<cfformgroup type="page" label="Loss History" width="990">
			<cfformgroup type="horizontal" label="Have you had any claims/losses?">
				<cfinput type="radio" name="LossClaim" onClick="{(LossClaim.selectedData == 1)?toggleRequired(5):null}" label="Yes" value="1" required="Yes" message="You must answer the question - Have you had any claims/losses?">
				<cfinput type="radio" name="LossClaim" onClick="{(LossClaim.selectedData == 0)?toggleRequired(5):null}" label="No" value="0" required="Yes" message="You must answer the question - Have you had any claims/losses?">
			</cfformgroup>
			<cfformgroup id="fgpLoss" type="horizontal" style="indicatorGap:2"
					visible="{(LossClaim.selectedData == 1)?true:false}" 
					height="{(LossClaim.selectedData == 1)?30:0}">
				<cfinput type="datefield" name="LossDate1" label="Date of Loss:" width="78" mask="MM/DD/YYYY" tooltip="(MM/DD/YYYY)">
				<cfinput type="text" name="LossLine1" label="Line of Coverage:" width="90">
				<cfinput type="datefield" name="ClaimDate1" label="Date of Claim:" width="78" mask="MM/DD/YYYY" tooltip="(MM/DD/YYYY)">
				<cfinput type="text" name="ClaimAmt1" label="Amount of Claim:" mask="9999999999" validate="numeric" message="Please enter a numeric Prior Premium value - whole dollars only" width="65">				
			</cfformgroup>
			<cfformgroup id="fgpLossDesc" type="horizontal" label="Description of Occurence/Claim :" 
					visible="{(LossClaim.selectedData == 1)?true:false}" 
					height="{(LossClaim.selectedData == 1)?50:0}">
				<cftextarea name="ClaimDesc1" width="350" ></cftextarea>
			</cfformgroup>	
            <cfinput type="Button" name="btn6" value="Continue" onclick="moveTab(6)"> 
		</cfformgroup>		
		<!--- tab 6 --->
		<cfformgroup type="page" label="Operations">
			<cfformgroup type="horizontal" label="Is there any exposure to radioactive/nuclear materials?">
				<cfinput type="radio" name="ExpRad" label="Yes" value="1" required="Yes" message="You must answer the question - Is there any exposure to radioactive/nuclear materials?">
				<cfinput type="radio" name="ExpRad" label="No" value="0" required="Yes" message="You must answer the question - Is there any exposure to radioactive/nuclear materials?">
			</cfformgroup>		
            <cfinput type="Button" name="btn7" value="Continue" onclick="moveTab(7)"> 
		</cfformgroup>
		<!--- tab 7 --->
		<cfformgroup type="page" label="Other Activities">
            <cfformitem type="html" width="790" height="18"><b>Is Your Operation Involved in any of the following activities?</b></cfformitem>
			<cfformgroup type="horizontal" label="Equipment Rental Operations including but not limited to contractors equipment, household equipment, and furniture rental operations?">
				<cfinput type="radio" name="EqpRent" label="Yes" value="1" required="Yes" message="You must answer the question - Equipment Rental Operations including but not limited to contractors equipment, household equipment, and furniture rental operations?">
				<cfinput type="radio" name="EqpRent" label="No" value="0" required="Yes" message="You must answer the question - Equipment Rental Operations including but not limited to contractors equipment, household equipment, and furniture rental operations?">
			</cfformgroup>        								
			<cfinput type="Button" name="btn8" value="Continue" onclick="moveTab(8)">			
		</cfformgroup>
		
	</cfformgroup>
	<cfinput  type="text" visible="false" height="0" width="0" name="tabsInit" value="#startIdx#" onchange="#onLoad#">
	<cfinput type="hidden" name="trig" bind="#disableTabs#">
</cfform>
<div align="left" style="color: #F79401; font-weight: bold; text-decoration: underline;" onclick="window.open('codeexample.html',null,'_blank');" onmouseover="this.className='cursorhand';" onmouseout="this.className='cursordefault';">show me the code</div> 
</body>
</html>