function bookmarksite(title, url){
	if (document.all){
		window.external.AddFavorite(url, title);
	} else if (window.sidebar){
		window.sidebar.addPanel(title, url, "")
	}
}

function textCounter(field, countfield, maxlimit) {
	// if too long...trim it!
	if (field.value.length > maxlimit){
		field.value = field.value.substring(0, maxlimit);
	// otherwise, update 'characters left' counter
	} else  {
		countfield.value = maxlimit - field.value.length;
	}
}

// opens a new window and centers it on the screen
function winBRopen(theURL, Name, popW, popH, scroll, winResize) {
	var winleft = (screen.width - popW) / 2;
	var winUp = (screen.height - popH) / 2;
	winProp = 'width='+popW+',height='+popH+',left='+winleft+',top='+winUp+',scrollbars='+scroll+',resizable='+winResize+''
	Win = window.open(theURL, Name, winProp)
	if (parseInt(navigator.appVersion) >= 4) { 
		Win.window.focus(); 
	}
}

function ElementOut(element, evt){
	if (typeof evt.toElement != 'undefined' && typeof element.contains != 'undefined'){
		return !element.contains(evt.toElement);
	} else if (typeof evt.relatedTarget != 'undefined' && evt.relatedTarget){
		return !contains(element, evt.relatedTarget);
	}
}

function contains(container, containee){
	while (containee){
		if (container == containee){ return true; }
		containee = containee.parentNode;
	}
	return false;
}

function ElementHide(element){
	document.getElementById(element).style.display='none';
}

function ElementShow(element){
	document.getElementById(element).style.display='inline';
}