// 2007.08.13 KJD: Document created

var NortonTab_tempBox			= "";
var thisTabSet					= 0;
var NortonTabList 				= new Array();
var NortonIsFirstTabName		= "";
var NortonIsFirstTabOnNextLine 	= "";  // this is my favorite variable name ;)

var NortonPageName				= "";
var NortonTabListByID			= new Array();

// 2007.08.13 KJD:
function NortonTab_Adjust( tabname )
{
	var thisTab					= document.getElementById( tabname );
	var thisOuterTab			= document.getElementById( tabname + '_outer' );
	var thisTabBottom			= document.getElementById( tabname + '_bottom' );
	
	
	thisOuterTab.style.width 	= thisTab.offsetWidth + 20 + "px";
	thisTab.style.display 		= "block";	
	thisTabBottom.style.width	= thisTab.offsetWidth + "px";

}

// 2007.08.13 KJD:
function NortonTab_CreateTab( tabID, tabText, tabCall )
{
	var thisString = "";
	
	var thisCall = "";
	if( typeof tabCall != 'undefined' )
	{
		thisCall += tabCall;
	}
	else
	{
		thisCall = "NortonTab_Select( this.id );" + tabCall;
	}
	
	// 2007.08.15 KJD: Check if extra style declared
	var ExtraTabStyle = "";
	if( typeof NortonTabStyle != 'undefined' ){ ExtraTabStyle = " STYLE=\"" + NortonTabStyle + "\""; }
	
	thisString = ""
		+ "<DIV CLASS='TabBox_outer_off' ID='" + tabID + "_outer' "
			+ "onClick		=\"" + thisCall + "\""
			+ ">"
		+ "	<DIV ID='" + tabID + "' CLASS='Tab_Off'"
		+ ExtraTabStyle 
		+  ">" + tabText + "</DIV>"
		+ "<DIV ID='" + tabID + "_bottom' CLASS='NortonTab_Bottom_Off'></DIV>"
		
		+ "</DIV><DIV STYLE='display:block;border:none;width:10px;height:40px;float:left'></DIV>";
	
	document.write( thisString );

	NortonCheckIfMultiLineTab( tabID );

	
	NortonTab_Adjust( tabID );
	
	
	NortonTab_tempBox = tabID;
	NortonTabList[ NortonTabList.length ] = tabID;
	
	NortonTabListByID[ NortonTabListByID.length ] = tabID + "####" + tabText;
	
	NortonCheckIfFirstTab( tabID );
	NortonCheckIfNextLineTab( tabID );
	
	
}

// 2007.08.14 KJD: Check if multiple line
function NortonCheckIfMultiLineTab( tabID, oversent )
{
	var thisTab		= document.getElementById( tabID );
	var thisWidth	= thisTab.offsetWidth;

	if( thisTab.offsetHeight > 50 )
	{
		thisWidth += 5;

		thisTab.style.width = thisWidth + "px";

		setTimeout( "NortonCheckIfMultiLineTab( '" + tabID + "', 1 )", 1 );
	}
	else if( oversent )
	{
		NortonIsFirstTabOnNextLine = "";
		NortonTab_Adjust( tabID );
		NortonCheckIfFirstTab( tabID );
		NortonCheckIfNextLineTab( tabID );
		
		// 2007.08.14 KJD: Adjust box
		thisWidth += 10;
		thisTab.style.width = thisWidth + "px";

		// 2007.08.14 KJD: Adjust highlight
		document.getElementById( tabID + '_bottom' ).style.width = thisWidth;
	}
}


// 2007.08.13 KJD:
function NortonCheckIfFirstTab( tabID )
{
	if( !( NortonIsFirstTabName ) )
	{
		NortonIsFirstTabName = tabID;
	}
}

// 2007.08.13 KJD:
function NortonCheckIfNextLineTab( tabID )
{
	if( !( NortonIsFirstTabOnNextLine ) )
	{
		var thisTab = document.getElementById( tabID );
		if( thisTab.offsetTop > 30 )
		{
			NortonIsFirstTabOnNextLine = tabID;
		}
	}
}

