//*****************************************************************************
//
// This script has been modified by Sebastian Petry, all changes 12.25.04 - 02.22.05
// All modifications marked by ***!CHANGE_<NUMBER>*** <CHANGE> ***CHANGE_<NUMBER>!***
//
// Modifications:
//  o modification (number)
//  o new variables (1.1; 1.2)
//  o changed value of variabale linkEventString, ascChr and desChr (2)
//  o deleted hovering of the table heads (3.1; 3.2)
//  o made table heads containing HTML possible (4)
//  o added IE 6 and Opera support (5)
//  o various other additions (6; 7; 8)
//  o made it possible to use , as seperator for the decimal place (9; 7)
//  o made sorting of cells which contain <span>s possible (10)
//  o made it possible to use record value "-" + exponents and implemented sorting by different keys if the values are equal;
//    special values possible (11)
//  o made it possible to deactivate cols for sorting (12)
//
// GPL and unmodified script: gpl.txt
//
// Filename: sortTable.js
// Description: This javascript file can be applied to convert record tables
// in a HTML file to be client-side sortable by associating title columns with
// sort events.
//
// COPYRIGHT (C) 2001 HAN J. YU, LIPING DAI
// THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT
// UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE
// SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION)
// ANY LATER VERSION. THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE
// USEFUL, BUT WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
// MERCHANTABILITY OF FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU GENERAL
// PUBLIC LICENSE FOR MORE DETAILS.
//
// YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE ALONG
// WITH THIS PROGRAM; IF NOT, WRITE TO:
//
// THE FREE SOFTWARE FOUNDATION, INC.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
//
// Bugs/Comments: han@velocityhsi.com
//
// Change History:
//
// 11-26-01:
//	o Made a few more settings configurable (i.e. data delimiter etc).
//	o Added a check for the browser type/version (>= IE 5.0 allowed).
// 11-27-01:
//	o Used document.getElementById method to retrieve object
//	o Now supports both IE 5.0 or greater and Netscape 6.0 or greater
// 11-28-01:
//	o Fixed the status display for Netscape.
//	o Fixed the cursor shape for Netscape. Used pointer instead of hand.
// 11-29-01:
//	o Fixed a cursor bug for IE 5.5
//*****************************************************************************

//*****************************************************************************
// sortTable.js
//
// This script contains useful functions that can be used to convert ordinary
// tables into sortable tables by modifying the HTML sources.
//
// Here is how one can do that. The following assumptions are required
// for the tables to be sorted.
//
// 1. All the record columns must be the same lengh. Otherwise (i.e. the ones
//    that contain colspan) the rows will be ignored.
//
// 2. Row spans can not happen in the record rows though column spans
//    can be one of the record rows.
//
// 3. Row-spanned single column will be considered as title.
//
// To enable the sorting, simply include this javascript source file and
// add an onLoad event to the <body> like below:
//
// <body onLoad='initTable("table1");initTable("table2");' ...>
//
// Note that all the tables that need to be sorted MUST contain ID tag.
// So, if they do not exist, you must create one for each table that
// needs to be sorted.
//*****************************************************************************

// Global variables
// ***!CHANGE_1.1***
var bezugsTemp = 20;
var vonTemp = false;
var firstRun = true;
var lastIndex = -1;
var rowElemArray = new Array();
var specialFunctions;
var spaltenSortieren;
// ***CHANGE_1.1!***

var table;				// Table object
var rowArray = new Array();		// Data row array
var titleRowArray = new Array();	// Contains title texts
var titleRowCellArray = new Array();	// Dynamically constructed title cells
var titleSpanCellArray = new Array();	// Title elelments from row-spanned
var colSpanArray = new Array();		// Rows col-spanned
var colTitleFilled = new Array();	// Indicates whether title is filled
var sortIndex;				// Selected index for sort
var descending = false;			// Descending order
var nRow, actualNRow, maxNCol;		// Various table stats
var origColor;				// Holds original default color
var isIE;				// True if IE

//***!CHANGE_2***
var linkEventString = 'href=\'#\' onClick=\'sortTable(';// What's insider <a> tag


// Configurable constants
var ascChr = "<img src=\"./asc.gif\" alt=\"aufsteigend\" width=\"8\" height=\"8\">";			// Symbol for ascending sort
var desChr = "<img src=\"./desc.gif\" alt=\"absteigend\" width=\"8\" height=\"8\">";			// Symbol for descending sort
//***CHANGE_2!***
//***!CHANGE_3.1*** ***CHANGE_3.1!***
var recDelimiter = '|';			// Char used as a record separator
var titleFace = 'b';			// Specifies the HTML tag for titles
var updownColor = 'gray';		// Specified the color for up/downs


