var expDays = 1; // number of days the cookie should last
var page = "http://www.olyx.ru/random7.php";
var windowprops = "top=0,left=0,width=850,height=600,location=no,toolbar=no,menubar=no,scrollbars=1,resizable=yes";
var b_mouse=0;
var clicks=0;

function GetCookie (name) {  
var arg = name + "=";  
var alen = arg.length;  
var clen = document.cookie.length;  
var i = 0;  
while (i < clen) {    
var j = i + alen;    
if (document.cookie.substring(i, j) == arg)      
return getCookieVal (j);    
i = document.cookie.indexOf(" ", i) + 1;    
if (i == 0) break;   
}  
return null;
}

function SetCookie (name, value) {  
var argv = SetCookie.arguments;  
var argc = SetCookie.arguments.length;  
var expires = (argc > 2) ? argv[2] : null;  
var path = "/";  
var domain = (argc > 4) ? argv[4] : null;  
var secure = (argc > 5) ? argv[5] : false;  
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
((path == null) ? "" : ("; path=" + path)) +  
((domain == null) ? "" : ("; domain=" + domain)) +    
((secure == true) ? "; secure" : "");
}

var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*60*60*1000));

function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

function checkCount_cl() {
var count = GetCookie('count');
if (count == null && clicks==0) {
  var wi=window.open(page+"?id=vv","",windowprops);
  wi.blur();
  b_mouse=1;
  clicks=1;
  count=1;
  SetCookie('count', count, exp);
  }
}

function checkCount_lo() {
var count = GetCookie('count');
if (count == null && clicks==0) {
  var wi=window.open(page+"?id=lo","",windowprops);
  if (wi.opener) {
    wi.blur();
    clicks=1;
    b_mouse=1;
    count=1;
    SetCookie('count', count, exp);
    }
  }
}

function addHandler(object, event, handler, useCapture) {
  if (object.addEventListener) {
    object.addEventListener(event, handler, useCapture ? useCapture : false);
  } else if (object.attachEvent) {
    object.attachEvent('on' + event, handler);
  } else alert("Add handler is not supported");
}

function exampleActivate() {
var count = GetCookie('count');
if (count == null) {
  /* Gecko */
  addHandler(window, 'DOMMouseScroll', wheel);
  /* Opera */
  addHandler(window, 'mousewheel', wheel);
  /* IE */
  addHandler(document, 'mousewheel', wheel);
  return false;
  }
}

function wheel(event){
  if (b_mouse==0){ 
    if (event.preventDefault)  event.preventDefault();
        event.returnValue = false;}
}

exampleActivate();