moz = document.getElementById&&!document.all
function unselect_selection()
{
	if(!moz)
	{
		oTextRange = document.selection.createRange()
		if (oTextRange)
		{
			oTextRange.expand("word")
			oTextRange.execCommand("unselect")
		}
	}
	else
	{
		oTextRange = window.getSelection()
		if (window.getSelection().toString().length)
			oTextRange.collapseToStart()
	}
}
function disableSelect(e)
{
	return false
}
function reEnableSelect()
{
	return true
}
function getEvent (e) 
{
	var event = window.event || arguments.callee.caller.arguments[0];
	if(!event.target ) 
	{
		event.target = event.srcElement
	}
	return event;
}

function initSelectionProofSystem()
{
	document.oncontextmenu= function(){return false;};
	var inputs = document.getElementsByTagName('input');
	for (i = 0; i < inputs.length; i++)
	{
		inputElement = inputs[i];
		if (!moz)
			inputElement.onmousedown = setTimeout(function(){getEvent().target.focus();}, 0);
		else
			inputElement.onmousedown = function(){getEvent().target.focus()};
	}
	var inputs = document.getElementsByTagName('textarea');
	for (i = 0; i < inputs.length; i++)
	{
		inputElement = inputs[i];
		if (!moz)
			inputElement.onmousedown = setTimeout(function(){getEvent().target.focus();}, 0);
		else
			inputElement.onmousedown = function(){getEvent().target.focus()};
	}
	var inputs = document.getElementsByTagName('select');
	for (i = 0; i < inputs.length; i++)
	{
		inputElement = inputs[i];
		if (!moz)
			inputElement.onmousedown = setTimeout(function(){getEvent().target.focus();}, 0);
		else
			inputElement.onmousedown = function(){getEvent().target.focus()};
	}
	setInterval("unselect_selection()", 100);
	/*css_links.length*/
}

document.onselectstart = new Function ("return false");
if (window.sidebar)
{
	document.onmousedown = disableSelect
	document.onclick = reEnableSelect
}

