jQuery.noConflict();

jQuery(document).ready(function ($) {
		
		jQuery(".calc.tx-powermail-pi1_fieldset select option").each(function(index){
				var selectvalue = jQuery(this).val();
				var selecttext = jQuery(this).text();
				//jQuery(this).attr('rel') = selecttext;
				jQuery(this).attr('rel', selectvalue);
				jQuery(this).val(selecttext);
		});	
		
		jQuery("input.calc_betrag").css("font-weight","bold");
		
		jQuery("#tx-powermail-pi1_fieldset_238 select,#tx-powermail-pi1_fieldset_7 select,#tx-powermail-pi1_fieldset_223 select,#tx-powermail-pi1_fieldset_225 select,#tx-powermail-pi1_fieldset_227 select,#tx-powermail-pi1_fieldset_326 select,#tx-powermail-pi1_fieldset_168 select,#tx-powermail-pi1_fieldset_330 select,#tx-powermail-pi1_fieldset_195 select,#tx-powermail-pi1_fieldset_179 select").bind("change", calcpferdehaftpflicht);
		jQuery("#onlinerechner_238 select,#onlinerechner_7 select,#onlinerechner_223 select,#onlinerechner_225 select,#onlinerechner_227 select").bind("change", calcpferdehaftpflicht2);
		
		var containerhaft = jQuery("#tx-powermail-pi1_fieldset_238,#tx-powermail-pi1_fieldset_7,#tx-powermail-pi1_fieldset_223,#tx-powermail-pi1_fieldset_225,#tx-powermail-pi1_fieldset_227,#onlinerechner_7,#onlinerechner_223,#onlinerechner_225,#onlinerechner_227,#onlinerechner_238,#tx-powermail-pi1_fieldset_326,#tx-powermail-pi1_fieldset_168,#tx-powermail-pi1_fieldset_330,#tx-powermail-pi1_fieldset_195,#tx-powermail-pi1_fieldset_179");
		if (containerhaft.length > 0) {
			calcpferdehaftpflicht();
			calcpferdehaftpflicht2();																  
		}
		
		
		jQuery("#tx-powermail-pi1_fieldset_229 select,#tx-powermail-pi1_fieldset_231 select,#tx-powermail-pi1_fieldset_173 select,#tx-powermail-pi1_fieldset_165 select").bind("change", calcpferdeop);
		jQuery("#onlinerechner_229 select,#onlinerechner_231 select").bind("change", calcpferdeop2);
		
		var containerop = jQuery("#tx-powermail-pi1_fieldset_229,#tx-powermail-pi1_fieldset_231,#onlinerechner_229,#onlinerechner_231,#tx-powermail-pi1_fieldset_173,#tx-powermail-pi1_fieldset_165");
		if (containerop.length > 0) {
			calcpferdeop();
			calcpferdeop2();
		}
		
		jQuery("#tx-powermail-pi1_fieldset_236 select,#tx-powermail-pi1_fieldset_153 select").bind("change", calcpferdekranken);
		jQuery("#onlinerechner_236 select").bind("change", calcpferdekranken2);
		
		//if (!($(this).hasClass("selected"))
		var containerkranken = jQuery("#tx-powermail-pi1_fieldset_236,#onlinerechner_236,#tx-powermail-pi1_fieldset_153");
		if (containerkranken.length > 0) {
			calcpferdekranken();
			calcpferdekranken2();
		}
		
		jQuery("#tx-powermail-pi1_fieldset_240 select,#tx-powermail-pi1_fieldset_340 select").bind("change", calcpferdetransport);
		jQuery("#onlinerechner_240 select").bind("change", calcpferdetransport2);
		
		var containertransport = jQuery("#tx-powermail-pi1_fieldset_240,#onlinerechner_240,#tx-powermail-pi1_fieldset_340");
		if (containertransport.length > 0) {
			calcpferdetransport();
			calcpferdetransport2();
		}
		
		jQuery("#tx-powermail-pi1_fieldset_249 select").bind("change", calceinmaligpferdetransport);
		jQuery("#onlinerechner_249 select").bind("change", calceinmaligpferdetransport2);
		
		var containereinmalig = jQuery("#tx-powermail-pi1_fieldset_249,#onlinerechner_249");
		if (containereinmalig.length > 0) {
			calceinmaligpferdetransport();
			calceinmaligpferdetransport2();
		}
		
		jQuery("#tx-powermail-pi1_fieldset_258 select").bind("change", calctraechtigkeit);
		jQuery("#onlinerechner_258 select").bind("change", calctraechtigkeit2);
		
		var containertraechtigkeit = jQuery("#tx-powermail-pi1_fieldset_258,#onlinerechner_258");
		if (containertraechtigkeit.length > 0) {
			calctraechtigkeit();
			calctraechtigkeit2();
		}
		
		jQuery("#tx-powermail-pi1_fieldset_266 select").bind("change", calcpferdehaftpflicht);
		jQuery("#onlinerechner_266 select").bind("change", calcpferdehaftpflicht2);
		
		var containerprivathaftpflicht = jQuery("#tx-powermail-pi1_fieldset_266,#onlinerechner_266");
		if (containerprivathaftpflicht.length > 0) {
			calcpferdehaftpflicht();
			calcpferdehaftpflicht2();
		}
		
		jQuery("#tx-powermail-pi1_fieldset_275 select").bind("change", calcpferdehaftpflicht);
		jQuery("#onlinerechner_275 select").bind("change", calcpferdehaftpflicht2);
		
		var containerprivathaftpflicht2 = jQuery("#tx-powermail-pi1_fieldset_275,#onlinerechner_275");
		if (containerprivathaftpflicht2.length > 0) {
			calcpferdehaftpflicht();
			calcpferdehaftpflicht2();
		}
		
		jQuery("#tx-powermail-pi1_fieldset_282 select").bind("change", calcreittherapeuthaftpflicht);
		jQuery("#onlinerechner_282 select").bind("change", calcreittherapeuthaftpflicht2);
		
		var containertherapeuthaftpflicht = jQuery("#tx-powermail-pi1_fieldset_282,#onlinerechner_282");
		if (containertherapeuthaftpflicht.length > 0) {
			calcreittherapeuthaftpflicht();
			calcreittherapeuthaftpflicht2();
		}
		
		jQuery("#tx-powermail-pi1_fieldset_290 select").bind("change", calcpferdevollkasko);
		jQuery("#onlinerechner_290 select").bind("change", calcpferdevollkasko2);
		
		var containervollkasko = jQuery("#tx-powermail-pi1_fieldset_290,#onlinerechner_290");
		if (containervollkasko.length > 0) {
			calcpferdevollkasko();
			calcpferdevollkasko2();
		}
		
		jQuery("#tx-powermail-pi1_fieldset_299 select").bind("change", calcpferdevollkasko);
		jQuery("#onlinerechner_299 select").bind("change", calcpferdevollkasko2);
		
		var containervollkaskohund = jQuery("#tx-powermail-pi1_fieldset_299,#onlinerechner_299");
		if (containervollkaskohund.length > 0) {
			calcpferdevollkasko();
			calcpferdevollkasko2();
		}
		
		
		jQuery("#tx-powermail-pi1_fieldset_309 select,#tx-powermail-pi1_fieldset_336 select").bind("change", calcpferdekranken);
		jQuery("#onlinerechner_309 select").bind("change", calcpferdekranken2);
		
		//if (!($(this).hasClass("selected"))
		var containerlebens = jQuery("#tx-powermail-pi1_fieldset_309,#onlinerechner_309,#tx-powermail-pi1_fieldset_336");
		if (containerlebens.length > 0) {
			calcpferdekranken();
			calcpferdekranken2();
		}
		
		
		jQuery("#tx-powermail-pi1_fieldset_317 select").bind("change", calcreittherapeuthaftpflicht);
		jQuery("#onlinerechner_317 select").bind("change", calcreittherapeuthaftpflicht2);
		
		var containerbetriebshaftpflicht = jQuery("#tx-powermail-pi1_fieldset_317,#onlinerechner_317");
		if (containerbetriebshaftpflicht.length > 0) {
			calcreittherapeuthaftpflicht();
			calcreittherapeuthaftpflicht2();
		}
		
		jQuery("#tx-powermail-pi1_fieldset_345 select").bind("change", calcpferdehaftpflicht);
		jQuery("#onlinerechner_345 select").bind("change", calcpferdehaftpflicht2);
		
		var containerschulhaftpflicht = jQuery("#tx-powermail-pi1_fieldset_345,#onlinerechner_345");
		if (containerschulhaftpflicht.length > 0) {
			calcpferdehaftpflicht();
			calcpferdehaftpflicht2();
		}
		
		jQuery("#tx-powermail-pi1_fieldset_346 select").bind("change", calcpferdehaftpflicht);
		jQuery("#onlinerechner_346 select").bind("change", calcpferdehaftpflicht2);
		
		var containerschulhaftpflicht2 = jQuery("#tx-powermail-pi1_fieldset_346,#onlinerechner_346");
		if (containerschulhaftpflicht2.length > 0) {
			calcpferdehaftpflicht();
			calcpferdehaftpflicht2();
		}
	
});