//*****************************************************************************
// Main function. This is to be associated with onLoad event in <BODY>.
//
// IMPORTANT: This is the only function that needs to be included in the pages
// to be sorted. The rest of the functions are simply called by this
// function.
//*****************************************************************************
//***!CHANGE_12***
function initTable(obj, specials, spalten)
{
	// Check whether it's viewed by IE 5.0 or greater
	if (! checkBrowser()) return;

    specialFunctions = specials;
    spaltenSortieren = spalten;
    //***CHANGE_12!***

	// Local variables
	var countCol;
	var nChildNodes;
	var innerMostNode;
	var nColSpan, nRowSpannedTitleCol, colPos;
	var cell, cellText;
	var titleFound = false;
	var rNRowSpan, rNColSpan;

	// Initializing global table object variable
	if (obj.tagName == "TABLE")
	{
		// Assumes that the obj is THE OBJECT
		table = obj;
	}
	else
	{
		// Assumes that the obj is the id of the object
		table = document.getElementById(obj);
	}

	// Check whether it's an object
	if (table == null) return;

	// Check whether it's a table
	if (table.tagName != "TABLE") return;

	// Initializing the max col number with the size of last data row
	maxNCol = table.rows[table.rows.length-1].cells.length;

	// Initializing arrays
	rowArray = new Array();
	colSpanArray = new Array();
	colTitleFilled = new Array();
	titleRowArray = new Array();
	titleRowCellArray = new Array();
	//***!CHANGE_10***
	rowElemArray = new Array()
	//***CHANGE_10!***

	for (var i=0; i<maxNCol; i++)
		colTitleFilled[i] = false;

	// Setting the number of rows
	nRow = table.rows.length;

	// Should have at least 1 row
	if (nRow < 1) return;

	// Initialization of local variables
	actualNRow = 0;			// Number of actual data rows
	rNRowSpan = 0;			// Remaining rows in the row span
	rNColSpan = 0;			// Remaining cols in the col span
	nRowSpannedTitleCol = 0;	// Number of title cols from row span

	// Loop through rows
	for (var i=0; i<nRow; i++)
	{
		nColSpan = 1, colPos = 0;
		// Loop through columns
		// Initializing
		for (var j=0; j<table.rows[i].cells.length; j++)
		{
			// Do this iff title has not been found
			if (titleFound == false)
			{
				if (table.rows[i].cells[j].rowSpan > 1)
				{
					if (table.rows[i].cells[j].colSpan < 2)
					{
						titleSpanCellArray[colPos] =
							table.rows[i].cells[j];
						colTitleFilled[colPos] = true;
						nRowSpannedTitleCol++;
					}
					if (table.rows[i].cells[j].rowSpan - 1
						> rNRowSpan)
					{
						rNRowSpan =
							table.
							rows[i].cells[j].
							rowSpan - 1;

						if (table.rows[i].
							cells[j].colSpan > 1)
							rNColSpan =
								rNRowSpan + 1;
					}
				}
			}
			if (table.rows[i].cells[j].colSpan > 1 &&
				rNColSpan == 0)
			{
				nColSpan = table.rows[i].cells[j].colSpan;
				colPos += nColSpan;
			}
			else
			{
				colPos++;
			}
		}

		// Setting up the title cells
		if (titleFound == false && nColSpan == 1 &&
			rNRowSpan == 0 && rNColSpan == 0 && titleFound == false)
		{
			colSpanArray[i] = true;
			titleFound = true;

			// Using indivisual cell as an array element
			countCol = 0;
			for (var j=0;
				j<table.rows[i].cells.length
					+ nRowSpannedTitleCol; j++)
			{
				if (colTitleFilled[j] != true)
				{
					titleRowCellArray[j] =
						table.rows[i].cells[countCol];
					countCol++;;
				}
				else
				{
					titleRowCellArray[j] =
						titleSpanCellArray[j];
				}
			}
		}
		// Setting up the data rows
		else if (titleFound == true && nColSpan == 1 && rNRowSpan == 0)
		{
			for (var j=0; j<table.rows[i].cells.length; j++)
			{
				// Can't have row span in record rows ...
				if (table.rows[i].cells[j].rowSpan > 1) return;
				nChildNodes =
					table.rows[i].
					cells[j].firstChild.childNodes.
					length;

				innerMostNode =
					table.rows[i].
					cells[j].firstChild;

                //***!CHANGE_10***
                if(j==0) { rowElemArray[actualNRow] = table.rows[i].cells[j].innerHTML; }
                else { rowElemArray[actualNRow] += recDelimiter + table.rows[i].cells[j].innerHTML; }

                //***CHANGE_10!***

				while ( nChildNodes != 0)
				{
					innerMostNode =
						innerMostNode.
						firstChild;
					nChildNodes =
						innerMostNode.
						childNodes.
						length;
				}

				if (j == 0)
				{
					rowArray[actualNRow] =
						innerMostNode.data;
				}
				else
				{
					rowArray[actualNRow] += recDelimiter +
						innerMostNode.data;
				}
			}
			// Inconsistent col lengh for data rows
			if (table.rows[i].cells.length > maxNCol)
				return;

            //***!CHANGE_10***
				rowArray[actualNRow] += recDelimiter + rowElemArray[actualNRow];
			//***CHANGE_10!***

			actualNRow++;
			colSpanArray[i] = false;
		}
		else if (nColSpan == 1 && rNRowSpan == 0 &&
			rNColSpan == 0 && titleFound == false)
		{
			colSpanArray[i] = false;
		}
		else
		{
			colSpanArray[i] = true;
		}

		// Counters for row/column spans
		if (rNRowSpan > 0) rNRowSpan--;
		if (rNColSpan > 0) rNColSpan--;
	}

	// If the row number is < 1, no need to do anything ...
	if (actualNRow < 1) return;

	// Re-drawing the title row
	for (var j=0; j<maxNCol; j++)
	{
	  // If for some reason, the rows do NOT have any child, then
	  // simply return ...

      if (titleRowCellArray[j].childNodes.length == 0) return;
      if (titleRowCellArray[j].firstChild != null)
      {
        nChildNodes = titleRowCellArray[j].firstChild.childNodes.length;

        //***!CHANGE_4***
        cellText = innerMostNode.data;

        while ( nChildNodes != 0)
        {
          nChildNodes = innerMostNode.childNodes.length;
          cellText = titleRowCellArray[j].childNodes[0].innerHTML;
        }

        if (firstRun == true)
        {
          td_list = document.getElementById(obj).getElementsByTagName('td');
          cellText = td_list[j].innerHTML;
        }
        //***CHANGE_4!***
      }
      else { cellText = "column(" + j + ")"; }

	  titleRowArray[j] = cellText;

      //***!CHANGE_12***
      if (j <= spaltenSortieren) {
        titleRowCellArray[j].innerHTML =
			'<a ' +
			linkEventString +
			j + ',' + '"' + table.id + '"' + ');\'>' +
			'<' + titleFace + '>' + cellText +
			'</' + titleFace +'></a>';
	  }
	  else
      {
	    titleRowCellArray[j].innerHTML = '<' + titleFace +'>' +
        cellText + '</' + titleFace + '>';
      }

	  //***CHANGE_12!***
	}
	//***!CHANGE_4***
	firstRun = false;
	//***CHANGE_4!***

	if(document.getElementById('tdStatic') && document.getElementById('tdStatic').innerHTML.match(/onclick=.+?>/i))
	{
		document.getElementById('tdStatic').innerHTML = document.getElementById('tdStatic').innerHTML.replace(/onclick=.+?>/i, 'href="#" onclick="alert(' + "'Diese Spalte ist nicht sortierbar!'" + ');">');
	}

}

