//////////////////////////////////////////////////////
//	Collapsing boxes constants
var CB_Default = 0;
var CB_Product = 1;
var CB_OrangeBar = 2;
var CB_FAQ = 3;
var CB_Orange = 4;
var CB_SecondaryProduct = 5;

//////////////////////////////////////////////////////
//	Collapsing boxes script by Nevron

var shortTextSpanPrefix = "cbShort-";
var longTextSpanPrefix = "cbLong-";
var glyphPrefix = "glyph-";

var glyphsArray = new Array();
var defaultGlyphSet = new Object();
var productGlyphSet = new Object();
var orangeBarGlyphSet = new Object();
var FAQGlyphSet = new Object();
var orangeGlyphSet = new Object();
var secondaryProductGlyphSet = new Object();

PrecacheImages();
MozillaEmbeddedTablesCheat();

function PrecacheImages()
{
	defaultGlyphSet.CollapsedImg = new Image(5);
	defaultGlyphSet.ExpandedImg = new Image(5);
	defaultGlyphSet.CollapsedImg.src = "images2/glyphfalse.gif";
	defaultGlyphSet.ExpandedImg.src = "images2/glyphtrue.gif";
	glyphsArray[CB_Default] = defaultGlyphSet;
	
	productGlyphSet.CollapsedImg = new Image(5);
	productGlyphSet.ExpandedImg = new Image(5);
	productGlyphSet.CollapsedImg.src = "images/glyphfalse.gif";
	productGlyphSet.ExpandedImg.src = "images/glyphtrue.gif";
	glyphsArray[CB_Product] = productGlyphSet;

	orangeBarGlyphSet.CollapsedImg = new Image(5);
	orangeBarGlyphSet.ExpandedImg = new Image(5);
	orangeBarGlyphSet.CollapsedImg.src = "images/obGlyphfalse.gif";
	orangeBarGlyphSet.ExpandedImg.src = "images/obGlyphtrue.gif";
	glyphsArray[CB_OrangeBar] = orangeBarGlyphSet;

	FAQGlyphSet.CollapsedImg = new Image(5);
	FAQGlyphSet.ExpandedImg = new Image(5);
	FAQGlyphSet.CollapsedImg.src = "images/FAQGlyphfalse.gif";
	FAQGlyphSet.ExpandedImg.src = "images/FAQGlyphtrue.gif";
	glyphsArray[CB_FAQ] = FAQGlyphSet;
	
	orangeGlyphSet.CollapsedImg = new Image(5);
	orangeGlyphSet.ExpandedImg = new Image(5);
	orangeGlyphSet.CollapsedImg.src = "images/orangeGlyphfalse.gif";
	orangeGlyphSet.ExpandedImg.src = "images/orangeGlyphtrue.gif";
	glyphsArray[CB_Orange] = orangeGlyphSet;
	
	secondaryProductGlyphSet.CollapsedImg = new Image(5);
	secondaryProductGlyphSet.ExpandedImg = new Image(5);
	secondaryProductGlyphSet.CollapsedImg.src = "images/secondaryGlyphfalse.gif";
	secondaryProductGlyphSet.ExpandedImg.src = "images/secondaryGlyphtrue.gif";
	glyphsArray[CB_SecondaryProduct] = secondaryProductGlyphSet;
}


function MozillaEmbeddedTablesCheat()
{
	var mozillaEmbeddedTablesCheatSpan = document.getElementById("spanMozillaEmbeddedTablesCheat");
	if(typeof(mozillaEmbeddedTablesCheatSpan) == "undefined" || mozillaEmbeddedTablesCheatSpan == null)
		return;

	mozillaEmbeddedTablesCheatSpan.className = "cbShortContentSpanVisiblefalse";
}

function SwapCbState(dbId, glyphSetIndex, anchorName)
{
	var shortTextSpan = document.getElementById(shortTextSpanPrefix + dbId);
	var longTextSpan = document.getElementById(longTextSpanPrefix + dbId);
	var glyphImg = document.getElementById(glyphPrefix + dbId);
	
	if(typeof(shortTextSpan) == "undefined" || typeof(longTextSpan) == "undefined" || typeof(glyphImg) == "undefined" )
		return;

	if(shortTextSpan.className == "cbShortContentSpanHiddenfalse")
	{
		shortTextSpan.className = "cbShortContentSpanVisiblefalse";
		longTextSpan.className = "cbLongContentSpanVisibletrue";
		glyphImg.src = glyphsArray[glyphSetIndex].ExpandedImg.src;

		if(typeof(anchorName) != "undefined")
			document.location.hash = "#" + anchorName;
		return;
	}
	
	if(shortTextSpan.className == "cbShortContentSpanVisibletrue")
	{
		shortTextSpan.className = "cbShortContentSpanVisiblefalse";
		longTextSpan.className = "cbLongContentSpanVisibletrue";
		glyphImg.src = glyphsArray[glyphSetIndex].ExpandedImg.src;
		
		if(typeof(anchorName) != "undefined")
			document.location.hash = "#" + anchorName;
		return;
	}
	
	shortTextSpan.className = "cbShortContentSpanVisibletrue";
	longTextSpan.className = "cbLongContentSpanVisiblefalse";
	glyphImg.src = glyphsArray[glyphSetIndex].CollapsedImg.src;
	
	if(typeof(anchorName) != "undefined")
		document.location.hash = "#top";
}

