// MHWINS.FGL - Mobile Home Rater Window Functions - FGL/VM3.6
// (c) 2000 by West Coast Web Adventures, Inc., All Rights Reserved.
//
// Functions
//	LoadMainWindow( dir )
//	LoadAppWindow( dir )
//


FUNCTION LoadMainWindow( dir )

	local win, wstyle, xstyle, err, hsmallfont, htitlefont, hMedFont
	local fclr, bclr, tclr, gbclr, lb, hsysfont, aclr, abclr, hbigfont
	local quote, str
	
	TRY

	fclr = rgb( 0, 255, 255 )
	bclr = rgb( 0, 0, 0 )
	tclr = rgb( 0, 0, 255 )
	gbclr = rgb( 128, 128, 128 )
	aclr = rgb( 0, 0, 0 )
	abclr = rgb( 255, 255, 255 )
	
   	wstyle  = 0x00C00000        // caption
    wstyle |= 0x00080000        // sysmenu
   	wstyle |=(0x7FFFFFFF + 1)   // popup
   	wstyle |= 0x00020000		// minimize

	xstyle = 8		// bevel border

    win = new( "window", 0, "King Mobile Home Insurance Rater - v2.0", -1, -1, 300, 210, wstyle, xstyle, RGB(192,192,192) )
	if ( type( win ) != "O" )
		return( 0 )
	end

	msgpopup( 1, "Initializing Mobile Home Rater..." )

	quote = new( "QuoteData" )

    hsmallfont = fontCreate( 'Arial', 10, 0, 0, 0, 0 )
    hMedFont = fontCreate( 'Arial', 12, 0, 0, 0, 0 )
    hbigfont = fontCreate( 'Times Roman', 32, 0, 0, 0, 0 )
    htitlefont = fontCreate( 'Times Roman', 16, 0, 0, 0, 0 )
    hsysfont = fontCreate( 'Courier', 10, 0, 0, 0, 0 )

	win.pagecreate( "Main" )
	win.pagecreate( "Parameters" )
	win.pagecreate( "Adjustments" )
	win.pagecreate( "Calculate" )
	win.pagecreate( "Help" )
	win.pagecreate( "About" )
	win.pagecreate( "Flood" )

	//////////
	// Main //
	//////////

    win.pagecontrol( 1, "text", "  King Insurance Support Services, Inc.\r        Mobile Home Insurance Rater\r             California 2000 Edition",  25, 40, 250, 80,  0, 0, "", hbigfont, rgb( 255, 255, 255 ), rgb( 0, 0, 128 ), "" )
    win.pagecontrol( 1, "text", "(c) 2000 by King Insurance Support Services, Inc. All Rights Reserved.\r    Written by Steven M. Repetti of West Coast Web Adventures, Inc.",  72, 142, 200, 12,  0, 0, "", hsmallfont, rgb( 255, 255, 255 ), rgb( 0, 0, 128 ), "" )
    win.pagecontrol( 1, "text", "",  15, 15, 270, 155,  0, 8 | 16, "", htitlefont, tclr, rgb( 0, 0, 128 ), "" )

    win.pagecontrol( 1, "button", "&Quotes", 15, 179,  39, 10,  0, 0, { || Quotes( win ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 1, "button", "&Applications", 55, 179,  39, 10,  0, 0, { || ProcessApps( win ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 1, "button", "&Help", 95, 179,  39, 10,  0, 0, { || win.PageDisplay( 5 ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 1, "button", "A&bout...", 135, 179,  39, 10,  0, 0, { || win.PageDisplay( 6 ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 1, "button", "E&xit", 248, 179,  39, 10,  0, 0, { || ExitProgram( win ) }, hsmallfont, 0, -1, "" )

	////////////////
	// Parameters //
	////////////////

    win.pagecontrol( 2, "groupbox", "Applicant Information",  10, 7, 155, 92,  0, 0, "", htitlefont, gbclr, -1, "" )
    win.pagecontrol( 2, "text", "Name:",  15, 21, 30, 10,  0, 0, "", htitlefont, tclr, -1, "" )
    win.pagecontrol( 2, "edit", "",  47, 20, 110, 11,  0, 0, "", htitlefont, fclr, bclr, "name" )
    win.pagecontrol( 2, "text", "Age:",  15, 33, 30, 10,  0, 0, "", htitlefont, tclr, -1, "" )
    win.pagecontrol( 2, "edit", "",  47, 32, 30, 11,  0, 0, "", htitlefont, fclr, bclr, "age" )
    win.pagecontrol( 2, "text", "County:",  15, 51, 30, 10,  0, 0, "", htitlefont, tclr, -1, "" )
    win.pagecontrol( 2, "edit", "",  47, 50, 50, 11,  0, 0, "", htitlefont, fclr, bclr, "county" )
    win.pagecontrol( 2, "text", "Zip:",  15, 63, 30, 10,  0, 0, "", htitlefont, tclr, -1, "" )
    win.pagecontrol( 2, "edit", "",  47, 62, 30, 11,  0, 0, "", htitlefont, fclr, bclr, "zip" )
    win.pagecontrol( 2, "text", "Deductible:",  107, 35, 50, 10,  0, 0, "", htitlefont, tclr, -1, "" )
    win.pagecontrol( 2, "listbox", "",  107, 45, 50, 29,  0, 8 | 16 | 32, "", hMedFont, fclr, bclr, "lbDeduct" )
	lb = new( "ListboxWrapper", win, "lbDeduct" )
	if ( type( lb ) == "O" )
		lb.add( "100" )
		lb.add( "500" )
		lb.add( "250" )
	end
    win.pagecontrol( 2, "text", "Claims w/i Last 3 Years:",  15, 81, 76, 10,  0, 0, "", htitlefont, tclr, -1, "" )
    win.pagecontrol( 2, "edit", "0",  92, 80, 14, 11,  0, 0, "", htitlefont, fclr, bclr, "claims" )
    win.pagecontrol( 2, "text", "Lien Free:",  110, 81, 32, 10,  0, 0, "", htitlefont, tclr, -1, "" )
    win.pagecontrol( 2, "edit", "N",  143, 80, 14, 11,  0, 0, "", htitlefont, fclr, bclr, "LienFree" )

    win.pagecontrol( 2, "groupbox", "Mobile Home Information", 10, 103, 155, 86,  0, 0, "", htitlefont, gbclr, -1, "" )
    win.pagecontrol( 2, "text", "Year Built:",  15, 118, 35, 10,  0, 0, "", htitlefont, tclr, -1, "" )
    win.pagecontrol( 2, "edit", "",  52, 117, 25, 11,  0, 0, "", htitlefont, fclr, bclr, "YearBuilt" )
    win.pagecontrol( 2, "text", "In-Park:",  15, 130, 35, 10,  0, 0, "", htitlefont, tclr, -1, "" )
    win.pagecontrol( 2, "edit", "Y",  52, 129, 14, 11,  0, 0, "", htitlefont, fclr, bclr, "InPark" )
    win.pagecontrol( 2, "text", "Ttl Spaces:",  15, 142, 35, 10,  0, 0, "", htitlefont, tclr, -1, "" )
    win.pagecontrol( 2, "edit", "",  52, 141, 25, 11,  0, 0, "", htitlefont, fclr, bclr, "TtlSpaces" )
    win.pagecontrol( 2, "text", "Width:",  15, 160, 35, 10,  0, 0, "", htitlefont, tclr, -1, "" )
    win.pagecontrol( 2, "edit", "24",  52, 159, 25, 11,  0, 0, "", htitlefont, fclr, bclr, "Width" )
    win.pagecontrol( 2, "text", "Length:",  15, 172, 35, 10,  0, 0, "", htitlefont, tclr, -1, "" )
    win.pagecontrol( 2, "edit", "60",  52, 171, 25, 11,  0, 0, "", htitlefont, fclr, bclr, "Length" )
    win.pagecontrol( 2, "text", "Manufacturer/Model:",  83, 115, 70, 9,  0, 0, "", htitlefont, tclr, -1, "" )
    win.pagecontrol( 2, "listbox", "",  82, 124, 75, 36,  0, 8 | 16 | 32, "", hsmallfont, fclr, bclr, "lbManu" )
	loadManufacturerListbox( win, dir )
    win.pagecontrol( 2, "text", "Attached Structure",  83, 162, 70, 9,  0, 0, "", htitlefont, tclr, -1, "" )
    win.pagecontrol( 2, "text", "Value:",  83, 170, 20, 10,  0, 0, "", htitlefont, tclr, -1, "" )
    win.pagecontrol( 2, "edit", "",  108, 171, 51, 11,  0, 0, "", htitlefont, fclr, bclr, "AttachedValue" )

    win.pagecontrol( 2, "groupbox", "Coverage Amount",  173, 7, 117, 30,  0, 0, "", htitlefont, gbclr, -1, "" )
    win.pagecontrol( 2, "text", "$",  178, 21, 5, 10,  0, 0, "", htitlefont, tclr, -1, "" )
    win.pagecontrol( 2, "edit", "",   183, 20, 50, 11,  0, 0, "", htitlefont, fclr, bclr, "Coverage" )
    win.pagecontrol( 2, "text", "Guaranteed Replacement:",  238, 19, 35, 20,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 2, "edit", "N",  272, 20, 12, 11,  0, 0, "", htitlefont, fclr, bclr, "Replacement" )

    win.pagecontrol( 2, "groupbox", "Options",  173, 41, 117, 133,  0, 0, "", htitlefont, gbclr, -1, "" )
    win.pagecontrol( 2, "checkbox", " Earthquake Coverage",  178, 54, 96, 8,  0, 0, "", hsmallfont, tclr, -1, "oQuake" )
    win.pagecontrol( 2, "checkbox", " Natural Disaster Protection",  178, 62, 90, 8,  0, 0, "", hsmallfont, tclr, -1, "oNatural" )
    win.pagecontrol( 2, "checkbox", " Secured Interest Protection",  178, 70, 90, 8,  0, 0, "", hsmallfont, tclr, -1, "oSecured" )
    win.pagecontrol( 2, "checkbox", " Additional Residence Premises Liability",  178, 78, 110, 8,  0, 0, "", hsmallfont, tclr, -1, "oResLiab" )
    win.pagecontrol( 2, "checkbox", " Golf Cart Coverage - Physical Damage",  178, 86, 110, 8,  0, 0, "", hsmallfont, tclr, -1, "oGolfCart" )
    win.pagecontrol( 2, "checkbox", " Wood Burning Stove",  178, 94, 96, 8,  0, 0, "", hsmallfont, tclr, -1, "oWoodStove" )
    win.pagecontrol( 2, "checkbox", " Workers' Comp - Residence Employee",  178, 102, 110, 8,  0, 0, "", hsmallfont, tclr, -1, "oWorkersComp" )
    win.pagecontrol( 2, "checkbox", " Loss Assessment",  178, 110, 96, 8,  0, 0, "", hsmallfont, tclr, -1, "oLoss" )
    win.pagecontrol( 2, "checkbox", " Additional Medical to $1000 Limit",  178, 118, 110, 8,  0, 0, "", hsmallfont, tclr, -1, "oMedical" )
    win.pagecontrol( 2, "checkbox", " Sewer Backup",  178, 126, 96, 8,  0, 0, "", hsmallfont, tclr, -1, "oSewer" )
    win.pagecontrol( 2, "checkbox", " Flood - $250 Deductible",  178, 134, 96, 8,  0, 0, "", hsmallfont, tclr, -1, "oFlood" )
    win.pagecontrol( 2, "checkbox", " Windstorm && Hail Exclusion",  178, 142, 96, 8,  0, 0, "", hsmallfont, tclr, -1, "oWind" )
    win.pagecontrol( 2, "checkbox", " Animal Liability Exclusion",  178, 150, 96, 8,  0, 0, "", hsmallfont, tclr, -1, "oAnimal" )
    win.pagecontrol( 2, "checkbox", " Lien Free Credit",  178, 158, 96, 8,  0, 0, "", hsmallfont, tclr, -1, "oLienFree" )

    win.pagecontrol( 2, "button", "&Next", 213, 179,  39, 10,  0, 0, { || win.PageDisplay( 3 ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 2, "button", "E&xit", 253, 179,  38, 10,  0, 0, { || win.PageDisplay( 1 ) }, hsmallfont, 0, -1, "" )

	/////////////////
	// Adjustments //
	/////////////////

    win.pagecontrol( 3, "groupbox", "Additional Coverage",  10, 7, 155, 92,  0, 0, "", htitlefont, gbclr, -1, "" )
    win.pagecontrol( 3, "text", "Radio && TV Antenna Coverage ($):",  15, 22, 115, 10,  0, 0, "", htitlefont, aclr, -1, "" )
    win.pagecontrol( 3, "edit", "",  130, 21, 29, 11,  0, 0, "", htitlefont, abclr, bclr, "aAntenna" )
    win.pagecontrol( 3, "text", "Unattached Structures Value ($):",  15, 34, 115, 10,  0, 0, "", htitlefont, aclr, -1, "" )
    win.pagecontrol( 3, "edit", "",  130, 33, 29, 11,  0, 0, "", htitlefont, abclr, bclr, "aUnStructures" )
    win.pagecontrol( 3, "text", "Additional Personal Effects ($):",  15, 46, 115, 10,  0, 0, "", htitlefont, aclr, -1, "" )
    win.pagecontrol( 3, "edit", "",  130, 45, 29, 11,  0, 0, "", htitlefont, abclr, bclr, "aPersonalEffects" )
    win.pagecontrol( 3, "text", "Additional Personal Liability ($):",  15, 58, 115, 10,  0, 0, "", htitlefont, aclr, -1, "" )
    win.pagecontrol( 3, "edit", "",  130, 57, 29, 11,  0, 0, "", htitlefont, abclr, bclr, "aPerLiab" )

    win.pagecontrol( 3, "checkbox", " Is Applicant a Seasonal Resident?",  37, 75, 100, 8,  0, 0, "", hsmallfont, aclr, -1, "IsSeasonal" )
    win.pagecontrol( 3, "checkbox", " Rental Policy",  37, 85, 45, 8,  0, 0, "", hsmallfont, aclr, -1, "IsRental" )
    win.pagecontrol( 3, "checkbox", " Tenant Policy",  87, 85, 45, 8,  0, 0, "", hsmallfont, aclr, -1, "IsTenant" )


    win.pagecontrol( 3, "groupbox", "Protection Device Credit", 10, 103, 155, 86,  0, 0, "", htitlefont, gbclr, -1, "" )
    win.pagecontrol( 3, "checkbox", " Fire OR Smoke Detector AND Fire Extinguisher",  15, 118, 145, 8,  0, 0, "", hsmallfont, aclr, -1, "FireDetector" )
    win.pagecontrol( 3, "checkbox", " Local Burglar Alarm AND Dead Bolts on Exterior Doors",  15, 133, 145, 8,  0, 0, "", hsmallfont, aclr, -1, "LocalFire" )
    win.pagecontrol( 3, "checkbox", " Fire OR Smoke Detector Reporting to Fire Department,",  15, 148, 145, 8,  0, 0, "", hsmallfont, aclr, -1, "FireReporting" )
    win.pagecontrol( 3, "text",     "Police Department, or Central Station",  24, 155, 115, 8,  0, 0, "", hsmallfont, aclr, -1, "" )
    win.pagecontrol( 3, "checkbox", " Both Fire AND Burglar Systems Reporting to Fire Dept.,",  15, 167, 145, 8,  0, 0, "", hsmallfont, aclr, -1, "FullReporting" )
    win.pagecontrol( 3, "text",     "Police Department, or Central Station",  24, 174, 115, 8,  0, 0, "", hsmallfont, aclr, -1, "" )

    win.pagecontrol( 3, "groupbox", "Scheduled Personal Property",  173, 7, 117, 138,  0, 0, "", htitlefont, gbclr, -1, "" )
    win.pagecontrol( 3, "text", "Camera Equipment ($)",  178, 25, 76, 8,  0, 0, "", hsmallfont, aclr, -1, "" )
    win.pagecontrol( 3, "edit", "",  255, 25, 30, 7,  0, 0, "", hsmallfont, abclr, bclr, "sCamera" )
    win.pagecontrol( 3, "text", "Fine Arts with out Breakage ($)",  178, 33, 76, 8,  0, 0, "", hsmallfont, aclr, -1, "" )
    win.pagecontrol( 3, "edit", "",  255, 33, 30, 7,  0, 0, "", hsmallfont, abclr, bclr, "sFineArts" )
    win.pagecontrol( 3, "text", "Fine Arts with Breakage ($)",  178, 41, 76, 8,  0, 0, "", hsmallfont, aclr, -1, "" )
    win.pagecontrol( 3, "edit", "",  255, 41, 30, 7,  0, 0, "", hsmallfont, abclr, bclr, "sFineArtsWith" )
    win.pagecontrol( 3, "text", "Golfers Equipment ($)",  178, 49, 76, 8,  0, 0, "", hsmallfont, aclr, -1, "" )
    win.pagecontrol( 3, "edit", "",  255, 49, 30, 7,  0, 0, "", hsmallfont, abclr, bclr, "sGolf" )
    win.pagecontrol( 3, "text", "Guns ($)",  178, 57, 76, 8,  0, 0, "", hsmallfont, aclr, -1, "" )
    win.pagecontrol( 3, "edit", "",  255, 57, 30, 7,  0, 0, "", hsmallfont, abclr, bclr, "sGuns" )
    win.pagecontrol( 3, "text", "Musical Instruments ($)",  178, 65, 76, 8,  0, 0, "", hsmallfont, aclr, -1, "" )
    win.pagecontrol( 3, "edit", "",  255, 65, 30, 7,  0, 0, "", hsmallfont, abclr, bclr, "sMusic" )
    win.pagecontrol( 3, "text", "PC/Audio/Video Equipment ($)",  178, 73, 76, 8,  0, 0, "", hsmallfont, aclr, -1, "" )
    win.pagecontrol( 3, "edit", "",  255, 73, 30, 7,  0, 0, "", hsmallfont, abclr, bclr, "sPC" )
    win.pagecontrol( 3, "text", "Silverware ($)",  178, 81, 76, 8,  0, 0, "", hsmallfont, aclr, -1, "" )
    win.pagecontrol( 3, "edit", "",  255, 81, 30, 7,  0, 0, "", hsmallfont, abclr, bclr, "sSilver" )
    win.pagecontrol( 3, "text", "Personal Jewelry ($)", 178, 89, 76, 8,  0, 0, "", hsmallfont, aclr, -1, "" )
    win.pagecontrol( 3, "edit", "",  255, 89, 30, 7,  0, 0, "", hsmallfont, abclr, bclr, "sJewelry" )
    win.pagecontrol( 3, "text", "Personal Furs ($)",  178, 97, 76, 8,  0, 0, "", hsmallfont, aclr, -1, "" )
    win.pagecontrol( 3, "edit", "",  255, 97, 30, 7,  0, 0, "", hsmallfont, abclr, bclr, "sFurs" )
    win.pagecontrol( 3, "text", "Stamps ($)",  178, 105, 76, 8,  0, 0, "", hsmallfont, aclr, -1, "" )
    win.pagecontrol( 3, "edit", "",  255, 105, 30, 7,  0, 0, "", hsmallfont, abclr, bclr, "sStamps" )
    win.pagecontrol( 3, "text", "Coins ($)",  178, 113, 76, 8,  0, 0, "", hsmallfont, aclr, -1, "" )
    win.pagecontrol( 3, "edit", "",  255, 113, 30, 7,  0, 0, "", hsmallfont, abclr, bclr, "sCoins" )
    win.pagecontrol( 3, "text", "Antiques ($)",  178, 121, 76, 8,  0, 0, "", hsmallfont, aclr, -1, "" )
    win.pagecontrol( 3, "edit", "",  255, 121, 30, 7,  0, 0, "", hsmallfont, abclr, bclr, "sAntiques" )
    win.pagecontrol( 3, "text", "All Other ($)",  178, 129, 76, 8,  0, 0, "", hsmallfont, aclr, -1, "" )
    win.pagecontrol( 3, "edit", "",  255, 129, 30, 7,  0, 0, "", hsmallfont, abclr, bclr, "sOther" )

    win.pagecontrol( 3, "groupbox", "Broker's Fee",  173, 148, 117, 25,  0, 0, "", htitlefont, gbclr, -1, "" )
    win.pagecontrol( 3, "edit", "",  176, 159, 111, 9,  0, 0, "", hsmallfont, abclr, bclr, "BrokerFee" )


    win.pagecontrol( 3, "button", "&Previous", 173, 179,  39, 10,  0, 0, { || win.PageDisplay( 2 ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 3, "button", "&Calculate", 213, 179,  39, 10,  0, 0, { || CalculateQuote( win, quote ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 3, "button", "E&xit", 253, 179,  38, 10,  0, 0, { || win.PageDisplay( 1 ) }, hsmallfont, 0, -1, "" )

	///////////////
	// Calculate //
	///////////////

    win.pagecontrol( 4, "groupbox", " Quote ",  10, 7, 281, 165,  0, 0, "", htitlefont, rgb( 128,128,128 ), -1, "" )
    win.pagecontrol( 4, "listbox", "",  15, 21, 269, 145,  0, 8 | 16 | 32, "", hsysfont, rgb(0,0,0), rgb(255,255,255), "lbCalc" )
    win.pagecontrol( 4, "button", "&Print Quote", 10, 179,  39, 10,  0, 0, { || PrintQuote( win, "lbCalc" ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 4, "button", "&Calculator", 50, 179,  39, 10,  0, 0, { || smartrun( "calc.exe" ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 4, "button", "&Generate App From Quote", 110, 179, 83, 10,  0, 0, { || GenerateApp( win, quote, dir ) }, hsmallfont, 0, -1, "" )

    win.pagecontrol( 4, "button", "&Back", 213, 179,  39, 10,  0, 0, { || win.PageDisplay( 2 ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 4, "button", "E&xit", 253, 179,  38, 10,  0, 0, { || win.PageDisplay( 1 ) }, hsmallfont, 0, -1, "" )

	//////////
	// Help //
	//////////

    win.pagecontrol( 5, "groupbox", " Help ",  10, 7, 281, 165,  0, 0, "", htitlefont, rgb( 128,128,128 ), -1, "" )
    win.pagecontrol( 5, "listbox", "",  15, 21, 269, 145,  0, 8 | 16 | 32, "", hsysfont, rgb(0,0,0), rgb(255,255,255), "lbHelp" )
    win.pagecontrol( 5, "button", "&Quotes", 15, 179,  39, 10,  0, 0, { || Quotes( win ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 5, "button", "&Applications", 55, 179,  39, 10,  0, 0, { || ProcessApps( win ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 5, "button", "A&bout...", 95, 179,  39, 10,  0, 0, { || win.PageDisplay( 6 ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 5, "button", "&Menu", 208, 179,  39, 10,  0, 0, { || win.PageDisplay( 1 ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 5, "button", "E&xit", 248, 179,  39, 10,  0, 0, { || ExitProgram( win ) }, hsmallfont, 0, -1, "" )
	lb = new( "ListboxWrapper", win, "lbHelp" )
	lbLoadFile( lb, dir + '\readme.txt' )

	///////////
	// About //
	///////////

    win.pagecontrol( 6, "groupbox", " About ",  10, 7, 281, 165,  0, 0, "", htitlefont, rgb( 128,128,128 ), -1, "" )
    win.pagecontrol( 6, "listbox", "",  15, 21, 269, 145,  0, 8 | 16 | 32, "", hsysfont, rgb(0,0,0), rgb(255,255,255), "lbAbout" )
    win.pagecontrol( 6, "button", "&Quotes", 15, 179,  39, 10,  0, 0, { || Quotes( win ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 6, "button", "&Applications", 55, 179,  39, 10,  0, 0, { || ProcessApps( win ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 6, "button", "&Help", 95, 179,  39, 10,  0, 0, { || win.PageDisplay( 5 ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 6, "button", "&Menu", 208, 179,  39, 10,  0, 0, { || win.PageDisplay( 1 ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 6, "button", "E&xit", 248, 179,  39, 10,  0, 0, { || ExitProgram( win ) }, hsmallfont, 0, -1, "" )
	lb = new( "ListboxWrapper", win, "lbAbout" )
	lbLoadFile( lb, dir + '\about.txt' )

    win.pagecontrol( 7, "groupbox", " Flood Exclusions ",  10, 7, 281, 165,  0, 0, "", htitlefont, rgb( 128,128,128 ), -1, "" )
	str = "The location of the Mobile Home that you specified is within a flood restricted area. Highlight the Applicant's park and click the YES button, or click the NO button if their park is not listed."
    win.pagecontrol( 7, "text", str,  35, 30, 240, 30,  0, 0, "", htitlefont, aclr, -1, "" )

    win.pagecontrol( 7, "listbox", "",  35, 65, 233, 80,  0, 8 | 16 | 32, "", hsysfont, rgb(0,0,0), rgb(255,255,255), "lbFloodExclude" )

    win.pagecontrol( 7, "button", "&Yes, selected park is restricted",  35, 147,  119, 11,  0, 0, { || CalcQuoteWithFloodRestriction( win, quote ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 7, "button", "&No, park is not on the list ",  151, 147, 119, 11,  0, 0, { || __CalculateQuote( win, quote, 0 ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 7, "button", "&Back", 248, 179,  39, 10,  0, 0, { || win.PageDisplay( win.prevpage ) }, hsmallfont, 0, -1, "" )

	msgpopup( 0, "" )

	win.display( 1, 1 )
	win.ProcessEvents( )
	win.close( )

	fontDestroy( hsmallfont )
	fontDestroy( hMedFont )
	fontDestroy( hbigfont )
	fontDestroy( htitlefont )
	fontdestroy( hsysfont )

	return( 1 )

    CATCH ( err )
        msgDelay( 3000, "Error [" + err.errornum + "] at line #" + err.errorline + " (" + ErrorAsText( err.errornum ) + ")" )
		return( 0 )
    END

END



FUNCTION LoadAppWindow( dir )

	local win, wstyle, xstyle, err, hsmallfont, htitlefont, hMedFont
	local fclr, bclr, tclr, gbclr, lb, hsysfont, aclr, abclr, hbigfont
	local str, app
	
	TRY

	fclr = rgb( 0, 255, 255 )
	bclr = rgb( 0, 0, 0 )
	tclr = rgb( 0, 0, 255 )
	gbclr = rgb( 128, 128, 128 )
	aclr = rgb( 0, 0, 0 )
	abclr = rgb( 255, 255, 255 )
	
   	wstyle  = 0x00C00000        // caption
    wstyle |= 0x00080000        // sysmenu
   	wstyle |=(0x7FFFFFFF + 1)   // popup
   	wstyle |= 0x00020000		// minimize

	xstyle = 8		// bevel border
    win = new( "window", 0, "mhRater - Insurance Application Module - v2.0", -1, -1, 300, 210, wstyle, xstyle, RGB(192,192,192) )
	if ( type( win ) != "O" )
		msgPopup( 0, "" )
		return( 0 )
	end

	app = new( "InsuranceApplication", win, dir )
	
    hsmallfont = fontCreate( 'Arial', 10, 0, 0, 0, 0 )
    hMedFont = fontCreate( 'Arial', 12, 0, 0, 0, 0 )
    hbigfont = fontCreate( 'Times Roman', 32, 0, 0, 0, 0 )
    htitlefont = fontCreate( 'Times Roman', 16, 0, 0, 0, 0 )
    hsysfont = fontCreate( 'Courier', 10, 0, 0, 0, 0 )

	win.pagecreate( "Main" )
	win.pagecreate( "Help" )
	win.pagecreate( "About" )
	win.pagecreate( "Insured" )
	win.pagecreate( "Lien" )
	win.pagecreate( "mhInfo" )
	win.pagecreate( "mhStructures" )
	win.pagecreate( "quote" )
	win.pagecreate( "print" )
	

	//////////
	// Main //
	//////////

    win.pagecontrol( 1, "groupbox", " Available Applications ",  10, 7, 281, 165,  0, 0, "", htitlefont, rgb( 128,128,128 ), -1, "" )

	str = "Please select the desired application to process from the list below. Then click the PROCESS THE SELECTED APP button to continue. Otherwise, press the RETURN TO THE MAIN MENU button to exit."
    win.pagecontrol( 1, "text", str,  17, 25, 265, 30,  0, 0, "", htitlefont, rgb(0,0,0), -1, "" )
    win.pagecontrol( 1, "listbox", "",  15, 63, 269, 103,  0, 8 | 16 | 32, "", hsysfont, rgb(0,0,0), rgb(255,255,255), "lbApps" )

    win.pagecontrol( 1, "button", "E&dit Application", 15, 179, 75, 10,  0, 0, { || EditCurrentApp( win, app, dir ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 1, "button", "&Print Application", 91, 179,  75, 10,  0, 0, { || win.PageDisplay( 9 ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 1, "button", "&Help", 167, 179,  39, 10,  0, 0, { || win.PageDisplay( 2 ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 1, "button", "&About", 207, 179,  40, 10,  0, 0, { || win.PageDisplay( 3 ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 1, "button", "E&xit", 248, 179,  39, 10,  0, 0, { || win.close( ) }, hsmallfont, 0, -1, "" )


	lb = new( "ListboxWrapper", win, "lbApps" )
	lbLoadApps( lb, dir )

	//////////
	// Help //
	//////////

    win.pagecontrol( 2, "groupbox", " Help ",  10, 7, 281, 165,  0, 0, "", htitlefont, rgb( 128,128,128 ), -1, "" )
    win.pagecontrol( 2, "listbox", "",  15, 21, 269, 145,  0, 8 | 16 | 32, "", hsysfont, rgb(0,0,0), rgb(255,255,255), "lbHelp" )
    win.pagecontrol( 2, "button", "&About", 15, 179,  39, 10,  0, 0, { || win.PageDisplay( 3 ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 2, "button", "&Menu", 208, 179,  39, 10,  0, 0, { || win.PageDisplay( 1 ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 2, "button", "E&xit", 248, 179,  39, 10,  0, 0, { || win.close( ) }, hsmallfont, 0, -1, "" )
	lb = new( "ListboxWrapper", win, "lbHelp" )
	lbLoadFile( lb, dir + '\readme.txt' )

	///////////
	// About //
	///////////

    win.pagecontrol( 3, "groupbox", " About ",  10, 7, 281, 165,  0, 0, "", htitlefont, rgb( 128,128,128 ), -1, "" )
    win.pagecontrol( 3, "listbox", "",  15, 21, 269, 145,  0, 8 | 16 | 32, "", hsysfont, rgb(0,0,0), rgb(255,255,255), "lbAbout" )
    win.pagecontrol( 3, "button", "&Help", 15, 179,  39, 10,  0, 0, { || win.PageDisplay( 2 ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 3, "button", "&Menu", 208, 179,  39, 10,  0, 0, { || win.PageDisplay( 1 ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 3, "button", "E&xit", 248, 179,  39, 10,  0, 0, { || win.close( ) }, hsmallfont, 0, -1, "" )
	lb = new( "ListboxWrapper", win, "lbAbout" )
	lbLoadFile( lb, dir + '\about.txt' )

	/////////////
	// Insured //
	/////////////

    win.pagecontrol( 4, "groupbox", " First Named Insured ",  10, 7, 155, 70,  0, 0, "", htitlefont, gbclr, -1, "" )
    win.pagecontrol( 4, "text", "Name:",  15, 22, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  42, 20, 115, 9,  0, 0, "", hsmallfont, fclr, bclr, "name" )
    win.pagecontrol( 4, "text", "Address:",  15, 32, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  42, 30, 115, 9,  0, 0, "", hsmallfont, fclr, bclr, "address" )
    win.pagecontrol( 4, "text", "City:",  15, 42, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  42, 40,  53, 9,  0, 0, "", hsmallfont, fclr, bclr, "city" )
    win.pagecontrol( 4, "text", "State:",  98, 42, 15, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "CA",  115, 40,  10, 9,  0, 0, "", hsmallfont, fclr, bclr, "state" )
    win.pagecontrol( 4, "text", "Zip:",  127, 42, 9, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  138, 40,  19, 9,  0, 0, "", hsmallfont, fclr, bclr, "zip" )
    win.pagecontrol( 4, "text", "County:",  15, 52, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  42, 50,  45, 9,  0, 0, "", hsmallfont, fclr, bclr, "county" )
    win.pagecontrol( 4, "text", "Phone #:",  90, 52, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  115, 50,  42, 9,  0, 0, "", hsmallfont, fclr, bclr, "phone" )
    win.pagecontrol( 4, "text", "AGE:",  15, 62, 15, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  42, 60, 25, 9,  0, 0, "", hsmallfont, fclr, bclr, "age" )
    win.pagecontrol( 4, "text", "D.O.B.:",  69, 62, 15, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  86, 60, 40, 9,  0, 0, "", hsmallfont, fclr, bclr, "dob" )

    win.pagecontrol( 4, "groupbox", " Second Named Insured ",  10, 82, 155, 40,  0, 0, "", htitlefont, gbclr, -1, "" )
    win.pagecontrol( 4, "text", "Name:",  15, 97, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  42, 95, 115, 9,  0, 0, "", hsmallfont, fclr, bclr, "sName" )
    win.pagecontrol( 4, "text", "AGE:",  15, 107, 15, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  42, 105, 25, 9,  0, 0, "", hsmallfont, fclr, bclr, "sAge" )
    win.pagecontrol( 4, "text", "D.O.B.:",  69, 107, 15, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  86, 105, 40, 9,  0, 0, "", hsmallfont, fclr, bclr, "sDob" )

    win.pagecontrol( 4, "groupbox", " Additional Insured ",  10, 127, 155, 50,  0, 0, "", htitlefont, gbclr, -1, "" )
    win.pagecontrol( 4, "text", "Name:",  15, 142, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  42, 140, 115, 9,  0, 0, "", hsmallfont, fclr, bclr, "aName" )
    win.pagecontrol( 4, "text", "Address:",  15, 152, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  42, 150, 115, 9,  0, 0, "", hsmallfont, fclr, bclr, "aAddress" )
    win.pagecontrol( 4, "text", "City:",  15, 162, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  42, 160,  53, 9,  0, 0, "", hsmallfont, fclr, bclr, "aCity" )
    win.pagecontrol( 4, "text", "State:",  98, 162, 15, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "CA",  115, 160,  10, 9,  0, 0, "", hsmallfont, fclr, bclr, "aState" )
    win.pagecontrol( 4, "text", "Zip:",  128, 162, 9, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  138, 160,  19, 9,  0, 0, "", hsmallfont, fclr, bclr, "aZip" )

    win.pagecontrol( 4, "groupbox", " Mailing Address ",  174, 7, 114, 70,  0, 0, "", htitlefont, gbclr, -1, "" )
    win.pagecontrol( 4, "text", "Address:",  179, 22, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  206, 20, 76, 9,  0, 0, "", hsmallfont, fclr, bclr, "mAddress" )
    win.pagecontrol( 4, "text", "City:",  179, 32, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  206, 30,  76, 9,  0, 0, "", hsmallfont, fclr, bclr, "mCity" )
    win.pagecontrol( 4, "text", "State:",  179, 42, 15, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "CA",  206, 40,  10, 9,  0, 0, "", hsmallfont, fclr, bclr, "mState" )
    win.pagecontrol( 4, "text", "Zip:",  235, 42, 10, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  247, 40,  20, 9,  0, 0, "", hsmallfont, fclr, bclr, "mZip" )
    win.pagecontrol( 4, "text", "County:",  179, 52, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  206, 50,  76, 9,  0, 0, "", hsmallfont, fclr, bclr, "mCounty" )
    win.pagecontrol( 4, "text", "Phone #:",  179, 62, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  206, 60,  76, 9,  0, 0, "", hsmallfont, fclr, bclr, "mPhone" )

    win.pagecontrol( 4, "groupbox", " Add'l Insured (Non-Resident) ",  174, 82, 114, 80,  0, 0, "", htitlefont, gbclr, -1, "" )
    win.pagecontrol( 4, "text", "Name:",  179, 97, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  206, 95, 76, 9,  0, 0, "", hsmallfont, fclr, bclr, "a2Name" )
    win.pagecontrol( 4, "text", "Address:",  179, 107, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  206, 105, 76, 9,  0, 0, "", hsmallfont, fclr, bclr, "a2Address" )
    win.pagecontrol( 4, "text", "City:",  179, 117, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  206, 115,  76, 9,  0, 0, "", hsmallfont, fclr, bclr, "a2City" )
    win.pagecontrol( 4, "text", "State:",  179, 127, 15, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "CA",  206, 125,  10, 9,  0, 0, "", hsmallfont, fclr, bclr, "a2State" )
    win.pagecontrol( 4, "text", "Zip:",  234, 127, 9, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  244, 125,  20, 9,  0, 0, "", hsmallfont, fclr, bclr, "a2Zip" )
    win.pagecontrol( 4, "text", "County:",  179, 137, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  206, 135,  76, 9,  0, 0, "", hsmallfont, fclr, bclr, "a2County" )
    win.pagecontrol( 4, "text", "Phone #:",  179, 147, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 4, "edit", "",  206, 145,  76, 9,  0, 0, "", hsmallfont, fclr, bclr, "a2Phone" )

    win.pagecontrol( 4, "button", "&Quote", 174, 179,  28, 10,  0, 0, { || LoadQuote( win, app ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 4, "button", "&Next", 232, 179,  28, 10,  0, 0, { || win.PageDisplay( 5 ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 4, "button", "E&xit", 261, 179,  27, 10,  0, 0, { || SaveApp( win, app ) }, hsmallfont, 0, -1, "" )

	////////////////
	// Lienholder //
	////////////////

    win.pagecontrol( 5, "groupbox", " Lienholder ",  10, 7, 155, 70,  0, 0, "", htitlefont, gbclr, -1, "" )
    win.pagecontrol( 5, "text", "Name:",  15, 22, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 5, "edit", "",  42, 20, 115, 9,  0, 0, "", hsmallfont, fclr, bclr, "lName" )
    win.pagecontrol( 5, "text", "Address:",  15, 32, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 5, "edit", "",  42, 30, 115, 9,  0, 0, "", hsmallfont, fclr, bclr, "lAddress" )
    win.pagecontrol( 5, "text", "City:",  15, 42, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 5, "edit", "",  42, 40,  53, 9,  0, 0, "", hsmallfont, fclr, bclr, "lCity" )
    win.pagecontrol( 5, "text", "State:",  98, 42, 15, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 5, "edit", "CA",  115, 40,  10, 9,  0, 0, "", hsmallfont, fclr, bclr, "lState" )
    win.pagecontrol( 5, "text", "Zip:",  127, 42, 9, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 5, "edit", "",  138, 40,  19, 9,  0, 0, "", hsmallfont, fclr, bclr, "lZip" )
    win.pagecontrol( 5, "text", "County:",  15, 52, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 5, "edit", "",  42, 50,  45, 9,  0, 0, "", hsmallfont, fclr, bclr, "lCounty" )
    win.pagecontrol( 5, "text", "Phone #:",  90, 52, 25, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 5, "edit", "",  115, 50,  42, 9,  0, 0, "", hsmallfont, fclr, bclr, "lPhone" )
    win.pagecontrol( 5, "text", "Loan #:",  15, 62, 20, 8,  0, 0, "", hsmallfont, tclr, -1, "" )
    win.pagecontrol( 5, "edit", "",  42, 60, 115, 9,  0, 0, "", hsmallfont, fclr, bclr, "Loan" )

    win.pagecontrol( 5, "groupbox", " Ineligible Risks - check if yes ",  10, 82, 277, 90,  0, 0, "", htitlefont, gbclr, -1, "" )
    win.pagecontrol( 5, "checkbox", " Is Mobile Home homemade, custom-built, or substantially modified?",  16, 96, 201, 7,  0, 0, "", hsmallfont, tclr, -1, "r1" )
    win.pagecontrol( 5, "checkbox", " Is Mobile Home under construction or not fully installed?",  16, 103, 201, 7,  0, 0, "", hsmallfont, tclr, -1, "r2" )
    win.pagecontrol( 5, "checkbox", " Is business conducted on insured premises?",  16, 110, 201, 7,  0, 0, "", hsmallfont, tclr, -1, "r3" )
    win.pagecontrol( 5, "checkbox", " Was applicant previously uninsured for 30 or more days?",  16, 117, 201, 7,  0, 0, "", hsmallfont, tclr, -1, "r4" )
    win.pagecontrol( 5, "checkbox", " Is there an un-fenced swimming pool on insured premises?",  16, 124, 201, 7,  0, 0, "", hsmallfont, tclr, -1, "r5" )
    win.pagecontrol( 5, "checkbox", " Has Mobile Home been reconstructed due to a total flood loss?",  16, 131, 201, 7,  0, 0, "", hsmallfont, tclr, -1, "r6" )
    win.pagecontrol( 5, "checkbox", " Has applicant sustained any loss in the last 3 years? If yes, submit.",  16, 138, 201, 7,  0, 0, "", hsmallfont, tclr, -1, "r7" )
    win.pagecontrol( 5, "checkbox", " Is Mobile Home unoccupied or vacant for more than 30 days?",  16, 145, 201, 7,  0, 0, "", hsmallfont, tclr, -1, "r8" )
    win.pagecontrol( 5, "checkbox", " Own or board a Doberman, Rottweiller, Pit Bull or guard dog or with a history of biting or board horses?",  16, 152, 251, 7,  0, 0, "", hsmallfont, tclr, -1, "r9" )
    win.pagecontrol( 5, "checkbox", " Is Rental/Commercial Mobile Home used as a motel or unoccupied for period less than 6 months?",  16, 159, 241, 7,  0, 0, "", hsmallfont, tclr, -1, "r10" )

    win.pagecontrol( 5, "groupbox", " Underwriting - check if yes ",  174, 7, 112, 70,  0, 0, "", htitlefont, gbclr, -1, "" )
    win.pagecontrol( 5, "checkbox", "",  179, 21, 10, 7,  0, 0, "", hsmallfont, tclr, -1, "u1" )
	str = "Is risk located in an area subject to excessive exposure to any peril? If yes, submit description."
    win.pagecontrol( 5, "text", str,  189, 21, 90, 20,  0, 0, "", hsmallfont, tclr, -1, "" )

    win.pagecontrol( 5, "checkbox", "",  179, 42, 10, 7,  0, 0, "", hsmallfont, tclr, -1, "u2" )
	str = "Is M.H. in an area subject to flooding or located less than 1000' from any river, ocean, bay, or flood prone area or on a site which has flooded in the last 10 years? If yes, exclude flood."
    win.pagecontrol( 5, "text", str,  189, 42, 90, 35,  0, 0, "", hsmallfont, tclr, -1, "" )

    win.pagecontrol( 5, "button", "&Quote", 174, 179,  28, 10,  0, 0, { || LoadQuote( win, app ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 5, "button", "&Previous", 203, 179,  28, 10,  0, 0, { || win.PageDisplay( 4 ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 5, "button", "&Next", 232, 179,  28, 10,  0, 0, { || win.PageDisplay( 6 ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 5, "button", "E&xit", 261, 179,  27, 10,  0, 0, { || SaveApp( win, app ) }, hsmallfont, 0, -1, "" )

	/////////////////
	// Policy Term //
	/////////////////

	CreatePage6( win, htitlefont, hsmallfont, gbclr, tclr, fclr, bclr, app )
	CreatePage7( win, htitlefont, hsmallfont, gbclr, tclr, fclr, bclr, app )

	///////////
	// Quote //
	///////////

    win.pagecontrol( 8, "groupbox", " Quote ",  10, 7, 281, 165,  0, 0, "", htitlefont, rgb( 128,128,128 ), -1, "" )
    win.pagecontrol( 8, "listbox", "",  15, 21, 269, 145,  0, 8 | 16 | 32, "", hsysfont, rgb(0,0,0), rgb(255,255,255), "lbQuote" )
    win.pagecontrol( 8, "button", "&Print Quote", 10, 179,  39, 10,  0, 0, { || PrintQuote( win, "lbQuote" ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 8, "button", "&Calculator", 50, 179,  39, 10,  0, 0, { || smartrun( "calc.exe" ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 8, "button", "&Back", 248, 179,  39, 10,  0, 0, { || win.PageDisplay( win.prevpage ) }, hsmallfont, 0, -1, "" )

	///////////
	// Print //
	///////////

    win.pagecontrol( 9, "text", "Select Print Method:",  11, 11, 100, 10,  0, 0, "", htitlefont, rgb( 0,0,0 ), -1, "" )

    win.pagecontrol( 9, "image", dir + '\print1.jpg', 30, 30, 110, 125,  0, 8 | 16 | 32, "", 0, 0, -1, "" )
    win.pagecontrol( 9, "image", dir + '\print2.jpg', 160, 30, 110, 125,  0, 8 | 16 | 32, "", 0, 0, -1, "" )

    win.pagecontrol( 9, "button", "Use Pre-printed Form", 30, 155, 110, 12,  0, 0, { || GenHardCopyOfApp( win, app, dir, 1 ) }, hsmallfont, 0, -1, "" )
    win.pagecontrol( 9, "button", "Print Without Form",  160, 155,  110, 12,  0, 0, { || GenHardCopyOfApp( win, app, dir, 0 ) }, hsmallfont, 0, -1, "" )

    win.pagecontrol( 9, "button", "&Back", 248, 179,  39, 10,  0, 0, { || win.PageDisplay( win.prevpage ) }, hsmallfont, 0, -1, "" )

	msgPopup( 0, "" )

	win.display( 1, 1 )
	win.ProcessEvents( )
	win.close( )

	fontDestroy( hsmallfont )
	fontDestroy( hMedFont )
	fontDestroy( hbigfont )
	fontDestroy( htitlefont )
	fontdestroy( hsysfont )

	return( 1 )

    CATCH ( err )
        msgDelay( 3000, "Error [" + err.errornum + "] at line #" + err.errorline + " (" + ErrorAsText( err.errornum ) + ")" )
		return( 0 )
    END

END