//*****************************************************************************
// Function called when user clicks on a title to sort
//*****************************************************************************
function sortTable(index,obj)
{
	// Re-inializing the table object
	//***!CHANGE_12***

	initTable(obj, specialFunctions, spaltenSortieren);
	//***CHANGE_12!***

    //***!CHANGE_6***
    if (vonTemp)
    {
      ascending = true;
      descending = false;
      vonTemp = false;
    }
    if (specialFunctions != 1 && lastIndex == -1 && index == 1)
    {
      ascending = false;
      descending = true;
      lastIndex = index;
    }
    else if (index != lastIndex)
    {
      ascending = true;
      descending = false;
      lastIndex = index;
    }
    //***CHANGE_6!***

	// Local variables
	var nChildNodes;
	var innerMostNode;
	var rowContent;
	var rowCount;
	var cell, cellText;
	var newTitle;

    //***!CHANGE_1.2!***
    var schmelzTemp;
    var siedeTemp;
    var farbe = "#FFFFFF";
    var ergebnis;
    //***CHANGE_1.2!***

	// Can't sort past the max allowed column size
	if (index < 0 || index >= maxNCol) return;

	// Assignment of sort index
	sortIndex = index;

	// Doing the sort using JavaScript generic function for an Array
	//***!CHANGE_9***

	if(specialFunctions != 4)
	{
		for(var i = 0; i < rowArray.length; i++)
		{
			while(rowArray[i].match(/\.([0-9]{1,})/))
			{
				rowArray[i] = rowArray[i].replace(/\.([0-9]{1,})/,'TAUSENDERPUNKT' + RegExp.$1);
			}
			while(rowArray[i].match(/,([0-9]{1,})/))
			{
				rowArray[i] = rowArray[i].replace(/,([0-9]{1,})/,'.' + RegExp.$1);
			}
			while(rowArray[i].match(/ca\. /))
			{
				rowArray[i] = rowArray[i].replace(/ca\. /,'CIRCA');
			}
		}
	}

    //***CHANGE_9!***
	rowArray.sort(compare);

	// Re-drawing the title row
	for (var j=0; j<maxNCol; j++)
	{
		cellText = titleRowArray[j];
        //***!CHANGE_12***
        if(j <= spaltenSortieren)
        {
		  cellText = '<' + titleFace +'>' +
			  cellText + '</' + titleFace + '></a>';
		  newTitle = '<a ' +
			  linkEventString +
			  j + ',' + '"' + table.id + '"' + ');\'>' +
			  cellText +
			  '</a>';
		}
		else
		{

		  cellText = '<' + titleFace +'>' +
			  cellText + '</' + titleFace + '>';
		  newTitle = cellText;
		}
		//***CHANGE_12!***

		if (j == sortIndex)
		{
			newTitle += ' <font color=' + updownColor + '>';
			if (descending)
				newTitle += desChr;
			else
				newTitle += ascChr;
			newTitle += '</font>';
		}
		if(titleRowCellArray[j].id != "tdStatic") { titleRowCellArray[j].innerHTML = newTitle; }
	}

	// Re-drawing the table
	rowCount = 0;
	for (var i=0; i<nRow; i++)
	{
		if (! colSpanArray[i])
		{
			for (var j=0; j<maxNCol; j++)
			{

			  rowContent = rowArray[rowCount].split(recDelimiter);

                //***!CHANGE_10***
				table.rows[i].cells[j].innerHTML = rowContent[j+maxNCol];
                //***CHANGE_10!***

			    nChildNodes = table.rows[i].cells[j].firstChild.childNodes.length;
				innerMostNode =	table.rows[i].cells[j].firstChild;
				while ( nChildNodes != 0)
				{
				  innerMostNode = innerMostNode.firstChild;
                  nChildNodes =	innerMostNode.childNodes.length;
				}
				innerMostNode.data = rowContent[j];

			if(specialFunctions != 4)
			{
	 			while(rowContent[j].match(/\.([0-9]{1,})/))
	 			{
	   			  rowContent[j] = rowContent[j].replace(/\.([0-9]{1,})/, ',' + RegExp.$1);
	 			}
	 			while(rowContent[j].match(/TAUSENDERPUNKT([0-9]{1,})/))
	 			{
	   			  rowContent[j] = rowContent[j].replace(/TAUSENDERPUNKT([0-9]{1,})/,'.' + RegExp.$1);
	 			}
	 			while(rowContent[j].match(/CIRCA([0-9]{1,})/))
	 			{
	   			  rowContent[j] = rowContent[j].replace(/CIRCA([0-9]{1,})/,'ca. ' + RegExp.$1);
	 			}
			}



                if(specialFunctions == 1)
                {
				  schmelzTemp = rowContent[3];
				  siedeTemp = rowContent[4];

                  if (siedeTemp == '-' && bezugsTemp > schmelzTemp)
                  {
				    rowContent[5] = "?<a href=\"#anm\"><font color=\"#FF0000\"><sup>***</sup></font></a>";
				    farbe = "sst_undef";
                  }
                  else if (bezugsTemp < schmelzTemp)
				  {
				    rowContent[5] = "fest";
				    farbe = "sst_fest";
				  }
				  else if (bezugsTemp > siedeTemp)
				  {
				    rowContent[5] = "gasförmig";
				    farbe = "sst_gas";
				  }
				  else if (bezugsTemp > schmelzTemp && bezugsTemp < siedeTemp)
				  {
				    rowContent[5] = "flüssig";
				    farbe = "sst_fluessig";
				  }
				  else if (bezugsTemp == schmelzTemp)
				  {
				    rowContent[5] = "fest/flüssig";
				    farbe = "sst_undef";
				  }
				  else if (bezugsTemp == siedeTemp)
				  {
				    rowContent[5] = "flüssig/gasförmig";
				    farbe = "sst_undef";
				  }

                  innerMostNode.data = rowContent[j];
                  if (siedeTemp == '-') { table.rows[i].cells[5].innerHTML = rowContent[5]; }
                  tr_list = document.getElementById('table0').getElementsByTagName('tr');
                  tr_list[i].className = farbe;
                }
                else if(specialFunctions == 2)
                {
                  if (j != sortIndex && table.rows[i].cells[j].className == "sst_cyan") { table.rows[i].cells[j].className = "sst_undef"; }
                  else { table.rows[i].cells[sortIndex].className = "sst_cyan"; }

                  innerMostNode.data = rowContent[j];
                }
                else if(specialFunctions == 0 || specialFunctions == 3)
                {
                  innerMostNode.data = rowContent[j];
                }
                //***CHANGE_7***
			}
			rowCount++;
		}
	}

	// Switching btw descending/ascending sort
	if (descending)
		descending = false;
	else
		descending = true;
}

