//**********************************************************
// Create a cookie to hold our active tab - we need this so
// that we can turn off the previously clicked tab when the 
// user clicks on the next one. Here we set the default of
// TAB 1 as the first tab - change this if you change the
// ACTIVE TAB that loads on page load in the <body> tag so
// that the previous tag matches the first one loaded
//**********************************************************

createCookie("ActiveContent","ProductDescriptionTab, Tab1",1);

//**********************************************************
// Set the default styles for the Active/InActive tags
//**********************************************************

var ActiveTag = "#DB2B1E";
var ActiveBackground = "";

var InActiveTag = "#8E908F";
var InActiveBackground = "";

//**********************************************************
// Function to show/hide the appropriate tag content and
// Update the active/inactive tag styles
//**********************************************************

function ShowHideTagContent(id, TabClicked)
{
var CookieArray;
//**********************************************************
// Define our variables
//**********************************************************
var obj;
var CookieContents; 
//**********************************************************
// Read a cookie to close the previous element that we 
// clicked. Cookie contains the content area and the
// previously clicked tag name
//**********************************************************

CookieContents=readCookie("ActiveContent");

//**********************************************************
// Split the cookie so we can access the content container
// and the previously clicked tag
//**********************************************************

CookieArray = CookieContents.split(",")

//**********************************************************
// Do we have an active tab? if not then reset the id to the
// contents of the Cookie's Previous tag name to avoid 
// errors
//**********************************************************
if (id=="")
	{
	id=CookieContents[1]
	}

//**********************************************************
// Hide the previously Active Tab and change the background
// back to the default colour/style
//**********************************************************

if (document.getElementById)
	{
		document.getElementById(CookieArray[0]).style.display = "none";
		if(document.getElementById(CookieArray[1])!=null)
		{
			document.getElementById(CookieArray[1]).style.backgroundColor = InActiveTag;
			document.getElementById(CookieArray[1]).style.backgroundImage = InActiveBackground;
		}
	}

//**********************************************************
// Open up the selected tab contents and overide the
// background colour/style to the active styling
//**********************************************************

if (document.getElementById)
	{
		obj = document.getElementById(id);
		if (obj.style.display == "none"){
			obj.style.display = "";
			document.getElementById(TabClicked).style.backgroundColor = ActiveTag;
			document.getElementById(TabClicked).style.backgroundImage = ActiveBackground;
		} else {
			obj.style.display = "none";
		}

//**********************************************************
// Hide the version/option display if the user clicks
// On the Accessories or reviews tab
//**********************************************************

if(id=='AccessoriesTab' || id=='ReviewsTab')
	{
		document.getElementById('HideVersionsTab').style.display = "none";	
	}
else
	{	
		document.getElementById('HideVersionsTab').style.display = "";
	}	
		
//**********************************************************		
// Update the cookie with the new Active Tab and the 
// Contents opened so that we can close it on next tab click
//**********************************************************
		createCookie("ActiveContent", id+","+TabClicked,  1);
	}
	

//*****************************************************************************
// Do we need to resize the Related Page element? Can't do this at page load
// As technically the iframe doesn't exist because it's hidden
//*****************************************************************************
var f="";

if (id=='SpecificationsTab')

{
	f = document.getElementById('specificationFrame');

	if(f!=null)
	{
		f.style.height = f.contentWindow.document.body.scrollHeight + "px";
	}	
}

	
}

