
/**
 * Adds the current page as a bookmark. Only works in IE
 *
 */
function addToFavorites(urlAddress,pageName)
{
  if (window.external)	{
   	window.external.AddFavorite(urlAddress,pageName)
  }
  else	{
    alert("Sorry! Your browser doesn't support this function. Please bookmark this page manually, by pressing (Ctrl+D).");
  }
}



function changeDisplay(myObj)
{
	var currentDisplay= document.getElementById(myObj).style.display;

	if (currentDisplay=='block') {
		document.getElementById(myObj).style.display='none';
	}
	else {
		document.getElementById(myObj).style.display='block';
	}
}



function changeDisplayGroup(sElement, iFirst, iLast)
{
	for(i=iFirst; i<iLast; i++) {
		document.getElementById(sElement+i).style.display='block';
	}
}


function noVis()
{
	var part1= "hid";
	var part2= "den";

	document.getElementById("links").style.visibility= part1+part2;
}



/**
 *	Accepts a TR (row) as input, script then changes the color of it's TDs (cells)
 *	depending on the action that called the function.
 *	The colors are taken from the relevant CSS styles
 */
function colorRow(theRow, action)
{
	var td1= 'TDStyle1';
	var td1h= 'TDStyle1-H';
	var td1hs= 'TDStyle1-S';

	var td2= 'TDStyle2';
	var td2h= 'TDStyle2-H';
	var td2hs= 'TDStyle2-S';


	if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
		return false;
    }

	cellsCnt= theCells.length;

	orgClassName= theCells[0].className;


	// mouseOver
	if ( action=='in' && orgClassName!= td1hs && orgClassName!= td2hs ) // mouseOver
	{
		if(orgClassName== td1)
		{
			hClass= td1h;
		}
		else if(orgClassName== td2)
		{
			hClass= td2h;
		}

		for (i= 0; i< cellsCnt; i++) {
			theCells[i].className= hClass;
		}
	}
	// mouseOut
	else if ( action=='out' && orgClassName!= td1hs && orgClassName!= td2hs )
	{
		if(orgClassName== td1h)
		{
			hClass= td1;
		}
		else if(orgClassName== td2h)
		{
			hClass= td2;
		}

		for (i= 0; i< cellsCnt; i++) {
			theCells[i].className= hClass;
		}
	}
	// onClick
	else if (action=='click')
	{

		if(orgClassName== td1 || orgClassName== td1h)
		{
			hClass= td1hs;
		}
		else if(orgClassName== td2 || orgClassName== td2h)
		{
			hClass= td2hs;
		}
		else if(orgClassName== td1hs)
		{
			hClass= td1;
		}
		else if(orgClassName== td2hs)
		{
			hClass= td2;
		}


		for (i= 0; i< cellsCnt; i++) {
			theCells[i].className= hClass;
		}

	}

}



/**
 * Colors a border differently on mouseover/mouseout
 *
 */
function colorBorder(oElement, sAction)
{
	if(sAction=='in') {
		oElement.style.border= '1px solid #000000';
	}
	else {
		oElement.style.border= '1px solid #CCCCCC';
	}
}


/**
 *	Changes the window status bar
 *
 */
function winStat(sStatus)
{
	window.status= sStatus;
}
