
function oRoll(img,onoff)
{
	if(onoff) { return; }
	img.src=img.src.replace(/_\d\./,"_"+(img.src.search(/_0\./)==-1?"0":"1")+".");
}

function cRoll(obj)
{
	var bg = obj.style.backgroundColor;
	obj.style.backgroundColor = !bg?'#B5B292':'';
}
function show(id)
{
	var obj = document.getElementById("menu_"+id);
	obj.style.visibility = 'visible';
	var obj = document.getElementById("menu_"+id+"_btn");
	obj.style.visibility = 'visible';
	//oRoll2(id,1);
}
function hide(id,x)
{
	var obj = document.getElementById("menu_"+id);
	obj.style.visibility = 'hidden';
	var obj = document.getElementById("menu_"+id+"_btn");
	obj.style.visibility = 'hidden';
	//if(id!=main_nav_id) { oRoll2(id,0); }
}
function oRoll2(id,x)
{
	obj = document.getElementById("img_"+id);
	obj.src=obj.src.replace(/_\d/,"_"+x);
}
//var tmp_disable_nav = true; // no popup nav after pg load
function showTopMenu(id)
{
	//if(tmp_disable_nav && main_nav_id==id) { return false; }
	stopHideDelay();
	hideCurrentTopMenu();
	show(id);
	currentTopMenu = id;
}
var currentTopMenu = '';
function hideCurrentTopMenu(x)
{
	//tmp_disable_nav = false;
	if(currentTopMenu) {
		hide(currentTopMenu,x);
	}
}
var delayHandler;
function startHideDelay()
{
	if(delayHandler) { clearTimeout(delayHandler); }
	delayHandler = setTimeout( 'checkDelay()', 500 );
}
function checkDelay()
{
	if(delayHandler) {
		hideCurrentTopMenu();
	}
}
function stopHideDelay()
{
	delayHandler = false;
}

function outLink(url)
{
	var param = "status,toolbar,menubar,scrollbars,resizable,location,height=450,width=700";
	var w = window.open( url, 'builderWin', param);
	w.focus();
}

function openLargeImg(id)
{
	if(id==21 || id==16) {
		alert('Larger image not available.');
		return false;
	}
	var param = "status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,height=400,width=500";
	var w = window.open( 'img_detail.phtml?id='+id, 'builderWin', param);
	w.focus();
}

function openWindow(url, width, height, type, winName) {
	var paramStr="";
	if (type=="console") {
		paramStr="resizable,height="+height+",width="+width;
	} else if (type=="fixed") {
		paramStr="status,height="+height+",width="+width;
	} else if (type=="content") { // fixed size with scrolling
		paramStr="scrollbars,status,height="+height+",width="+width;
	} else if (type=="normal") { // a normal window but with width & height set
		paramStr="status,toolbar,menubar,scrollbars,resizable,location,height="+height+",width="+width;
	} else if(!type || type=="flexible") { // default
		paramStr="scrollbars,resizable,height="+height+",width="+width;
	}
	if(!winName) { // make unique but consistent window name for this page
		winName = 'myWin_'+url.substr(0,url.indexOf("?")).replace(/\W/g,"");
	}
	winObj = window.open(url, winName, paramStr);
	winObj.focus();
	return winObj;
}