// 2007.08.13 KJD: Document created

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

var NortonPageName				= "";
var NortonTabListByID			= new Array();
var childTabListByID			= new Array();
var mouseInHoverArea;
// 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 	= 225;	
	
	thisTab.style.display 		= "block";
	thisTab.style.height		= 50;
	
	thisTab.style.widtg 		= 225;
	thisTabBottom.style.width	= 225;
	

	
}

function childTab_Adjust( tabname )
{
	var thisTab					= document.getElementById( tabname );
	//var thisOuterTab			= document.getElementById( tabname + '_outer' );
	//var thisTabBottom			= document.getElementById( tabname + '_bottom' );
	
	
	//thisOuterTab.style.width 	= 190;
	thisTab.style.display 		= "block";
	//thisTab.style.width		= 210;
	
	

	
}
function Tab_Select_out( tabID )
{
	mouseInHoverArea=false;
	
	
	

}
// 2007.08.13 KJD:
function BizTab_CreateTab( tabID, tabText1,tabText2, tabCall )
{
	var thisString = "";
	
	var thisCall = "";
	if( typeof tabCall != 'undefined' )
	{
		thisCall += tabCall;
	}
	else
	{
		thisCall = "Tab_Select( this.id );" + tabCall;
	}
	
	var call2="Tab_Select_out();" ;
	// 2007.08.15 KJD: Check if extra style declared +" onMouseOut		=\"" + call2+ "\""
	var ExtraTabStyle = "";
	if( typeof NortonTabStyle != 'undefined' ){ ExtraTabStyle = " STYLE=\"" + NortonTabStyle + "\""; }
	
	thisString = ""
		+ "<DIV STYLE='display:block;border:none;width:10px;height:10px;float:left'></DIV><DIV CLASS='TabBox_outer_off' ID='" + tabID + "_outer' "
			
			+ " onmouseout		=\"" + call2 + "\"  onMouseOver		=\"" + thisCall + "\""
			+ ">"
		+ "<DIV ID='" + tabID + "_bottom' CLASS='BizBottomOff'></DIV>"
		+ "	<DIV ID='" + tabID + "' CLASS='Tab_Off'"
		+ ExtraTabStyle 
		+ ">" + tabText1 +"<br/>"+ tabText2
		+ "</DIV>"	
		
		+ "</DIV>";
	
	document.write( thisString );

	//NortonCheckIfMultiLineTab( tabID );

	
	NortonTab_Adjust( tabID );
	
	
	NortonTab_tempBox = tabID;
	NortonTabList[ NortonTabList.length ] = tabID;
	
	NortonTabListByID[ NortonTabListByID.length ] = tabID + "####" + tabText1 + "<br/>" + tabText2;
	
	NortonCheckIfFirstTab( tabID );
	NortonCheckIfNextLineTab( tabID );
	
	
}

//2007.09.06 KK: Creats child tabs



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

	
		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 > 10 )
		{
			NortonIsFirstTabOnNextLine = tabID;
		}
	}
}





// 2007.08.13 KJD:
function NortonTab_DeSelect( tabID )
{
	//defaultInfo();
	document.getElementById( tabID + "_bottom" ).className	= "BizBottomOff";
	document.getElementById( tabID + "_outer" ).className	= "TabBox_outer_off";
	document.getElementById( tabID ).className 				= "Tab_Off";
}



// 2007.08.13 KJD:
function NortonTab_DeSelectAll()
{
	for( var i=0; i< NortonTabList.length; i++ )
	{
		NortonTab_DeSelect( NortonTabList[ i ] );
	}
	
	defaultInfo();
}



function Tab_Select( tabID )
{
	mouseInHoverArea=true;	
	
	setTimeout(function(){NortonTab_Select( tabID )},250);
	
	

}
// 2007.08.13 KJD:
function NortonTab_Select( tabID )
{
	if(!mouseInHoverArea)
	{
		return false;
	}
	
	NortonTab_DeSelectAll();
	NortonFadeout();

	var thisName	= tabID;

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

	
	document.getElementById( thisName + "_bottom" ).className	= "BizBottomOn";
	document.getElementById( thisName + "_outer" ).className 	= "TabBox_outer_on";
	document.getElementById( thisName ).className 				= "Tab_On";
	
	// 2007.08.14 KJD: Check if first tab
	if(  thisName == "tab1" )
	{
		document.getElementById( 'BizTabCornerCover' ).style.visibility = "visible";
		document.getElementById( 'BizTabCornerCoverRight' ).style.visibility = "hidden";
	}
	
	else if ( thisName == "tab4")
	{
		document.getElementById( 'BizTabCornerCoverRight' ).style.visibility = "visible";
		document.getElementById( 'BizTabCornerCover' ).style.visibility = "hidden";
	}
	else{
		document.getElementById( 'BizTabCornerCoverRight' ).style.visibility = "hidden";
		document.getElementById( 'BizTabCornerCover' ).style.visibility = "hidden";
	}
	
	
	// 2007.08.15 KJD: Swap Content
	NortonTab_SwapInfo( thisName + "_Content", 'info' );


	// 2007.08.14 KJD: Adjust corners
	var thisTextHeight = document.getElementById( 'info' ).offsetHeight;
	//document.getElementById( 'TabSectionContent_outer' ).style.height = thisTextHeight+30;
	//document.getElementById( 'TabSectionContent_text' ).style.height = thisTextHeight+20;
	

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



// 2007.08.13 KJD:




// 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( 'BizBlendLayer', 1 );

	/*
	setTimeout( "Norton_SetOpacity( 'BizBlendLayer', .99 )",	100 );
	setTimeout( "Norton_SetOpacity( 'BizBlendLayer', .77 )",	200 );
	setTimeout( "Norton_SetOpacity( 'BizBlendLayer', .55 )",	300 );
	setTimeout( "Norton_SetOpacity( 'BizBlendLayer', .33 )",	400 );
	setTimeout( "Norton_SetOpacity( 'BizBlendLayer', .11 )",	500 );
	setTimeout( "Norton_SetOpacity( 'BizBlendLayer', .01 )",	600 );
	*/
}

