var activeMenu = null;

var activeSubmenu = null;

var activeButton = null;

var menuTimer = 0;
var win3;
function dobaWindow(){
	win3 = window.open("", "DOBA_Information", "width=450,height=275,scrollbars=yes");

	// write to window
	win3.document.writeln("<body bgcolor='#eeecdd'><div style='font-family:Arial;font-size:12px;'><h3>DOBA</h3><br />Pinnacle Cart has partnered with Doba to provide our clients a place where suppliers can list their product inventory, and <b>you can find items to sell</b>. These different suppliers will drop ship products right to your customers, so you never have to handle or ship products. Our integration connects you to 75 wholesale distributors, manufacturers, and craftsmen in <b>one place</b>. When you sign up, you gain full access to all the drop ship wholesalers and their wholesale product catalogs.<ul><li>Search and find products in one place.</li><li>List products from one place.</li>	<li>Order products from one place.</li><li>Track your product orders in one place.</li></ul><br /><a href='http://www.doba.com/catalog?clear_filter' style='color:#3e8443;' target='_blank'>Click here</a> (link info below) to view all the products you can sell using Pinnacle Cart.</div></body> ");	
}

// 2 funstions are from http://forums.devshed.com/t40400/s.html

function getRealLeft(el) {

    xPos = el.offsetLeft;

    tempEl = el.offsetParent;

    while (tempEl != null) {

        xPos += tempEl.offsetLeft;

        tempEl = tempEl.offsetParent;

    }

    return xPos;

}

function getRealTop(el) {

    yPos = el.offsetTop;

    tempEl = el.offsetParent;

    while(tempEl != null){

        yPos += tempEl.offsetTop;

        tempEl = tempEl.offsetParent;

    }

    return yPos;

}

//////////////////////////

//show top menu item

function onTopButton(button){
	if(activeMenu != null) activeMenu.style.display = "none";
	if(activeSubmenu != null) activeSubmenu.style.display = "none";
	if(activeButton != null) activeButton.style.background = "url('images/nav_divider.gif') no-repeat";
	clearTimeout(menuTimer);
	activeButton = button;
	activeMenu = document.getElementById(activeButton.id + '_items');
	if(activeMenu){
		activeMenu.style.left = 0;
		activeMenu.style.left = getRealLeft(button)   + "px"; //alert(activeMenu.id + "---" + activeMenu.style.left);		
		activeMenu.style.display="block";
	}
	
	// new
	if(button)
		button.style.background = "url('images/nav_bg2.gif') repeat-x";

}

function offTopButton(button,fadeOutFast){
	if(fadeOutFast)
		button.style.background = "url('images/nav_divider.gif') no-repeat";
	menuTimer = setTimeout("hideMenu()", 500);

}

function hideMenu(button){
	if(activeMenu != null) activeMenu.style.display = "none";
	if(activeSubmenu != null) activeSubmenu.style.display = "none";
	if(activeButton != null) activeButton.style.background = "url('images/nav_divider.gif') no-repeat";
	activeButton = null;
	activeMenu = null;
	activeSubmenu = null;
	window.status = "Pinnacle Cart" ;
	
	// new
	

}

function onTopMenuItem(item, item_id){

	if(activeSubmenu != null) activeSubmenu.style.display = "none";
	clearTimeout(menuTimer);
	var submenu_id = item_id + '_items';
	activeSubmenu = document.getElementById(submenu_id);

	//alert(submenu_id);
	if(activeSubmenu){
		activeSubmenu.style.left = (getRealLeft(item) - 0)  + "px"; 
		activeSubmenu.style.display="block";
	}
	window.status = "Pinnacle Cart";// + item.statustext;

}

function offTopMenuItem(item,fadeOutFast){
	if(fadeOutFast)
		menuTimer = setTimeout("hideMenu()", 400);
	else
		menuTimer = setTimeout("hideMenu()", 500);
}

function onTopSubMenuItem(item, item_id){

	clearTimeout(menuTimer);

	window.status = "Pinnacle Cart";// + item.statustext;

}

function offTopSubMenuItem(item){

	item.className = "menu_item";

	menuTimer = setTimeout("hideMenu()", 500);

}

function gotoTopMenuItem(url){

	document.location = url;

}

var activeHint = false;
var activeHintTimer = false;

function showHint(opnr, div_id){
	if(activeHint && activeHint.id != div_id){
		activeHint.style.visibility = 'hidden';
	}
	activeHint = document.getElementById(div_id);
	if(activeHint){
		activeHint.style.top = (getRealTop(opnr) + 10) + "px";
		activeHint.style.left = (getRealLeft(opnr) + 10) + "px";
		activeHint.style.visibility = "visible";
	}
}

function hideHint(div_id){
	activeHint = document.getElementById(div_id);
	if(activeHint){
		activeHint.style.visibility = 'hidden';
	}
}