/*
Tested for 
- Internet Explorer 4.0, 5.0, 5.5
- Netscape 6.01
- Opera, Web TV, Konquerer, Galeon
-----------------------------------------*/

function gos(){
 if(document.selection && document.selection.createRange){
  var oBuf=document.selection.createRange();
  document.forms.tt.Terms.value=document.all['cri'].innerText+' '+oBuf.text;
  if(oBuf.text!=''){document.forms.tt.submit();}
 }
}
document.ondblclick=gos;
function foc(){self.focus();}
//if(screen.width>1500){
//document.write("<style type='text/css'>TD,TH{FONT-FAMILY:arial, helvetica, ms sans serif, sans serif;}TD{FONT-SIZE:9pt;}</style>")
//}

var fSize      = 1;	// init sans-serif
var fontSize   = 11;
var fontFamily = 'verdana,geneva,arial,helvetica,sans-serif';

function stSetObj()
	{
	if (document.getElementById) stObj = document.getElementById('defBody');
	if (document.all) stObj = document.all('defBody');
	}
	
function fontTg()
	{
	stSetObj();
	if (fontFamily == 'verdana,geneva,arial,helvetica,sans-serif')
		{
		fontFamily = 'georgia,times,times new roman,serif';
		if (fSize == 1)	// checks for sans-serif then adjusts
			{
			fontSize += 3;	// +3px for the serif font
			stObj.style.fontSize = fontSize + 'px';
			fSize = 0;
			}
		}
	else
		{
		fontFamily = 'verdana,geneva,arial,helvetica,sans-serif';
		if (fSize == 0)	// checks for serif then adjusts
			{
			fontSize -= 3;	// -3px for the serif font
			stObj.style.fontSize = fontSize + 'px';
			fSize = 1;
			}
		}
	stObj.style.fontFamily = fontFamily;
	stSavePrefs();
	}

function fontUp()
	{
	fontSize += 1;
	if (fSize == 1)
		{
		if (fontSize > 18) fontSize = 18;	// was 16
		}
	else 
		{
		if (fontSize > 21) fontSize = 21;	// +3px for the serif font, was 19
		}
	stSetObj();
	stObj.style.fontSize = fontSize + 'px';
	stSavePrefs();
	}
	
function fontDn()
	{
	fontSize -= 1;
	if (fSize == 1)
		{
		if (fontSize < 9) fontSize = 9;
		}
	else 
		{
		if (fontSize < 12) fontSize = 12	// +3px for the serif font
		}
	stSetObj();
	stObj.style.fontSize = fontSize + 'px';
	stSavePrefs();
	}

function stSavePrefs()
	{
	tCookie = 'stPrefs=';
	tCookie = tCookie + '^fSize=' + fSize + '^fontSize=' + fontSize + '^fontFamily=' + fontFamily;
	var expire = new Date ();
   	expire.setTime (expire.getTime() + (30 * 24 * 3600000));	// expires 30 days from users clock
   	expire = expire.toGMTString();
	fCookie = tCookie + '; path=/; expires=' + expire; 
  	document.cookie = fCookie;
	}

function stLoadPrefs()
	{
	stPrefString = null;
	tArray = document.cookie.split(';');
	for (tA = 0; tA < tArray.length; tA++)
		{
		if (tArray[tA].indexOf('stPrefs=') > -1)
			{
			tPos = tArray[tA].indexOf('=') + 2;
			stPrefString = tArray[tA].substring(tPos, tArray[tA].length);
			}
		}
	if (stPrefString != null)
		{
		tArray = stPrefString.split('^');
		for (tA = 0; tA < tArray.length; tA++)
			{
			if (tArray[tA].indexOf('fSize') > -1)
				{
				tFSize = tArray[tA].split('=');
				fSize  = parseInt(tFSize[1]);
				}
			if (tArray[tA].indexOf('fontSize') > -1)
				{
				tFontSize = tArray[tA].split('=');
				fontSize  = parseInt(tFontSize[1]);
				}
			if (tArray[tA].indexOf('fontFamily') > -1)
				{
				tFontFamily = tArray[tA].split('=');
				fontFamily  = (tFontFamily[1]);
				}
			}
		}
	}

function stSetElm()
	{
	stSetObj();
	stObj.style.fontSize = fontSize + 'px';
	stObj.style.fontFamily = fontFamily;
	stSavePrefs();
	}

function stInit()	// loaded in a global onload function in script.js
	{
	stLoadPrefs();
	stSetElm();
	}


//     Browser Detection ----------

agt = navigator.userAgent.toLowerCase();
w3c = (document.getElementById) ? true : false;
xxx = ((agt.indexOf('opera') != -1) || (agt.indexOf('webtv') != -1) || (agt.indexOf('omniweb') != -1)) ? true : false;
ieX = ((agt.indexOf('msie')  != -1) && w3c && !xxx) ? true : false;
ie4 = ((agt.indexOf('msie')  != -1) && (document.all) && !w3c && !xxx) ? true : false;
ns6 = ((agt.indexOf('gecko') != -1) && w3c && !xxx) ? true : false;
ns4 = (document.layers && !w3c && !xxx) ? true : false;


function initialize() 
	{
	 stInit();
	}
window.onload = initialize;