var ActiveTab = false;

function showTab(TabName, TabURL){
	hideTab(ActiveTab);
	
	var TheTabElement = document.getElementById('Tab-'+TabName);
	var TheTabTitle = "";
	
	try{
		// Highlight the tab
		if(TheTabElement){
			TheTabElement.className = 'TabActive';
		}
		
		// Change the URL at the top of the browser to have the name of the tab on it (It doesn't actually relocate the page, it just adds #Features or #Introduction etc to the end of the URL.
		document.location.href='#'+TabName;
		
		// Store off the active tab name so it can be referenced later.
		ActiveTab = TabName;
	
		// Navigate the hidden iframe to load the ajax content
		if(TabURL != ''){
			TheCharacter = (TabURL.indexOf("?") > -1) ? "&" : "?";
			frames['TrackingFrame'].location.href = TabURL + TheCharacter + 'template=default-landing-page-vertical-ajaxiframe&ParentAjaxDiv=ActiveFrame&TabName='+TabName;
		}
		
		// Show or hide the promo start depending on what they clicked
		if(TabName == 'FreeDemo'){
			setTimeout('hidePromoIcon()', 1000);
		}
		else{
			// If the demo start is already showing, dont do the effect again
			if(document.getElementById('DemoPromoStar').style.display == 'none'){
				setTimeout('showPromoIcon()', 1000); // Give it some time so that it actually grabs the person's attention
			}
		}
	}
	catch(Ex){}
	
	return false;
}

function showPromoIcon(){
	$("#DemoPromoStar").show("slide", {direction:"right"}, 500);
	$("#RequestDemoButton").show("slide", {direction:"down"}, 500);
}

function hidePromoIcon(){
	$("#DemoPromoStar").hide("slide", {direction:"right"}, 500);
	$("#RequestDemoButton").hide("slide", {direction:"down"}, 500);
}

function hideTab(TabName){
	var TheTabElement = document.getElementById("Tab-"+TabName);
	
	if(TheTabElement){
		TheTabElement.className = 'TabInActive';
	}
	//document.getElementById('Frame-' + TabName).className = 'FrameInActive';
}

function showLoadingIcon(){
	//$("#LoadingIcon").show("slide", {direction:"up"}, 250);
}
function hideLoadingIcon(){
	//$("#LoadingIcon").hide("slide", {direction:"up"}, 250);
}