function Office2007MenuRenderer() {

	this._menu = null;
	this._container = null;
	//this._mainTable = null;
}

Office2007MenuRenderer.prototype.getMenu = function() {
	return this._menu;	
}

Office2007MenuRenderer.prototype.setMenu = function(menu){
	this._menu = menu;	
}

Office2007MenuRenderer.prototype.getItemOffsetTop = function(itemdom){
	return itemdom.offsetTop;
}

Office2007MenuRenderer.prototype.renderContainer = function () {
	this._container = document.createElement('div');
	//this._mainTable = document.createElement('<table border=0 cellspacing=0 cellpadding=0 width=100%>');
	//this._container.appendChild(this._mainTable);
	
	this._container.className = this.getMenu().getCls();

	//var tbody = document.createElement('tbody');
	//this._mainTable.appendChild(tbody);
	
	return this._container;
}

Office2007MenuRenderer.prototype.renderItem = function (item) {
	if(this.getMenu() == null || this._container == null)
		return null;

	var div = document.createElement('div');
	// div.className = this.getMenu().getItemCls();
	
	var table = document.createElement('<table border=0 cellspacing=0 cellpadding=0 width=100%>');
	div.appendChild(table);

	var tr = table.insertRow();
	if (item.title == '-') {
		var fgTD = document.createElement('td');
		fgTD.colSpan = '3';
		fgTD.style.height = '1px';
		fgTD.style.padding = "3px 1px";
		fgTD.innerHTML = '<table width="100%" cellpadding=0 cellspacing=0><tr><td style="height:1px;background-color:#BFBFBF;"></td></tr>';

		div.className = '';
		tr.appendChild(fgTD);
		// table.appendChild(tr);
		
		return tr;
	}
	
	var icontd = document.createElement('td');
	icontd.id = 'icon_ct';
	// if (item.icon) {
		// icontd.innerHTML = '<img src="' + item.icon + '" />';
		var box = document.createElement('input');
		box.type = 'checkbox';
		box.onclick = Office2007MenuRenderer.createCheckboxClick(item);
		icontd.appendChild(box);
		item.checkboxDom = box;
	// }
	tr.appendChild(icontd);
	
	var tltd = document.createElement('td');
	tltd.id = 'title_ct';
	tltd.innerHTML = item.title;
	tr.appendChild(tltd);
	
	var arrtd = document.createElement('td');
	arrtd.id = 'arrow_ct';
	if (item.children && this.getMenu().getRightArrow() != null) {
		arrtd.className = this.getMenu().getRightArrow();
	}

	tr.appendChild(arrtd);
	this._container.appendChild(div);
	
	return div;
}

Office2007MenuRenderer.createCheckboxClick = function(item) {
	return function() {
		event.cancelBubble = true;
		item.checked = this.checked;
		if (item.children) {
			if (item.childMenu && item.childMenu.isDisplay()) {
				// dataitem.childMenu.show(xy);
				Menu.showChildMenu(item);
			}
		}

		/*var its = null;
		if(item.children) {
			if(item.children.items) {
				its = item.children.items;
			} else {
				its = item.children;
			}

			for(var i = 0; i < its.length; i++){
				its[i].checked = this.checked;
				its[i].checkboxDom.checked = this.checked;
				its[i].checkboxDom.disabled = this.checked;
			}
		}

		Menu.showChildMenu(item);*/
		Menu.setItemChildSelectedCnt(item, this.checked ? 1 : -1);
		/*Menu.setItemDefaultCls(item);*/

		if(Menu._checkboxClick) {
			Menu._checkboxClick(item);
		}
	}
}
