function DynaScriptTag(url){
this.url = url;
this.userAgent = navigator.userAgent.toLowerCase();
this.browser = {
version: (this.userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
safari: /webkit/.test(this.userAgent),
opera: /opera/.test(this.userAgent),
msie: /msie/.test(this.userAgent) && !/opera/.test(this.userAgent),
mozilla: /mozilla/.test(this.userAgent) && !/(compatible|webkit)/.test(this.userAgent),
konqueror: this.userAgent.match(/konqueror/i)
};
this.send = send;
this.callback = callback;
if (this.browser.safari || this.browser.konqueror) {
_xsajax$node = [];
_xsajax$nodes = 0;
}
}
function send() {
var arg = {
'url': null
};
arg.url = this.url;
this.node = document.createElement('SCRIPT');
this.node.type = 'text/javascript';
this.node.src = arg.url;
var node_helper = null;
if (this.browser.msie) {
function mybind(obj) {
temp = function() {
if (this.readyState == "complete" || this.readyState == "loaded") {
return obj.callback.call(obj);
}
};
return temp;
}
this.node.onreadystatechange = mybind(this);
} else if (this.browser.safari || this.browser.konqueror) {
_xsajax$nodes++;
var helper = 'var ctx = _xsajax$node[' + _xsajax$nodes + '];' + 'ctx.callback.call(ctx.node);' + 'setTimeout(function () {' + ' ctx.node_helper.parentNode.removeChild(ctx.node_helper);' + '}, 100);';
node_helper = document.createElement('SCRIPT');
node_helper.type = 'text/javascript';
node_helper.appendChild(document.createTextNode(helper));
_xsajax$node[_xsajax$nodes] = {
callback: this.callback,
node: this.node,
node_helper: node_helper
};
} else {
this.node.onload = this.callback;
}
var head = document.getElementsByTagName('HEAD')[0];
head.appendChild(this.node);
if (node_helper !== null) {
setTimeout(function() {
var head = document.getElementsByTagName('HEAD')[0];
head.appendChild(node_helper);
}, 100);
}
}
function callback() {
}
/*
* $RCSfile: common.js,v $
* $Revision: 1.1 $
* $Date: 2008/03/31 21:03:43 $
*
* Copyright (C) 2003 Jive Software. All rights reserved.
*
* This software is the proprietary information of Jive Software. Use is subject to license terms.
*/
// Override the default trim method of String.
String.prototype.trim = function() {
var text = this;
var start = 0;
var end = text.length;
var display = "";
for (var i = 0; i < text.length; i++) {
display += text.charCodeAt(i) + " ";
}
for (var i = 0; i < text.length; i++) {
var code = text.charCodeAt(i);
if (code >= 33) {
start = i;
break;
}
else{
start++;
}
}
for (var i = text.length; i > start; i--) {
var code = text.charCodeAt(i - 1);
if (code >= 33) {
end = i;
break;
}
}
return text.substring(start, end);
}
// variable to tell whether or not a form has been clicked
var clicked = false;
function allowClick() {
if (! clicked) {
clicked = true;
return true;
}
return false;
}
// Sequence for open window names
var windowNameSeq = 0;
// Array of all open windows
var windows = new Array();
// Checks to see if a window exists
function windowExists(name) {
for (var i = 0; i < windows.length; i++) {
// IE needs a try/catch here for to avoid an access violation on windows[i].name
// in some cases.
try {
if (windows[i].name == name) {
return true;
}
}
catch (exception) {
}
}
return false;
}
// Returns the window object - returns nothing if not found.
function getWindow(name) {
for (var i = 0; i < windows.length; i++) {
try {
if (windows[i].name == name) {
return windows[i];
}
}
catch (exception) {
}
}
}
function removeWindow(name) {
for (var i = 0; i < windows.length; i++) {
try {
if (windows[i].name == name) {
windows.splice(i, 1);
return;
}
}
catch (exception) {
}
}
}
// Open a window given its unique name, url, width and height.
function pushWin(name, url, width, height) {
var defaultOptions = "location=yes,status=yes,toolbar=no,personalbar=no,menubar=no,directories=no,";
defaultOptions += "scrollbars=yes,resizable=yes,";
defaultOptions += "width=" + width + ",height=" + height;
launchWinWithOptions(name, url, defaultOptions);
}
// Open a window given its unique name, url, width and height.
function launchWin(name, url, width, height) {
var defaultOptions = "location=no,status=no,toolbar=no,personalbar=no,menubar=no,directories=no,";
var winleft = (screen.width - width) / 2;
var winUp = (screen.height - height) / 2;
defaultOptions += "scrollbars=yes,resizable=yes,top=" + winUp + ",left=" + winleft + ",";
defaultOptions += "width=" + width + ",height=" + height;
launchWinWithOptions(name, url, defaultOptions);
}
// Open a window with given name, url, and options list
function launchWinWithOptions(name, url, options) {
if (! windowExists(name)) {
var winVar = window.open(url, name, options);
windows[windows.length] = winVar;
return winVar;
}
else{
var theWin = getWindow(name);
theWin.focus();
}
}
function getTopLevelWindow() {
var win = window;
if (win.parent == win) {
return win;
}
while (win.parent != win) {
win = window.parent.window;
}
return win;
}
// Close the current window object
function closeWin(win) {
win.close();
}
// Handle closing of the current window
function handleClose(message) {
if (confirm(message)) {
removeWindow(getTopLevelWindow().name);
closeWin(getTopLevelWindow());
return true;
}
else{
return false;
}
}
// Handle closing of the current window
function confirmCancel(message) {
if (confirm(message)) {
getTopLevelWindow().location.href = 'userinfo.jsp';
return true;
}
else{
return false;
}
}
function cancelQueue(workgroup, chatID){
getTopLevelWindow().location.href = 'userinfo.jsp?workgroup=' + workgroup +'&chatID='+chatID;
return true;
}
function confirmCancelAndClose(message) {
if (confirm(message)) {
getTopLevelWindow().location.href = 'userinfo.jsp';
getTopLevelWindow().close();
return true;
}
else{
return false;
}
}
// Handle closing of the current window
function confirmCancel(message, workgroup, chatID) {
if (confirm(message)) {
getTopLevelWindow().location.href = 'userinfo.jsp?workgroup=' + workgroup +'&chatID='+chatID;
return true;
}
else{
return false;
}
}
function closeAll() {
removeWindow(getTopLevelWindow().name);
closeWin(getTopLevelWindow());
}
// Opens the help window:
function launchHelpWin() {
var win = launchWin('helpwin', 'helpwin.jsp', 550, 350);
}
// Hide a DIV
function hide(divId) {
if (document.layers) {
document.layers[divId].visibility = 'hide';
}
else if (document.all) {
document.all[divId].style.visibility = 'hidden';
}
else if (document.getElementById) {
document.getElementById(divId).style.visibility = 'hidden';
}
}
// Show a DIV
function show(divId) {
if (document.layers) {
document.layers[divId].visibility = 'show';
}
else if (document.all) {
document.all[divId].style.visibility = 'visible';
}
else if (document.getElementById) {
document.getElementById(divId).style.visibility = 'visible';
}
}
function getDiv(divID) {
if (document.layers) {
return document.layers[divID];
}
else if (document.all) {
return document.all[divID];
}
else if (document.getElementById) {
return document.getElementById(divID);
}
}
function getDivByDoc(divID, doc) {
if (doc.layers) {
return doc.layers[divID];
}
else if (doc.all) {
return doc.all[divID];
}
else if (doc.getElementById) {
return doc.getElementById(divID);
}
}
// TODO
function showTypingIndicator(flag) {
if (flag) {
// put the text in the div
}
else{
// blank out the div
}
}
function informConnectionClosed() {
alert('Your support session has ended, you will be redirected to the transcript page.');
parent.location.href = 'transcriptmain.jsp';
}
function addChatText(yakWin, from, text) {
// The div to write to:
var yakDiv = yakWin.document.getElementById('ytext');
// This will be an announcement if there is no from passed in
var isAnnouncement = (from == "");
// Create a new span node in the yakDiv. Record the num of nodes right now - used later
// to see if the node was really added:
var numChildren = yakDiv.childNodes.length;
var nameSpan = document.createElement("span");
var textSpan = document.createElement("span");
if (isAnnouncement) {
nameSpan.setAttribute("class", "chat-announcement");
textSpan.setAttribute("class", "chat-announcement");
}
else{
textSpan.setAttribute("class", "text");
}
// add another span containing the username if this is not an announcement:
var fromIsCurrentUser = false;
if (! isAnnouncement) {
// is the from the same as the current user?
fromIsCurrentUser = (nickname == from);
if (fromIsCurrentUser) {
nameSpan.setAttribute("class", "client-name");
}
else{
nameSpan.setAttribute("class", "operator-name");
}
}
var chatLineDiv = document.createElement("div");
chatLineDiv.setAttribute("class", "chat-line");
var appendFailed = false;
try {
if (! isAnnouncement) {
nameSpan.innerHTML = from + ": ";
chatLineDiv.appendChild(nameSpan);
}
textSpan.innerHTML = text;
chatLineDiv.appendChild(textSpan);
yakDiv.appendChild(chatLineDiv);
}
catch (exception) {
appendFailed = true;
}
if (! appendFailed) {
// Make sure the browser appended:
appendFailed = (numChildren == yakDiv.childNodes.length);
}
if (appendFailed) {
var inn = yakDiv.innerHTML;
inn += "
";
if (! isAnnouncement) {
inn += "" + from + ": ";
// yakDiv.innerHTML = inn;
}
// var inn = yakDiv.innerHTML;
inn += "" : "chat_text\">");
inn += text + "
";
yakDiv.innerHTML = inn;
}
else{
// yakDiv.appendChild(document.createElement("br"));
}
}
function scrollYakToEnd(yakWin) {
var endDiv = yakWin.document.getElementById('enddiv');
yakWin.scrollTo(0, endDiv.offsetTop);
}
function showChatButton(workgroup) {
var d = new Date();
var v1 = d.getSeconds() + '' + d.getDay();
var img = "//a248.e.akamai.net/f/248/47542/30d/www.ibm.com/i/v14/buttons/chat_rd.gif";
var gotoURL = "https://www-304.ibm.com/partnerworld/wps/servlet/chat/start.jsp?workgroup=" + workgroup + "&location=" + window.location.href;
document.write("");
document.write("");
document.write(
" ");
document.write(" | ");
document.write(
" Online text chat");
document.write(" |
");
}
function showChatLink(workgroup, title) {
var d = new Date();
var v1 = d.getSeconds() + '' + d.getDay();
var gotoURL = "https://www-304.ibm.com/partnerworld/wps/servlet/chat/start.jsp?workgroup=" + workgroup + "&location=" + window.location.href;
document.write("" + title + "");
}
function showChatButtonWithAgent(workgroup, agent) {
var d = new Date();
var v1 = d.getSeconds() + '' + d.getDay();
var img = "https://www-304.ibm.com/partnerworld/wps/servlet/chat/live?action=isAvailable&workgroup=" + workgroup;
var gotoURL = "https://www-304.ibm.com/partnerworld/wps/servlet/chat/start.jsp?workgroup=" + workgroup + "&agent=" + agent + "&location=" + window.location.href;
document.write("
");
}
function showButtonWithoutUI(workgroup, params){
var d = new Date();
var v1 = d.getSeconds() + '' + d.getDay();
var img = "https://a248.e.akamai.net/f/248/47542/30d/www.ibm.com/i/v14/buttons/chat_rd.gif";
var gotoURL = "https://www-304.ibm.com/partnerworld/wps/servlet/chat/start.jsp?workgroup=" + workgroup + "&noUI=true&"+params + "&location=" + window.location.href;
document.write("");
document.write("");
document.write(
" ");
document.write(" | ");
document.write(
" Online text chat");
document.write(" |
");
}
function everestCallout(key,text,image,url,type) {
this.key = key;
this.text = text;
this.image = image;
this.url = url;
this.type = type;
}
function vlpCallout(key,text,image,url,type) {
this.key = key;
this.text = text;
this.image = image;
this.url = url;
this.type = type;
}
function vicCallout(key,text,image,url,type) {
this.key = key;
this.text = text;
this.image = image;
this.url = url;
this.type = type;
}
function renderEntitledChat(div_id, link_only, workgroup, origin){
}
function entitledChat(div_id, link_only, workgroup, origin, isOnline) {
var d = new Date();
var v1 = d.getSeconds() + '' + d.getDay();
var img = "//a248.e.akamai.net/f/248/47542/30d/www.ibm.com/i/v14/buttons/chat_rd.gif";
var gotoURL = "https://www-304.ibm.com/partnerworld/wps/servlet/chat/start.jsp?workgroup=" + workgroup +"&origin=" + origin+"&noUI=false&email=&question=&language=en" ;
// find the div
var div = document.getElementById( div_id );
if( div ){
//construct the HTML for either the link or the box.
if( link_only ){
content = "";
}
else{
if (isOnline == "false") {
content = "We're here to help

Easy ways to get the answers you need.
";
} else {
content = "We're here to help

Easy ways to get the answers you need.
";
}
}
//put the html into the div.
div.innerHTML = content;
}
}
function renderEverestChat(div_id, version, everestContents, locale){
var div = document.getElementById( div_id );
var url = "https://www-304.ibm.com/partnerworld/wps/servlet/chat/JSONServlet?command=everestChat&id=Unauthenticated&locale=US";
var xhr=new DynaScriptTag(url);
xhr.callback=function()
{
everestChat(div_id, version, everestContents, locale, Result.workgroupName, Result.online , Result.origin, 'en_US');
}
xhr.send();
}
function everestChat(div_id, version, everestContents,locale, workgroup, isOnline, origin, computedLocale) {
if (version == "v16" && (everestContents == "undefined" || everestContents == null))
{
if (workgroup != "null") {
if (isOnline == "false") {
content = "We're here to help
Live Chat is currently unavailable
The live chat service is normally available weekdays 8am-8pm Eastern Time. Use the \"Contact us\" link or one of the other links for help now.
";
}//end if (isOnline == "false")
else if (isOnline == "true") {
gotoURL = "https://www-304.ibm.com/partnerworld/wps/servlet/chat/start.jsp?workgroup=" + workgroup +"&origin=" + origin+"&invoker=" + window.location.href;
content = "";
} //end if (isOnline == "true")
} //end if (workgroup != null)
else {
content = "";
} //else if workgroup is null
} // end if (version == "v16")
else if (version == "v15" && (everestContents == "undefined" || everestContents == null)) {
if (workgroup != "null") {
if (isOnline == "false") {
content = "";
} // end if (isOnline == "false")
else if (isOnline == "true") {
gotoURL = "https://www-304.ibm.com/partnerworld/wps/servlet/chat/start.jsp?workgroup=" + workgroup +"&origin=" + origin+"&invoker=" + window.location.href;
content="";
}// end if (isOnline == "true")
}//end if (workgroup != "null")
else {
content = "";
}
} //end if (version == "v15")
if (version == "v16" && everestContents != "undefined" && everestContents != null )
{
var i=0;
chat_needed = "false";
optionalRendered = "false";
for (i=0; i"+title+"
";
}//end if (isOnline == "false")
else if (isOnline == "true") {
gotoURL = "https://www-304.ibm.com/partnerworld/wps/servlet/chat/start.jsp?workgroup=" + workgroup +"&origin=" + origin+"&invoker=" + window.location.href;
content = "";
} //end if (isOnline == "true")
} //end if (workgroup != null)
else {
content = "";
} //else if workgroup is null
} // end if (version == "v16")
else if (version == "v15" && everestContents != "undefined" && everestContents != null) {
var i=0;
optionalRendered = "false";
chat_needed = "false";
for (i=0; i ";
} // end if (isOnline == "false")
else if (isOnline == "true") {
gotoURL = "https://www-304.ibm.com/partnerworld/wps/servlet/chat/start.jsp?workgroup=" + workgroup +"&origin=" + origin+"&invoker=" + window.location.href;
content=" ";
}// end if (isOnline == "true")
}//end if (workgroup != "null")
else {
content = " ";
} //end else
} //end if (version == "v15")
var div = document.getElementById( div_id );
if( div ){
//put the html into the div.
div.innerHTML = content;
}
}
function renderVlpChat(div_id, origin, vlpcontents){
var url = "https://www-304.ibm.com/partnerworld/wps/servlet/chat/JSONServlet?command=vlpChat&id=Unauthenticated";
var xhr=new DynaScriptTag(url);
xhr.callback = function(){
vlpChat(div_id, origin, vlpcontents, Result.workgroupName, Result.online);
}
xhr.send();
}
function vlpChat(div_id, origin, vlpcontents, workgroup, isOnline) {
content = "";
var div = document.getElementById( div_id );
if( div ){
//put the html into the div.
div.innerHTML = content;
}
}
function renderVICBluChat(div_id, version, everestContents, locale){
var div = document.getElementById( div_id );
var url = "https://www-304.ibm.com/partnerworld/wps/servlet/chat/JSONServlet?command=vicBluChat&id=Unauthenticated";
var xhr=new DynaScriptTag(url);
xhr.callback = function(){
VICBluChat(div_id, version, everestContents, locale, Result.workgroupName, Result.online , Result.origin);
}
xhr.send();
}
function VICBluChat(div_id, version, everestContents,locale, workgroup, isOnline, origin) {
if (version == "v16" && (vicContents == "undefined" || vicContents == null)) {
if (workgroup != "null") {
if (isOnline == "false") {
content = "We're here to helpLive Chat is currently unavailable The live chat service is normally available weekdays 8am-8pm Eastern Time. Use the \"Contact us\" link or one of the other links for help now. ";
}//end if (isOnline == "false")
else if (isOnline == "true") {
gotoURL = "https://www-304.ibm.com/partnerworld/wps/servlet/chat/start.jsp?workgroup=" + workgroup +"&origin=" + origin+"&invoker=" + window.location.href;
content = "";
} //end if (isOnline == "true")
} //end if (workgroup != null)
else {
content = "";
} //else if workgroup is null
} // end if (version == "v16")
else if (version == "v15" && (vicContents == "undefined" || vicContents == null)) {
if (workgroup != "null") {
if (isOnline == "false") {
content = "";
} // end if (isOnline == "false")
else if (isOnline == "true") {
gotoURL = "https://www-304.ibm.com/partnerworld/wps/servlet/chat/start.jsp?workgroup=" + workgroup +"&origin=" + origin+"&invoker=" + window.location.href;
content="";
}// end if (isOnline == "true")
}//end if (workgroup != "null")
else {
content = "";
}
} //end if (version == "v15")
if (version == "v16" && vicContents != "undefined" && vicContents != null ) {
var i=0;
chat_needed = "true";
optionalRendered = "false";
for (i=0; i"+title+""+offline+" ";
for (i=5; i
";
optionalRendered = "true";
} // end if
content=content+"- "+vicContent.text +"
";
} // end for i
content=content+" ";
}//end if (isOnline == "false")
else if (isOnline == "true") {
gotoURL = "https://www-304.ibm.com/partnerworld/wps/servlet/chat/start.jsp?workgroup=" + workgroup +"&origin=" + origin+"&invoker=" + window.location.href;
content = "";
} //end if (isOnline == "true")
} //end if (workgroup != null)
else {
content = ""+title+"";
for (i=5; i
";
optionalRendered = "true";
} // end if
content=content+"- "+vicContent.text +"
";
} //end for i
content=content+" ";
} //else if workgroup is null
} // end if (version == "v16")
else if (version == "v15" && vicContents != "undefined" && vicContents != null) {
var i=0;
optionalRendered = "false";
chat_needed = "true";
for (i=0; i | ";
} // end if (isOnline == "false")
else if (isOnline == "true") {
gotoURL = "https://www-304.ibm.com/partnerworld/wps/servlet/chat/start.jsp?workgroup=" + workgroup +"&origin=" + origin+"&invoker=" + window.location.href;
content=" ";
}// end if (isOnline == "true")
}//end if (workgroup != "null")
else {
content = " | ";
} //end else
} //end if (version == "v15")
var div = document.getElementById( div_id );
if( div ){
//put the html into the div.
div.innerHTML = content;
}
}
|
|
|
|
|