var d, dom, ie, ie4, ie5x, moz, mac, win, lin, old, ie5mac, ie5xwin, op;
d = document;
n = navigator;
na = n.appVersion;
nua = n.userAgent;
win = ( na.indexOf( 'Win' ) != -1 );
mac = ( na.indexOf( 'Mac' ) != -1 );
lin = ( nua.indexOf( 'Linux' ) != -1 );

if ( !d.layers ){
	dom = ( d.getElementById );
	op = ( nua.indexOf( 'Opera' ) != -1 );
	konq = ( nua.indexOf( 'Konqueror' ) != -1 );
	saf = ( nua.indexOf( 'Safari' ) != -1 );
	moz = ( nua.indexOf( 'Gecko' ) != -1 && !saf && !konq);
	ie = ( d.all && !op && !saf && !konq );
	ie4 = ( ie && !dom );
	ie5x = ( d.all && dom );
	ie5mac = ( mac && ie5x );
	ie5xwin = ( win && ie5x );
}

function write_page_code ( part, extra )
{
	var bookmark = '<span><a name="bookmark this page" href="#"' +  'onclick="window.external.AddFavorite(window.document.location,window.document.title)">' +
	'Bookmark this page</a></span>';
	switch ( part )
	{
		case 'bookmark':
			if ( ie && !ie4 && ( parent.frames.length <= 1 ))
			{
				document.write(bookmark);
			}
			break;
		default:
			break;
	}
}

function table_display ( table_id, onoff, other )
{
	if ( dom )
	{
		d.getElementById( table_id ).style.visibility = onoff;
		if ( other )
		{
			d.getElementById(other).style.visibility = 'visible';
		}
	}
}

function no_more_junk(name, domain, css_class, subject, which, text, type) 
{
	closep = '';
	if (subject)
	{
		subject = '?subject=' + subject;
	}
	if (css_class)
	{
		css_class += ' class="' + css_class + '\"';
	}
	if (!text)
	{
		text = name + '@' + domain + '.' + type;
	}
	if (which == 'glossary')
	{
		blurb = '<p class="glossary-link">If you\'d like to make a comment or suggestion about the definition, ';
		text = 'click here';
		closep = '</p>';
	}
	if (which == 'customer')
	{
		blurb = '';
		text = 'click here';
		closep = '';
	}
	email = blurb + '<a href=\"mailto:' + name + '@' + domain + '.' + type + subject + '\"' + css_class + 
	'\>' + text + '<\/a>' + closep;
	d.write(email);
}

function dropdown_location_changer()
{
	location = document.gotolocation.dropdown.options[document.gotolocation.dropdown.selectedIndex].value;
}

function OpenComments (c) 
	{
	window.open(c, 'comments', 'width=645,height=480,scrollbars=yes,status=yes');
}