function calcpferdeop(){
		
		//var grundsumme_array = jQuery("select.calc_grundsumme :selected").val().split("-");
		if(jQuery("fieldset.calc select.calc_zahlweise :selected").attr('rel')) {
			var zahlweisewert_array = jQuery("fieldset.calc select.calc_zahlweise :selected").attr('rel').split("-");
			var zahlweisewert_1 = zahlweisewert_array[0];
			var zahlweisewert_2 = zahlweisewert_array[1];
			var zahlweisetext = jQuery("fieldset.calc select.calc_zahlweise :selected").text();
		}
		
		jQuery("fieldset.calc input.calc_betrag").calc(
			// the equation to use for the calculation
			"(((((grundsumme * vfdwert) * selbstwert) * gotwert) * zahlweisewert_1) * zahlweisewert_2) * laufzeitwert",
			// define the variables used in the equation, these can be a jQuery object
			{
				grundsumme: jQuery("fieldset.calc .calc_anzahl :selected").attr('rel'),
				vfdwert: jQuery("fieldset.calc .calc_vfd :selected").attr('rel'),
				selbstwert: jQuery("fieldset.calc .calc_selbst :selected").attr('rel'),
				gotwert: jQuery("fieldset.calc .calc_got :selected").attr('rel'),
				zahlweisewert_1: zahlweisewert_1,
				zahlweisewert_2: zahlweisewert_2,
				laufzeitwert: jQuery("fieldset.calc .calc_laufzeit :selected").attr('rel')
				
			},
			
			// define the formatting callback, the results of the calculation are passed to this function
			function (s){
				// return the number as a dollar amount
				return s.toFixed(2);
			},
			// define the finish callback, this runs after the calculation has been complete
			function ($this){
				// sum the total of the $("[id^=total_item]") selector
				var sum = jQuery(this).sum();
				jQuery("fieldset.calc .calc_betrag").val(
					// round the results to 2 digits
					sum.toFixed(2) + " Euro " + zahlweisetext
				);
			}
		);
		
}