// 2007.08.13 KJD:
function NortonTab_DeSelectAll()
{
	for( var i=0; i< NortonTabList.length; i++ )
	{
		NortonTab_DeSelect( NortonTabList[ i ] );
	}
}
// 2007.08.13 KJD:
function NortonTab_DeSelect( tabID )
{
	document.getElementById( tabID + "_bottom" ).className	= "NortonTab_Bottom_Off";
	document.getElementById( tabID + "_outer" ).className	= "TabBox_outer_off";
	document.getElementById( tabID ).className 				= "Tab_Off";
}

// 2007.08.13 KJD:
function NortonTab_Select( tabID )
{
	NortonTab_DeSelectAll();
	NortonFadeout();

	var thisName	= tabID;
	thisName		= thisName.replace( "_outer", "" );

	document.getElementById( thisName + "_bottom" ).className	= "NortonTab_Bottom_On";
	document.getElementById( thisName + "_outer" ).className 	= "TabBox_outer_on";
	document.getElementById( thisName ).className 				= "Tab_On";
	
	// 2007.08.14 KJD: Check if first tab
	if( ( thisName == NortonIsFirstTabName ) || ( thisName == NortonIsFirstTabOnNextLine ) )
	{
		document.getElementById( 'NortonTab_cornercover' ).style.visibility = "visible";
	}
	else
	{
		document.getElementById( 'NortonTab_cornercover' ).style.visibility = "hidden";
	}
	
	// 2007.08.15 KJD: Swap Content
	NortonTab_SwapInfo( thisName + "_Content", 'TabSectionContent_text_inner' );


	// 2007.08.16 KJD: Adjust the size
	if( window.NortonTabContentAutoSize )
	{
		NortonTab_AdjustContent( thisName );
	}
	
	NortonTab_AdjustBlendLayer();
	NortonFadein();
	
	NortonTrackTab( thisName );

	NortonTabProductTitle();
	NortonTabProductTitle2();
}

// 2007.08.13 KJD:
function Norton_SetOpacity( itemID, itemAlpha )
{
	if( document.getElementById( itemID ) )
	{
		document.getElementById( itemID ).style.filter	= "alpha( opacity=" + ( 100 * itemAlpha ) + ")";
		document.getElementById( itemID ).style.opacity = itemAlpha;
		
		if( itemAlpha == 1 )
		{
			document.getElementById( itemID ).style.visibility = "visible";
		}
		else if( itemAlpha == 0 )
		{
			document.getElementById( itemID ).style.visibility = "hidden";
		}
	}
}

// 2007.08.13 KJD:
function NortonFadeout()
{
	Norton_SetOpacity( 'Norton_BlendLayer', 1 );
}

// 2007.08.16 KJD:
function NortonFadein()
{
	setTimeout( "Norton_SetOpacity( 'Norton_BlendLayer', 1 )",		100 );
	setTimeout( "Norton_SetOpacity( 'Norton_BlendLayer', .77 )",	200 );
	setTimeout( "Norton_SetOpacity( 'Norton_BlendLayer', .55 )",	300 );
	setTimeout( "Norton_SetOpacity( 'Norton_BlendLayer', .33 )",	400 );
	setTimeout( "Norton_SetOpacity( 'Norton_BlendLayer', .11 )",	500 );
	setTimeout( "Norton_SetOpacity( 'Norton_BlendLayer', 0 )",		600 );
}


