 $(document).ready(function() {
	
	 $('#calc_mapform').validate({
		   showErrors: function(errorMap, errorList) {
				$("#calc_form_errors").html("<strong>Cost of bike and Salary before Tax are required</strong>");
			},
			onsubmit: true
		 });
	 
	 $('#calc_form_errors').hide();
	 	 
	 $('#tt_caveat').tooltip({ 
		    bodyHandler: function() { 
		        return '<div class="popupcontent"><img src="/images/popup_logo.gif" alt="logo" width="120" height="51" /><p>Savings displayed here are for illustration only. If you don\'t enter an employer code, your calculation will not include information such as finance charges and your actual savings may be lower.</p></div>'; 
		    }, 
		    showURL: false 
		});
	 
	 $('#tt_empl_code').tooltip({ 
	    bodyHandler: function() { 
	        return '<div class="popupcontent"><img src="/images/popup_logo.gif" alt="logo" width="120" height="51" /><p>If your employer is already signed up with Cyclescheme, they will have a unique  five or six figure code, eg: <strong>abc12 </strong>or<strong> 123def</strong>. </p><p>Talk to your HR or Cyclescheme representative to get the code (it may appear on your posters and leaflets), and enter it  here to get a more accurate calculation of your savings, including any finance charges. If you don\'t enter an employer code,  your actual savings will be different to the calculations shown here.</p></div>'; 
	    }, 
	    showURL: false 
	});
	 
	 $('#tt_out_salary').tooltip({ 
		    bodyHandler: function() { 
		        return '<div class="popupcontent"><img src="/images/popup_logo.gif" alt="logo" width="120" height="51" /><p>Enter your current total gross salary sacrifice outgoings (eg childcare vouchers, pension, other benefits from gross salary) in this box, so we can adjust your gross wage. Use whatever time period you\'ve entered in the \'pay fequency\' box above.</p></div>'; 
		    }, 
		    showURL: false 
		}); 
	 
	 $('#tt_county').tooltip({ 
		    bodyHandler: function() { 
		        return '<div class="popupcontent"><img src="/images/popup_logo.gif" alt="logo" width="120" height="51" /><p>We have over 20 partner stores across Ireland. Let us know your county and we\'ll search for your nearest partners, and display them on the calculation page.</p></div>'; 
		    }, 
		    showURL: false 
		}); 

	 $('#tt_post_code').tooltip({ 
		    bodyHandler: function() { 
		        return '<div class="popupcontent"><img src="/images/popup_logo.gif" alt="logo" width="120" height="51" /><p>We have over 1,200 partner stores across the UK. Let us know your postcode and we\'ll search for your nearest partners, and display them on the calculation page.</p></div>'; 
		    }, 
		    showURL: false 
		}); 

	 $('#tt_empl_vat').tooltip({ 
		    bodyHandler: function() { 
		        return '<div class="popupcontent"><img src="/images/popup_logo.gif" alt="logo" width="120" height="51" /><p>Some employers - for example NHS trusts, charities and some financial institutions - cannot claim back VAT, and so cannot pass the VAT saving on to you. Your savings under the scheme will be reduced. If you enter an employer code, the VAT status will be set automatically.</p></div>'; 
		    }, 
		    showURL: false 
		}); 
	 
	 $('#tt_nmw_age, #tt_nmw_hours, #tt_nmw_weeks').tooltip({ 
		    bodyHandler: function() { 
		        return '<div class="popupcontent"><img src="/images/popup_logo.gif" alt="logo" width="120" height="51" /><p>As part of our HRMC compliance we need to check that any salary sacrifice won\'t take you below the National Minimum Wage if you\'re paid by the hour, or less than '+ currency_symbol +'13,000 per annum. This is dependent on your age and how many hours you work, so we need you to provide this information.</p></div> '; 
		    }, 
		    showURL: false 
		}); 
	 
	 
 });
	


function updateCalcForm(){
				if($("#NMWOptions").css("display")=="none" || ($("#gross_salary").val() != "" && $("#gross_salary").val()<13000)){
					$("#NMWOptions").show();
				}
				else{
					$("#NMWOptions").hide();
				}
}


