
function right(mousebutton)
{
	if (navigator.appName == 'Netscape')
	{
		window.getSelection().removeAllRanges();
		return false;
	}
	else
	if (navigator.appName == 'Netscape')
	{
		window.getSelection().removeAllRanges();
		return false;
	}
	else
	if (navigator.appName == 'Microsoft Internet Explorer' && event.button == 1)
	{
		document.selection.empty();
		return false;
	}
	else
	
	if (navigator.appName == 'Microsoft Internet Explorer' && event.button == 2)
	{
		document.selection.empty();
		return false;
	}
	return true;
}


function nosource(mousebutton)
{
	if (navigator.appName == 'Netscape'  && mousebutton.which==3)
	{
		alert("Protected by Jurislex.ro!");
		return false;
	}
	
	else
	
	if (navigator.appName == 'Microsoft Internet Explorer' && event.button == 2)
	{
		alert("Protected by Jurislex.ro!");
		return false;
	}
	return true;
}



if (navigator.appName == 'Netscape'){
	document.captureEvents(Event.MOUSEMOVE | Event.MOUSEDOWN);
}
document.onmousemove = right;
document.onmousedown = nosource;
document.ondblclick = nosource;



//------------------------
var popUp = 0;
var popURL = 0;
var popWidth = 0;
var popHeight = 0;

var thisMargin = 10;

var popTopPosition = 0;
var popLeftPosition = 0;

var pause = 20;
var step = 40;	// The higher the number, the faster the window.
var timer = 0;

var screenWidth = 0;
var screenHeight = 0;

var endX = 0;
var endY = 0;

function startPop(thistop,thisleft) {
	popTopPosition = thistop;	
	var e=document.getElementById("cautare");
	e.style.top = thistop;
	e.style.left = thisleft;
	screenWidth = window.screen.width;
	screenHeight = window.innerHeight;
	endX = screenWidth-200;
	endY = screenHeight-210;
	//alert(endY + " " + screenHeight + " " + popTopPosition);
	movedown();
}

function movedown() {
	e=document.getElementById("cautare");
	//popTopPosition = e.style.top; 
	e.style.top = getScrollY()+10;
	//popTopPosition = popTopPosition.substr(0,popTopPosition.length-2);
	//endY = window.pageYOffset;
	//alert(endY + " " + screenHeight + " " + popTopPosition);
	/*if (popTopPosition - 0<= endY) {
		popTopPosition = popTopPosition - 0 + step;
		e=document.getElementById("cautare");
		e.style.top = popTopPosition;
		//screenHeight = window.screen.height-popTopPosition;
		//endY = screenHeight;
	}*/
	timer = setTimeout("movedown()",pause);		

	//alert(endY + " " + screenHeight + " " + popTopPosition);
	/*else {
		//clearTimeout(timer);
		popTopPosition = endY - 50;
		e=document.getElementById("cautare");
		e.style.top = popTopPosition;
		e.style.left = popLeftPosition;
		
		//moveright();
	}*/
}

function moveright() {
	if (popLeftPosition <= endX) {
		popUp.moveTo(popLeftPosition,popTopPosition);
		popLeftPosition += step;
		timer = setTimeout("moveright()",pause);
	}
	else {
		clearTimeout(timer);
		popLeftPosition = endX;
		popUp.moveTo(popLeftPosition,popTopPosition);
		moveup();
	}
}

function moveup() {
	if (popTopPosition >= thisMargin) {
		popUp.moveTo(popLeftPosition,popTopPosition);
		popTopPosition -= step;
		timer = setTimeout("moveup()",pause);
	}
	else {
		clearTimeout(timer);
		popTopPosition = thisMargin;
		popUp.moveTo(popLeftPosition,popTopPosition);
		moveleft();
	}
}

function moveleft() {
	if (popLeftPosition >= thisMargin) {
		popUp.moveTo(popLeftPosition,popTopPosition);
		popLeftPosition -= step;
		timer = setTimeout("moveleft()",pause);
	}
	else {
		clearTimeout(timer);
		popLeftPosition = thisMargin;
		popUp.moveTo(popLeftPosition,popTopPosition);
	}
}


function getScrollY() {
  var scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
  } else if( document.documentElement &&
      ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;

  }
  return scrOfY;
}