// 2007.08.14 KJD: Create curve
function Norton_CreateCurve( thisID, thisSection, thisColor )
{
	var thisString = ""
		+ "<STYLE>"
		+ ".curve_" + thisID + "_top, .curve_" + thisID + "_bottom {display:block; background:transparent}"
		+ "	.curve_" + thisID + "_Bdygs1, .curve_" + thisID + "_Bdygs2, .curve_" + thisID + "_Bdygs3, .curve_" + thisID + "_Bdygs4 {display:block; overflow:hidden}"
		+ "	.curve_" + thisID + "_Bdygs1, .curve_" + thisID + "_Bdygs2, .curve_" + thisID + "_Bdygs3 {height:1px}"
		+ "	.curve_" + thisID + "_Bdygs2, .curve_" + thisID + "_Bdygs3, .curve_" + thisID + "_Bdygs4 {background:" + thisColor + "; border:1px solid " + thisColor + "; border-width:0 1px}"
		+ "	.curve_" + thisID + "_Bdygs1 {margin:0 5px; background:" + thisColor + "}"
		+ "	.curve_" + thisID + "_Bdygs2 {margin:0 3px; border-width:0 2px}"
		+ "	.curve_" + thisID + "_Bdygs3 {margin:0 2px}"
		+ "	.curve_" + thisID + "_Bdygs4 {height:2px; margin:0 1px}"
		+ "</STYLE>";
		
	if( thisSection == 'top' )
	{
		thisString += ""
			+ "	<div class='curve_" + thisID + "_" + thisSection + "'>"
			+ "		<div class='curve_" + thisID + "_Bdygs1'><b></b></div>"
			+ "		<div class='curve_" + thisID + "_Bdygs2'></div>"
			+ "		<div class='curve_" + thisID + "_Bdygs3'><b></b></div>"
			+ "		<div class='curve_" + thisID + "_Bdygs4'><b></b></div>"
			+ "	</div>";
	}
	else
	{
		thisString += ""
			+ "	<div class='curve_" + thisID + "_" + thisSection + "'>"
			+ "		<div class='curve_" + thisID + "_Bdygs4'><b></b></div>"
			+ "		<div class='curve_" + thisID + "_Bdygs3'></div>"
			+ "		<div class='curve_" + thisID + "_Bdygs2'><b></b></div>"
			+ "		<div class='curve_" + thisID + "_Bdygs1'><b></b></div>"
			+ "	</div>";
	}
	
	
	return thisString;

}
function Norton_CreateCurveSmallRgt( thisID, thisSection, thisColor )
{
	var thisString = ""
		+ "<STYLE>"
		+ ".curve_" + thisID + "_top, .curve_" + thisID + "_bottom {display:block; background:transparent}"
		+ "	.curve_" + thisID + "_Bdygs1, .curve_" + thisID + "_Bdygs2, .curve_" + thisID + "_Bdygs3, .curve_" + thisID + "_Bdygs4 {display:block; overflow:hidden}"
		+ "	.curve_" + thisID + "_Bdygs1, .curve_" + thisID + "_Bdygs2, .curve_" + thisID + "_Bdygs3 {height:1px}"
		+ "	.curve_" + thisID + "_Bdygs2, .curve_" + thisID + "_Bdygs3, .curve_" + thisID + "_Bdygs4 {background:" + thisColor + "; border:1px solid " + thisColor + "; border-width:0 1px}"
		+ "	.curve_" + thisID + "_Bdygs1 {margin:0 4px 0 0; background:" + thisColor + "}"
		+ "	.curve_" + thisID + "_Bdygs2 {margin:0 2px 0 0; border-width:0 2px}"
		+ "	.curve_" + thisID + "_Bdygs3 {margin:0 1px 0 0}"
		+ "	.curve_" + thisID + "_Bdygs4 {height:1px; margin:0 1px 0 0}"
		+ "</STYLE>";
		
	if( thisSection == 'top' )
	{
		thisString += ""
			+ "	<div class='curve_" + thisID + "_" + thisSection + "'>"
			+ "		<div class='curve_" + thisID + "_Bdygs1'><b></b></div>"
			+ "		<div class='curve_" + thisID + "_Bdygs2'></div>"
			+ "		<div class='curve_" + thisID + "_Bdygs3'><b></b></div>"
			+ "		<div class='curve_" + thisID + "_Bdygs4'><b></b></div>"
			+ "	</div>";
	}
	else
	{
		thisString += ""
			+ "	<div class='curve_" + thisID + "_" + thisSection + "'>"
			+ "		<div class='curve_" + thisID + "_Bdygs4'><b></b></div>"
			+ "		<div class='curve_" + thisID + "_Bdygs3'></div>"
			+ "		<div class='curve_" + thisID + "_Bdygs2'><b></b></div>"
			+ "		<div class='curve_" + thisID + "_Bdygs1'><b></b></div>"
			+ "	</div>";
	}
	
	
	return thisString;

}