function calcpferdeop2(){
		
		//var grundsumme_array = jQuery("select.calc_grundsumme :selected").val().split("-");
		if(jQuery(".tx-powermailcalc-pi1 select.calc_zahlweise :selected").val()) {
			var zahlweisewert_array = jQuery(".tx-powermailcalc-pi1 select.calc_zahlweise :selected").val().split("-");
			var zahlweisewert_1 = zahlweisewert_array[0];
			var zahlweisewert_2 = zahlweisewert_array[1];
			var zahlweisetext = jQuery(".tx-powermailcalc-pi1 select.calc_zahlweise :selected").text();
		}
		
		jQuery(".tx-powermailcalc-pi1 input.calc_betrag").calc(
			// the equation to use for the calculation
			"(((((grundsumme * vfdwert) * selbstwert) * gotwert) * zahlweisewert_1) * zahlweisewert_2) * laufzeitwert",
			// define the variables used in the equation, these can be a jQuery object
			{
				grundsumme: jQuery(".tx-powermailcalc-pi1 .calc_anzahl :selected").val(),
				vfdwert: jQuery(".tx-powermailcalc-pi1 .calc_vfd :selected").val(),
				selbstwert: jQuery(".tx-powermailcalc-pi1 .calc_selbst :selected").val(),
				gotwert: jQuery(".tx-powermailcalc-pi1 .calc_got :selected").val(),
				zahlweisewert_1: zahlweisewert_1,
				zahlweisewert_2: zahlweisewert_2,
				laufzeitwert: jQuery(".tx-powermailcalc-pi1 .calc_laufzeit :selected").val()
				
			},
			
			// define the formatting callback, the results of the calculation are passed to this function
			function (s){
				// return the number as a dollar amount
				return s.toFixed(2);
			},
			// define the finish callback, this runs after the calculation has been complete
			function ($this){
				// sum the total of the $("[id^=total_item]") selector
				var sum = jQuery(this).sum();
				jQuery(".tx-powermailcalc-pi1 .calc_betrag").val(
					// round the results to 2 digits
					sum.toFixed(2) + " Euro " + zahlweisetext
				);
			}
		);
		
		selectHiddenInputs();
		
}

function calcpferdehaftpflicht(){
		
		
		var zahlweisetext = jQuery("fieldset.calc select.calc_zahlweise :selected").text();
		
		jQuery("fieldset.calc input.calc_betrag").calc(
			// the equation to use for the calculation
			"(grundsumme * verssum * selbstwert * zahlweise * laufzeitwert) * 1.19",
			// define the variables used in the equation, these can be a jQuery object
			{
				grundsumme: jQuery("fieldset.calc .calc_anzahl :selected").attr('rel'),
				verssum: jQuery("fieldset.calc .calc_versum :selected").attr('rel'),
				selbstwert: jQuery("fieldset.calc .calc_selbst :selected").attr('rel'),
				zahlweise: jQuery("fieldset.calc select.calc_zahlweise :selected").attr('rel'),
				laufzeitwert: jQuery("fieldset.calc .calc_laufzeit :selected").attr('rel')
				
			},
			
			// define the formatting callback, the results of the calculation are passed to this function
			function (s){
				// return the number as a dollar amount
				return s.toFixed(2);
			},
			// define the finish callback, this runs after the calculation has been complete
			function ($this){
				// sum the total of the $("[id^=total_item]") selector
				var sum = jQuery(this).sum();
				jQuery("fieldset.calc .calc_betrag").val(
					// round the results to 2 digits
					sum.toFixed(2) + " Euro " + zahlweisetext
				);
			}
		);
		
}

