var temp = null;

var buttons = new Array (
					new TSPButton("Strona główna", "", "main.html"),
					new TSPButton("Władze", "", "wladze.html"),
					new TSPButton("Statut", "", "statut.html"),
					new TSPButton("Członkostwo", "", "czlonkostwo.html"),
					new TSPButton("Licencje<br>&nbsp;i rekomendacje", "", "licencje.html"),
					new TSPButton("Szkolenia<br>&nbsp;i konferencje", "", "szkolenia.html"),
					new TSPButton("Prawo<br>&nbsp;dla psychologów", "", "prawo.html"),
					new TSPButton("Kontakt", "", "kontakt.html")					
					);

var defaultStatus = "";

//classa przycisku haha
function TSPButton (_caption, _status, _command, _td)
	{
	//property
	this.caption = _caption;//
	this.command = _command;//
	this.status = _status;//
	this.td = _td;
	
	//metods
	this.onclick = _onclick_TSPButton;
	this.onmouseover = _onmouseover_TSPButton;
	this.onmouseout = _onmouseout_TSPButton;
	}

function _onclick_TSPButton()
//co ma sie stac jak clickniemy przycisk
	{_set_status("!!!--Click--!!!");
//    eval(this.command);
//document.location.href = 'pages/' + this.command;
	document.getElementById('id_frame').src = 'pages/' + this.command;
	}

function _onmouseover_TSPButton()
//a teraz co sie stanie po najechaniu na przycisk
	{//eval(this.td).className = "buttonover";
	document.getElementById(this.td).className = "buttonover";	
	_set_status(this.status);
	}	

function _onmouseout_TSPButton()
//a teraz co sie stanie po zjechaniu z przycisku
	{//eval(this.td).className = "button";
	document.getElementById(this.td).className = "button";
	 _set_status(defaultStatus);
	}			
	
function _set_status(newstatus)
	{//id_status.innerText = newstatus;
	}

function _create_buttons(id_menu)
//tworzymy przyciski na podstawie tabeli buttons
	{
	var i =  2 * buttons.length + 1;
	var tab = "<table class='button' cellpadding='0' cellspacing='0' width='100%'><tbody><tr><td class='menu' rowspan='"+i+"' width='0'></td><td class='menu' height='0'></td><td class='menu' rowspan='"+i+"' width='0'></td></tr>";
	var b = ""
	i = 0;

	while (i < buttons.length)
		{b = "buttons["+i+"].";
		tab += ("<tr><td id='id_button_"+i+"' class='button' onclick='"+b+"onclick()' onmouseover='"+b+"onmouseover()' onmouseout=  '"+b+"onmouseout()' style='cursor:pointer' align='left' width='100%'>&nbsp;"+buttons[i].caption+"</td></tr><tr><td class='menu' height='4'></td></tr>");
		buttons[i].td = "id_button_" + i++;
		}
	
	document.getElementById('id_menu').innerHTML = tab + "</tbody></table>";
	};