// 2007.08.15 KJD: Swap the div info
function NortonTab_SwapInfo( sourceDiv, targetDiv )
{
	var thisHTML = document.getElementById( sourceDiv ).innerHTML;
	document.getElementById( targetDiv ).innerHTML = "";
	document.getElementById( targetDiv ).innerHTML = thisHTML;
}

// 2007.08.16 KJD: Adjust the content area
function NortonTab_AdjustContent( sourceDiv )
{
	var thisInnerDiv	= document.getElementById( 'TabSectionContent_text_inner' );

	// 2007.08.16 KJD: This corrects issues with divs within 
	var thisHTML = "<DIV STYLE=\"position:absolute;\" ID=\"NortonTab_ContentCorrected\" STYLE='border:solid white 1px;'>" + thisInnerDiv.innerHTML + "</div>";
	thisInnerDiv.innerHTML = thisHTML;

	var thisParentDiv	= document.getElementById( 'TabSectionContent_text' );
	var thisGrandDiv	= document.getElementById( 'TabSectionContent_outer' );
	
	var newDiv = document.getElementById( 'NortonTab_ContentCorrected' );
	
}

// 2007.08.16 KJD: Adjust the Blend Layer
function NortonTab_AdjustBlendLayer()
{
	var thisInnerDiv	= document.getElementById( 'TabSectionContent_text_inner' );

}

// 2007.08.16 KJD: Track the tab in use

var IsTracked = 0;

function NortonTrackTab( thisName )
{
	if( !( NortonPageName ) )
	{
		if( !( typeof s == 'undefined' ) )
		{
			// 2007.08.16 KJD: Pagename hasn't been set yet, so set it
			NortonPageName = s.pageName;
		}
		
		// 2007.08.16 KJD: Keep checking
		setTimeout( "NortonTrackTab( \"" + thisName + "\" )", 1000 );
	}
	else
	{
		var thisNortonPageName = "";
	
		if( thisName != 'more' )
		{
			for( var i = 0; i < NortonTabListByID.length; i++ )
			{
				var thisTabArray = NortonTabListByID[ i ].split( "####" );
				if( thisTabArray[0] == thisName )
				{
					thisNortonPageName = NortonPageName + ": " + thisTabArray[1];
				}
			}
		}
		else
		{
			thisNortonPageName = NortonPageName + ": More";
		}
	
			
		s.prop31 = thisNortonPageName;
		
		if( IsTracked )
		{
			void( s.t() );
		}
		else
		{
			// 2007.08.20 KJD: So we skip the first time
			IsTracked = 1;
		}
	}
}

// 2007.08.23 KJD: Check the Product Title width's
function NortonTabProductTitle()
{
	var thisObj = document.getElementsByName( 'TabSectionContent_ProductTitle' );
	
	if( thisObj.length > 0 )
	{
		for( var i = 0; i < thisObj.length; i++ )
		{
			// 2007.08.23 KJD: Set width
			thisObj[ i ].style.width	= "285px";
			
			NortonTabProductTitleAdjust( thisObj[ i ] );
		}
	}
}
// 2007.08.23 KJD: Check the Product Title width's
function NortonTabProductTitle2()
{
	var thisObj = document.getElementsByName( 'TabSectionContent_ProductTitle2' );
	
	if( thisObj.length > 0 )
	{
		for( var i = 0; i < thisObj.length; i++ )
		{
			// 2007.08.23 KJD: Set width
			thisObj[ i ].style.width	= "210px";
			
			NortonTabProductTitleAdjust( thisObj[ i ] );
		}
	}
}

// 2007.08.23 KJD: Adjust the font size of the product title
function NortonTabProductTitleAdjust( thisName )
{
	// 2007.08.23 KJD: Check height
	if( thisName.offsetHeight > 30 )
	{
		
		var thisFontSize = parseInt( thisName.style.fontSize );
		if( !( thisFontSize ) )
		{
			thisFontSize = 15;
		}
		else
		{
			thisFontSize--;
		}
		
		thisName.style.fontSize = thisFontSize + "px";
		
		setTimeout( "NortonTabProductTitle()", 10 );
	}
}