function calcpferdehaftpflicht2(){
		//var currentform = selectedForm;
		//jQuery("form.tx_powermail_pi1_form").each(function(index){
		//			selectedForm = jQuery(this).attr('id');
		//			calcpferdehaftpflicht2(selectedForm);															  
		//	});
		//var currentform = jQuery(this).attr('id');
		
		//var zahlweisetext = jQuery(".tx-powermailcalc-pi1 select.calc_zahlweise :selected").text();
		
		jQuery(".tx-powermailcalc-pi1 form.tx_powermail_pi1_form").each(function(index){
		
		var currentform = jQuery(this).attr('id');
		var zahlweisetext = jQuery('#'+currentform+' select.calc_zahlweise :selected').text();
		
		jQuery('#'+currentform+' input.calc_betrag').calc(
			// the equation to use for the calculation
			"(grundsumme * verssum * selbstwert * zahlweise * laufzeitwert) * 1.19",
			// define the variables used in the equation, these can be a jQuery object
			{
				grundsumme: jQuery('#'+currentform+' select.calc_anzahl :selected').val(),
				verssum: jQuery('#'+currentform+' select.calc_versum :selected').val(),
				selbstwert: jQuery('#'+currentform+' select.calc_selbst :selected').val(),
				zahlweise: jQuery('#'+currentform+' select.calc_zahlweise :selected').val(),
				laufzeitwert: jQuery('#'+currentform+' select.calc_laufzeit :selected').val()
				
			},
			
			// define the formatting callback, the results of the calculation are passed to this function
			function (s){
				// return the number as a dollar amount
				return s.toFixed(2);
			},
			// define the finish callback, this runs after the calculation has been complete
			function ($this){
				// sum the total of the $("[id^=total_item]") selector
				var sum = jQuery(this).sum();
				jQuery('#'+currentform+' input.calc_betrag').val(
					// round the results to 2 digits
					sum.toFixed(2) + " Euro " + zahlweisetext
				);
			}
		);
		
		});
		selectHiddenInputs();
}
		
function calcpferdekranken(){
		
		
		var zahlweisetext = jQuery("fieldset.calc select.calc_zahlweise :selected").text();
		
		//var grundsumme_array = jQuery("select.calc_grundsumme :selected").val().split("-");
		if(jQuery("fieldset.calc select.calc_zahlweise :selected").attr('rel')) {
			var zahlweisewert_array = jQuery("fieldset.calc select.calc_zahlweise :selected").attr('rel').split("-");
			var zahlweisewert_1 = zahlweisewert_array[0];
			var zahlweisewert_2 = zahlweisewert_array[1];
		}
		
		jQuery("fieldset.calc input.calc_betrag").calc(
			// the equation to use for the calculation
			"(grundsumme * verssum * laufzeitwert) * (zahlweisewert1 * zahlweisewert2)",
			// define the variables used in the equation, these can be a jQuery object
			{
				grundsumme: jQuery("fieldset.calc .calc_anzahl :selected").attr('rel'),
				verssum: jQuery("fieldset.calc .calc_versum :selected").attr('rel'),
				//zahlweise: jQuery("fieldset.calc select.calc_zahlweise :selected").attr('rel'),
				zahlweisewert1: zahlweisewert_1,
				zahlweisewert2: zahlweisewert_2,
				laufzeitwert: jQuery("fieldset.calc .calc_laufzeit :selected").attr('rel')
				
			},
			
			// define the formatting callback, the results of the calculation are passed to this function
			function (s){
				// return the number as a dollar amount
				return s.toFixed(2);
			},
			// define the finish callback, this runs after the calculation has been complete
			function ($this){
				// sum the total of the $("[id^=total_item]") selector
				var sum = jQuery(this).sum();
				jQuery("fieldset.calc .calc_betrag").val(
					// round the results to 2 digits
					sum.toFixed(2) + " Euro " + zahlweisetext
				);
			}
		);
		
}