//*****************************************************************************
// Function to be used for Array sorting
//*****************************************************************************
function compare(a, b)
{

	// Getting the element array for inputs (a,b)
	var aRowContent = a.split(recDelimiter);
	var bRowContent = b.split(recDelimiter);
	// Needed in case the data conversion is necessary
	var aToBeCompared, bToBeCompared;

	//***!CHANGE_11***
    if(/CIRCA/.test(aRowContent[sortIndex+maxNCol])) { aRowContent[sortIndex+maxNCol] = aRowContent[sortIndex+maxNCol].replace(/CIRCA/, ''); }
    if(/CIRCA/.test(bRowContent[sortIndex+maxNCol])) { bRowContent[sortIndex+maxNCol] = bRowContent[sortIndex+maxNCol].replace(/CIRCA/, ''); }

    while(/TAUSENDERPUNKT/.test(aRowContent[sortIndex])) { aRowContent[sortIndex] = aRowContent[sortIndex].replace(/TAUSENDERPUNKT/, ''); }
    while(/TAUSENDERPUNKT/.test(bRowContent[sortIndex])) { bRowContent[sortIndex] = bRowContent[sortIndex].replace(/TAUSENDERPUNKT/, ''); }


    var regex = /((-?[0-9]+(\.[0-9]+)?) × )?(-?[0-9]+)<SUP>(-?[0-9]+)<\/SUP>/i;
    var result = regex.test(aRowContent[sortIndex+maxNCol]);
    if(result)
    {
      if(RegExp.$2)
      {
        aToBeCompared = RegExp.$2 * Math.pow(RegExp.$4, RegExp.$5);
      }
      else if(RegExp.$4)
      {
        aToBeCompared = Math.pow(RegExp.$4, RegExp.$5);
      }
    }
    else
    {
      if (! isNaN(aRowContent[sortIndex])) { aToBeCompared = parseFloat(aRowContent[sortIndex]); }
      else { aToBeCompared = aRowContent[sortIndex]; }
    }

    var result = regex.test(bRowContent[sortIndex+maxNCol]);

    if(result)
    {
      if(RegExp.$2)
      {
        bToBeCompared = RegExp.$2 * Math.pow(RegExp.$4, RegExp.$5);
      }
      else if(RegExp.$4)
      {
        bToBeCompared = Math.pow(RegExp.$4, RegExp.$5);
      }
    }
    else
    {
      if (! isNaN(bRowContent[sortIndex])) { bToBeCompared = parseFloat(bRowContent[sortIndex]); }
      else { bToBeCompared = bRowContent[sortIndex]; }
    }

	if(aToBeCompared == '-' || aToBeCompared == 'keine Angabe')
	{
	  if(specialFunctions == 1)
	  {
  	    if(bezugsTemp < 10000) { aToBeCompared = 100000; }
	    else if(bezugsTemp >= 10000) { aToBeCompared = bezugsTemp+1; }
	  }
	  else if(specialFunctions == 3)
	  {
	    aToBeCompared = -10000;
	  }
	  else
	  {
	    aToBeCompared = 10000;
	  }
	}

	if(bToBeCompared == '-' || bToBeCompared == 'keine Angabe')
	{
	  if(specialFunctions == 1)
	  {
  	    if(bezugsTemp < 10000) { bToBeCompared = 100000; }
	    else if(bezugsTemp >= 10000) { bToBeCompared = bezugsTemp+1; }
	  }
	  else if(specialFunctions == 3)
	  {
	    bToBeCompared = -10000;
	  }
	  else
	  {
	    bToBeCompared = 10000;
	  }
	}
    //***CHANGE_11!***

	if (aToBeCompared < bToBeCompared)
	{
	  if (!descending) { return -1; }
	  else { return 1; }
	}

	if (aToBeCompared > bToBeCompared)
	{
	  if (!descending) { return 1; }
	  else { return -1; }
	}

	if (aToBeCompared == bToBeCompared)
	{
	  aRowContent = a.split(recDelimiter);
	  bRowContent = b.split(recDelimiter);

      if (! isNaN(aRowContent[1])) { aToBeCompared = parseFloat(aRowContent[1]); }
      else { aToBeCompared = aRowContent[1]; }

      if (! isNaN(bRowContent[1])) { bToBeCompared = parseFloat(bRowContent[1]); }
      else { bToBeCompared = bRowContent[1]; }

	  if(aToBeCompared == '–' || aToBeCompared == 'keine Angabe')
	  {
	    if(specialFunctions == 1)
	    {
  	      if(bezugsTemp < 10000) { aToBeCompared = 100000; }
	      else if(bezugsTemp >= 10000) { aToBeCompared = bezugsTemp+1; }
	    }
	    else if(specialFunctions == 3)
	    {
	      aToBeCompared = -10000;
	    }
	    else
	    {
	      aToBeCompared = 10000;
	    }
	  }
	  if(bToBeCompared == '-' || bToBeCompared == 'keine Angabe')
	  {
	    if(specialFunctions == 1)
	    {
  	      if(bezugsTemp < 10000) { bToBeCompared = 100000; }
	      else if(bezugsTemp >= 10000) { bToBeCompared = bezugsTemp+1; }
	    }
	    else if(specialFunctions == 3)
	    {
	      bToBeCompared = -10000;
	    }
	    else
	    {
	      bToBeCompared = 10000;
	    }
	  }

      if (aToBeCompared < bToBeCompared) { return -1; }
      if (aToBeCompared > bToBeCompared) { return 1; }
      return 0;
	}

	return 0;
}

