Hello everybody, new to this forums.

Appreciated, if youīd take a minute out of your time to help me with a relatively small ( hopefully ) issue, I just canīt get my head wrapped around.

As you may see from my code I am relatively new at coding Jscript, however I think I got the basics right.

Now, what I am trying to do is coloring a named TD-element ( in the case below itīs called "td_teles_c5" ). The HTML Code for the TD Element looks like this:

HTML Code:
<td id="td_teles_c5">
<!-- Teles C5 -->
<a href="javascript:void(0)" onclick="toggle_div('teles_c5','toggle');"><img src="img/bg_main/teles_logo_c5_125_80.png"></a>
</td>
So a click on the link toggles the corresponding DIV element ( "teles_c5" in this example ) either open or close, which works perfectly.

The toggling code looks like this:

Code:
function toggle_div(div_id,status)
{
	if (div_id=='all')
	{
		var el=document.getElementsByTagName('div');
		for (var i=0;i<el.length;i++)
		{
			if (el[i].id!=='div_navigation')
			{
				document.getElementById(el[i].id).style.display=status;

				if (status='none') 
					{ set_color_of_div(el[i].id,'off'); }
				else 
					{ set_color_of_div(el[i].id,'color');  }
			}
		}
	}
	else if (status=='toggle') 
	{
		document.getElementById(div_id).style.display = (document.getElementById(div_id).style.display=='block') ? 'none' : 'block';
		
		if (document.getElementById(div_id).style.display=='block') 
			{ set_color_of_div(div_id,'color'); }
		else
			{ set_color_of_div(div_id,'off'); }
	}
	else
	{
		document.getElementById(div_id).style.display=status;
		
		if (status='none') 
			{ set_color_of_div(div_id,'off'); }
		else 
			{ set_color_of_div(div_id,'color');  }
	}
}

function set_color_of_div(div_id,color)
{
	alert ('switchting td_'+div_id+' to '+color);
	// document.getElementById('td_'+div_id).style.backgroundColor='red';
}
Now, here are my questions:
1) Is adressing the TD element via getElementById the correct way? I suppose not, since I fail to set the TD backgroundcolor.

2) As you can see, toggle_div contains three actions. It can toggle elements, it can switch on/off elements and it can grock through all elements and make them either appear or disapper.

Now the "all" function works only, when I remove the calls to "set_color_of_div". When "set_color" is called, what happens is that I see 8 times ( the number of DIVs I have currently ) the alert Window with correct values for div_id and color, but only the first DIV element is actually toggled, whilst the other 7 stay closed. Why is that? What can I do to fix this?

I sincerely hope I explained clearly what I am trying to do and what fails.

Looking forward to any helpful input.