function calcpferdekranken2(){
		
		
		var zahlweisetext = jQuery(".tx-powermailcalc-pi1 select.calc_zahlweise :selected").text();
		
		//var grundsumme_array = jQuery("select.calc_grundsumme :selected").val().split("-");
		if(jQuery(".tx-powermailcalc-pi1 select.calc_zahlweise :selected").val()) {
			var zahlweisewert_array = jQuery(".tx-powermailcalc-pi1 select.calc_zahlweise :selected").val().split("-");
			var zahlweisewert_1 = zahlweisewert_array[0];
			var zahlweisewert_2 = zahlweisewert_array[1];
		}
		
		jQuery(".tx-powermailcalc-pi1 input.calc_betrag").calc(
			// the equation to use for the calculation
			"(grundsumme * verssum * laufzeitwert) * (zahlweisewert1 * zahlweisewert2)",
			// define the variables used in the equation, these can be a jQuery object
			{
				grundsumme: jQuery(".tx-powermailcalc-pi1 .calc_anzahl :selected").val(),
				verssum: jQuery(".tx-powermailcalc-pi1 .calc_versum :selected").val(),
				//zahlweise: jQuery("fieldset.calc select.calc_zahlweise :selected").attr('rel'),
				zahlweisewert1: zahlweisewert_1,
				zahlweisewert2: zahlweisewert_2,
				laufzeitwert: jQuery(".tx-powermailcalc-pi1 .calc_laufzeit :selected").val()
				
			},
			
			// define the formatting callback, the results of the calculation are passed to this function
			function (s){
				// return the number as a dollar amount
				return s.toFixed(2);
			},
			// define the finish callback, this runs after the calculation has been complete
			function ($this){
				// sum the total of the $("[id^=total_item]") selector
				var sum = jQuery(this).sum();
				jQuery(".tx-powermailcalc-pi1 .calc_betrag").val(
					// round the results to 2 digits
					sum.toFixed(2) + " Euro " + zahlweisetext
				);
			}
		);
		
		selectHiddenInputs();
		
}

function calcpferdetransport(){
		
		
		var zahlweisetext = jQuery("fieldset.calc select.calc_zahlweise :selected").text();
		
		//var grundsumme_array = jQuery("select.calc_grundsumme :selected").val().split("-");
		if(jQuery("fieldset.calc select.calc_zahlweise :selected").attr('rel')) {
			var zahlweisewert_array = jQuery("fieldset.calc select.calc_zahlweise :selected").attr('rel').split("-");
			var zahlweisewert_1 = zahlweisewert_array[0];
			var zahlweisewert_2 = zahlweisewert_array[1];
		}
		
		jQuery("fieldset.calc input.calc_betrag").calc(
			// the equation to use for the calculation
			"(grundsumme * laufzeitwert) * (zahlweisewert1 * zahlweisewert2)",
			// define the variables used in the equation, these can be a jQuery object
			{
				grundsumme: jQuery("fieldset.calc .calc_anzahl :selected").attr('rel'),
				zahlweisewert1: zahlweisewert_1,
				zahlweisewert2: zahlweisewert_2,
				laufzeitwert: jQuery("fieldset.calc .calc_laufzeit :selected").attr('rel')
				
			},
			
			// define the formatting callback, the results of the calculation are passed to this function
			function (s){
				// return the number as a dollar amount
				return s.toFixed(2);
			},
			// define the finish callback, this runs after the calculation has been complete
			function ($this){
				// sum the total of the $("[id^=total_item]") selector
				var sum = jQuery(this).sum();
				jQuery("fieldset.calc .calc_betrag").val(
					// round the results to 2 digits
					sum.toFixed(2) + " Euro " + zahlweisetext
				);
			}
		);
		
}


function calcpferdetransport2(){
		
		
		var zahlweisetext = jQuery(".tx-powermailcalc-pi1 select.calc_zahlweise :selected").text();
		
		//var grundsumme_array = jQuery("select.calc_grundsumme :selected").val().split("-");
		if(jQuery(".tx-powermailcalc-pi1 select.calc_zahlweise :selected").val()) {
			var zahlweisewert_array = jQuery(".tx-powermailcalc-pi1 select.calc_zahlweise :selected").val().split("-");
			var zahlweisewert_1 = zahlweisewert_array[0];
			var zahlweisewert_2 = zahlweisewert_array[1];
		}
		
		jQuery(".tx-powermailcalc-pi1 input.calc_betrag").calc(
			// the equation to use for the calculation
			"(grundsumme * laufzeitwert) * (zahlweisewert1 * zahlweisewert2)",
			// define the variables used in the equation, these can be a jQuery object
			{
				grundsumme: jQuery(".tx-powermailcalc-pi1 .calc_anzahl :selected").val(),
				zahlweisewert1: zahlweisewert_1,
				zahlweisewert2: zahlweisewert_2,
				laufzeitwert: jQuery(".tx-powermailcalc-pi1 .calc_laufzeit :selected").val()
				
			},
			
			// define the formatting callback, the results of the calculation are passed to this function
			function (s){
				// return the number as a dollar amount
				return s.toFixed(2);
			},
			// define the finish callback, this runs after the calculation has been complete
			function ($this){
				// sum the total of the $("[id^=total_item]") selector
				var sum = jQuery(this).sum();
				jQuery(".tx-powermailcalc-pi1 .calc_betrag").val(
					// round the results to 2 digits
					sum.toFixed(2) + " Euro " + zahlweisetext
				);
			}
		);
		
		selectHiddenInputs();
}



