
var hide = false;
var counter = 0;
var cntr = 0;
var reload_cntr = 0;
var justopened;
var _debug;
var _cln_requested = false;
var bProto = false;
//var __mon_img = document.cln_mon_img;
var __mon_img = new Image;
//__mon_img = _mon_img;
//var _img_1px = new Image;
//_img_1px.src = 'http://secure.hostinglivechat.com/lcn/js/1px.gif';
//var _img_1px = new Image;
//_img_1px.src = 'http://secure.hostinglivechat.com/lcn/js/3px.gif';
var mark_yes = false;
var mark_order_id;
var mark_paid;
var mark_sale;
var mark_profit;
var mark_mark;


function _cln_custom_1()
{
 _cln_debug(' _cln_custom_1()');
}

function _cln_custom_2()
{
 _cln_debug(' _cln_custom_2()');
}

function _cln_custom_3()
{
 _cln_debug(' _cln_custom_3()');
}

function _cln_live_engage()
{
 _cln_debug(' _cln_live_engage()');
}
function _cln_live_engage_Proto()
{
 _cln_debug(' _cln_live_engage_Proto()');
}
var arr_lcn_mouse_handler = new Array();
var _lcn_mouse_handler_counter = 0;
function addMouseHandler(x)
{
 arr_lcn_mouse_handler[_lcn_mouse_handler_counter++] = x;
}
function allMouseHandlers(e)
{
 for(i = 0; i < arr_lcn_mouse_handler.length; i++)
 {
  arr_lcn_mouse_handler[i](e);
 }
}
function _cln_setProto(x)
{
 bProto = x;
 if(x)
 {
  _cln_live_engage_Proto();
 }
 else
 {
  _lcn_caption_close_Proto();
 }
}
function _lcn_live_engage_init()
{
 _cln_debug(' _cln_live_engage_init()');
}
function _lcn_live_engage_init_Proto()
{
 _cln_debug(' _cln_live_engage_init_Proto()');
}


function _escape(x)
{
 return escape(x).replace(/\+/g,"%2B");
}

function _cln_debug(x)
{
 return;
}

function _cln_get_cookie(x) 
{ if(document.cookie == '') { return false;  } 
else {var firstChar, lastChar;  var _cookie = document.cookie;
firstChar = _cookie.indexOf(x);
var NN2Hack = firstChar + x.length;
if((firstChar != -1) && (_cookie.charAt(NN2Hack) == '=')) 
{ firstChar += x.length + 1;lastChar = _cookie.indexOf(';', firstChar);
if(lastChar == -1) lastChar = _cookie.length;
//_cln_debug("Cookie: " + x + " " + unescape(_cookie.substring(firstChar, lastChar)));
return unescape(_cookie.substring(firstChar, lastChar));
} else { return false; }}}

function _checknew()
{
 _cln_debug("_checknew() " + __mon_img.complete + " # " + __mon_img.width + ' ' + justopened);
 if(__mon_img.complete)
 {
  _cln_debug('URL _cln_requested = false;');
  __cln_requested = _cln_requested;
  _cln_requested = false;
  if(__cln_requested)
   return __mon_img.width;
  else
  {
   if(__mon_img.width < 10)
    return __mon_img.width;
   else
    return 1;
  }
 }
 return 0;
}

function _cln_track()
{
 var cookie = _cln_get_cookie('lcncom')
 if(!cookie)
 {
  //alert("COOKIES_START: " + document.cookie);
  _newcookie = escape(Math.random().toString().substr(2)+(new Date()).getTime());
  newcookie = "lcncom=" + _newcookie;
  _oldcookie = _cln_get_cookie('lcnone');
  //alert("OC2: " + _oldcookie);
  var expdate = new Date ();
  //alert("DATE1: " + expdate.toGMTString());
  expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000 * 365 * 10));
  //alert("DATE2: " + expdate.toGMTString());
  // // date("D, d m Y H:i:s",time() + 473040000)." GMT"
  if(_oldcookie == '')
  {
   oldcookie = "lcnone=" + escape(_newcookie) + "; expires=" + expdate.toGMTString();
  }
  else
  {
   oldcookie = "lcnone=" + escape(_oldcookie) + "; expires=" + expdate.toGMTString();  
  }
  //alert("OC: " + oldcookie);
  document.cookie = newcookie;
  document.cookie = oldcookie;
  //alert("COOKIES_END: " + document.cookie);
  return _cln_get_cookie('lcncom');
 }
 if(window._cln_track_code)
 {
  _cln_track_code = cookie;
 }
 return cookie;
}

function _cln_chat()
{
 window.open('http://secure.hostinglivechat.com/lcn/js/chatjs.php?track=' + _cln_track() + '&op=&site_id=&name=&email=&skin=&ip=&group=rclients&url=&uid=94548&q=&refer=','_chat_livechatnow','resizable=yes,menubar=no,scrollbars=no,width=458,height=500');
 return false;
}

