var marked_row = new Array;
function highlight_row(theRow, theRowNum, theAction, theDefaultColor, thePointerColor) {
    var theCells = null;
    if ((thePointerColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    }
    if (currentColor == '' || currentColor == null || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor              = thePointerColor;
        }
    }
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
             && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) {
        if (theAction == 'out') {
            newColor              = theDefaultColor;
        }
    }

    if (newColor) {
        var c = null;
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } 
        }
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } 
    return true;
} 


function toogle_cookie (cookie) 
{
	pos = document.location.href.lastIndexOf ('/');
	url = document.location.href.substring (0, pos);
	if (document.getElementById('no_tooltip').checked == true)
		url += '/ajax/tooltip.php?no_tooltip=set';
	else
		url += '/ajax/tooltip.php?no_tooltip=unset';

	try 
	{
		request = new XMLHttpRequest();
	}
	catch (trymicrosoft) 
	{
		try
		{
			request = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (othermicrosoft) 
		{
			try 
			{
				request = new ActiveXObject("Microsoft.XMLHTTP");
			}
		    catch (failed)
			{
				request = false;
			}
		}
	}

	if (!request) alert("Error initializing XMLHttpRequest!");
	else
	{
		request.open("GET", url, true);
//		request.onreadystatechange = updatePage;
		request.send(null);
	}
}

function updatePage() {
     alert(request.responseText);
}


sections = new Array ('lage', 'zeit', 'objekt', 'kosten', 'wg_infos', 'ausstattung', 'titel', 'anzeigentext', 'pers_angaben');
status = new Array (true, false, false, false, false, false, false, false, false);
next_section = 'zeit';

function show_section (id)
{
//alert ("deaktiviert");
/*
	if (document.getElementById('show_all').checked == true) return false;

	for (i = 0; i < sections.length; i++)
	{
		if (sections[i] == id)
		{
			document.getElementById(sections[i]).style.display = 'block';
		}
		else
		{
			document.getElementById(sections[i]).style.display = 'none';
		}
	}
*/
}

function alles ()
{
	if (document.getElementById('show_all').checked == true)
	{
		for (i = 0; i < sections.length; i++)
			document.getElementById(sections[i]).style.display = 'block';
	}	
	else show_section ('zeit');
}