(function($) {
	var allowAnimation = true,
		  activeItem = 4, // 0 = start, 3 = latest visible item, 4 = invisible
		transitionSpeed = 400,
		timer = null;
	$(document).ready(function() {
		/** 
		 *	CARROUSEL NAVIGATION (at the right)
		 *	- move nav-items outside views-row
		 *	- position them below each-other
		 *	- give them a unique ID
		 **/
		var counter=0;
	
		$('.view-carrousel .views-row').each(function() {
			$(this).attr('id','carrousel_'+counter);
			$('.view-carrousel .view-content').append(
				$(this).find('.views-field-nothing').attr('id','carrousel_nav_'+counter)
													.css({'top':(80*counter)+'px'})
													.addClass('carrousel_nav')
			);
			counter++;
		});
		
		// INITIALIZATION 
		$('.view-carrousel .view-content').append($('<div class="carrousel_nav_arrow"></div>')); // ADD NAV-ARROW
		$('#carrousel_nav_'+activeItem).addClass('carrousel_nav_active'); // MAKE FIRST NAV-ITEM ACTIVE
		$('.view-carrousel .views-row').hide(); // HIDE ALL VIEWS-ROW INITIALY
		$('.view-carrousel .views-row-'+(activeItem+1)).show(); // SHOW ACTIVE ITEM
		if(activeItem > 3){
			$('.carrousel_nav_arrow').hide(); // HIDE ARROW
		}
		else{
			$('.carrousel_nav_arrow').css({'top':(80*activeItem)+'px'});
			$('.carrousel_nav_arrow').show(); // SHOW ARROW
		}
		
		// SET MOUSELISTENERS 
		$('.carrousel_nav').mouseenter(CarrouselMouseEnter);	// MOUSE LISTENER
		$('.carrousel_nav').mouseleave(CarrouselMouseLeave);	// MOUSE LISTENER
		
		timer = setInterval(function() { transition(parseInt(activeItem)+1); },6000); // ANIMATION
	});
	
	// TRANSITION
	function transition(toID) {
		if(activeItem!=toID) {
			$('#carrousel_'+activeItem).fadeOut(transitionSpeed);
			$('#carrousel_nav_'+activeItem).removeClass('carrousel_nav_active');
			/*$('#carrousel_pager_'+activeItem).fadeTo(transitionSpeed,0.4).removeClass('carrousel_pager_active');*/
			activeItem=toID;
			if(activeItem>$(".view-carrousel .views-row").length-1) activeItem=0;
			$('#carrousel_'+activeItem).fadeIn(transitionSpeed);
			$('#carrousel_nav_'+activeItem).addClass('carrousel_nav_active');
			/*$('#carrousel_pager_'+activeItem).fadeTo(transitionSpeed,1).addClass('carrousel_pager_active');*/
			$('.carrousel_nav_arrow').css({'top':(80*activeItem)+'px'});
			$('.carrousel_nav_arrow').show(); // SHOW ARROW
		}
	}
	
	// MOUSE LISTENERS
	function CarrouselMouseEnter(e) {
		clearInterval(timer);
		var id=0;
		if($(e.target).hasClass('carrousel_nav'))
			id = $(e.target).attr('id').replace('carrousel_nav_','');
		else
			id = $(e.target).parents('.carrousel_nav').attr('id').replace('carrousel_nav_','');
		transition(id);
	}
	function CarrouselMouseLeave(e) {
		timer = setInterval(function() { transition(parseInt(activeItem)+1); },6000); // ANIMATION
	}
	
	
})(jQuery);;
(function($) {
	var eanElectricity = '',
		eanGas = '';
	$(document).ready(function() {
		
		// MAKE AN ORANGE BUTTON OF DYNAMIC WIDTH
		$('.dyn-orange-button').each(function() {
			$(this).html('<span class="dyn-orange-btn-left"></span><span class="dyn-orange-btn-content">'+$(this).text()+'</span><span class="dyn-orange-btn-right"></span>');
		});
		
		$('#block-system-navigation').css({'float':'left'});
		enableInlineLabels('#signup .webform-component-textfield','label');
		enableInlineLabels('#signup .webform-component-email','label');
		// Newsletter <front>
		enableInlineLabels('#block-webform-client-block-15 .webform-component-textfield','label');
		enableInlineLabels('#block-webform-client-block-15 .webform-component-email','label');
		// Customer Conversion Form
		enableInlineLabels('#webform-client-form-1 .webform-component-textfield','.field-prefix');
		// Contact form
		enableInlineLabels('#webform-client-form-43 .webform-component-textfield','.field-prefix');
		
		// SHOW WEBFORM-FIELD DESCRIPTIONS WHEN FIELD VALIDATION FAILED (ERROR MSGS)
		$('.webform-client-form input:not(.webform-calendar), .webform-component-date select').each(function() {
			var description = $(this).parents('.webform-component').find('.description');
			if($(this).hasClass('error')) {
				$(this).parents('.webform-component').addClass('webform-error');
				description.show();
			} else {
				description.hide();
			}
		});
		
		// "CHOSEN"-MODULE VALIDATION (ERROR MESSAGES)
		setChosenErrorMessage('#webform-component-correspondentadress--cor-street');
		setChosenErrorMessage('#webform-component-correspondentadress--cor-city');
		setChosenErrorMessage('#webform-component-delivery-adress--cor-street');
		setChosenErrorMessage('#webform-component-delivery-adress--cor-city');
		setChosenErrorMessage('#webform-component-billingadress--cor-street');
		setChosenErrorMessage('#webform-component-billingadress--cor-city');

		/*$('#edit-submitted-enddate-current-contract-gas-day').val('DD');
		$('#edit-submitted-enddate-current-contract-gas-month').val('MM');
		$('#edit-submitted-enddate-current-contract-gas-year').val('YYYY');
		$('#edit-submitted-enddate-current-contract-electricity-day').val('DD');
		$('#edit-submitted-enddate-current-contract-electricity-month').val('MM');
		$('#edit-submitted-enddate-current-contract-electricity-year').val('YYYY');		*/

		// EXTRA INFO TOOLTIP EAN INFO
		$('#webform-component-ean-info-electricity').hide().prev().append('<a href="webform-component-ean-info-electricity" class="ean-extra-info">?</a>');
		$('#webform-component-ean-info-gas').hide().prev().append('<a href="webform-component-ean-info-gas" class="ean-extra-info">?</a>');
		$('#webform-component-promo-info').hide().prev().append('<a href="webform-component-promo-info" class="ean-extra-info">?</a>');
		$('.ean-extra-info').live('click',function(e) {
			var objId = $(e.target).attr('href').split('/');
			var target = $('#'+objId[objId.length-1]);
			if(target.hasClass('open')) {
				target.removeClass('open').slideUp();
			} else {
				target.addClass('open').slideDown();
			}
			return false;
		});
		
		// SET LANGUAGE IN ALL "language" HIDDEN WEBFORMSFIELDS
		switch(Drupal.settings.pathPrefix) {
			case 'fr/': $("[name='submitted[language]']").val('fr-be'); break;
			default: $("[name='submitted[language]']").val('nl-be'); break;
		}
		
		if ($("[name='submitted[ean_electricity_code_unknown][true]']:checked").val() == 'true') {
				$('#webform-component-ean-electricity-code').fadeOut();
				$("[name='submitted[ean_electricity_code]']").val('');
		}
		
		// ENABLE-DISABLE CHECKBOXES IN CUSTOMER-FLOW-CONTACT FORM
		if ($("[name='submitted[ean_gas_code_unknown][true]']:checked").val() == 'true') {
				$('#webform-component-ean-gas-code').fadeOut();
				$("[name='submitted[ean_gas_code]']").val('');
		}
				
		$("[name='submitted[ean_electricity_code_unknown][true]']").live('click',function() {
			if($(this).attr('checked')) {
				eanElectricity = $("[name='submitted[ean_electricity_code]']").val();
				$("[name='submitted[ean_electricity_code]']").val('');
				$('#webform-component-ean-electricity-code').fadeOut();
			} else {
				$("[name='submitted[ean_electricity_code]']").val(eanElectricity);
				$('#webform-component-ean-electricity-code').fadeIn();
			}
		});
		$("[name='submitted[ean_gas_code_unknown][true]']").live('click',function() {
			if($(this).attr('checked')) {
				eanGas = $("[name='submitted[ean_gas_code]']").val();
				$("[name='submitted[ean_gas_code]']").val('');
				$('#webform-component-ean-gas-code').fadeOut();
			} else {
				$("[name='submitted[ean_gas_code]']").val(eanGas);
				$('#webform-component-ean-gas-code').fadeIn();
			}
		});
	   
	
		// *** GET CHECKED VALUES
		var valEnergyType = '';
		$("[name='submitted[conversion_type]']").each(function() {
			if($(this).attr('checked')) valEnergyType = $(this).val();
			//console.log(valEnergyType);
		});		
		
		var valElectricity = '';
		if (valEnergyType == 'electricity' || valEnergyType == 'both' ) {
		  $("[name='submitted[contractsituatie_elektriciteit]']").each(function() {
			if($(this).attr('checked')) valElectricity = $(this).val();
		  });
		}
		
		var valGas = '';
		if (valEnergyType == 'gas' || valEnergyType == 'both' ) {
		  $("[name='submitted[contractsituatie_gas]']").each(function() {
			if($(this).attr('checked')) valGas = $(this).val();
		  });
		}
		
		var valSwitchScenario = '';
		if (valEnergyType == 'electricity' || valEnergyType == 'both' ) {
		  $("[name='submitted[switch_scenario]']").each(function() {
			if($(this).attr('checked')) valSwitchScenario = $(this).val();
		  });
		}		

		var valSwitchScenarioGas = '';
		if (valEnergyType == 'gas' || valEnergyType == 'both' ) {
		  $("[name='submitted[switch_scenario_gas]']").each(function() {
			if($(this).attr('checked')) valSwitchScenarioGas = $(this).val();
		  });
		}			
		
		// END GET CHECKED VALUES ***
		
		
		$('#webform-component-enddate-current-contract-electricity-unknown').hide();
		$('#webform-component-enddate-current-contract-gas-unknown').hide();

		//if ($("[name='submitted[contractsituatie_elektriciteit]']").attr("checked")) {
		var language = Drupal.settings.pathPrefix;
		
		// initial hide
		$('#webform-component-enddate-current-contract-gas').hide();
		$('#webform-component-enddate-current-contract-electricity').hide();
		$("input[name='submitted[contractsituatie_elektriciteit]']").parent().css('margin-top','4px');
		$("input[name='submitted[contractsituatie_gas]']").parent().css('margin-top','4px');
		$('#webform-component-ean-info-electricity').hide();
		$('#webform-component-ean-info-gas').hide();
		$('#webform-component-info-move-in-electricity').hide();
		$('#webform-component-info-move-in-gas').hide();
		  
		if (valSwitchScenario == 'Move In') {
		  $('#webform-component-info-move-in-electricity').show();
		}
		if (valSwitchScenarioGas == 'Move In') {
		  $('#webform-component-info-move-in-gas').show();
		}
		
		/* GET ELECTRICITY DATE FIELDS WHEN YOU HIT BACK */
		if (valElectricity == 'unknown_length_electricity') {
		  //console.log('ik ben binnen bij unknown_length_electricity');
		  $('#webform-component-enddate-current-contract-electricity').hide();
		  $('#webform-component-enddate-current-contract-electricity-unknown').hide();
		  $('#webform-component-enddate-current-contract-gas-unknown').hide();

		  $('#edit-submitted-contractsituatie-elektriciteit-1').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-elektriciteit-2').parent().animate({ marginTop: '60px' }, 500);
		  $('#edit-submitted-contractsituatie-elektriciteit-3').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-elektriciteit--2-1').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-elektriciteit--2-2').parent().animate({ marginTop: '60px' }, 500);
		  $('#edit-submitted-contractsituatie-elektriciteit--2-3').parent().animate({ marginTop: '4px' }, 500);
		  if ( $.browser.msie ) {
            $('#webform-component-enddate-current-contract-electricity').fadeIn('slow').css('margin-top','-110px');
          } else {
            $('#webform-component-enddate-current-contract-electricity').fadeIn('slow').css('margin-top','-104px');
          }
		  if(language == 'fr/') {
		    $('#webform-component-enddate-current-contract-electricity label').text('Date de début souhaitée: ');			
		  }
		  else {
		    $('#webform-component-enddate-current-contract-electricity label').text('Gewenste startdatum: ');
		  }
		}
		  
		if (valElectricity == 'enddate_unknown_electricity') {
		  //console.log('ik ben binnen bij enddate_unknown_electricity');
		  $('#webform-component-enddate-current-contract-electricity').hide();
		  $('#webform-component-enddate-current-contract-electricity-unknown').hide();
		  $('#webform-component-enddate-current-contract-gas-unknown').hide();	
					
		  $('#edit-submitted-enddate-current-contract-electricity-day').val('');
		  $('#edit-submitted-enddate-current-contract-electricity-month').val('');
		  $('#edit-submitted-enddate-current-contract-electricity-year').val('');
		  $('#edit-submitted-enddate-current-contract-electricity-day--2').val('');
		  $('#edit-submitted-enddate-current-contract-electricity-month--2').val('');
		  $('#edit-submitted-enddate-current-contract-electricity-year--2').val('');
		  $('#edit-submitted-contractsituatie-elektriciteit-1').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-elektriciteit-2').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-elektriciteit-3').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-elektriciteit--2-1').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-elektriciteit--2-2').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-elektriciteit--2-3').parent().animate({ marginTop: '4px' }, 500);			
		}
		  
		if (valElectricity == 'enddate_current_contract_electricity') {
			  //console.log('ik ben binnen bij enddate_current_contract_electricity');
		  $('#webform-component-enddate-current-contract-electricity').hide();
	      $('#webform-component-enddate-current-contract-electricity-unknown').hide();
		  $('#webform-component-enddate-current-contract-gas-unknown').hide();
		
		  $('#edit-submitted-contractsituatie-elektriciteit-1').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-elektriciteit-2').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-elektriciteit-3').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-elektriciteit--2-1').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-elektriciteit--2-2').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-elektriciteit--2-3').parent().animate({ marginTop: '4px' }, 500);
		  $('#webform-component-enddate-current-contract-electricity').fadeIn('slow').css('margin-top','-1px');
		  if(language == 'fr/') {
		    $('#webform-component-enddate-current-contract-electricity label').text('Date de fin de contrat/date de déménagement : ');			
		  }
		  else {
		    $('#webform-component-enddate-current-contract-electricity label').text('Einddatum contract / verhuisdatum: ');
		  }
		}	
		  
		/* GET GAS DATE FIELDS WHEN YOU HIT BACK */
		if (valGas == 'unknown_length_gas') {
		  //console.log('ik ben binnen bij unknown_length_gas');
		  $('#webform-component-enddate-current-contract-gas').hide();
		  $('#webform-component-enddate-current-contract-electricity-unknown').hide();
		  $('#webform-component-enddate-current-contract-gas-unknown').hide();
			
		  $('#edit-submitted-contractsituatie-gas-1').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-gas-2').parent().animate({ marginTop: '60px' }, 500);
		  $('#edit-submitted-contractsituatie-gas-3').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-gas--2-1').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-gas--2-2').parent().animate({ marginTop: '60px' }, 500);
		  $('#edit-submitted-contractsituatie-gas--2-3').parent().animate({ marginTop: '4px' }, 500);
		  if ( $.browser.msie ) {
            $('#webform-component-enddate-current-contract-gas').fadeIn('slow').css('margin-top','-110px');
          } else {
            $('#webform-component-enddate-current-contract-gas').fadeIn('slow').css('margin-top','-104px');
          }
		  if(language == 'fr/') {
		    $('#webform-component-enddate-current-contract-gas label').text('Date de début souhaitée: ');			
		  }
		  else {
		    $('#webform-component-enddate-current-contract-gas label').text('Gewenste startdatum: ');
		  }
		}
		  
	    if (valGas == 'enddate_unknown_gas') {
		  //console.log('ik ben binnen bij enddate_unknown_gas');
		  $('#webform-component-enddate-current-contract-gas').hide();
		  $('#webform-component-enddate-current-contract-electricity-unknown').hide();
		  $('#webform-component-enddate-current-contract-gas-unknown').hide();
			
		  $('#edit-submitted-enddate-current-contract-gas-day').val('');
		  $('#edit-submitted-enddate-current-contract-gas-month').val('');
		  $('#edit-submitted-enddate-current-contract-gas-year').val('');
	      $('#edit-submitted-contractsituatie-gas-1').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-gas-2').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-gas-3').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-gas--2-1').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-gas--2-2').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-gas--2-3').parent().animate({ marginTop: '4px' }, 500);			
		}
		  
		if (valGas == 'enddate_current_contract_gas') {
		  //console.log('ik ben binnen bij enddate_current_contract_gas');
		  $('#webform-component-enddate-current-contract-gas').hide();
		  $('#webform-component-enddate-current-contract-electricity-unknown').hide();
		  $('#webform-component-enddate-current-contract-gas-unknown').hide();
		
		  $('#edit-submitted-contractsituatie-gas-1').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-gas-2').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-gas-3').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-gas--2-1').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-gas--2-2').parent().animate({ marginTop: '4px' }, 500);
		  $('#edit-submitted-contractsituatie-gas--2-3').parent().animate({ marginTop: '4px' }, 500);
		  $('#webform-component-enddate-current-contract-gas').fadeIn('slow').css('margin-top','-1px');
		  if(language == 'fr/') {
		    $('#webform-component-enddate-current-contract-gas label').text('Date de fin de contrat/date de déménagement : ');			
		  }
		  else {
		    $('#webform-component-enddate-current-contract-gas label').text('Einddatum contract / verhuisdatum: ');
		  }
		}	
			
			
			
		// CLICK ON "MOVE IN" BULLET ON THE SWITCH SCENARIO ELECTRICITY
		$("[name='submitted[switch_scenario]']").live('click',function(e) {
		  if ($(this).val() == 'Move In') {
			$('#webform-component-info-move-in-electricity').show('fast');
		  }
	      else {
	        $('#webform-component-info-move-in-electricity').hide('fast');
		  }		  
		});
		
		// CLICK ON "MOVE IN" BULLET ON THE SWITCH SCENARIO GAS
		$("[name='submitted[switch_scenario_gas]']").live('click',function(e) {
		  if ($(this).val() == 'Move In') {
			$('#webform-component-info-move-in-gas').show('fast');
		  }
		  else {
	        $('#webform-component-info-move-in-gas').hide('fast');
		  }
		});	
		
		
		
		// CLICK ON "GAS", "ELECTRICITY", "GAS AND ELECTRICITY"			
		$("[name='submitted[conversion_type]']").live('click',function(e) {
			// initial hide
			valEnergyType = $(this).val();
			//console.log('click on gas xxx '+valEnergyType);
			//console.log('valSwitchScenario xxx '+valSwitchScenario);
			//console.log('valSwitchScenarioGas xxx '+valSwitchScenarioGas);
			
			$('#webform-component-enddate-current-contract-gas').hide();
			$('#webform-component-enddate-current-contract-electricity').hide();
			$('#edit-submitted-enddate-current-contract-gas-day').val('');
			$('#edit-submitted-enddate-current-contract-gas-month').val('');
			$('#edit-submitted-enddate-current-contract-gas-year').val('');
			$('#edit-submitted-enddate-current-contract-electricity-day').val('');
			$('#edit-submitted-enddate-current-contract-electricity-month').val('');
			$('#edit-submitted-enddate-current-contract-electricity-year').val('');
			$("input[name='submitted[contractsituatie_elektriciteit]']").parent().css('margin-top','4px');
			$("input[name='submitted[contractsituatie_gas]']").parent().css('margin-top','4px');
			$("input[name='submitted[contractsituatie_elektriciteit]']").attr("checked",false);
			$("input[name='submitted[contractsituatie_gas]']").attr("checked",false);
			$('#webform-component-ean-info-electricity').hide();
			$('#webform-component-ean-info-gas').hide();
			$("input[name='submitted[switch_scenario]']").attr("checked",false);
			$("input[name='submitted[switch_scenario_gas]']").attr("checked",false);
			$('#webform-component-info-move-in-gas').hide();	
			$('#webform-component-info-move-in-electricity').hide();
		});
	   
	
        $("[name='submitted[contractsituatie_elektriciteit]']").live('click',function() {
			// REMOVE GAS FIELDS
            if (valEnergyType != 'both') {
			  $('#webform-component-enddate-current-contract-gas').hide();	
			  $('#webform-component-info-move-in-gas').hide();	
			}
		  var language = Drupal.settings.pathPrefix;
		  if ($(this).val() == 'unknown_length_electricity') {
		    $('#webform-component-enddate-current-contract-electricity').hide();
		  	$('#edit-submitted-contractsituatie-elektriciteit-1').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-elektriciteit-2').parent().animate({ marginTop: '60px' }, 500);
		  	$('#edit-submitted-contractsituatie-elektriciteit-3').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-elektriciteit--2-1').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-elektriciteit--2-2').parent().animate({ marginTop: '60px' }, 500);
		  	$('#edit-submitted-contractsituatie-elektriciteit--2-3').parent().animate({ marginTop: '4px' }, 500);			
		  	$(this).parent().prev().animate({ marginTop: '4px' }, 500);
			if ( $.browser.msie ) {
              $('#webform-component-enddate-current-contract-electricity').fadeIn('slow').css('margin-top','-110px');
            } else {
              $('#webform-component-enddate-current-contract-electricity').fadeIn('slow').css('margin-top','-104px');
            }
		  	
			if(language == 'fr/') {
		  	  $('#webform-component-enddate-current-contract-electricity label').text('Date de début souhaitée: ');			
			}
			else {
		  	  $('#webform-component-enddate-current-contract-electricity label').text('Gewenste startdatum: ');
			}
		  }
		  
		  if ($(this).val() == 'enddate_unknown_electricity') {
		  	$('#webform-component-enddate-current-contract-electricity').hide();
			$('#edit-submitted-contractsituatie-elektriciteit-1').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-elektriciteit-2').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-elektriciteit-3').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-elektriciteit--2-1').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-elektriciteit--2-2').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-elektriciteit--2-3').parent().animate({ marginTop: '4px' }, 500);			
		  }
		  
		  if ($(this).val() == 'enddate_current_contract_electricity') {	  	
		    $('#webform-component-enddate-current-contract-electricity').hide();
		  	$('#edit-submitted-contractsituatie-elektriciteit-1').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-elektriciteit-2').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-elektriciteit-3').parent().animate({ marginTop: '4px' }, 500);
			$('#edit-submitted-contractsituatie-elektriciteit--2-1').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-elektriciteit--2-2').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-elektriciteit--2-3').parent().animate({ marginTop: '4px' }, 500);
		  	$('#webform-component-enddate-current-contract-electricity').fadeIn('slow').css('margin-top','-1px');
			if(language == 'fr/') {
		  	  $('#webform-component-enddate-current-contract-electricity label').text('Date de fin de contrat/date de déménagement : ');			
			}
			else {
		  	  $('#webform-component-enddate-current-contract-electricity label').text('Einddatum contract / verhuisdatum: ');
			}
		  	
		  }
	     
		});
		
        $("[name='submitted[contractsituatie_gas]']").live('click',function() {
			// REMOVE ELECTRICITY FIELDS
			if (valEnergyType != 'both') {
		      $('#webform-component-enddate-current-contract-electricity').hide();
			  $('#webform-component-info-move-in-electricity').hide();	
			}
			
		  var language = Drupal.settings.pathPrefix;
		  
		  if ($(this).val() == 'unknown_length_gas') {
		    $('#webform-component-enddate-current-contract-gas').hide();
		  	$('#edit-submitted-contractsituatie-gas-1').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-gas-2').parent().animate({ marginTop: '60px' }, 500);
		  	$('#edit-submitted-contractsituatie-gas-3').parent().animate({ marginTop: '4px' }, 500);
			$('#edit-submitted-contractsituatie-gas--2-1').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-gas--2-2').parent().animate({ marginTop: '60px' }, 500);
		  	$('#edit-submitted-contractsituatie-gas--2-3').parent().animate({ marginTop: '4px' }, 500);			
			if ( $.browser.msie ) {
              $('#webform-component-enddate-current-contract-gas').fadeIn('slow').css('margin-top','-120px');
            } else {
              $('#webform-component-enddate-current-contract-gas').fadeIn('slow').css('margin-top','-104px');
            }
		  	if(language == 'fr/') {
		  	  $('#webform-component-enddate-current-contract-gas label').text('Date de début souhaitée : ');			
			}
			else {
		  	  $('#webform-component-enddate-current-contract-gas label').text('Gewenste startdatum: ');
			}
		  }
		  
		  if ($(this).val() == 'enddate_unknown_gas') {
		  	//$('#webform-component-enddate-current-contract-electricity').fadeIn('slow').css('margin-top','-50px');
		  	$('#webform-component-enddate-current-contract-gas').hide();
			$('#edit-submitted-contractsituatie-gas-1').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-gas-2').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-gas-3').parent().animate({ marginTop: '4px' }, 500);
			$('#edit-submitted-contractsituatie-gas--2-1').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-gas--2-2').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-gas--2-3').parent().animate({ marginTop: '4px' }, 500);		
		  }
		  
		  if ($(this).val() == 'enddate_current_contract_gas') {	  	
		    $('#webform-component-enddate-current-contract-gas').hide();
		  	$('#edit-submitted-contractsituatie-gas-1').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-gas-2').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-gas-3').parent().animate({ marginTop: '4px' }, 500);
			$('#edit-submitted-contractsituatie-gas--2-1').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-gas--2-2').parent().animate({ marginTop: '4px' }, 500);
		  	$('#edit-submitted-contractsituatie-gas--2-3').parent().animate({ marginTop: '4px' }, 500);					
		  	$('#webform-component-enddate-current-contract-gas').fadeIn('slow').css('margin-top','-1px');
		  	if(language == 'fr/') {
		  	  $('#webform-component-enddate-current-contract-gas label').text('Date de fin de contrat/date de déménagement : ');			
			}
			else {
		  	  $('#webform-component-enddate-current-contract-gas label').text('Einddatum contract / verhuisdatum: ');
			}
		  }
	     
		});	
		
		
		// FAQ
		$('.view-faq .views-field-body').hide();
		$('.view-faq .views-field-title a').each(function() {
			var title = $(this),
				content = title.parents('.views-row').find('.views-field-body');
			title.click(function() {
				if(content.hasClass('open'))
					content.removeClass('open').slideUp();
				else
					content.addClass('open').slideDown();
				return false;
			});
		});
		$('.view-faq .faq-cat-row').hide();
		$('.view-faq h3 a').each(function() {
			var title = $(this),
				titleTxt = title.text().replace(' ','_'),
				hash = window.location.hash,
				content = title.parents('h3').next();
			if(hash.toLowerCase()=='#'+titleTxt.toLowerCase()) content.addClass('open').slideDown();
			title.click(function() {
				if(content.hasClass('open'))
					content.removeClass('open').slideUp();
				else
					content.addClass('open').slideDown();
				return false;
			});
		});
		
		// Autosubmit form klant-worden to step-2
		if( window.location.href.indexOf("&page=2") != -1 && window.location.href.indexOf("&step") == -1) {
			$('#webform-client-form-1').submit();
		}
	
		// Autosubmit form klant-worden to step-2
		if( window.location.href.indexOf("date=reset") != -1) {
			$('#edit-submitted-enddate-current-contract-gas-day').val('');
			$('#edit-submitted-enddate-current-contract-gas-month').val('');
			$('#edit-submitted-enddate-current-contract-gas-year').val('');
			$('#edit-submitted-enddate-current-contract-electricity-day').val('');
			$('#edit-submitted-enddate-current-contract-electricity-month').val('');
			$('#edit-submitted-enddate-current-contract-electricity-year').val('');
		}
	
		// enddate 
		if( window.location.href.indexOf("date=endyear") != -1) {
			$('#edit-submitted-enddate-current-contract-gas-day').val('31');
			$('#edit-submitted-enddate-current-contract-gas-month').val('12');
			$('#edit-submitted-enddate-current-contract-gas-year').val('2011');
			$('#edit-submitted-enddate-current-contract-electricity-day').val('31');
			$('#edit-submitted-enddate-current-contract-electricity-month').val('12');
			$('#edit-submitted-enddate-current-contract-electricity-year').val('2011');
		}
	
	});
	
	//Set source to the klant worden form
	if((window.location.href.indexOf("klant-worden") != -1) && (window.location.href.indexOf("devenir-client") != -1)) {// SET SOURCE (hidden fields) TO PAGE-TITLE
		$("[name='submitted[source]']").val($.trim($('#page-title').text()));
	}
	
	// SET ERROR MESSAGES FOR "CHOSEN" DROPDOWNS
	setChosenErrorMessage = function(field) {
		if($(field).hasClass('webform-error')) {
			$(field+'-chosen').addClass('webform-error');
			$(field+'-chosen .description').show();
		}
	}
	
	// SET LABELS OF SOME FIELD INSIDE THE FIELD
	enableInlineLabels = function(obj,obj2) {
		// onload, check if a field is filled out, if so, hide the label
		$(obj+' '+obj2).each(function() {
			var label = $(this);
			label.addClass('inlineLabel');
			var inputval = label.next().val();
			if(inputval!=='') label.hide();
			// onClick, Focus input-field
			label.click(function() { label.next().focus(); });
		});
		// onEvents
		$(obj+' input').focus(function(){
			var label = $(this).prev(obj2);
			var value = $(this).val();
			if(value=='') label.css({'display':'inline'}).fadeTo(200,0.4);
		}).keyup(function(e) {
			var label=$(this).prev(obj2);
			var value=$(this).val();
			if(value!='') label.hide();
			else label.css({'display':'inline'}).fadeTo(20,0.4);
		}).blur(function(){
			var label=$(this).prev(obj2);
			var value=$(this).val();
			if(value=='') label.css({'display':'inline'}).fadeTo(200,1);
		});
	};
})(jQuery);;

