function Menu(id) {
	this.shows = false;
	this.beforeShow = false;
	this.beforeHide = false;
	if(id == undefined) {
		alert('no id');
		return false;
	} else {
		this.id = id;
	}
	
}

Menu.prototype.show = function() {
	if(this.beforeShow) {
		this.onbeforeShow('beforeShow');
	}
	document.getElementById(this.id).style.display = 'block';
	// tutaj np sprawdzanie stylu czy display= block i wywolanie funkcji afterShow
}

Menu.prototype.hide = function() {
	if(this.beforeHide) {
		this.onbeforeHide('beforeHide');
	}
	document.getElementById(this.id).style.display = 'none';
	// tutaj np sprawdzanie stylu czy display= block i wywolanie funkcji afterShow
}

Menu.prototype.onbeforeShow = function(msg) {
	alert('funkcja: '+ msg);	
}

Menu.prototype.onbeforeHide = function(msg) {
	alert('funkcja: '+ msg);	
}

function copycontent(name, text) {
//	//var txt = window.frames[iframename].document.getElementId('myfield1ID').value;
//	var txt = window.frames;
//	
//	for(var i = 0; i< txt.length; i++) {
//	alert(txt[i].innerHTML);
//	}
//	
//	return false;
	document.getElementById(name).value = text;
}

/**
 * wykonaj ajaxa metoda GET
 * 
 * @param adres url ktory ma sie wykonac
 * @param id do ktorego ma byc zwrocony wynik
 * @param opcjonalnie zapytanie do potwierdzenia
 */
function doAjax(html, id/*, ask*/) {
	
	var ask = arguments[2];
	if(ask != undefined) {
		var res = confirm(ask);
		if(res) {
			// wykonujemy ajaxa
			
			dojo.byId(id).innerHTML = 'czekaj...';
			
			dojo.xhrGet( {
				url: html,
				timeout: 10000,
				load: function(response, ioArgs) {
					dojo.byId(id).innerHTML = response;
				},
				error: function(response, ioArgs) {
					alert("Błąd: "+ response)
				}		
			} );
			
		} else {
			// nie robimy nic
		}
		
	} else {
	
//	dojo.byId(id).innerHTML = '';
//	return;

	dojo.byId(id).innerHTML = 'czekaj...';
	
	dojo.xhrGet( {
		url: html,
		timeout: 10000,
		load: function(response, ioArgs) {
			dojo.byId(id).innerHTML = response;
		},
		error: function(response, ioArgs) {
			alert("Błąd: "+ response)
		}		
	} );
	
	}
}