function popwin(w,h,path){
	if(popup)
		popup.close();
	
	var x1 = (document.all) ? window.screenLeft : screenX;
	var x2 = (document.all) ? document.body.clientWidth : window.innerWidth;
	var y = (document.all) ? window.screenTop : screenY;
	var wleft = (x1 + (x2/2)) - (w/2);
	var wtop = 0;
	if (navigator.appName == "Microsoft Internet Explorer") { wtop = 20; } else { wtop = y + 20; };
	var feat = 'width='+w+',height='+h+',top='+wtop+',left='+wleft+',status=no,location=no,menubar=no,scrollbars=no,resizable=no';
	var popup = window.open(path,'v',feat);
	
	popup.focus();
}

function getLikeElements(tagName, attrName, attrValue) {
	var start, end = [], re = new RegExp("(^|\\s)"+attrValue+"(\\s|$)");
	if(tagName) 
		start = document.getElementsByTagName(tagName);
	else{
		start = (document.all && !window.opera) ? document.all :
		document.getElementsByTagName("*");
	}
	if(attrName) {
		for(var i = 0, l = start.length; i < l; i++) {
			if (attrName == "class" && start[i].className) {
				if(attrValue) {
					if (re.test(start[i].className) || start[i].getAttribute(attrName) == attrValue) {
						end.push(start[i]);
					}
				}
				else end.push(start[i]);
			}
		}
	}
	else end = start;
	return end;
}

var curOpen;

function showSubMenu(id,tagName,attrName,attrValue){
	if(!curOpen || curOpen!=id)
		curOpen=id;
	else
		curOpen='';
		
	tagName=tagName?tagName:'div';
	attrName=attrName?attrName:'class';
		
	var collection = getLikeElements(tagName,attrName,attrValue);
	for(var i = 0; i < collection.length; i++) {
		collection[i].style.display = 'none';
	}
	
	/*
	var collection = getLikeElements('div','class','podmenuDiv');
	for(var i = 0; i < collection.length; i++) {
		collection[i].style.backgroundImage='url(/i/plus3.gif)';
		collection[i].style.marginTop='0';
	}
	*/
	
	
	if(curOpen==id){
		//document.getElementById('group_'+id).style.backgroundImage='url(/i/minus3.gif)';
		//document.getElementById('group_'+id).style.marginTop='10px';
	
		document.getElementById(id).style.display='block';
	}
}
