// JavaScript Document var xmlhttp var str_section_1_txt var str_section_2_txt var str_section_3_txt var str_section_4_txt var str_section_5_txt var str_response_code var int_wages_new_hires var int_wages_salary var int_wages_total_salary var int_wages_total_subsidy var bln_qstnflg_province = new Boolean(false); var bln_qstnflg_revenue = new Boolean(false); var bln_qstnflg_jobs = new Boolean(false); var bln_qstnflg_sector = new Boolean(false); var bln_qstnflg_atlantic = new Boolean(false); var bln_qstnflg_northont = new Boolean(false); var bln_prgrmflg_csbf = new Boolean(false); var bln_prgrmflg_fednor = new Boolean(false); var bln_prgrmflg_acoa = new Boolean(false); var bln_prgrmflg_wages = new Boolean(false); var bln_prgrmflg_reif = new Boolean(false); function showlinks(str) { if (str.length==0) { MsgBox("Error"); return; } xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Your browser does not support XMLHTTP!"); return; } reset_flags(); if ((str.indexOf("location")) == 0) { str_province = str.substr(9) if (str_province == "ontario") { str_province = format_province_name(str_province); str_section_1_txt = display_selected_province("Ontario"); str_section_2_txt = display_ontario_north_section_1(); document.getElementById("section_1").innerHTML= str_section_1_txt; document.getElementById("section_2").innerHTML= str_section_2_txt; } else { str_province = format_province_name(str_province); str_section_1_txt = display_selected_province(str_province); str_section_2_txt = display_revenue_section_2(); document.getElementById("section_1").innerHTML= str_section_1_txt; document.getElementById("section_2").innerHTML= str_section_2_txt; } } else if(str.indexOf("sublocation") == 0) { str_province_sublocation = format_ontario_sublocation(str); str_province = str_province + " - " + str_province_sublocation; str_section_1_txt = display_selected_province(str_province); str_section_2_txt = display_revenue_section_2(); document.getElementById("section_1").innerHTML= str_section_1_txt; document.getElementById("section_2").innerHTML= str_section_2_txt; } else if(str.indexOf("revenue") == 0) { str_revenue = str.substr(8); str_section_2_txt = display_selected_revenue(str_revenue); str_section_3_txt = display_jobs_section_3(); document.getElementById("section_2").innerHTML= str_section_2_txt; document.getElementById("section_3").innerHTML= str_section_3_txt; } else if(str.indexOf("jobs") == 0) { str_jobs = str.substr(5); if(str_jobs == 'yes'){ str_section_3_txt = display_selected_jobs(str_jobs); str_section_4_txt = display_wage_calculation_section_4(); document.getElementById("section_3").innerHTML= str_section_3_txt; document.getElementById("section_4").innerHTML= str_section_4_txt; } else{ str_section_3_txt = display_selected_jobs(str_jobs); str_section_4_txt = display_sector_section_4(); document.getElementById("section_3").innerHTML= str_section_3_txt; document.getElementById("section_4").innerHTML= str_section_4_txt; } } else if(str.indexOf("wages") == 0) { str_section_3_txt = format_wages_selected(str_jobs); str_section_4_txt = display_sector_section_4(); document.getElementById("section_3").innerHTML= str_section_3_txt; document.getElementById("section_4").innerHTML= str_section_4_txt; } else if(str.indexOf("sector") == 0) { str_sector = str.substr(7); str_section_4_txt = display_selected_sector(str_sector); calculate_results(str_province, str_revenue, str_jobs, str_sector); str_section_5_txt = display_results_section_5(); document.getElementById("section_4").innerHTML= str_section_4_txt; document.getElementById("section_5").innerHTML= str_section_5_txt; } /* -- -- These are the reverse functions. They allow the user to 'go back' in the questions and reselect -- answers already input. -- */ if (str == 'selected_province') { reset_flags(); display_default_section_1() document.getElementById("section_1").innerHTML= str_section_1_txt; document.getElementById("section_2").innerHTML=""; document.getElementById("section_3").innerHTML=""; document.getElementById("section_4").innerHTML=""; document.getElementById("section_5").innerHTML=""; } if (str == 'selected_revenue') { reset_flags(); str_section_1_txt = display_selected_province(str_province); str_section_2_txt = display_revenue_section_2(); document.getElementById("section_1").innerHTML= str_section_1_txt; document.getElementById("section_2").innerHTML= str_section_2_txt; document.getElementById("section_3").innerHTML=""; document.getElementById("section_4").innerHTML=""; document.getElementById("section_5").innerHTML=""; } if (str == 'selected_jobs') { reset_flags(); int_wages_new_hires = 0; int_wages_salary = 0; int_wages_total_salary = 0; int_wages_total_subsidy = 0; str_section_1_txt = display_selected_province(str_province); str_section_2_txt = display_selected_revenue(str_revenue); str_section_3_txt = display_jobs_section_3(); document.getElementById("section_1").innerHTML= str_section_1_txt; document.getElementById("section_2").innerHTML= str_section_2_txt; document.getElementById("section_3").innerHTML= str_section_3_txt; document.getElementById("section_4").innerHTML=""; document.getElementById("section_5").innerHTML=""; } if (str == 'selected_sector') { reset_flags(); str_section_1_txt = display_selected_province(str_province); str_section_2_txt = display_selected_revenue(str_revenue); str_section_3_txt = display_selected_jobs(str_jobs); str_section_4_txt = display_sector_section_4(); document.getElementById("section_1").innerHTML= str_section_1_txt; document.getElementById("section_2").innerHTML= str_section_2_txt; document.getElementById("section_3").innerHTML= str_section_3_txt; document.getElementById("section_4").innerHTML= str_section_4_txt; document.getElementById("section_5").innerHTML=""; } //var url="gethint.php"; //url=wizard.html //url+"?q="+str; // url=url+"&sid="+Math.random(); //xmlhttp.onreadystatechange=stateChanged; //xmlhttp.open("GET",url,true); //xmlhttp.send(null); }//end of function showlinks() function calculate_results(str_province, str_revenue, str_jobs, str_sector) { /* -- -- Switch statesment set boolean flags as appropriate to each program based on user responses -- */ switch(str_province){ case 'Ontario - Northern Ontario': bln_qstnflg_province = true; bln_qstnflg_northont = true; break; case 'Ontario - Eastern Ontario': case 'Ontario - Southern Ontario': case 'Ontario - Western Ontario': case 'Manitoba': case 'Alberta': case 'British Columbia': case 'Northwest Territories': case 'Nunavut': case 'Quebec': case 'Saskatchewan': case 'Yukon': bln_qstnflg_province = true; break; case 'Nova Scotia': case 'New Brunswick': case 'Newfoundland & Labrador': case 'Prince Edward Island': bln_qstnflg_province = true; bln_qstnflg_atlantic = true; break; } switch(str_revenue){ case 'startup': case 'sme': bln_qstnflg_revenue = true; break; case 'large': bln_qstnflg_revenue = false; break; } switch(str_jobs){ case 'yes': bln_qstnflg_jobs = true; break; case 'notsure': case 'no': bln_qstnflg_jobs = false; break; } switch(str_sector){ case 'retail': case 'wholesale': case 'realestate': case 'personal': case 'entertainment': bln_qstnflg_sector = false; break; case 'other': bln_qstnflg_sector = true; break; } /* -- -- Determines if the individual is eligible for the programs based on their responses and sets flag variables -- */ if (bln_qstnflg_province == true){ if (bln_qstnflg_sector == true){ if (bln_qstnflg_atlantic == true){ bln_prgrmflg_acoa = true; // ACOA Business Development Program str_response_code = str_response_code + "-04"; } else if(str_province == 'Quebec'){ bln_prgrmflg_reif = true; // Regional Economic Intervention Fund Program str_response_code = str_response_code + "-06"; } } if (bln_qstnflg_jobs == true){ bln_prgrmflg_wages = true; // Wage Subsidies Program str_response_code = str_response_code + "-03"; if (bln_qstnflg_revenue == true){ bln_prgrmflg_csbf = true; // Canadian Small Business Financing str_response_code = str_response_code + "-01"; } } if (bln_qstnflg_northont == true){ if (bln_qstnflg_revenue == true){ bln_prgrmflg_fednor = true; // FedNor str_response_code = str_response_code + "-02"; } } } } // End of calculate_results Function function reset_flags(){ bln_qstnflg_province = false; bln_qstnflg_revenue = false; bln_qstnflg_jobs = false; bln_qstnflg_sector = false; bln_qstnflg_atlantic = false; bln_qstnflg_northont = false; bln_prgrmflg_csbf = false; bln_prgrmflg_fednor = false; bln_prgrmflg_acoa = false; bln_prgrmflg_wages = false; bln_prgrmflg_reif = false; str_response_code = "00"; }//end of function reset_flags() function stateChanged() { if (xmlhttp.readyState==4) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } }//end of function stateChanged() function GetXmlHttpObject() { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari return new XMLHttpRequest(); } if (window.ActiveXObject) { // code for IE6, IE5 return new ActiveXObject("Microsoft.XMLHTTP"); } return null; }//end of function GetXmlHttpObject() function noenter() { return !(window.event && window.event.keyCode == 13); }//end of function noenter() function calculate_wages(str_wages_new_hires, str_wages_salary) { if (isNaN(str_wages_salary) == true) { alert("Please only use numbers and a period when entering the number"); showlinks("jobs_yes"); } else { int_wages_new_hires = str_wages_new_hires; int_wages_salary = parseFloat(str_wages_salary); int_wages_total_salary = int_wages_new_hires * int_wages_salary * 1820 // Avg 35 hrs per week for 52 weeks per new hire int_wages_total_subsidy = int_wages_total_salary * 0.60 // Maximum subsidy for Targeted Wage Subsidy Program showlinks("wages"); } }//end of function calculate_wages() /* -- -- These are the input display functions. They generate the HTML to update the screen after each click. -- */ function display_default_section_1() { str_section_1_txt="

