function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}

function toggle_visibility(id) { 
	var e = document.getElementById(id); 
	if(e != null) { 
		if(e.style.display == 'none') { 
			e.style.display = 'block'; 
		} else { 
			e.style.display = 'none'; 
		} 
	} 
}

function confirm_delete() {
	var agree=confirm("Vai tu tiešām vēlies dzēst?");
	if (agree) {
		return true;
	} else {
		return false;
	}
}

function prompt_why_delete(url) {
	var reply = prompt("Iemesls dzēšanai?", "")
	if(reply) {
		window.location = url+'&message='+reply;
	} else {
		return false;
	}
}

function DraugiemSay( title, url, titlePrefix ){
 window.open(
  'http://www.draugiem.lv/say/ext/add.php?title=' + encodeURIComponent( title ) +
  '&link=' + encodeURIComponent( url ) +
  ( titlePrefix ? '&titlePrefix=' + encodeURIComponent( titlePrefix ) : '' ),
  '',
  'location=1,status=1,scrollbars=0,resizable=0,width=530,height=400'
 );
 return false;
}