In js chat. php Chat class initialization,
a probably better handling of quotes in names is this:
this.guest = '<?php echo addslashes($_SESSION['hcl_'.$chatid]['guest']); ?>';
this.operator = '<?php echo addslashes($_SESSION['hcl_'.$chatid]['operator']); ?>';
this.department = '<?php echo addslashes($_SESSION['hcl_'.$chatid]['department']); ?>';
Having quotes in names are problematic everywhere, but it should be handled anyways.