function _cln_enterchat()
{
 window.open('http://secure.hostinglivechat.com/lcn/js/enterchat.php?track=' + _cln_track() + '&op=&site_id=&name=&email=&skin=&ip=&group=rclients&url=&uid=94548&q=&refer=','_chat_livechatnow','resizable=yes,menubar=no,scrollbars=no,width=458,height=500');
 return false;
}

function _open_livechatnow(track)
{ 
 window.open('http://secure.hostinglivechat.com/lcn/js/enter.php?url=&refer=&site_id=&name=&email=&skin=&user=&uid=94548&sid=&op=&ip=&group=rclients&q=&track='+track,'_chat_livechatnow','resizable=yes, menubar=no, scrollbars=no, width=458, height=500');
 return false;
}
function _cln_enter()
{
 return _open_livechatnow(_cln_track());
}
function _lcn_mark(order_id,paid,sale,profit,mark)
{
 mark_yes = true;
 mark_order_id = order_id;
 mark_paid = paid;
 mark_sale = sale;
 mark_profit = profit;
 mark_mark = mark;
}
function _lcn_reload(x)
{
 _cln_reload(x);
}
function _cln_reload(x)
{
 if(_cln_get_cookie('clnaction') == 'hide')
 {
  hide = true;
 }
 var _track = _cln_track();
 var _track_cube = _cln_get_cookie('lcnone');
 if(cntr == 0)
 {
  _lcn_live_engage_init();
  _lcn_live_engage_init_Proto();
 }
 if(x > 0)
 {
  if(hide)
  {
   document.write("<img src='http://secure.hostinglivechat.com/lcn/img/img.php?site_id=&img=url=&t=" + (new Date()).getTime() + "' border=0><br>");
  }
  else
  {
   if(x == 1)
   {
    s_func = '_open_livechatnow("' + _track + '");';
   }
   else if(x == 2)
   {
    s_func = '_cln_chat();';
   }
   else if(x == 3)
   {
    s_func = '_cln_enterchat();';
   }
  document.write("<a href='http://www.livechatnow.com/' onclick='" + s_func + " return false;';><img src='http://secure.hostinglivechat.com/lcn/img/img.php?site_id=&img=url=&t=" + (new Date()).getTime() + "' border=0></a><br>");
  }
 }
 var i = 0;
 i = _checknew();
  _cln_debug("### " + " counter: " + counter + " track: " + _track + " i: <b>" + i + "</b> realod_cntr: " + reload_cntr);
 if((_track != "") && (counter == 0 || reload_cntr > 15))
 {
  if(cntr == 0)
  {
   _file = '0';
  }
  else
  {
   _file = '';
  }
  var mark_s = '';
  if(mark_yes)
  {
   mark_s += "&order_id=" + escape(mark_order_id);
   mark_s += "&paid=" + escape(mark_paid);
   mark_s += "&sale=" + escape(mark_sale);
   mark_s += "&profit=" + escape(mark_profit);
   mark_s += "&mark=" + escape(mark_mark);
  }
  var url = 'http://secure.hostinglivechat.com/lcn/js/imgjs_mon' + _file + '.php?track=' + escape(_track) + '&track_cube=' + escape(_track_cube) + '&ip=&site_id=&url='  + _escape(document.location) + '&refer='  + _escape(document.referrer) + '&group=rclients&uid=94548&name=&email=&sid=&agent=CCBot%2F1.0+%28%2Bhttp%3A%2F%2Fwww.commoncrawl.org%2Fbot.html%29&le=&proto=' + (bProto ? '1' : '0') + '&cntr=' + cntr + '&time=' + escape((new Date()).getTime()) + mark_s;
  _cln_debug("<i><font color=#0000FF>"+url+"</font></i>");
  if(!hide)
  {
   _cln_debug('URL _cln_requested = true;');
   _cln_requested = true;
   __mon_img.src = url;
  }
  reload_cntr = 0;
 }
 // Debug
 counter++;
 cntr++;
 counter %= 5;
 var s;
 if(i == 3)
 {
  if(!justopened)
  {
   _cln_chat();
   justopened = true;
  }
 }
 else  if(i == 4)
 {
  //if(!justopened)
  {
   _cln_live_engage();
  }
 }
 else  if(i == 5)
 {
  //if(!justopened)
  {
   _cln_setProto(true);
   //_cln_live_engage_Proto();
  }
 }
 else  if(i == 6)
 {
  _cln_setProto(false);
 }
 else  if(i >= 10)
 {
  eval("_cln_custom_" + (i - 9) + "();");
 }
 else
 {
  justopened = false;
 }
 var k = 1;
 if(cntr > 300)
 {
  k = 5;
 }
 
 if(cntr < 600 && !hide && x >= 0)
 {
  if(i == 0 || i == null)
  {
   counter = 1;
   reload_cntr++;
   setTimeout("_cln_reload(0)", 1000 * k);
  }
  else
  {
   if(i > 1)
   {
    counter = 0;
   }
   //_cln_debug('setTimeout ' + i + ' ' + (1000 * k));
   setTimeout("_cln_reload(0)", 1000 * k);
  }
 }
}


