// -- JS Compatibility
if (!Array.push)
	Array.prototype.push = function (el) {
		this[this.length] = el;
	}

if (!Array.join)
	Array.prototype.join = function (sep) {
		for (var i=0, s = ''; i<this.length; i++)
			s += (i>0? sep: '') + this[i];
		return s;
	}

// -- Begin: Main Menu
function getAttributes(objSrc, lstAttrs) {
	var arrAttrs = [];
	for (var i=0; i<lstAttrs.length; i++)
		if (typeof(objSrc[lstAttrs[i]]) != 'undefined')
			arrAttrs.push(lstAttrs[i] + '="' + objSrc[lstAttrs[i]] + '"');
	return arrAttrs.join(' ');
}


function getMenuHtml (menuContents, activeIndex) {
	var arrBuffer = [];
	for (var i=0; i<menuContents.length; i++) {
		var attrs = getAttributes(menuContents[i], ['width', 'height', 'alt']);
		if (i==activeIndex)
			arrBuffer.push('<td><a href="' + menuContents[i].url + '"><img src="' + menuContents[i].imagePrefix + '_active.gif" border="0" ' + attrs + '></a><\/td>')
		else
			arrBuffer.push('<td><a href="' + menuContents[i].url + '"><img src="' + menuContents[i].imagePrefix + '.gif" onMouseOver="this.src = \'' + menuContents[i].imagePrefix + '_over.gif\';" onMouseOut="this.src = \'' + menuContents[i].imagePrefix + '.gif\';" border="0" ' + attrs + '></a><\/td>');
		window['imgpreload' + i] = new Image();
		window['imgpreload' + i].src = menuContents[i].imagePrefix + '_over.gif';
	}
	return '<table cellpadding="0" cellspacing="0"><tr>' + arrBuffer.join('') + '<\/tr><\/table>';
};

var mainMenuContents = [
		{ imagePrefix: 'img/menu1/mmHome', width: 62, height: 23, url: 'index.htm', alt: 'Home' },
		{ imagePrefix: 'img/menu1/mmDVBWorld', width: 139, height: 23, url: 'programme.htm', alt: 'DVB World 2009' },
		{ imagePrefix: 'img/menu1/mmExhibition', width: 91, height: 23, url: 'exhibition.htm', alt: 'Exhibition' },
		{ imagePrefix: 'img/menu1/mmArchives', width: 83, height: 23, url: 'archives.htm', alt: 'Archives' },
		{ imagePrefix: 'img/menu1/mmContact', width: 96, height: 23, url: 'contact.htm', alt: 'Contact us' }
	];
// -- End: Main Menu

function openPopUp(url, name, width, height) {
	var win = window.open(url, name, 'width=' + width + ',height=' + height + 'toolbar=no,menubar=no,location=no,scrollbars=no');
	win.focus();
}