1. Your business is (will be) located in:

\
\

\
\
\
\
\
\
\
\
\
\
\
\

\
"; }//end of function display_default_section_1() function display_ontario_north_section_1() { str_section_2_txt = "In:"; return str_section_2_txt; }//end of function display_ontario_north_section_1() function display_revenue_section_2() { str_section_2_txt="

2. During the last year was (or will) your revenue be greater or less than $5 million:

\
\

\
\
\

"; return str_section_2_txt; }//end of function display_revenue_section_2() function display_jobs_section_3() { str_section_3_txt="

3. Would you be open to hiring Employment Insurance recipients?

\
\

\
\
\

"; return str_section_3_txt; }//end of function display_jobs_section_3() function display_wage_calculation_section_4() { str_section_4_txt="

How many people would you look to hire?\ \
At what average hourly rate?\ CONTINUE"; return str_section_4_txt; }//end of function display_wage_calculation_section_4() function display_sector_section_4() { str_section_4_txt="

4. What kind of business is this?

\

\
\
\
\
\
"; return str_section_4_txt; }//end of function display_sector_section_4() function display_results_section_5() { var str_section_5_tmp = ""; if (bln_prgrmflg_csbf == true){ // Canadian Small Business Finance Program str_section_5_tmp = str_section_5_tmp + "

  • up to $250,000 in loans representing up to 90% of your project cost
  • "; } if (bln_prgrmflg_fednor == true){ // FedNor Program str_section_5_tmp = str_section_5_tmp + "
  • up to $500,000 in non-repayable grants, with a further $500,000 in repayable loans
  • "; } if (bln_prgrmflg_acoa == true){ // ACOA Program str_section_5_tmp = str_section_5_tmp + "
  • an unsecured, interest-free loan of up to $1,000,000
  • "; } if (bln_prgrmflg_wages == true){ // Targeted Wage Subsidies Program str_section_5_tmp = str_section_5_tmp + "
  • up to $" + format_currency(int_wages_total_subsidy) + " of your " + int_wages_new_hires + " new hires' combined salary of $" + format_currency(int_wages_total_salary) + "
  • "; } if (bln_prgrmflg_reif == true){ // Regional Economic Intervention Fund Program str_section_5_tmp = str_section_5_tmp + "
  • up to $500,000 of equity investment, depending on your location in Quebec
  • "; } // test to see if str_section_5_tmp = is NULL -> add 'you aren't entitled to anything' else display results if (str_section_5_tmp == ""){ str_section_5_txt="

    Based on your responses above, you may be eligible to apply to government funding programmes.

    For details, please contact our research staff at 1-800-481-7718, quoting reference code 7362.

    "; } else{ str_section_5_txt="

    Government assistance may be available for all these purposes if you meet the criteria.

    Based on your responses, you may be eligible to apply to government programmes that could give you:\

    For details, please contact our research staff at 1-800-481-7718, quoting reference code: " + str_response_code + "

    "; } str_section_5_txt = '

    Results

    ' + str_section_5_txt + '
    '; return str_section_5_txt; }//end of function display_results_section_5() /* -- -- These are the selected information display functions. They generate the HTML to update the screen after -- has been selected by the user for the previous section. -- */ function display_selected_province(str_province) { str_section_1_txt= '

    1. Your business is (will be) located in: ' + str_province + ' EDIT

    '; return str_section_1_txt; }//end of function display_selected_province() function display_selected_revenue(str_revenue) { str_revenue = format_revenue(str_revenue); str_section_2_txt='

    2. Your business is a ' + str_revenue + ' EDIT

    '; return str_section_2_txt; }//end of function display_selected_revenue() function display_selected_jobs(str_jobs) { str_jobs = format_jobs(str_jobs); str_section_3_txt='

    3. You are ' + str_jobs + ' employing people on Employment Insurance EDIT

    '; return str_section_3_txt; }//end of function display_selected_jobs() function display_selected_sector(str_sector) { str_sector = format_sector(str_sector); str_section_4_txt='

    4. Your business is in ' + str_sector + ' EDIT

    '; return str_section_4_txt; }//end of function display_selected_sector() function format_wages_selected() { if (int_wages_new_hires > 1) { hiresText = " people"; } else { hiresText = " person"; } str_section_3_txt='

    3. You are open to hiring ' + int_wages_new_hires + hiresText + ' on Employment Insurance EDIT

    '; return str_section_3_txt; }//end of function format_wages_selected() /* -- -- These are the format functions. They change the input variables into different formats. -- */ function format_province_name(str_province) { switch(str_province){ case 'ontario': str_province = "Ontario"; break; case 'ontario_north': str_province = "Northern Ontario"; break; case 'ontario_east': str_province = "Eastern Ontario"; break; case 'ontario_south': str_province = "Southern Ontario"; break; case 'ontario_west': str_province = "Western Ontario"; break; case 'manitoba': str_province = "Manitoba"; break; case 'alberta': str_province = "Alberta"; break; case 'british_columbia': str_province = "British Columbia"; break; case 'new_brunswick': str_province = "New Brunswick"; break; case 'newfoundland_&_labrador': str_province = "Newfoundland & Labrador"; break; case 'northwest_territories': str_province = "Northwest Territories"; break; case 'nova_scotia': str_province = "Nova Scotia"; break; case 'nunavut': str_province = "Nunavut"; break; case 'prince_edward_island': str_province = "Prince Edward Island"; break; case 'quebec': str_province = "Quebec"; break; case 'saskatchewan': str_province = "Saskatchewan"; break; case 'yukon': str_province = "Yukon"; break; } return str_province; }//end of function format_province_name() function format_ontario_sublocation(str_province_sublocation) { switch(str_province_sublocation){ case 'sublocation_ontario_north': str_province_sublocation = "Northern Ontario"; break; case 'sublocation_ontario_east': str_province_sublocation = "Eastern Ontario"; break; case 'sublocation_ontario_south': str_province_sublocation = "Southern Ontario"; break; case 'sublocation_ontario_west': str_province_sublocation = "Western Ontario"; break; } return str_province_sublocation; }//end of function format_ontario_sublocation() function format_revenue(str_revenue) { switch(str_revenue){ case 'startup': str_revenue = "Startup Company"; break; case 'sme': str_revenue = "Small-Medium Enterprise"; break; case 'large': str_revenue = "Large Corporate Entity"; break; } return str_revenue; }//end of function format_revenue() function format_jobs(str_jobs) { switch(str_jobs){ case 'yes': str_jobs = "open to"; break; case 'no': str_jobs = "not open to"; break; case 'notsure': str_jobs = "not sure about"; break; } return str_jobs; }//end of function format_jobs() function format_sector(str_sector) { switch(str_sector){ case 'retail': str_sector = "Retail"; break; case 'wholesale': str_sector = "Wholesale"; break; case 'realestate': str_sector = "Real Estate"; break; case 'personal': str_sector = "Personal Services"; break; case 'entertainment': str_sector = "Entertainment Services"; break; case 'other': str_sector = "another Sector / Not Sure"; break; } return str_sector; }// end of function format_sector() function format_currency(str_amount) // Function stolen from http://www.web-source.net/web_development/currency_formatting.htm { var i = parseFloat(str_amount); if(isNaN(i)) { i = 0.00; } var minus = ''; if(i < 0) { minus = '-'; } i = Math.abs(i); i = parseInt((i + .005) * 100); i = i / 100; s = new String(i); if(s.indexOf('.') < 0) { s += '.00'; } if(s.indexOf('.') == (s.length - 2)) { s += '0'; } s = minus + s; s = CommaFormatted(s); // Seperates large numbers with commas return s; }// end of function CurrencyFormatted() function CommaFormatted(amount) // Function stolen from http://www.web-source.net/web_development/currency_formatting.htm { var delimiter = ","; var a = amount.split('.',2) var d = a[1]; var i = parseInt(a[0]); if(isNaN(i)) { return ''; } var minus = ''; if(i < 0) { minus = '-'; } i = Math.abs(i); var n = new String(i); var a = []; while(n.length > 3) { var nn = n.substr(n.length-3); a.unshift(nn); n = n.substr(0,n.length-3); } if(n.length > 0) { a.unshift(n); } n = a.join(delimiter); if(d.length < 1) { amount = n; } else { amount = n + '.' + d; } amount = minus + amount; return amount; }// end of function CommaFormatted()