function getCookie(sCookie, sDefault){
	var res = sDefault;
	if (document.cookie.length > 0){
		idx = document.cookie.indexOf(sCookie+'=');
		if (idx != -1){
			idx += sCookie.length+1;
			aux = document.cookie.indexOf(';', idx);
			if (aux == -1){ aux = document.cookie.length; }
			res = unescape(document.cookie.substring(idx, aux)); 
		}
	}
	return res;
}
function dispBoxBody(sTagId, sCookie, bSwitch, titleExpand, titleCollapse, sColor){
	var bCollapse = getCookie(sCookie, '0');
	if(bSwitch){
		bCollapse = (bCollapse=='0' ? '1' : '0');
		var exdate = new Date();
		exdate.setDate(exdate.getDate()+200);
		document.cookie = sCookie + '=' + bCollapse + '; path=/;expires=' + exdate.toGMTString();
	}

	var oBoxTitle = document.getElementById(sTagId);
	if(oBoxTitle){
		if(bCollapse == '1'){
			oBoxTitle.style.backgroundImage = 'url(../images/boxes2/unhide.gif)';
			oBoxTitle['title'] = titleExpand;
		} else{
			oBoxTitle.style.backgroundImage = 'url(../images/boxes2/hide.gif)';
			oBoxTitle['title'] = titleCollapse;
		}
	
		var pPar = oBoxTitle.parentNode.parentNode;
		if(pPar){
			for( var x = 0; x<pPar.childNodes.length; x++ ){
				if(pPar.childNodes[x].tagName == 'DIV'){
					pPar.childNodes[x].style.color = (bCollapse == '1' ? sColor : '');
					break;
				}
			}
		
			var nSib = pPar.nextSibling;
			while(nSib){
				if(nSib.tagName == 'DIV'){
					nSib.style.display = (bCollapse=='1' ? 'none' : 'block');
				}
				nSib = nSib.nextSibling;
			}
		}
	}
}
