// check for IE by object testing. Returns Boolean.
function isIE() 
{
	if (document.all) 
	{
		return true;
	}
	else
	{
		return false;
	}
}


// uses isIE() on each page it is included.
// Reason: This application is IE only!
if ( !isIE() )
{
	message="NOTE:\n Internet Explorer v5.0+ is needed to use the " +
		" Verizon Broadband Toolbar.\n\n" +
		"Please close your current Browser and open Internet Explorer.\n";
	alert(message);
}


// sets flag when loading of object failed and redirects to an error page
var objError = false;

function trapComErr(e)
{
	objError = true;
	window.location.href = "failed.asp";
}


// parses QueryString ("?x=a&y=b") and allows looking up key values.
var arrKeyValues = new Array;

function parseQueryString ( querystring )
{
	var strTemp = querystring.substr(1, querystring.length);
	var result = strTemp.match(/^vzbb/);
	if (result != null && result.length > 1)
	{
		strTemp = strTemp.substr(4, strTemp.length);
	}
	var arrPairs = strTemp.split("&");
	
	for ( var i = 0; i < arrPairs.length; i++ )
	{
		arrKeyValues[ arrPairs[i].split("=")[0] ] = arrPairs[i].split("=")[1];
	}
}

function getQSAttribute ( key )
{
	if (arrKeyValues[key])
	{
		return arrKeyValues[key];
	}
	else
	{
		return '';
	}
}

// functions that are used on the options page.
// setFormValues sets the starting values
// resetFormValues resets the values to their default values
function setFormValues() {
	oneform.SearchInNewWindow.checked	=	( getQSAttribute( 'SearchInNewWindow' ) == '1') ? true : false;

	var boxsize = getQSAttribute( 'BoxSize_COMBOSEARCH' );
	if ( boxsize < 0 || boxsize > 2 || isNaN( boxsize ) )
	{
		boxsize = 0;
	}
	
	for (var i = 0; i < oneform.BoxSize_COMBOSEARCH.length; i++)
	{
		if (oneform.BoxSize_COMBOSEARCH[i].value == boxsize)
		{
			oneform.BoxSize_COMBOSEARCH[i].checked = true;
		}
	}

	oneform.HistoryTrack.checked			= ( getQSAttribute( 'HistoryTrack' ) == '1') ? true : false;
	oneform.HistoryStore.checked			= ( getQSAttribute( 'HistoryStore' ) == '1') ? true : false;
	oneform.HistoryAutoClick.checked	= ( getQSAttribute( 'HistoryAutoClick' ) == '1') ? true : false;

	var captions = getQSAttribute( 'ShowCaptions' );
	if ( captions < 0 || captions > 2 || isNaN( boxsize ) )
	{
		captions = 0;
	}

	for (var i = 0; i < oneform.ShowCaptions.length; i++)
	{
		if (oneform.ShowCaptions[i].value == captions)
		{
			oneform.ShowCaptions[i].checked = true;
		}
	}

	oneform.buttonwebsearch.checked		= ( getQSAttribute( 'buttonwebsearch' ) == '1') ? true : false;
}

function resetFormValues() {
	oneform.BoxSize_COMBOSEARCH.value	=	1;
	oneform.ShowCaptions.value				= 1;
	oneform.SearchInNewWindow.checked	=	false;
	oneform.HistoryTrack.checked			= true;
	oneform.HistoryStore.checked			= true;
	oneform.HistoryAutoClick.checked	= true;
	oneform.buttonwebsearch.checked		= true;
	window.location.href 							= 'http://www.donotchangeit.com/?vzbbReset=';
}

function submitFormValues()  {
	window.location.href = "http://www.donotchangeit.com/?vzbbOk=&";
}


// upgrade toolbar function
function upgradeToolbar() {
  window.location.href = "ggtbupgrade19671131vzbb8753409889.html";
}
