var lastLeft;
var lastTop;
var timeLength = 50;
var arrMenu = [['ourBrands',false,'']];
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
		return [curleft,curtop];
	}
}
function setUpBlinds() {
	arrMenu.each(function(item, index){
		$('menu_'+item[0]).addEvent('mouseover', function(){
			item[1] = true;
			//clearTimeout(item[3]);
			showHide(findPos(this));
		});
		$('menu_'+item[0]).addEvent('mouseout', function(){
			//item[3] = setTimeout('closeMenu('+index+')', timeLength);
			item[3] = closeMenu(index);
		});
		$(item[0]+'_blinds').addEvent('mouseover', function(){
			item[1] = true;
			//clearTimeout(item[3]);
			showHide();
		});
		$(item[0]+'_blinds').addEvent('mouseout', function(){
			//item[3] = setTimeout('closeMenu('+index+')', timeLength);
			item[3] = closeMenu(index);
		});

    });
}

function showHide(param1) {
	if (param1=='undefined' || param1==null){
		param1=[lastLeft,lastTop];
	}

	arrMenu.each(function(item, index){
		if (item[1]){
			lastLeft = param1[0];
			lastTop = param1[1];
			$(item[0]+'_blinds').style.left = param1[0]+"px";
			$(item[0]+'_blinds').style.top = param1[1]+"px";
			$(item[0]+'_blinds').style.display = 'block';
		}else{
			$(item[0]+'_blinds').style.display = 'none';
		}
	});
}

function closeMenu(menuID){
	arrMenu[menuID][1] = false;
	arrMenu.each(function(item, index){
		showHide();
	});
}

function findHeight(obj) {
	var curheight=0;
	if (obj.offsetParent) {
		do {
			curheight += obj.offsetHeight;
		} while (obj = obj.offsetParent);
		return curheight;
	}
}
function leftGutterSizer(){
	var documentH = document.body.offsetHeight;
	var windowH = document.documentElement.clientHeight;
	var myHeight;
	if (documentH < windowH){
		myHeight = windowH;
	}else{
		myHeight = documentH;
	}
	document.getElementById("gutter_container").style.height = myHeight+"px";
	if($("gutter_footer")!= null){
		document.getElementById("gutter_footer").style.width="158px";
		document.getElementById("gutter_footer").style.position="absolute";
		document.getElementById("gutter_footer").style.top=(myHeight-283)+"px";
		document.getElementById("gutter_footer").style.display="block";
	}
}
//window.onload = leftGutterSizer;
//$("gutter_container").style.height = document.documentElement.clientHeight+"px";