
var mjs_lastSelectedCell;
var mjs_lastPrevious;
var mjs_lastNext;

function selectCell(pjs_cell){
	pjs_cell.className = pjs_cell.className + "Over";
	var previous = getPreviousMenuLeftBtn(pjs_cell);
	previous.className = previous.className + "Over";
 	var next = getNextMenuRightBtn(pjs_cell);
	next.className = next.className + "Over";
}

function hiliteCell(pjs_cell) {
	if (mjs_lastSelectedCell != null) {
		mjs_lastSelectedCell.className = mjs_lastSelectedCell.className.substring(0, mjs_lastSelectedCell.className.length - 4);
	}

	if (mjs_lastPrevious != null) {
		mjs_lastPrevious.className = mjs_lastPrevious.className.substring(0, mjs_lastPrevious.className.length - 4);
	}
	
	if (mjs_lastNext != null) {
		mjs_lastNext.className = mjs_lastNext.className.substring(0, mjs_lastNext.className.length - 4);
	}

	
	mjs_lastSelectedCell = pjs_cell;
	mjs_lastSelectedCell.className = mjs_lastSelectedCell.className + "Over";
	
	mjs_lastPrevious = getPreviousMenuLeftBtn(mjs_lastSelectedCell);
	mjs_lastPrevious.className = mjs_lastPrevious.className + "Over";
	
	
	mjs_lastNext = getNextMenuRightBtn(mjs_lastSelectedCell);
	mjs_lastNext.className = mjs_lastNext.className + "Over";
	
	
}

function hiddenCell(pjs_cell) {	
	if (mjs_lastSelectedCell != null) {
		mjs_lastSelectedCell.className = mjs_lastSelectedCell.className.substring(0, mjs_lastSelectedCell.className.length - 4);
	}

	if (mjs_lastPrevious != null) {
		mjs_lastPrevious.className = mjs_lastPrevious.className.substring(0, mjs_lastPrevious.className.length - 4);
	}
	
	if (mjs_lastNext != null) {
		mjs_lastNext.className = mjs_lastNext.className.substring(0, mjs_lastNext.className.length - 4);
	}
	mjs_lastSelectedCell = null;
	mjs_lastNext = null;
	mjs_lastPrevious = null;
	
}


function getNextMenuRightBtn(pjs_element){
	var ljs_element = pjs_element.nextSibling;
	while(ljs_element!=null){
		if(ljs_element.className=="hNavMenuTableRightCell"){
			return ljs_element;
		}else{
			ljs_element=ljs_element.nextSibling;
		}
	}
}


function getPreviousMenuLeftBtn(pjs_element){
	var ljs_element = pjs_element.previousSibling;
	while(ljs_element!=null){
		if(ljs_element.className=="hNavMenuTableLeftCell"){
			return ljs_element;
		}else{
			ljs_element=ljs_element.previousSibling;
		}
	}
}

