//******************************************************************************
//
//
//
//******************************************************************************

var netscape = false;

if (navigator.appName == 'Netscape') {

  netscape = true;

}

//******************************************************************************
//
//
//
//******************************************************************************

var mouse_X = 0;
var mouse_Y = 0;


function MoveHandler(e) {
 
   
  if (!e) e = window.event;
  

  if (netscape) {

  	mouse_X = e.pageX;
        mouse_Y = e.pageY;
  
  	return;
  }

  mouse_X = e.screenX - window.screenLeft;
  mouse_Y = e.screenY - window.screenTop + document.body.scrollTop;

}

var PpOwn = null;

timerProc = setInterval("check_popup()", 1000);

function getElPos(elem) {

  el=document.getElementById(elem);

  var w = el.offsetWidth;
  var h = el.offsetHeight;
  var l = 0;
  var t = 0;

  while (el) {

    l += el.offsetLeft;
    t += el.offsetTop;
    el = el.offsetParent;

  }

  return {"l":l, "t":t, "w":w, "h":h};
}

function mouse_inside(elem) {

  var ElPos = getElPos(elem);

  var r = ElPos.l + ElPos.w;

  var b = ElPos.t + ElPos.h;

  if (mouse_X >= ElPos.l && mouse_X <= r && mouse_Y >= ElPos.t && mouse_Y <= b) {

    return(true);

  }

  return(false);

}

function on_PopUp() {

  pp_content = get_pp_content(PpOwn);

  if (!pp_content) {

    return;

  }

  elPpc = document.getElementById('rds_popup_cntt');

  elPpc.innerHTML = pp_content;

  elPp = document.getElementById('rds_popup');

  elPp.style.display = 'block';

  elPp.style.left = mouse_X - 3;

  elPp.style.top = mouse_Y - 3;
}

function check_popup() {

  elPp = document.getElementById('rds_popup');

  if (!elPp) {

    return;

  }

  if (elPp.style.display == 'none') {

    if (PpOwn == null) {
      return;
    }

    if (mouse_inside(PpOwn)) {

      on_PopUp();

      return;
    }

  } else {

    if (mouse_inside('rds_popup')) {

      return;

    }

    if (PpOwn == null) {

      elPp.style.display ='none;'

      return;

    } else {

      if (mouse_inside(PpOwn) == false) {

        elPp.style.display ='none';

        return;
      }
    }
  }
}

function pp_mOvr(owner) {

  if (PpOwn == owner) {

    return;

  } else {

    elPp = document.getElementById('rds_popup'); if (!elPp) { return;  }

    if (elPp.style.display != 'none') {

      elPp.style.display = 'none';

    }
  }

  if (timerProc != null) {

    clearInterval(timerProc);

  }

  PpOwn = owner;

  timerProc = setInterval("check_popup()", 1000);
}

//******************************************************************************
//
//
//
//******************************************************************************

var OEItm2 = null;

document.onkeydown=pressed;

function getkey(e) {

  if (window.event) {

    return window.event.keyCode;

  } else {

    if (e) {

	  return e.which;
    
	} else {

	  return null;
    }
  }
}


function process_ENTER() {

  el = null;
  
  if (OEItm2) {
    
	el = document.getElementById(OEItm2);
  
  }
  
  if (el) {
    
	el.click();
    
	return false;
  }
 
  // document.forms[0].submit();

  return true;
}

function pressed(e) {
  
  if (navigator.userAgent.indexOf('MSIE') != -1) {
    
	if (getkey(e) == 13) {
    
	  return(process_ENTER());
    
	}
  
  } else { 
	
	if (e.which == 13)  {
      
	  return(process_ENTER());
    
	}
  }
}

//******************************************************************************
//
// rds11FBBanner(...
//
// use:
//
//      SSr, gag & target may be null
//
// site - site name wihout protocol 
//   for instance www.wa-2.yar.ru
// 
// label free label used in your html
//
// gag can be: "88x31","100x60","100x100","110x110","120x60","250x250","310x300","440x60"
//             "620x100", "250x400", "468x50", "660x60"
//
// WARNING this is gag only nothing else!
//
function rds11FBBanner(SSr,site,Label,gag,target) {
  
  cTime  = new Date();
  
  s_call = 'http://www.business.ru/cgi-bin/rds11?usr_data=FBB&count=' + cTime.getSeconds();
  
  if (site != null && Label != null)
    s_call = s_call + '&site=' + site + '&Label=' + Label + '&XFrom=' + site;
  
  if (SSr != null)
    s_call = s_call + '&SSr_master=' + SSr;

  if (gag != null)
    s_call = s_call + '&gag=' + gag;
  
  s_call = s_call + '&CMD=';
  s_img  = s_call + 'bnr_img';
  s_href = s_call + 'bnr_href';

  document.write('<a');
  if (target != null) {
    document.write(' target=\"');
    document.write(target);
    document.write('\"');
  }
  document.write(' href=\"');
  document.write(s_href);
  document.write('\">');
  document.write('<img src=');
  document.write(s_img);
  document.write(' border=0>');
  document.write('</a>');
}