(function(){
var height = 35;
var minWidth = 750;
var barwidth = Math.max(minWidth, parseInt(window.barwidth,10)) || minWidth;
/*
var pagecolour = window.pagecolour || "#000";
if (pagecolour.substr[0] != "#" && !isNaN(parseInt(pagecolour,16))) {
	pagecolour = "#" + pagecolour;
}
*/
var pagecolour = "#000";
var imgPath = "http://navbar.disneyinternational.com/pt/i/" + height;

var menuItems = {
	"disney-logo.gif" : ["Disney", "http://www.disney.pt/"],
	"movies.gif" : ["Filmes", "http://www.disney.pt/disney-filmes/"],
	"tv.gif" : ["TV", "http://www.disney.pt/disney-channel/"],
	"books.gif" : ["Livros e Revistas", "http://www.disney.pt/disney-livros-e-revistas/"],
	"travel.gif" : ["F&eacute;rias", "http://www.disneylandparis.pt/"],
	"shop.gif" : ["Loja", "http://www.disney.pt/disney-loja/"],
	"characters.gif" : ["Personagens e Estrelas", "http://www.disney.pt/disney-personagens/"],
	"games.gif" : ["Jogos", "http://www.disney.pt/disney-jogos/"],
	"activities.gif" : ["Actividades", "http://www.disney.pt/zona-de-diversao/"]
};

var header = document.getElementsByTagName("head")[0];
var css = document.createElement("link");
css.href = imgPath + "/chrome.css";
css.rel = "stylesheet";
css.type = "text/css";
header.appendChild(css);

var domAnchor = document.getElementsByTagName("*");
domAnchor = domAnchor[domAnchor.length - 1];
var wrapper = document.createElement("div");
wrapper.id = "disneyChromeBar20100308";
wrapper.style.background = pagecolour;
wrapper.style.width = barwidth + "px";

var h = "<ol>";
var cnt = 0;
for (var i in menuItems) {
	++cnt;
	if (cnt > 1) {
		if (cnt > 2) {
			h += "<img src=\"" + imgPath + "/menu-divider.gif\" alt=\"\" \/>";
		}
		h += "<\/li>";
	}
	h += "<li class=\"chrome-item-" + cnt + "\"><a href=\"" + menuItems[i][1] + "\"><img src=\"" + imgPath + "/" + i + "\" alt=\"" + menuItems[i][0] + "\" title=\"" + menuItems[i][0] + "\" \/><\/a>";
}
h += "<\/li>";
h += "<\/ol>";
wrapper.innerHTML = h;

domAnchor.parentNode.insertBefore(wrapper, domAnchor);
})()
