// 2007.08.06 KJD: Button Items

// 2007.08.06 KJD: Create a Symantec Button

var testButton = "";

function SymButton( buttonName, thisText, thisAlt, thisURL, FontSize, StartColor, EndColor, text_default, text_over )
{
	var thisString = thisText;

	// 2007.09.12 KJD: Need to Encode and Serialize text because of regional characters
	thisString = base64( escape( thisText ) );

	
	// document.getElementById( 'outputdiv' ).innerHTML = thisString;
	
	// var thisButton = "/flash/20070807/button_norton.swf?thisText=" + escape( thisText );
	// var thisButton = "/flash/20070912/button_norton.swf?thisText=" + thisString;
	var thisButton = "../flash/button_norton.swf?thisText=" + thisString;
	
	// document.write( thisButton );
	// alert( thisButton );
	
	// 2007.08.30 KJD: Added for non-flash
	var thisStyle = "font-family:Arial;";
	
	if( typeof FontSize 	!= 'undefined' )	{		thisButton += "&text_size=" 			+ FontSize;				thisStyle += "font-size:" + FontSize + "px;";}
	if( typeof StartColor 	!= 'undefined' )	{		thisButton += "&StartColor=" 			+ StartColor;			thisStyle += "background-color:#" + StartColor.replace( "0x","" ) + ";";}
	if( typeof EndColor 	!= 'undefined' )	{		thisButton += "&EndColor=" 				+ EndColor;				}
	
	if( typeof text_default	!= 'undefined' )	{		thisButton += "&text_color_default="	+ text_default;			thisStyle += "color:#" + text_default.replace("0x","") + ";";}
	if( typeof text_over 	!= 'undefined' )	{		thisButton += "&text_color_over=" 		+ text_over;			}
	
	if( typeof thisURL	 	!= 'undefined' )	{		thisButton += "&thisURL=" 				+ escape( thisURL );	}
	
	// 2007.08.14 KJD: Check browser type
	var thisNav = navigator.userAgent.toLowerCase();
	if( thisNav.indexOf( "msie" ) > -1 )
	{
		thisButton += "&isIE=1";
	}
	else
	{
		thisButton += "&isIE=0";
	}
	
	thisButton += "&buttonName=" + buttonName;
	
	// 2007.08.30 KJD: Check if Flash Enabled
	if( FlashDetected() )
	{
		thisString = DisplayFlash( thisButton, 600, 60, buttonName, 1 );
	}
	else
	{
		// 2007.08.30 KJD: Show regular button if no flash
		thisString = "<INPUT TYPE='BUTTON' VALUE=\"" + thisText + "\" STYLE=\"font-weight:bold;" + thisStyle + "\">";
	}
	
	
	var thisStyle = "position:relative;display:block;overflow:hidden;clear:both;width:150px;";

	var myCheck = thisURL.toLowerCase();
	
	if( myCheck.indexOf( 'javascript:' ) > -1 )
	{
		thisURL = thisURL.replace( "javascript:", "" );
	}
	else
	{
		// thisURL = "location.href = '" + thisURL + "'";
		// 2007.09.07 KJD: Updated to use location function
		thisURL = "URLredirect( '" + thisURL + "' )";
	}

	document.write( "<DIV ID='button_" + buttonName + "' STYLE='" + thisStyle + "' TITLE=\"" + thisAlt + "\" onMouseDown=\"" + thisURL + "\">" + thisString + "</DIV>" );
	
	testButton = thisString;
	
	SetVB( buttonName );
	
	return thisString;
}


// 2007.08.09 KJD: Receive sizes
function Button_SetSize( buttonName, thisInfo )
{
	var thisSize = thisInfo.split( "," );
	
	var arg0 = thisSize[0];
	var arg1 = thisSize[1];

	if( arg0 == "url" )
	{
		ButtonReceive( arg1 );
	}
	else
	{
		document.getElementById( 'button_' + buttonName ).style.width	= parseInt( arg0 ) + 5;
		document.getElementById( 'button_' + buttonName ).style.height	= parseInt( arg1 ) + 5;
	}
}

// 2007.08.09 KJD: Set up VB function
function SetVB( buttonName )
{
	// 2007.07.27 KJD: Catch FSCommand in IE
	document.write( ""
		+ "<SCR" + "IPT LANGUAGE=\"VBScript\">"
		+ "Sub " + buttonName + "_FSCommand(ByVal command, ByVal args)\n"
		// + "call Button_SetSize( \"" + buttonName + "\", args)\n"
		+ "call FlashItem_DoFSCommand( args )\n"
		+ "end sub"
		+ "</SCR" + "IPT>" );
}

// 2007.08.14 KJD: Receive URL from Button
function ButtonReceive( thisArg )
{
	var myCheck = thisArg.toLowerCase();
	
	if( myCheck.indexOf( 'javascript:' ) > -1 )
	{
		thisArg = thisArg.replace( "javascript:", "" );
		eval( thisArg );
	}
	else
	{
		// location.href = thisArg;
		// 2007.09.07 KJD: Updated to use Location function
		URLredirect( thisArg )
	}
}


function testme( thistext )
{
	// alert( thistext );
}