
var noclick = {
  bind: function(obj,event,handler,p) {
    var closure = function(e) {
      if(!e) e = window.event;
      if(handler(obj,e,p)===false) {
        if(e.preventDefault) e.preventDefault();
        e.returnValue = false;
      }
    }
    if(obj.addEventListener) obj.addEventListener(event,closure,false);
    else if(obj.attachEvent) obj.attachEvent("on"+event,closure);
  },
 

 
 disableSelection: function (target){   
if (typeof target.onselectstart!="undefined") //IE route
	target.onselectstart=function(){return noclick.SelectionStarted(null,null,null);}
else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
	target.style.MozUserSelect="none"
else //All other route (ie: Opera)
	//target.onmousedown=function(){return noclick.SelectionStarted(event);}
	noclick.bind(document.body,"mousedown",noclick.SelectionStarted);
target.style.cursor = "default"
},     

    


 isLink: function (x,y)
 {   
   var el = document.body.elements;
   for (i=0;i<el.length;i++)
   {
     var ely = el[i].offsetTop;
     var elx = el[i].offsetLeft;
     if (x==elx && y==ely)
     alert (el[i].type);
   }
 },    
 
 


y:5,
shown:false,
moving:false,

SelectionStarted: function (o,e,p)
{
  if (noclick.isLink(e.pageX,e.pageY))
  return true;
  if (!noclick.shown)
  {
    var nc = "<div id='nocopy' style='width:100%;background-color:red;color:white;text-align:center;position: absolute; left: 1px; top: 1px'>This site is under copyright !</div>";
    noclick.shown = true;
    var old = document.body.innerHTML;
    document.body.innerHTML = nc + old;
  }
  if (!noclick.moving)
  {
    document.getElementById ('nocopy').style.top = 5;
    noclick.SlideDown();
  }
  return false;
},



SlideDown: function ()
{
  noclick.moving = true;
  document.getElementById ('nocopy').style.top=noclick.y+'px';
  noclick.y+=3;
  if (noclick.y < 15)
    setTimeout("noclick.SlideDown()",50);
  else
    setTimeout("noclick.SlideUp()",1000);
},      

SlideUp: function ()
{
  document.getElementById ('nocopy').style.top=noclick.y+'px';
  noclick.y-=3;
  if (noclick.y > -25)
    setTimeout("noclick.SlideUp()",50);
  else
    noclick.moving = false;
},


  
 
  loaded: function() 
  {
   if(document.getElementById('copy')==null)
   noclick.disableSelection(document.body);  
  }
};

noclick.bind(window,"load",noclick.loaded);
