// BLOCK
function BlockShow(id) { document.getElementById(id).style.display = "block"; }
function BlockHide(id) { document.getElementById(id).style.display = "none"; }
function BlockSwap(id) { document.getElementById(id).style.display == "block" ? BlockHide(id) : BlockShow(id); }
function BlockSwapGp(base, id) {
	name = base+'-'+id; total = eval(base+'TotalId');
	if (document.getElementById(name).style.display!="block") for(i=1; i<=total; i++) BlockHide(base+'-'+i);
	BlockSwap(name);
}
function BlockExtend(id,height) {
	current = document.getElementById(id).style.overflow;
	if (current == 'auto') { current='visible'; height='100%'; } 
	else current='auto';
	document.getElementById(id).style.overflow = current;
	document.getElementById(id).style.height = height;
}
// CHECKBOXES
function UnCheck(id) { document.getElementById(id).checked = false; }
function Check(id) { document.getElementById(id).checked = true; }
function SetCheckboxes(form, tab, action) {
	obj = document.forms[form].elements[tab+'[]']; nbr = obj.length;
    if (nbr) for (i=0; i<nbr; i++) obj[i].checked = action;
	else obj.checked = action;
}
function ComboCheck(form, tab, check_all) { 
	obj = document.forms[form].elements[tab+'[]']; nbr = obj.length;
	if (nbr) {
		check=0; for (i=0; i<nbr; i++) if (obj[i].checked) check++;
		if (check==nbr && !check_all) SetCheckboxes(form, tab, false);
		if ((check==nbr && !check_all)|| check==0) Check(tab); else UnCheck(tab);
	} else if (obj.checked) UnCheck(tab); else Check(tab);
}
// OVERTRAIL
var OverTrailHeight, OverTrailWidth;
function OverTrail(html,width,height,padding) {
	OverTrailWidth = width+padding*2+2;
	OverTrailHeight = height+padding*2+2;
	ObjTrail = document.getElementById("overtrail");
	ObjTrail.style.width = (document.all?OverTrailWidth:width)+"px";
	ObjTrail.style.padding = padding+"px";
	ObjTrail.innerHTML = html;
	document.onmousemove = FollowMouse;
}
function OverTrail_Img(imagename,width,height) { OverTrail('<img src="' + imagename + '" border="0">',width,height,10); }
function OverTrail_Txt(html,width,height) { OverTrail(html,width,height,5); }
function HideTrail() {
	document.getElementById("overtrail").style.visibility="hidden";
	document.onmousemove="";
}
function FollowMouse(e) {
	x=15, y=15;
	xmax=document.all? document.body.clientWidth+document.body.scrollLeft : window.innerWidth+window.pageXOffset-15;
	ymax=document.all? document.body.clientHeight+document.body.scrollTop : window.innerHeight+window.pageYOffset-15;
	if (typeof e != "undefined") {
		x+=e.pageX; y+=e.pageY;
	} else if (typeof window.event !="undefined") {
		x+=document.body.scrollLeft+event.clientX; y+=document.body.scrollTop+event.clientY;
	}
	if (x+OverTrailWidth>xmax) x=x-OverTrailWidth-30;
	if (y+OverTrailHeight>ymax) y=y-OverTrailHeight-15;
	document.getElementById("overtrail").style.left=x+"px";
	document.getElementById("overtrail").style.top=y+"px";
	document.getElementById("overtrail").style.visibility="visible";
}
function Insert_flash(path,width,height,flashvars,classes) { document.write('<object type="application/x-shockwave-flash" data="'+path+'" width="'+width+'" height="'+height+'" class="'+classes+'"><param name="movie" value="'+path+'" /><param name="flashvars" value="'+flashvars+'" /><param name="wmode" value="transparent" /></object>'); }
function Insert_form(action) { document.write('<form action="'+action+'" method="post">'); }