﻿//http://www.ajaxray.com/blog/2007/11/09/interactive-character-limit-for-textarea-using-jquery/
function limitChars(textarea, limit, infodiv)
{
	var text = textarea.value; 
	var textlength = text.length;
	var info = document.getElementById(infodiv);
	if(textlength > limit) {
		info.innerHTML = 'You cannot write more then '+limit+' characters!';
		textarea.value = text.substr(0,limit);
		return false;
	} else {
		info.innerHTML = (limit - textlength) +' characters left.';
		return true;
	}
}
function Hide(id, speed){
    jQuery("#" + id).hide(speed);
}
function Show(id, speed){
    jQuery("#" + id).show(speed);
}
function ShowHide(id){
    jQuery("#" + id).animate({ "height": "toggle" }, { duration: 300 });
}

function ChangeLocation(url, showConfirm) {
    if (showConfirm && !confirm('Are you sure?'))
        return;
    window.location = url;
}