function limitText(limitField, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	}
}
function showhide(layer_ref,state) {
	//alert(layer_ref);
	if (document.all) { //IS IE 4 or 5 (or 6 beta)
		eval( "document.all." + layer_ref + ".style.display = state");
	}
	if (document.layers) { //IS NETSCAPE 4 or below
		document.layers[layer_ref].display = state;
	}
	if (document.getElementById &&!document.all) {
		hza = document.getElementById(layer_ref);
		hza.style.display = state;
	} 
}

function showTc() {
	window.open("carriage-terms.php?popup=1","terms",'width=500,height=600,toolbar=0,location=0,directories=0,scrollbars=1,status=0,menubar=0');
}
function showPr() {
	window.open("prohibited-items.php?popup=1","terms",'width=500,height=600,toolbar=0,location=0,directories=0,scrollbars=1,status=0,menubar=0');
}
function helpContents(s) {
	window.open("help.php?popup=1&show="+s,"terms",'width=500,height=600,toolbar=0,location=0,directories=0,scrollbars=1,status=0,menubar=0');
}

function overlay() {
	var el = document.getElementById("overlay");
	var el2 = document.getElementById("overlay2");

	var windowwidth = 0, windowheight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		windowwidth = window.innerWidth;
		windowheight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		windowwidth = document.documentElement.clientWidth;
		windowheight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		windowwidth = document.body.clientWidth;
		windowheight = document.body.clientHeight;
	}

	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}

	var htmlheight = document.body.parentNode.scrollHeight;

	el.style.height = htmlheight + "px";
	el.style.width = windowwidth + "px";
	el2.style.top = (scrOfY+ (windowheight-100)/2) +"px";

	el2.style.left = (windowwidth-550)/2;
	//alert(el2.style.offsetHeight);
	el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible";
	el2.style.visibility = (el2.style.visibility == "visible") ? "hidden" : "visible";
}