function calceinmaligpferdetransport(){
		
		if(jQuery("#tx-powermail-pi1_fieldset_249 select.calc_vers :selected").attr('rel')) {
			var grundsumme_array = jQuery("#tx-powermail-pi1_fieldset_249 select.calc_vers :selected").attr('rel').split("-");
			var grundsumme_bis = grundsumme_array[0];
			var grundsumme_uber = grundsumme_array[1];
			var diebstahl = grundsumme_array[2];
		}
		
		if(jQuery("#tx-powermail-pi1_fieldset_249 select.calc_entfernung :selected").attr('rel') == 1) {
			var grundsumme_cur = grundsumme_bis;
		} else {
			var grundsumme_cur = grundsumme_uber;
		}
		
		if(jQuery("#tx-powermail-pi1_fieldset_249 select.calc_diebstahl :selected").attr('rel') == 1) {
			var diebstahl_cur = 0;
		} else {
			var diebstahl_cur = diebstahl;
		}
		
		
		jQuery("fieldset.calc input.calc_betrag").calc(
			// the equation to use for the calculation
			"(grundsumme + diebstahl)",
			// define the variables used in the equation, these can be a jQuery object
			{
				grundsumme: grundsumme_cur,
				diebstahl: diebstahl_cur
				
			},
			
			// define the formatting callback, the results of the calculation are passed to this function
			function (s){
				// return the number as a dollar amount
				return s.toFixed(2);
			},
			// define the finish callback, this runs after the calculation has been complete
			function ($this){
				// sum the total of the $("[id^=total_item]") selector
				var sum = jQuery(this).sum();
				jQuery("fieldset.calc .calc_betrag").val(
					// round the results to 2 digits
					sum.toFixed(2) + " Euro "
				);
			}
		);
		
}

function calceinmaligpferdetransport2(){
		
		
		//var zahlweisetext = jQuery("fieldset.calc select.calc_zahlweise :selected").text();
		
		//var grundsumme_array = jQuery("select.calc_grundsumme :selected").val().split("-");
		if(jQuery(".tx-powermailcalc-pi1 select.calc_vers :selected").val()) {
			var grundsumme_array = jQuery(".tx-powermailcalc-pi1 select.calc_vers :selected").val().split("-");
			var grundsumme_bis = grundsumme_array[0];
			var grundsumme_uber = grundsumme_array[1];
			var diebstahl = grundsumme_array[2];
		}
		
		if(jQuery(".tx-powermailcalc-pi1 select.calc_entfernung :selected").val() == 1) {
			var grundsumme_cur = grundsumme_bis;
		} else {
			var grundsumme_cur = grundsumme_uber;
		}
		
		if(jQuery(".tx-powermailcalc-pi1 select.calc_diebstahl :selected").val() == 1) {
			var diebstahl_cur = 0;
		} else {
			var diebstahl_cur = diebstahl;
		}
		
		
		jQuery(".tx-powermailcalc-pi1 input.calc_betrag").calc(
			// the equation to use for the calculation
			"(grundsumme + diebstahl)",
			// define the variables used in the equation, these can be a jQuery object
			{
				grundsumme: grundsumme_cur,
				diebstahl: diebstahl_cur
				
			},
			
			// define the formatting callback, the results of the calculation are passed to this function
			function (s){
				// return the number as a dollar amount
				return s.toFixed(2);
			},
			// define the finish callback, this runs after the calculation has been complete
			function ($this){
				// sum the total of the $("[id^=total_item]") selector
				var sum = jQuery(this).sum();
				jQuery(".tx-powermailcalc-pi1 .calc_betrag").val(
					// round the results to 2 digits
					sum.toFixed(2) + " Euro "
				);
			}
		);
		
		selectHiddenInputs();
}



