
function FindFrame(wnd, frameName) 
{   
  for (i = 0; i < wnd.frames.length; i++) 
  {
	if (wnd.frames[i].name == frameName)
	{
		return  wnd.frames[i];
	}
  }
  return null;
}

function FindParentFrame(frameName) 
{
  return FindFrame(parent.window, frameName);
}

function opnInParentFrame(frameName, url)
{
	var frm = FindParentFrame(frameName);
	if (frm)
	{
		frm.window.location =url;
	}
}

function readStyleSheetData()
{
	if (document.styleSheets)
	{
        evenRowColor = '#99CCFF';	//document.styleSheets[0].'EVENROW'.backgroundColor;
        oddRowColor = 'paleturquoise';	//document.styleSheets[0].['ODDROW'].backgroundColor;
    }
}


// the name of this function is made short to make html pages smaller: "opn" id shorter than "window.location"
function opn(url) 
{ 
  window.location =url;
}

function parentOpn(url) 
{ 
  parent.window.location =url;
}
function openWindow(url, title, features) 
{ 
  newWin = window.open(url,title,features);
  newWin.focus();
}

function closeWindow() 
{ 
  if (newWin && !newWin.closed)
  {
  	newWin.close()
  }
}

function FindStyleRule(styleName) 
{
  var theRules = new Array();
  for (i = 0; i < document.styleSheets.length; i++) 
  {
	if (document.styleSheets[i].cssRules)
	{
//alert("Netscape; cssRules");
		theRules = document.styleSheets[i].cssRules;	// Netscape
	}
	else if (document.styleSheets[i].rules)
	{
//alert("IE; rules");
		theRules = document.styleSheets[i].rules;	// IE
	}
	else 
	{
		return;
	}
    for (j = 0; j < theRules.length; j++) 
    {
      if (theRules[j].selectorText == styleName)
      {
 //alert("rules for " + styleName + " are found!");
      	return theRules[j];
      }
    }    
  }
}

var evenRowColor = '#99CCFF';
var oddRowColor = 'paleturquoise';

var evenRowStyle 		= FindStyleRule('TR.evenRow');
var oddRowStyle 		= FindStyleRule('TR.oddRow');
var selectedRowStyle 	= FindStyleRule('TR.selectedRow');
var tabStyle 			= FindStyleRule('TD.tab');
var selectedTabStyle 	= FindStyleRule('TD.selectedTab');


function h(arg)
{
//  var highlight_colour = selectedRowStyle.style.backgroundColor;//'#FCFEBD';  
//  arg.style.backgroundColor = highlight_colour;
	arg.className = 'selectedRow';
}
function uh(arg)
{
	if (arg.id == '0')
	{
//  		arg.style.background = evenRowStyle.style.backgroundColor;
		arg.className = 'evenRow';
	}
	else //if (arg.id == 1)
	{
//  		arg.style.background = oddRowStyle.style.backgroundColor;
		arg.className = 'oddRow';
	}
}

function selectTab(arg)
{
//  var highlight_colour = selectedtabStyle.style.backgroundColor;
//  alert("background = " + highlight_colour);
  
//  arg.style.backgroundColor = selectedTabStyle.style.backgroundColor;
//  arg.style.borderTop = selectedTabStyle.style.borderTop;
//  arg.style.borderBottom = selectedTabStyle.style.borderBottom;
//  arg.style.borderLeft = selectedTabStyle.style.borderLeft;
//  arg.style.borderRight = selectedTabStyle.style.borderRight;

	arg.className = 'selectedTab';

  
//  alert("background = " + oldColor + "\nnew color = " + arg.style.backgroundColor);
}

function unselectTabByName(itemName)
{
	var item = document.getElementById(itemName);
	if (item)
	{
//		item.style.backgroundColor = tabStyle.style.backgroundColor;
//		item.style.borderTop = tabStyle.style.borderTop;
//		item.style.borderBottom = tabStyle.style.borderBottom;
//		item.style.borderLeft = tabStyle.style.borderLeft;
//		item.style.borderRight = tabStyle.style.borderRight;

		item.className = 'tab';

		//  alert("background = " + oldColor + "\nnew color = " + arg.style.backgroundColor);
	}
}
