
function redirect(url){
	window.location = url;
}

function popupWindow(url, w, h){
	var width = w || 640, height = h || 480;
	var top = parseInt((screen.width - width) / 2), left = parseInt((screen.height - height) / 2);
	var popupWin = window.open(url, "myPopupWindow", "location,width=" + width + ",height=" + height + ",top=" + top + ",left=" + left);
	popupWin.focus();
	return false;
}

function charCounter(obj, max){
	var textarea = $(obj);
	var limit = max || 3000;
	var count = textarea.value.length;
	var current = limit - count;
	if(count >= limit){
		this.value = textarea.value.substr(0, limit);
		current = limit - textarea.value.length;
	}
	$('char_counter').update(current);
};

//---------------------------------------------------------------- ONLOAD EVENTS

Event.observe(document, 'dom:loaded', function(e){
});