// 2007.08.16 KJD:
function NortonFadein()
{
	setTimeout( "Norton_SetOpacity( 'BizBlendLayer', 1 )",		100 );
	setTimeout( "Norton_SetOpacity( 'BizBlendLayer', .77 )",	200 );
	setTimeout( "Norton_SetOpacity( 'BizBlendLayer', .55 )",	300 );
	setTimeout( "Norton_SetOpacity( 'BizBlendLayer', .33 )",	400 );
	setTimeout( "Norton_SetOpacity( 'BizBlendLayer', .11 )",	500 );
	setTimeout( "Norton_SetOpacity( 'BizBlendLayer', 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_CreateCurve_tab( thisID, thisSection, thisColor )
{
	var thisString = ""
		+ "<STYLE>"
		+ ".curve_" + thisID + "_top, .curve_" + thisID + "_bottom {display:block; background:transparent;width:225px}"
		+ "	.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:url('/images/masthead/business/b_top__gradation1.gif') bottom repeat-x ;" +"border:1px solid #ddd; border-width:0 1px}"
		+ "	.curve_" + thisID + "_Bdygs1 {margin:0 5px; background:#ddd }"
		+ "	.curve_" + thisID + "_Bdygs2 {margin:0 3px; border-width:0 2px}"
		+ "	.curve_" + thisID + "_Bdygs3 {margin:0 2px}"
		+ "	.curve_" + thisID + "_Bdygs4 {height:2px; margin:0 1px}"
		+ "	.curve_" + thisID + "_Bdygs5, .curve_" + thisID + "_Bdygs6, .curve_" + thisID + "_Bdygs7, .curve_" + thisID + "_Bdygs8 {display:block; overflow:hidden}"
		+ "	.curve_" + thisID + "_Bdygs5, .curve_" + thisID + "_Bdygs6, .curve_" + thisID + "_Bdygs7 {height:1px}"
		+ "	.curve_" + thisID + "_Bdygs6, .curve_" + thisID + "_Bdygs7, .curve_" + thisID + "_Bdygs8 {background:#fff;" +"border:1px solid " + thisColor + "; border-width:0 1px}"
		+ "	.curve_" + thisID + "_Bdygs5 {margin:0 5px; background:#fff}"
		+ "	.curve_" + thisID + "_Bdygs6 {margin:0 3px; border-width:0 2px}"
		+ "	.curve_" + thisID + "_Bdygs7 {margin:0 2px}"
		+ "	.curve_" + thisID + "_Bdygs8 {height:2px; margin:0 1px}"
		+ "</STYLE>";
		
	if( thisSection == 'top' )
	{
		thisString += ""
			+ "	<div class='curve_" + thisID + "_" + thisSection + "'>"
			+ "		<div class='curve_" + thisID + "_Bdygs5'><b></b></div>"
			+ "		<div class='curve_" + thisID + "_Bdygs6'></div>"
			+ "		<div class='curve_" + thisID + "_Bdygs7'><b></b></div>"
			+ "		<div class='curve_" + thisID + "_Bdygs8'><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;
}

function childTab_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\" >" + 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.14 KJD: Check browser type
	var thisNav = navigator.userAgent.toLowerCase();

	// 2007.08.20 KJD: for non-IE
	if( thisNav.indexOf( "msie" ) == -1 )
	{
		thisInnerDiv.style.height	= newDiv.offsetHeight + 20;
		thisParentDiv.style.height	= newDiv.offsetHeight + 70;
		thisGrandDiv.style.height	= newDiv.offsetHeight + 75;
	}
	else
	{
		thisInnerDiv.style.height	= newDiv.offsetHeight + 150;
		thisParentDiv.style.height	= newDiv.offsetHeight + 180;
		thisGrandDiv.style.height	= newDiv.offsetHeight + 180;
	}
	
}

// 2007.08.16 KJD: Adjust the Blend Layer
function NortonTab_AdjustBlendLayer()
{
	var thisInnerDiv	= document.getElementById( 'TabSectionContent_text_inner' );
	
	if( document.getElementById( 'BizBlendLayer' ) )
	{
		document.getElementById( 'BizBlendLayer' ).style.height = thisInnerDiv.offsetHeight - 25;
	}
}

// 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;
		}
	}
}
