var g_zIndex = 100;
var g_maxHeight = 175;

function showTab(id, str, rubrik, services, destinations, headquarters)
{
	var tab = document.getElementById(id);
	//tab.interval = window.setInterval("slideTab('"+id+"')", 10);
	//tab.stepsize = calcStepsize(g_maxHeight);

	//tab.style.height = 0;
	//tab.style.zIndex = g_zIndex++;
	//tab.style.borderBottom = "1px solid #597e98";
	
	if(str == "undefined") str = "";
	if(rubrik == "undefined") rubrik = "";
	if(services == "undefined") services = "";
	if(destinations == "undefined") destinations = "";
	if(headquarters == "undefined") headquarters = "";
	
	DWREngine._execute(_ajaxConfig._cfscriptLocation, null, 'getContent', id, str,rubrik,services,destinations,headquarters, doQueryAndJSResults);

	tab.style.zIndex = g_zIndex++;
	setActiveButton("btn_"+id);
	
}
function doQueryAndJSResults (r) {
		// evaluate server side JS
		eval(r);
}

function calcStepsize(height)
{
	var i = parseInt(height / 10);
	return i;
}

function slideTab(id)
{
	var tab = document.getElementById(id);
	var curHeight = parseInt(tab.style.height);
	var newHeight = curHeight + parseInt(tab.stepsize);

	if(newHeight > g_maxHeight)
		newHeight = g_maxHeight;

	tab.style.height = newHeight + "px";

	if(newHeight >= g_maxHeight)
	{
		window.clearInterval(tab.interval);
		tab.style.borderBottom = "none";
	}
}

function setActiveButton(id)
{
	var img = document.getElementById("tabbuttons").getElementsByTagName("img");
	for(i = 0; i < img.length; i++)
	{
		img[i].src = img[i].src.replace(/_active/g,"");
	}

	img = document.getElementById(id);
	img.src = img.src.substring(0, img.src.length-4) + "_active.gif";
}