var aMenu = new Array();
aMenu[0] = new Array("Apteka","Lokalizacja","Oferta","Ogłoszenia","Kontakt");
aMenu[1] = new Array("Aktualne","Logowanie","Rejestracja");
aMenu[2] = new Array("Moje ogłoszenia","Moje dane","Wyloguj","Dodaj ogłoszenie");
var aItem = new Array(0,0,0);
var aFrame = new Array("_iframe1","_iframe2","_iframe2");
var aLink = new Array("main.php","adverts.php","adverts.php");
function menu(n) {
	var html = "";
	for(var i=0; i<aMenu[n].length; i++) {
		if(i==aItem[n]) {
			html += "<span style='color:#CC0000; cursor:default;'>";
		} else {
			html += "<span style='color:#786C82; cursor:pointer' ";
			html += "onMouseOver='style.color=\"#CC0000\"' ";
			html += "onMouseOut='style.color=\"#786C82\"' ";
			html += "onClick='top.aItem["+n+"]="+i+"; ";
			html += "window.open(\"../inc/"+aLink[n]+"?m="+i+"\",\""+aFrame[n]+"\");'>";
		}
		html +=  "<b>" +aMenu[n][i] +"</b></span>";
		if(i<aMenu[n].length-1)
			html += "&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;";
	}
	return html;
}

Date.prototype.getFullDay = function () {
	return (this.getDate() < 10 ? "0" : "") + this.getDate();
}

Date.prototype.getFullMonth = function () {
	return (this.getMonth() < 10 ? "0" : "") + this.getMonth();
}

Date.prototype.add = function(y,m,d) {
	// e.g. y=0, m=9, d=45
	this.setFullYear(this.getFullYear() +y);
	this.setMonth(this.getMonth() +m);
	this.setDate(this.getDate() +d);
}

Date.prototype.format = function(f) {
	// e.g. dt.format("yyyy/mm/dd")
	return f.replace(/y{1,4}/g,this.getFullYear()).replace(/m{1,2}/g,this.getFullMonth()).replace(/d{1,2}/g,this.getFullDay());
}

Date.prototype.parseDate = function(y,m,d) {
	// e.g. y=2005, m=5, d=16
	this.setFullYear(y);
	this.setMonth(m);
	this.setDate(d);
}

Date.prototype.parseString = function(s) {
	// e.g. s="2005-05-16"
	this.parseDate( s.substr(0,4), s.substr(5,2), s.substr(8,2) );
}