
if (location.hostname.indexOf("www.havanacoffeeco.com") == -1) {
	location.replace("http://www.havanacoffeeco.com" + location.pathname + location.search);
}

function BrandChange(intBrandID) {
	if (intBrandID != 0) location.href = "search.asp?brandid=" + intBrandID;
}

function KeywordSearch() {
	var strKeywords = document.search.keywords.value;
	if (strKeywords != "" && strKeywords != "keyword search") location.href = "search.asp?keywords=" + strKeywords;
	return false;
}


var lockOutSlider = false;
var slidemenu_width='260px' //specify width of menu (in pixels throughout)
var slidemenu_height='100px' //specify height of menu
var slidemenu_reveal='30px' //specify amount that menu should protrude initially
var slidemenu_left='600px'   //specify vertical offset of menu on page
var slidemenu_url="member_tools.asp" //specify path to menu file

var ie4=document.all;
var ns6=document.getElementById&&!document.all?1:0

bottomboundary=0
topboundary=(parseInt(slidemenu_height)-parseInt(slidemenu_reveal))*-1

document.write('<div style="position:absolute; border:none; width:'+slidemenu_width+'; left:'+slidemenu_left+'; height:10px; top:0px; z-index:101; background-color:#FDF6DC; "><img src=images/blank.gif width=1 height=1></div>');
document.write('<iframe id="slidemenubar2" style="top:'+((parseInt(slidemenu_height)-parseInt(slidemenu_reveal))*-1)+'px; left:'+slidemenu_left+'; width:'+slidemenu_width+'; height:'+slidemenu_height+'; border:none;" src="'+slidemenu_url+'" frameborder="0" scrolling="no"></iframe>')

function setTheMenuRef() {
	var tmp;
	if (ns6)
		tmp = document.getElementById("slidemenubar2");
	else 
		tmp = document.all.slidemenubar2;
		
	if (!tmp) {
		window.setTimeout('setTheMenuRef();', 300);
		return;
	}
	
	themenu = tmp.style;
}
setTheMenuRef();



function pull(){
	if (window.drawit) clearInterval(drawit)
	pullit=setInterval("pullengine()",20)
}
function draw(){
	clearInterval(pullit)
	drawit=setInterval("drawengine()",20)
}
function pullengine(){
	if ((ie4||ns6)&&parseInt(themenu.top)<bottomboundary)
		themenu.top=parseInt(themenu.top)+10+"px"
	else if (window.pullit){
		themenu.top=0
		clearInterval(pullit)
	}
}

function drawengine(){
	if (lockOutSlider) return;
	if ((ie4||ns6)&&parseInt(themenu.top)>topboundary)
		themenu.top=parseInt(themenu.top)-10+"px"
	else if (window.drawit){
		themenu.top=topboundary
		clearInterval(drawit)
	}
}



var objDropdown;
var intWait = 500;
var intTimer;

function ShowMenu(objMenuElement, strSubMenuName) {
	
	var objNewDropdown = document.getElementById(strSubMenuName);
	if (objDropdown && objNewDropdown.id == objDropdown.id) return;
	HideMenu();
	objDropdown = document.getElementById(strSubMenuName);
	if (!objDropdown) return;
	objMenuElement = GetParentFromTagName(objMenuElement, "TD");
	objDropdown.style.top = getOffsetTop(objMenuElement) + 35;
	objDropdown.style.left = getOffsetLeft(objMenuElement) - 0;
	if (objDropdown.filters) objDropdown.filters[0].apply();
	objDropdown.style.visibility = "visible";
	if (objDropdown.filters) objDropdown.filters[0].play();
}

function HideMenu() { if (objDropdown) objDropdown.style.visibility = "hidden"; }
function keepOpen() { if (intTimer) clearTimeout(intTimer); }
function hide() { intTimer = setTimeout("HideMenu()", intWait); }
function getOffsetLeft(el){var ol=el.offsetLeft;while((el=el.offsetParent)!= null) ol+=el.offsetLeft;return ol;}
function getOffsetTop(el){var ot=el.offsetTop;while((el=el.offsetParent)!=null) ot+=el.offsetTop;return ot;}

function GetParentFromTagName(curElement, ParentElementTagName) {
	if (curElement.tagName == ParentElementTagName)
		return curElement;
	else
		return GetParentFromTagName(curElement.parentNode, ParentElementTagName);

}