function calctraechtigkeit(){
		
		if(jQuery("#tx-powermail-pi1_fieldset_258 select.calc_vers :selected").attr('rel')) {
			var grundsumme_array = jQuery("#tx-powermail-pi1_fieldset_258 select.calc_vers :selected").attr('rel').split("-");
			var grundsumme_1 = grundsumme_array[0];
			var grundsumme_2 = grundsumme_array[1];
		}
		
		if(jQuery("#tx-powermail-pi1_fieldset_258 select.calc_erstling :selected").attr('rel') == 1) {
			var grundsumme_cur = grundsumme_1;
		} else {
			var grundsumme_cur = grundsumme_2;
		}
		
		
		
		jQuery("fieldset.calc input.calc_betrag").calc(
			// the equation to use for the calculation
			"(grundsumme)",
			// define the variables used in the equation, these can be a jQuery object
			{
				grundsumme: grundsumme_cur
				
			},
			
			// define the formatting callback, the results of the calculation are passed to this function
			function (s){
				// return the number as a dollar amount
				return s.toFixed(2);
			},
			// define the finish callback, this runs after the calculation has been complete
			function ($this){
				// sum the total of the $("[id^=total_item]") selector
				var sum = jQuery(this).sum();
				jQuery("fieldset.calc .calc_betrag").val(
					// round the results to 2 digits
					sum.toFixed(2) + " Euro "
				);
			}
		);
		
}


function calctraechtigkeit2(){
		
		if(jQuery(".tx-powermailcalc-pi1 select.calc_vers :selected").val()) {
			var grundsumme_array = jQuery(".tx-powermailcalc-pi1 select.calc_vers :selected").val().split("-");
			var grundsumme_1 = grundsumme_array[0];
			var grundsumme_2 = grundsumme_array[1];
		}
		
		if(jQuery(".tx-powermailcalc-pi1 select.calc_erstling :selected").val() == 1) {
			var grundsumme_cur = grundsumme_1;
		} else {
			var grundsumme_cur = grundsumme_2;
		}
		
		
		
		jQuery(".tx-powermailcalc-pi1 input.calc_betrag").calc(
			// the equation to use for the calculation
			"(grundsumme)",
			// define the variables used in the equation, these can be a jQuery object
			{
				grundsumme: grundsumme_cur
				
			},
			
			// define the formatting callback, the results of the calculation are passed to this function
			function (s){
				// return the number as a dollar amount
				return s.toFixed(2);
			},
			// define the finish callback, this runs after the calculation has been complete
			function ($this){
				// sum the total of the $("[id^=total_item]") selector
				var sum = jQuery(this).sum();
				jQuery(".tx-powermailcalc-pi1 .calc_betrag").val(
					// round the results to 2 digits
					sum.toFixed(2) + " Euro "
				);
			}
		);
		
		selectHiddenInputs();
}

function calcreittherapeuthaftpflicht(){
		
		
		var zahlweisetext = jQuery("fieldset.calc select.calc_zahlweise :selected").text();
		
		
		
		jQuery("fieldset.calc input.calc_betrag").calc(
			// the equation to use for the calculation
			"(verssum * zahlweise * laufzeitwert) * 1.19",
			// define the variables used in the equation, these can be a jQuery object
			{
				verssum: jQuery("fieldset.calc .calc_versum :selected").attr('rel'),
				zahlweise: jQuery("fieldset.calc select.calc_zahlweise :selected").attr('rel'),
				laufzeitwert: jQuery("fieldset.calc .calc_laufzeit :selected").attr('rel')
				
			},
			
			// define the formatting callback, the results of the calculation are passed to this function
			function (s){
				// return the number as a dollar amount
				return s.toFixed(2);
			},
			// define the finish callback, this runs after the calculation has been complete
			function ($this){
				// sum the total of the $("[id^=total_item]") selector
				var sum = jQuery(this).sum();
				jQuery("fieldset.calc .calc_betrag").val(
					// round the results to 2 digits
					sum.toFixed(2) + " Euro " + zahlweisetext
				);
			}
		);
		
}

function calcreittherapeuthaftpflicht2(){
		
		
		var zahlweisetext = jQuery(".tx-powermailcalc-pi1 select.calc_zahlweise :selected").text();
		
		
		
		jQuery(".tx-powermailcalc-pi1 input.calc_betrag").calc(
			// the equation to use for the calculation
			"(verssum * zahlweise * laufzeitwert) * 1.19",
			// define the variables used in the equation, these can be a jQuery object
			{
				verssum: jQuery(".tx-powermailcalc-pi1 .calc_versum :selected").val(),
				zahlweise: jQuery(".tx-powermailcalc-pi1 select.calc_zahlweise :selected").val(),
				laufzeitwert: jQuery(".tx-powermailcalc-pi1 .calc_laufzeit :selected").val()
				
			},
			
			// define the formatting callback, the results of the calculation are passed to this function
			function (s){
				// return the number as a dollar amount
				return s.toFixed(2);
			},
			// define the finish callback, this runs after the calculation has been complete
			function ($this){
				// sum the total of the $("[id^=total_item]") selector
				var sum = jQuery(this).sum();
				jQuery(".tx-powermailcalc-pi1 .calc_betrag").val(
					// round the results to 2 digits
					sum.toFixed(2) + " Euro " + zahlweisetext
				);
			}
		);
		
		selectHiddenInputs();
}

