function select_ck(PID) {
  if(document.form["ck["+PID+"]"].checked)
    document.form["ck["+PID+"]"].checked = false;
  else
	document.form["ck["+PID+"]"].checked = true;
}

function popup(url, width, height) {
  var swidth = window.screen.width;
  var sheight = window.screen.height;
  var left = (swidth-width)/2;
  var top = (sheight-height)/2-50;
  window.open(url,"_blank","width=" + width + ",height=" + height + ",toolbar=0,left="+left+",top="+top+",directories=0,resizable=1,status=0,menubar=0,scrollbars=0");
}

function popup2(url, width, height, scrollbars) {
  window.open(url,"_blank","width=" + width + ",height=" + height + ",toolbar=0,directories=0,resizable=1,status=0,menubar=0,scrollbars=" + scrollbars);
}

function addtofavorites(){
	if (window.sidebar) window.sidebar.addPanel(document.title, document.location.href, ""); 
	else if(document.all) window.external.AddFavorite(document.location.href, document.title);
	else alert("Browserul tau nu are suport automat pentru aceasta functie!\nVa trebui sa adaugi pagina manual.");
} 

function textCounter(field, count) {
  count.value = field.value.length;
}

// code for hide/show keywords on the double-matches page
function toggleKeywords(id) {
  var kwspan = document.getElementById('kw'+id);
  if(kwspan.style.display == 'none') {
    // hide the more link
	document.getElementById('kwlink'+id).style.display='none';
	// show the div
	kwspan.style.display = 'inline';
	// show the less link
	document.getElementById('kwlesslink'+id).style.display='inline';
  }	else { // it's already showing
	// hide the less link
	document.getElementById('kwlesslink'+id).style.display='none';
	// show the more link
	document.getElementById('kwlink'+id).style.display='inline';
	// hide the span
	kwspan.style.display = 'none';
  }
} // end toggleKeywords function