﻿//Changes the tab on the call to action
function changeTab(clickedTab, tabToMakeInvisibleId, panelToMakeVisibleId, panelToMakeInvisibleId) {
	var tabToMakeInvisible = document.getElementById(tabToMakeInvisibleId);
	var panelToMakeVisible = document.getElementById(panelToMakeVisibleId);
	var panelToMakeInVisible = document.getElementById(panelToMakeInvisibleId);

	panelToMakeVisible.style.display = 'block';
	panelToMakeInVisible.style.display = 'none';

	clickedTab.className = clickedTab.className.replace('tabInactive', 'tabActive');
	tabToMakeInvisible.className = tabToMakeInvisible.className.replace('tabActive', 'tabInactive');
}

//Changing the active item on the homepage tab
function setActiveRotator(imageContainer1Id, imageContainer2Id, imageContainer3Id, activeTabNumber) {
	var imageContainer1 = document.getElementById(imageContainer1Id);
	var imageContainer2 = document.getElementById(imageContainer2Id);
	var imageContainer3 = document.getElementById(imageContainer3Id);
	var arrowContainer	= document.getElementById('rotatorArrow');
	
	if (activeTabNumber == 1) {
		imageContainer1.style.display = 'block';
		imageContainer2.style.display = 'none';
		imageContainer3.style.display = 'none';
		arrowContainer.className = 'rotatorArrowPosition1';
	}
	else if (activeTabNumber == 2) {
		imageContainer1.style.display = 'none';
		imageContainer2.style.display = 'block';
		imageContainer3.style.display = 'none';
		arrowContainer.className = 'rotatorArrowPosition2';
	}
	else if (activeTabNumber == 3) {
		imageContainer1.style.display = 'none';
		imageContainer2.style.display = 'none';
		imageContainer3.style.display = 'block';
		arrowContainer.className = 'rotatorArrowPosition3';
	}
}

	//Set demo login for Planning Online module
function setDemoLogin() {
	var emailField = document.getElementById('eml');
	var passwordField = document.getElementById('pass');

	emailField.value = 'test@mjfp.nl';
	passwordField.value = 'Test_01';
}

//Sets for form action to the given URL and posts the form
function postToExternalSite(externalUrl) {
	document.forms[0].action = externalUrl;
	document.forms[0].submit();
	return false;
}

//Hides the subscription form of a sidebar newsletter subscription element
//when the subscription is send
function hideSubscriptionForm() {
	var subscriptionForm		= $('div#newsSubscriptionForm');
	var subscriptionSendDiv = $('div#newsSubscriptionSent');

	subscriptionForm.hide();
	subscriptionSendDiv.show();
}

