function PrintComments()
{
	var ver = navigator.appVersion;
	var dom = document.getElementById ? 1: 0;
	var nIE6 = ( ver.indexOf('MSIE 6') > -1 && dom ) ? 1 : 0;
	var nIE5 = ( ver.indexOf('MSIE 5') > -1 && dom ) ? 1 : 0;
	var nIE4 = ( document.all && !dom ) ? 1 : 0;
	var nNS5 = ( dom && parseInt(ver) >= 5 ) ? 1 : 0;
	var nNS4 = ( document.layers && !dom ) ? 1 : 0;	
	if ( nIE6 || nIE5 || nNS5 || nNS4 )
		window.print();
	else if ( nIE4 )
		IEPrint();
      	return;
}

function comments(sid) {
	window.open('', 'thecomments', 'toolbar=no, directories=no,'+'status=no, resizable=yes, scrollbars=yes, location=no'+', dependent, width=650, height=450');
}
var mapWindow
function newWindow(s)
{
	mapWindow=window.open(s, 'mapWin','width=550,height=350,scrollbars=yes,resizable=1')
	mapWindow.focus()
}

function submitonce (theform) {
	if (document.all||document.getElementById)
	{
		for (i=0;i<theform.length;i++)
		{
			var tempobj=theform.elements[i]
			if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
				tempobj.disabled=true
		}
	}
}

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;
}

//<![CDATA[
function emoticon(code) {
	x = document.postform.text;
	x.value = x.value + ' [' + code + ']';
	document.postform.text.focus();
}
function emoticonp(code) {
	if (window.event && window.event.keyCode == 13) {
		return emoticon(code);
         	}
}
//]]>

//<![CDATA[
function qpost(code) {
	x = document.postform.text;
	x.value = x.value + '[' + code + ']';
	document.postform.text.focus();
}
function qpostp(code) {
	if (window.event && window.event.keyCode == 13) {
		return emoticon(code);
	}
}
//]]>

function checkUncheckAll(theElement) {
	var theForm = theElement.form, z = 0;
	while (theForm[z].type == 'checkbox' && theForm[z].name != 'checkall') {
		theForm[z].checked = theElement.checked;
		z++;
	}
}

function addLink()
{
	document.getElementById("freetext").value += '|קישור|http://www.example.com|סוף|';
}