function calcpferdevollkasko(){
		
		//var grundsumme_array = jQuery("select.calc_grundsumme :selected").val().split("-");
		if(jQuery("fieldset.calc select.calc_zahlweise :selected").attr('rel')) {
			var zahlweisewert_array = jQuery("fieldset.calc select.calc_zahlweise :selected").attr('rel').split("-");
			var zahlweisewert_1 = zahlweisewert_array[0];
			var zahlweisewert_2 = zahlweisewert_array[1];
			var zahlweisetext = jQuery("fieldset.calc select.calc_zahlweise :selected").text();
		}
		
		jQuery("fieldset.calc input.calc_betrag").calc(
			// the equation to use for the calculation
			"((grundsumme * vfdwert * selbstwert * zahlweisewert_1) * zahlweisewert_2) * laufzeitwert",
			// define the variables used in the equation, these can be a jQuery object
			{
				grundsumme: jQuery("fieldset.calc .calc_anzahl :selected").attr('rel'),
				vfdwert: jQuery("fieldset.calc .calc_vfd :selected").attr('rel'),
				selbstwert: jQuery("fieldset.calc .calc_selbst :selected").attr('rel'),
				zahlweisewert_1: zahlweisewert_1,
				zahlweisewert_2: zahlweisewert_2,
				laufzeitwert: jQuery("fieldset.calc .calc_laufzeit :selected").attr('rel')
				
			},
			
			// define the formatting callback, the results of the calculation are passed to this function
			function (s){
				// return the number as a dollar amount
				return s.toFixed(2);
			},
			// define the finish callback, this runs after the calculation has been complete
			function ($this){
				// sum the total of the $("[id^=total_item]") selector
				var sum = jQuery(this).sum();
				jQuery("fieldset.calc .calc_betrag").val(
					// round the results to 2 digits
					sum.toFixed(2) + " Euro " + zahlweisetext
				);
			}
		);
		
}

function calcpferdevollkasko2(){
		
		//var grundsumme_array = jQuery("select.calc_grundsumme :selected").val().split("-");
		if(jQuery(".tx-powermailcalc-pi1 select.calc_zahlweise :selected").val()) {
			var zahlweisewert_array = jQuery(".tx-powermailcalc-pi1 select.calc_zahlweise :selected").val().split("-");
			var zahlweisewert_1 = zahlweisewert_array[0];
			var zahlweisewert_2 = zahlweisewert_array[1];
			var zahlweisetext = jQuery(".tx-powermailcalc-pi1 select.calc_zahlweise :selected").text();
		}
		
		jQuery(".tx-powermailcalc-pi1 input.calc_betrag").calc(
			// the equation to use for the calculation
			"((grundsumme * vfdwert * selbstwert * zahlweisewert_1) * zahlweisewert_2) * laufzeitwert",
			// define the variables used in the equation, these can be a jQuery object
			{
				grundsumme: jQuery(".tx-powermailcalc-pi1 .calc_anzahl :selected").val(),
				vfdwert: jQuery(".tx-powermailcalc-pi1 .calc_vfd :selected").val(),
				selbstwert: jQuery(".tx-powermailcalc-pi1 .calc_selbst :selected").val(),
				zahlweisewert_1: zahlweisewert_1,
				zahlweisewert_2: zahlweisewert_2,
				laufzeitwert: jQuery(".tx-powermailcalc-pi1 .calc_laufzeit :selected").val()
				
			},
			
			// define the formatting callback, the results of the calculation are passed to this function
			function (s){
				// return the number as a dollar amount
				return s.toFixed(2);
			},
			// define the finish callback, this runs after the calculation has been complete
			function ($this){
				// sum the total of the $("[id^=total_item]") selector
				var sum = jQuery(this).sum();
				jQuery(".tx-powermailcalc-pi1 .calc_betrag").val(
					// round the results to 2 digits
					sum.toFixed(2) + " Euro " + zahlweisetext
				);
			}
		);
		
		selectHiddenInputs();
		
}

function selectHiddenInputs() {
			
			var containerhidden = jQuery(".tx_powermail_hidden_form");
			
			if (containerhidden.length > 0) {
			jQuery("form.tx_powermail_hidden_form").each(function(){
				//var currentform = jQuery(this).attr('id');
				var mainform = jQuery(this).attr('id').split("-");
				
				jQuery(this).find('input[class^=onlinerechnerhidden]').each(function(){
				//jQuery("input[class^=onlinerechnerhidden]").each(function(index){
						var hiddenclass = jQuery(this).attr('class').split("-");
						if(hiddenclass[1]) {
							var hiddenval = jQuery('#'+mainform[0]+' .'+hiddenclass[1]+' :selected').val();
							//var hiddenval = jQuery('.' + hiddenclass[1] + ' :selected').val();
							jQuery(this).val(hiddenval);
						}
				});
			});
			}
}


