function limit(what,chars,counter) {

	if (what.value.length > chars) {
		what.value=what.value.substr(0,chars);
		alert('Max '+chars+' characters please!');
	}

	counting = (chars - what.value.length);
	c = document.getElementById(counter);
	c.innerHTML = counting;
}

function hidediv(divid) {
	if (document.getElementById) {
		document.getElementById(divid).style.visibility = 'hidden';
		document.getElementById(divid).style.height = '0px;';
	} else {
		if (document.layers) { 
			document.hideshow.visibility = 'hidden';
			document.hideshow.height = '0px;';
		} else { 
			document.all.hideshow.style.visibility = 'hidden';
			document.all.hideshow.style.height = '0px;';
		}
	}
}

function showdiv(divid) {
	if (document.getElementById) { 
		document.getElementById(divid).style.visibility = 'visible';
		document.getElementById(divid).style.height = '100%';
	} else {
		if (document.layers) { 
			document.hideshow.visibility = 'visible';
			document.hideshow.height = '100%';
		} else { 
			document.all.hideshow.style.visibility = 'visible';
			document.all.hideshow.style.height = '100%';
		}
	}
} 

function popcenter(url,t,w,h) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+'resizable=0,location=yes,scrollbars=yes,status=yes'
	window.open(url+""+""+"", t, winprops)
} 

function checkAll(formId, cName, check ) {
    for (i=0,n=formId.elements.length;i<n;i++)
        if (formId.elements[i].className.indexOf(cName) !=-1)
            formId.elements[i].checked = check;
}
