/********************************************************************************************
Vars
********************************************************************************************/
var browserTitle = cakeSafe(document.title);
var browserURL = cakeSafe(String(window.location));
var inviteBG = new Image();
inviteBG.src = 'http://chatadvisors.buffalofulfillment.com/img/invites/';
function cakeSafe(varStr){
regEx=/\//g;
var newString = varStr.replace(regEx,'-');
regEx=/\&\;/g;
newString = newString.replace(regEx,'*amp*');
regEx=/\&/g;
newString = newString.replace(regEx,'*amp*');
return escape(newString);
}
/********************************************************************************************
Cookies
********************************************************************************************/
function setCookie(c_name,value,expiredays){
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
function getCookie(c_name){
if (document.cookie.length>0){
c_start=document.cookie.indexOf(c_name + "=");
if (c_start!=-1){
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if (c_end==-1) c_end=document.cookie.length;
return unescape(document.cookie.substring(c_start,c_end));
}
}else{
return "38.107.191.98";
}
return "";
}
function cookieForURL(varValue){
if (varValue==""){
return "38.107.191.98";
}else{
return varValue;
}
}
function browserTitleForURL(varValue){
if (varValue==""){
return "No Title";
}else{
return varValue;
}
}
function isNew(){
var visitorSession='';
visitorSession=getCookie('sessionID');
if (visitorSession=='' || visitorSession==null){
setCookie('sessionID','p97u4oampqi86d8hj4n40ibo80',1);
return true;
}else{
return false;
}
}
/********************************************************************************************
INVITATIONS
********************************************************************************************/
function invite(varMessage, varStyle, varInviteID, varWebsiteKey, varInviteType, varAdvisorPhoto){
switch(varInviteType){
case "STANDARD":
var newdiv = document.createElement('div');
newdiv.setAttribute('id','chat-invite');
newdiv.innerHTML = '