//*****************************************************************************
// Function to set the cursor
//*****************************************************************************
function setCursor(obj)
{
	// Show hint text at the browser status bar
	window.status = "Sortieren nach " + obj.firstChild.innerHTML;
	// Change the mouse cursor to hand or pointer
	if (isIE)
		obj.firstChild.style.cursor = "hand";
	else
		obj.firstChild.style.cursor = "pointer";
}

//***!CHANGE_3.2*** ***CHANGE_3.2!***

//*****************************************************************************
// Function to check browser type/version
//*****************************************************************************
function checkBrowser()
{
	if ((navigator.appName == "Microsoft Internet Explorer"
		&& navigator.appVersion.indexOf("5.") >= 0
		//***!CHANGE_5***
		|| navigator.appVersion.indexOf("6.") >= 0
		)
		||
		(navigator.appName == "Opera")
		//***CHANGE_5!***
		)
	{
		isIE = true;
		return true;
	}
	// For some reason, appVersion returns 5 for Netscape 6.2 ...
	else if (navigator.appName == "Netscape"
		&& navigator.appVersion.indexOf("5.") >= 0)
	{
		isIE = false;
		return true;
	}
	else
		return false;
}

//***!CHANGE_8***
//*****************************************************************************
// Function to set temperature
//*****************************************************************************
function setTemp(temp)
{
  if(temp.indexOf(',') > -1) { temp = temp.replace(/,/,'.'); }
  if(temp != '' && !isNaN(temp))
  {
    bezugsTemp = parseFloat(temp);
    if(bezugsTemp == 'NaN')
    {
      bezugsTemp = 20;
      document.form0.temp.value = 20;
    }
    else if(bezugsTemp < -273.15)
    {
      bezugsTemp = -273.15;
      document.form0.temp.value = '-273,15';
    }
    else if(bezugsTemp > 6000)
    {
      bezugsTemp = 6000;
      document.form0.temp.value = 6000;
    }
  }
  else
  {
    bezugsTemp = 20;
    document.form0.temp.value = 20;
  }
  vonTemp = true;
  sortTable(3,document.getElementById("table0").id);
}
//***CHANGE_8!***
