stillon=0;
current=0;

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function showcat(no) {
	if (current!=0&&current!=no) {document.getElementById('dropdn'+current).style.display = 'none';}
	current=no;
	pos=findPos(document.getElementById('catf'+no))
	document.getElementById('dropdn'+no).style.left=pos[0]+document.getElementById('categorylist').offsetWidth-3;
	var winheight = (window.innerHeight ? window.innerHeight : document.body.clientHeight)
	var scrolltop = (window.scrollTop ? window.scrollTop : document.body.scrollTop)
	document.getElementById('dropdn'+no).style.display='block';
	if (document.getElementById('dropdn'+no).offsetHeight>winheight-5) {
		document.getElementById('dropdn'+no).style.top=1+scrolltop;
	} else {
	
		if (document.getElementById('dropdn'+no).offsetHeight+pos[1]<winheight+scrolltop) {
			document.getElementById('dropdn'+no).style.top=pos[1];
			
		} else {
			document.getElementById('dropdn'+no).style.top=winheight-document.getElementById('dropdn'+no).offsetHeight-5+scrolltop;
		}
	}
	
	stillon=1;
}

function hidecat(no) {
	stillon=0;
	setTimeout('collps('+no+')', 1000);
	
}



function hidecat2(no) {
	
		
		stillon=0;
		setTimeout('collps('+no+')', 1000);
	
	
}

function collps(no) {
	if (stillon == 0) {
		document.getElementById('dropdn'+no).style.display = 'none';
	}
}
