
function OnMouseOverTab(tab)
{
	homeActive = (tab == "home" || activetab == "home");
	tourActive = (tab == "tour" || activetab == "tour");
	rentalActive = (tab == "rental" || activetab == "rental");
	eventsActive = (tab == "events" || activetab == "events");
	promoActive = (tab == "promo" || activetab == "promo");
	buyActive = (tab == "buy" || activetab == "buy");
	UpdateTabLayout(homeActive, tourActive, rentalActive, eventsActive, promoActive, buyActive);
}

function OnMouseOutTab()
{
	homeActive = (activetab == "home");
	tourActive = (activetab == "tour");
	rentalActive = (activetab == "rental");
	eventsActive = (activetab == "events");
	promoActive = (activetab == "promo");
	buyActive = (activetab == "buy");
	UpdateTabLayout(homeActive, tourActive, rentalActive, eventsActive, promoActive, buyActive);
}

function UpdateTabLayout(homeActive, tourActive, rentalActive, eventsActive, promoActive, buyActive)
{

	if (homeActive)
	{
		UpdateImage("tab_begin", "images/header/active_begin.jpg");
		UpdateImage("tab_home", "images/header/active_home.jpg");
	}
	else
	{
		UpdateImage("tab_begin", "images/header/inactive_begin.jpg");
		UpdateImage("tab_home", "images/header/inactive_home.jpg");
	}
	
	if (tourActive)
	{
		UpdateImage("tab_tour", "images/header/active_tour.jpg");
		if (homeActive)
		{
			UpdateImage("tab_home_tour", "images/header/active_active.jpg");
		}
		else
		{
			UpdateImage("tab_home_tour", "images/header/inactive_active.jpg");
		}
	}
	else
	{
		UpdateImage("tab_tour", "images/header/inactive_tour.jpg");
		if (homeActive)
		{
			UpdateImage("tab_home_tour", "images/header/active_inactive.jpg");
		}
		else
		{
			UpdateImage("tab_home_tour", "images/header/inactive_inactive.jpg");
		}
	}

	if (rentalActive)
	{
		UpdateImage("tab_rental", "images/header/active_rental.jpg");
		if (tourActive)
		{
			UpdateImage("tab_tour_rental", "images/header/active_active.jpg");
		}
		else
		{
			UpdateImage("tab_tour_rental", "images/header/inactive_active.jpg");
		}
	}
	else
	{
		UpdateImage("tab_rental", "images/header/inactive_rental.jpg");
		if (tourActive)
		{
			UpdateImage("tab_tour_rental", "images/header/active_inactive.jpg");
		}
		else
		{
			UpdateImage("tab_tour_rental", "images/header/inactive_inactive.jpg");
		}
	}

	if (eventsActive)
	{
		UpdateImage("tab_events", "images/header/active_events.jpg");
		if (rentalActive)
		{
			UpdateImage("tab_rental_events", "images/header/active_active.jpg");
		}
		else
		{
			UpdateImage("tab_rental_events", "images/header/inactive_active.jpg");
		}
	}
	else
	{
		UpdateImage("tab_events", "images/header/inactive_events.jpg");
		if (rentalActive)
		{
			UpdateImage("tab_rental_events", "images/header/active_inactive.jpg");
		}
		else
		{
			UpdateImage("tab_rental_events", "images/header/inactive_inactive.jpg");
		}
	}

	if (promoActive)
	{
		UpdateImage("tab_promo", "images/header/active_promo.jpg");
		if (eventsActive)
		{
			UpdateImage("tab_events_promo", "images/header/active_active.jpg");
		}
		else
		{
			UpdateImage("tab_events_promo", "images/header/inactive_active.jpg");
		}
	}
	else
	{
		UpdateImage("tab_promo", "images/header/inactive_promo.jpg");
		if (eventsActive)
		{
			UpdateImage("tab_events_promo", "images/header/active_inactive.jpg");
		}
		else
		{
			UpdateImage("tab_events_promo", "images/header/inactive_inactive.jpg");
		}
	}

	if (buyActive)
	{
		UpdateImage("tab_buy", "images/header/active_buy.jpg");
		UpdateImage("tab_eind", "images/header/active_eind.jpg");
		if (promoActive)
		{
			UpdateImage("tab_promo_buy", "images/header/active_active.jpg");
		}
		else
		{
			UpdateImage("tab_promo_buy", "images/header/inactive_active.jpg");
		}
	}
	else
	{
		UpdateImage("tab_buy", "images/header/inactive_buy.jpg");
		UpdateImage("tab_eind", "images/header/inactive_eind.jpg");
		if (promoActive)
		{
			UpdateImage("tab_promo_buy", "images/header/active_inactive.jpg");
		}
		else
		{
			UpdateImage("tab_promo_buy", "images/header/inactive_inactive.jpg");
		}
	}	
}

function UpdateImage(id, src)
{
	var img = document.getElementById(id);
	if (img)
	{
		img.src = src;
	}
}

function EverythingTheSameHeight(block1, block2, block3, block4)
{
	EverythingTheSameHeightOffsetted(block1, 0, block2, 0, block3, 0, block4, 0);
}

function EverythingTheSameHeightOffsetted(block1, offset1, block2, offset2, block3, offset3, block4, offset4)
{
	var highestHeight = 0;
	var obj1 = null;
	var obj2 = null;
	var obj3 = null;
	var obj4 = null;
	var obj1height = 0;
	var obj2height = 0;
	var obj3height = 0;
	var obj4height = 0;
	if (block1 != "")
	{
		obj1 = document.getElementById(block1)
		obj1height = obj1.offsetHeight;
		if (highestHeight < obj1height)
		{
			highestHeight = obj1height;
		}
	}
	if (block2 != "")
	{
		obj2 = document.getElementById(block2)
		obj2height = obj2.offsetHeight;
		if (highestHeight < obj2height)
		{
			highestHeight = obj2height;
		}
	}
	if (block3 != "")
	{
		obj3 = document.getElementById(block3)
		obj3height = obj3.offsetHeight;
		if (highestHeight < obj3height)
		{
			highestHeight = obj3height;
		}
	}
	if (block4 != "")
	{
		obj4 = document.getElementById(block4)
		obj4height = obj4.offsetHeight;
		if (highestHeight < obj4height)
		{
			highestHeight = obj4height;
		}
	}
	
	if (obj1)
	{
		if (obj1height < highestHeight)
		{
			obj1.style.height = (highestHeight + offset1) + "px";
		}
	}
	if (obj2)
	{
		if (obj2height < highestHeight)
		{
			obj2.style.height = (highestHeight + offset2) + "px";
		}
	}
	if (obj3)
	{
		if (obj3height < highestHeight)
		{
			obj3.style.height = (highestHeight + offset3) + "px";
		}
	}
	if (obj4)
	{
		if (obj4height < highestHeight)
		{
			obj4.style.height = (highestHeight + offset4) + "px";
		}
	}
}

function MatchHeight(block1, block2, offset)
{
	var obj1 = null;
	var obj2 = null;
	var obj1height = 0;
	if (block1 != "")
	{
		obj1 = document.getElementById(block1)
		obj1height = obj1.offsetHeight;
	}
	if (block2 != "")
	{
		obj2 = document.getElementById(block2)
	}
	
	if (obj2)
	{
		obj2.style.height = (obj1height + offset) + "px";
	}
}
