






window.onscroll = bt_onScroll;
function bt_onScroll() {
  if(!document.bt_document_relative && bt_animation_box_sty) {
    bt_animation_box_sty.top = bt_top(bt_currentY) + 'px';
    bt_animation_box_sty.left = bt_left(bt_currentX) + 'px';
  }
}
var bt_doc_width, bt_doc_height;
if (document.body && document.body.clientWidth) { bt_doc_width = document.body.clientWidth; bt_doc_height = document.body.clientHeight; }
else if (window.outerWidth) { bt_doc_width = window.outerWidth; bt_doc_height = window.outerHeight; }
else { bt_doc_width = 800; bt_doc_height = 600; }
var bt_doc_x_top;
var bt_currentX;
var bt_currentY;
var bt_opacity;
var bt_x_animation_step;
var bt_x_animation_every;
var bt_x_increment_saved;
var bt_x_increment;
var bt_timer = null;
function bt_hideAnimation() {
  bt_hideAnimationImpl(1);
}
var bt_rpc_img = new Image();
function bt_hideAnimationImpl(a_adi) {
   bt_animation_box_sty.display = 'none';
   if(bt_timer != null) clearTimeout(bt_timer);
   bt_timer = null;
   if(document.bt_invitation_id != ''){
     var bt_rpc_url = 'http://rpc.boldchat.com/aid/5719737970068878639/bc.irpc/BoldchatServer?m=inviteStatus&p0=5719737970068878639';
     bt_rpc_url += ('&p1=' + document.bt_invitation_id);
     bt_rpc_url += ('&p2=' + (document.bt_auto_invite ? '1' : '0'));
     bt_rpc_url += ('&p3=' + a_adi);
     bt_rpc_url += ('&kill=' + (new Date()).getTime());
     bt_rpc_img.src = bt_rpc_url;
  }
}
function bt_animationStep(){
  if(bt_animation_box_sty.display == 'none') {
      return;
  }
  newX = bt_currentX + bt_x_increment;
  if (bt_x_increment > 0) {
      if (newX < bt_doc_x_top) {
          bt_currentX = newX;
          bt_animation_box_sty.left = bt_left(bt_currentX)+'px';
          setTimeout('bt_animationStep()', bt_x_animation_every);
      } else {
          if(document.bt_animation_type==1) {
            bt_timer = setTimeout('bt_hideAnimationImpl(2)', 3000);
          } else {
            bt_x_increment_saved = -bt_x_increment_saved;
            bt_x_increment = bt_x_increment_saved;
            setTimeout('bt_animationStep()', bt_x_animation_every);
          }
      }
  } else if (bt_x_increment < 0) {
      if (bt_currentX > 0) {
          bt_currentX = newX;
          bt_animation_box_sty.left = bt_left(bt_currentX)+'px';
          setTimeout('bt_animationStep()', bt_x_animation_every);
      } else {
          if(document.bt_animation_type==1) {
            bt_x_increment_saved = -bt_x_increment_saved;
            bt_x_increment = bt_x_increment_saved;
            setTimeout('bt_animationStep()', bt_x_animation_every);
          } else {
            bt_timer = setTimeout('bt_hideAnimationImpl(2)', 3000);
          }
      }
  } else {
      if(bt_x_increment_saved == 0) {
          bt_timer = setTimeout('bt_hideAnimationImpl(2)', document.bt_animation_time);
      } else {
          setTimeout('bt_animationStep()', 1000);
      }
  }
}
function bt_inviteCallback() {
    if(document.bt_standardizes_html && document.documentElement) {
        bt_doc_width = document.documentElement.clientWidth;
        bt_doc_height = document.documentElement.clientHeight;
    }
   var bt_animation_div = document.bt_invite_div;
   bt_animation_box_sty = bt_animation_div.style;
   var bt_box_width_text = bt_animation_div.style.width;
   var bt_box_height_text = bt_animation_div.style.height;
   var bt_box_width = parseInt(bt_box_width_text);
   var bt_box_height = parseInt(bt_box_height_text);
   bt_doc_x_top = bt_doc_width - bt_box_width;
   bt_x_animation_every = Math.round(0.99 * (document.bt_animation_time / (bt_doc_x_top * 2)));
   bt_x_animation_step = ((document.bt_animation_type == 1) ? -1 : ((document.bt_animation_type == 0) ? 1 : 0));
   if(bt_x_animation_step != 0) {
     if (bt_x_animation_every < 10) {
        bt_x_animation_every = 10;
        var bt_num_steps = document.bt_animation_time / bt_x_animation_every;
        bt_x_animation_step = Math.round((bt_doc_x_top * 2) / bt_num_steps);
      }
   }
   bt_x_increment_saved = bt_x_animation_step;
   bt_x_increment = bt_x_increment_saved;
   if(document.bt_document_relative) {
     if(document.bt_vertical_align == 0) {
        bt_currentY = document.bt_vertical_offset;
     } else if (document.bt_vertical_align == 1) {
        var bt_new_top = (bt_doc_height / 2) - (bt_box_height / 2) + document.bt_vertical_offset;
        bt_currentY = bt_new_top;
     } else if (document.bt_vertical_align == 2) {
        bt_currentY = bt_doc_height - document.bt_vertical_offset - bt_box_height;
     }
     if(document.bt_horizontal_align == 0) {
        bt_currentX = document.bt_horizontal_offset;
     } else if (document.bt_horizontal_align == 1) {
        var bt_new_left = (bt_doc_width / 2) - (bt_box_width / 2) + document.bt_horizontal_offset;
        bt_currentX = bt_new_left;
     } else if (document.bt_horizontal_align == 2) {
        bt_currentX = bt_doc_width - document.bt_horizontal_offset - bt_box_width;
     }
   } else {
     bt_currentX = (bt_doc_width - bt_box_width) * document.bt_horizontal_offset / 100.0;
     bt_currentY = (bt_doc_height - bt_box_height) * document.bt_vertical_offset / 100.0;
   }
    bt_animation_box_sty.zIndex = 3141592;
    bt_animation_box_sty.position = 'absolute';
    bt_animation_box_sty.top = bt_top(bt_currentY) + 'px';
    bt_animation_box_sty.left = bt_left(bt_currentX) + 'px';
    if(document.bt_animation_type == 3) {
      bt_opacity = 5;
      bt_animation_box_sty.opacity = '' + (bt_opacity / 100.0);
      var bt_new_filter = 'alpha(opacity=' + bt_opacity + ')';
      bt_animation_box_sty.filter = bt_new_filter;
      setTimeout('bt_fadingStep()', 100);
      bt_animation_box_sty.display = 'block';
    } else {
      bt_animation_box_sty.opacity = 100;
      bt_animation_box_sty.filter = 'alpha(opacity=100)';
      bt_animation_box_sty.display = 'block';
      setTimeout('bt_animationStep()', 5000);
    }
}
function bt_left(a_in_doc) {
   if(document.bt_document_relative) {
       return a_in_doc;
   }
   var bt_body;
   if(document.bt_standardizes_html) bt_body = document.documentElement;
   else bt_body = document.body;
   if(bt_body == null) return a_in_doc;
   return bt_body.scrollLeft + a_in_doc;
}
function bt_top(a_in_doc) {
   if(document.bt_document_relative) {
       return a_in_doc;
   }
   var bt_body;
   if(document.bt_standardizes_html) bt_body = document.documentElement;
   else bt_body = document.body;
   if(bt_body == null) return a_in_doc;
   return bt_body.scrollTop + a_in_doc;
}
function bt_fadingStep() {
    bt_opacity += 5;
    if(bt_opacity >= 100) bt_opacity = 99;
    bt_animation_box_sty.opacity = bt_opacity / 100.0;
    var bt_new_filter = 'alpha(opacity=' + bt_opacity + ')';
    bt_animation_box_sty.filter = bt_new_filter;
    if(bt_opacity < 99) {
        setTimeout('bt_fadingStep()', 100);
    } else {
        bt_timer = setTimeout('bt_hideAnimationImpl(2)', document.bt_animation_time);
    }
}
function bt_isBlank(a_text) {
    return (a_text == null || a_text == '');
}
function bt_utf8(wide) {
  var c, s;
  var enc = '';
  var i = 0;
  while(i < wide.length) {
    c= wide.charCodeAt(i++);
    if (c>=0xDC00 && c<0xE000) continue;
    if (c>=0xD800 && c<0xDC00) {
      if (i>=wide.length) continue;
      s= wide.charCodeAt(i++);
      if (s<0xDC00 || c>=0xDE00) continue;
      c= ((c-0xD800)<<10)+(s-0xDC00)+0x10000;
    }
    if (c<0x80) enc += String.fromCharCode(c);
    else if (c<0x800) enc += String.fromCharCode(0xC0+(c>>6),0x80+(c&0x3F));
    else if (c<0x10000) enc += String.fromCharCode(0xE0+(c>>12),0x80+(c>>6&0x3F),0x80+(c&0x3F));
    else enc += String.fromCharCode(0xF0+(c>>18),0x80+(c>>12&0x3F),0x80+(c>>6&0x3F),0x80+(c&0x3F));
  }
  return enc;
}
function bt_openChat(a_key_message,a_initial_question,a_name,a_email) {
    var bt_chat_url = 'http://livechat.boldchat.com/aid/5719737970068878639/bc.chat?cwdid=1541338646616992327&s=&ct=4';
    bt_chat_url = bt_chat_url + (document.bt_operator_id == null ? '' : '&aoid=' + document.bt_operator_id);
    bt_chat_url = bt_chat_url + (bt_isBlank(a_initial_question) ? '' : '&iq=' + escape(bt_utf8(a_initial_question))) + (bt_isBlank(a_name) ? '' : '&vn=' + escape(bt_utf8(a_name))) + (bt_isBlank(a_email) ? '' : '&ve=' + escape(a_email));
    bt_chat_url = bt_chat_url + (bt_isBlank(a_key_message) ? '' : '&km=' + escape(bt_utf8(a_key_message)));
    bt_chat_url = bt_chat_url + '&url=' + escape(document.location.href);
    window.open(bt_chat_url, 'Chat6486160053956714344', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=640,height=480');
    bt_hideAnimationImpl(0);
    return false;
}
function bt_pause() {
    bt_x_increment = 0;
}
function bt_resume() {
    bt_x_increment = bt_x_increment_saved;
}
if(!document.bt_invite_div){
  var div = document.createElement('div');
  div.setAttribute('id', 'bt_invite_box');
  div.setAttribute('name', 'bt_invite_box');
  div.setAttribute('style', 'display: none');
  if(document.body && document.body.firstChild) document.body.insertBefore(div, document.body.firstChild);
  document.bt_invite_div = div;
}
var bt_invite_div = document.bt_invite_div;
bt_invite_div.style.width = '300px';
bt_invite_div.style.height = '200px';
var bt_invite_div_html = '<div id=\"bt_chat_like_form\" style=\"position: static; border-style:solid;border-width:1px;background-color:#F0F0F0\" onMouseOver=\"bt_pause();\" onMouseOut=\"bt_resume();\">\n<img src=\"http://images.boldchat.com/ext/images/close_btn.gif\" border=\"0\" onclick=\"bt_hideAnimation();\" style=\"position:absolute;width:12px;height:12px;right:5px;top:5px;\">\n<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n  <tr>\n    <td>\n      <table cellspacing=\"0\" cellpadding=\"4px\" style=\"width: 100%; background-color: #FFFFFF; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: black\">\n      <tr>\n        <td valign=\"bottom\" align=\"left\">\n        <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n        <tr><td><img src=\"http://www.costaricaholidays.co.uk/logo.jpg\"  width=\"117\" height=\"65\" border=\"0\"></td></tr>\n        </table>\n        </td>\n        <td valign=\"bottom\" align=\"right\">\n            <b>&nbsp;</b>\n        </td>\n      </tr>\n      </table>\n    </td>\n  </tr>\n  <tr>\n    <td valign=\"top\" align=\"left\">\n      <table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"margin: 0px; padding: 10px\">\n        <tr>\n          <td align=\"left\" valign=\"top\">\n            <table cellpadding=\"2px\" cellspacing=\"0px\" border=\"0\">\n            <tr>\n            <td valign=\"top\" >\n              <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n              <tr>\n                \n                \n                \n                <td valign=\"top\" width=\"261px\">\n                <div style=\"position: static; font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; color: black; border-color: #C0C0C0; border-style: solid; border-width: 1px; padding: 5px; width: 100%; height: 100%; overflow: auto\">\n                <div style=\"position: static; width:261px;height:38px\">\n                   <strong>[Fiona]</strong> Hello, Do you have any questions about Costa Rica?\n                </div>\n                </div>\n                </td>\n                \n              </tr>\n            </table>\n            </td>\n            </tr>\n            <tr>\n              <td valign=\"bottom\">\n                <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"274px\">\n                    <tr>\n                       <td align=\"left\" style=\"width:75%\">\n                            \n                            <textarea id=\"bt_chat_input\" rows=\"1\" cols=\"40\" style=\"font-family:verdana;font-size:12px;border-color:#C0C0C0;border-style:solid;border-width:1px;padding:5px;color:black;width:100%;;height:31px\" onkeypress=\"var bt_key_code = event.which ? event.which : event.keyCode ? event.keyCode : 0; if(bt_key_code==13 && !event.shiftKey) { bt_openChat(\'Hello, Do you have any questions about Costa Rica?\',document.getElementById(\'bt_chat_input\').value,\'\',\'\'); };\"></textarea>\n                       </td>\n                       \n                       <td align=\"right\">\n                            &nbsp;<input type=\"submit\" value=\"Send\" onClick=\"bt_openChat(\'Hello, Do you have any questions about Costa Rica?\',document.getElementById(\'bt_chat_input\').value,\'\',\'\');\">\n                       </td>\n                    </tr>\n                 </table>\n              </td>\n            </tr>    \n            </table>\n          </td>\n        </tr>\n      </table>\n    </td>\n  </tr>\n</table>\n</div>';
if(navigator.userAgent.indexOf('MSIE') != -1)
  bt_invite_div_html += '<bgsound src="http://images.boldchat.com/ext/sounds/default_invite.wav">';
else
  bt_invite_div_html += '<div style="position: static; width: 0px; height: 0px"><embed type="audio/mpeg" src="http://images.boldchat.com/ext/sounds/default_invite.wav" hidden="true" loop="false" autostart="true"></div>';
bt_invite_div.innerHTML = bt_invite_div_html;
document.bt_initial_top = 200;
document.bt_animation_type = 3;
document.bt_animation_time = 90000;
document.bt_auto_invite = true;
document.bt_invitation_id = '9223365576350506939';
document.bt_operator_id = '5092895669071522935';
document.bt_vertical_align = 0;
document.bt_horizontal_align = 0;
document.bt_vertical_offset = 10;
document.bt_horizontal_offset = 10;
document.bt_document_relative = 0;
document.bt_standardizes_html = 1;
bt_inviteCallback();



