// Live Help Server Version: 3.95 Rev. 3 // Database Version: 3.90 // stardevelop.com Live Help International Copyright 2003 var LiveHelp = function() { var server = 'http://soporte.haztutienda.com'; var domain = '.haztutienda.com'; var pages = '0'; var LiveHelpXMLHTTP = null; var statusImagesLiveHelp = new Array(); var currentStatus = ''; var posLeft = (screen.width - 625) / 2; var posTop = (screen.height - 435) / 2; var size = 'height=435,width=625,top=' + posTop + ',left=' + posLeft + ',resizable=1,toolbar=0,menubar=0'; var ns6 = (!document.all && document.getElementById); var ie4 = (document.all); var ns4 = (document.layers); function currentTime() { var date = new Date(); return date.getTime(); } var initiateOpen = 0; var initiateLoaded = 0; var initiateAuto = 0; var countTracker = 0; var idleTimeout = 90 * 60 * 1000; var timeStart = currentTime(); var timeElapsed; var trackingInitalized = 0; var topMargin = 10; var leftMargin = 10; var hAlign = "right"; var vAlign = "bottom"; var layerHeight = 229; var layerWidth = 323; var browserWidth = 0; var browserHeight = 0; var trackerStatus = new Image; var time = currentTime(); var title = encodeURI(escape(document.title.substring(0, 150))); var localtime = getTimezone(); //alert('Timezone: ' + localtime); var TrackingTimer; var InitiateChatTimer; var referrer = encodeURI(escape(document.referrer)); var url = encodeURI(escape(document.location.href)); var resetTracking = 0; function getTimezone() { var datetime = new Date(); if (datetime) { return datetime.getTimezoneOffset(); } else { return ''; } } function checkXMLHTTP() { obj = null; if (window.XMLHttpRequest) { obj = new XMLHttpRequest(); } else if (window.ActiveXObject) { obj = new ActiveXObject("Microsoft.XMLHTTP") if (!obj) { try { obj = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { obj = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { obj = null; } } } } return obj; } function LoadXMLTracking(initiateResult) { var time = currentTime(); LiveHelpXMLHTTP = checkXMLHTTP(); // Run the XML query if (LiveHelpXMLHTTP.readyState != 0) { LiveHelpXMLHTTP.abort(); } if (typeof initiateResult == 'undefined') { initiateResult = '' } var RequestData = 'JS=1&DEPARTMENT=&INITIATE=' + initiateResult; if (trackingInitalized == 0) { RequestData = 'JS=1&TITLE=' + title + '&URL=' + url + '&REFERRER=' + referrer + '&WIDTH=' + screen.width + '&HEIGHT=' + screen.height + '&DEPARTMENT=&INITIATE=' + initiateResult + '&TIME=' +time; trackingInitalized = 1; } try { LiveHelpXMLHTTP.open('POST', 'http://soporte.haztutienda.com/include/status.php', true); } catch(e) { CancelXMLTracking(initiateResult); return false; } if (LiveHelpXMLHTTP.withCredentials !== undefined) { LiveHelpXMLHTTP.withCredentials = 'true'; } LiveHelpXMLHTTP.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); //LiveHelpXMLHTTP.setRequestHeader("Content-length", RequestData.length); //LiveHelpXMLHTTP.setRequestHeader("Connection", "close"); LiveHelpXMLHTTP.onreadystatechange = function() { if (LiveHelpXMLHTTP.readyState == 4) { // Process response as JavaScript if (LiveHelpXMLHTTP.status == 200) { eval(LiveHelpXMLHTTP.responseText); } } }; try { LiveHelpXMLHTTP.send(RequestData); } catch(e) { CancelXMLTracking(initiateResult); return false; } timeElapsed = time - timeStart; if (timeElapsed < idleTimeout) { window.clearTimeout(TrackingTimer); TrackingTimer = window.setTimeout(function(){ LoadXMLTracking(); }, 10000); } } function CancelXMLTracking(initiateResult) { LiveHelpXMLHTTP.abort(); LiveHelpXMLHTTP = null; if (resetTracking == 0) { trackingInitalized = 0; resetTracking = 1; } OnlineTracker(initiateResult); } function findObj(n, d) { var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i this.browserHeight) { this.E = this.Y > 0 ? this.targetY - this.browserHeight : this.targetY + this.browserHeight; this.Y = this.Y > 0 ? this.browserHeight : -this.browserHeight; } else { this.E = this.currentY; } if (Math.abs(this.X) > this.browserWidth) { this.F = this.X > 0 ? this.targetX - this.browserWidth : this.targetX + this.browserWidth; this.X = this.X > 0 ? this.browserWidth : -this.browserWidth; } else { this.F = this.currentX; } } function animate(layer) { var now = new Date(); var newY = this.Y * Math.sin( this.C * ( now.getTime() - this.D ) ) + this.E; var newX = this.X * Math.sin( this.C * ( now.getTime() - this.D ) ) + this.F; newY = Math.round(newY); newX = Math.round(newX); if ((this.Y > 0 && newY > this.currentY) || (this.Y < 0 && newY < this.currentY)) { if (document.getElementById) { document.getElementById(layer).style.top = newY + 'px'; } else if (document.all) { document.all[layer].style.pixelTop = newY + 'px'; } else if (document.layers && document.layers[object] != null) { document.layers[layer].top = newY + 'px'; } } if ((this.X > 0 && newX > this.currentX) || (this.X < 0 && newX < this.currentX)) { if (document.getElementById) { document.getElementById(layer).style.left = newX + 'px'; } else if (document.all) { document.all[layer].style.pixelLeft = newX + 'px'; } else if (document.layers && document.layers[object] != null) { document.layers[layer].left = newX + 'px'; } } } function resetLayerLocation() { var width = 0; var height = 0; if(typeof(window.innerWidth) == 'number') { width = window.innerWidth; height = window.innerHeight; } else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { width = document.documentElement.clientWidth; height = document.documentElement.clientHeight; } else if(document.body && (document.body.clientWidth || document.body.clientHeight)) { width = document.body.clientWidth; height = document.body.clientHeight; } leftMargin = 10; topMargin = 10; browserWidth = width; browserHeight = height; if (hAlign == 'right') { leftMargin = width - leftMargin - layerWidth - 20; } else if (hAlign == 'middle') { leftMargin = Math.round((width - 20) / 2) - Math.round(layerWidth / 2); } if (vAlign == 'bottom') { topMargin = height - topMargin - layerHeight - 45; } else if (vAlign == 'center') { topMargin = Math.round((height - 20) / 2) - Math.round(layerHeight / 2); } } function stopLayer() { window.clearTimeout(InitiateChatTimer); if (initiateOpen == 1) { toggleInitiateChat('floatLayer'); } initiateLoaded = 0; } function resizeEvent(e) { if (!e) e = window.event; resetLayerLocation(); return true; } window.onresize = resizeEvent; function checkInitiate(e) { // Check if site visitor has an Initiate Chat Request Pending for display... if (!e) var e = window.event; var imageWidth = this.width; var imageHeight = this.height; if (imageHeight == 2 || initiateAuto == 1) { displayInitiateChat(); } if (imageWidth == 1) { // Hidden changeStatus('Hidden') } else if (imageWidth == 2) { // Online changeStatus('Online'); } else if (imageWidth == 3) { // Be Right Back changeStatus('BRB'); } else if (imageWidth == 4) { // Away changeStatus('Away'); } return true; } function writeLayer(layer, sText) { if (layer != false) { if (layer.innerHTML == null) { layer.open(); layer.write(sText); layer.close(); return true; } else { layer.innerHTML = sText; return true; } } return false; } function acceptInitiateChat() { if (LiveHelpXMLHTTP != null) { LoadXMLTracking('Accepted'); } else { OnlineTracker('Accepted'); } stopLayer(); } function declineInitiateChat() { if (LiveHelpXMLHTTP != null) { LoadXMLTracking('Declined'); } else { OnlineTracker('Declined'); } stopLayer(); } function displayInitiateChat() { if (initiateOpen == 0 || initiateLoaded == 1) { resetLayerLocation(); var obj; if (document.getElementById) { obj = document.getElementById('floatLayer'); if (obj != null) { obj.style.top = topMargin + 'px'; obj.style.left = leftMargin + 'px'; } } else if (document.all) { obj = document.all['floatLayer']; if (obj != null) { obj.style.pixelTop = topMargin + 'px'; obj.style.pixelLeft = leftMargin + 'px'; } } else if (document.layers) { obj = document.layers['floatLayer']; if (obj != null) { obj.top = topMargin + 'px'; obj.left = leftMargin + 'px'; } } if (obj != null) { var openingTrackerStatus = new Image; openingTrackerStatus.src = 'http://soporte.haztutienda.com/include/tracker.php?INITIATE=Opened'; if (document.getElementById) { document.getElementById('floatLayer').location = 'http://soporte.haztutienda.com/include/tracker.php?INITIATE=Opened'; } else if (document.layers) { document.layers['floatLayer'].location = 'http://soporte.haztutienda.com/include/tracker.php?INITIATE=Opened'; } else if (document.all) { document.all['floatLayer'].location = 'http://soporte.haztutienda.com/include/tracker.php?INITIATE=Opened'; } floatRefresh(); toggleInitiateChat('floatLayer'); initiateOpen = 1; initiateLoaded = 0; initiateAuto = 0; } } } function OnlineTracker(initiateResult) { var time = currentTime(); trackerStatus = new Image; trackerStatus.src = 'http://soporte.haztutienda.com/include/status.php?TRACKER=1&TITLE=' + title + '&URL=' + url + '&REFERRER=' + referrer + '&WIDTH=' + screen.width + '&HEIGHT=' + screen.height + '&TIME=' + time; } LiveHelpXMLHTTP = checkXMLHTTP(); if (LiveHelpXMLHTTP != null) { LoadXMLTracking(); } else { OnlineTracker(); } function strTrim(str) { if (!str || str == '') { return ''; } return str.replace(/^\s+|\s+$/g, ''); } var LiveHelpWindow = ''; var OfflineEmail = -1; function getTxQry(name, value) { if (value == '') { str = '' } value = strTrim(value); if (value != '') { var str = '&' + name + '=' + strTrim(value)} return str; } var transCompleted = 0; function setLiveHelpTrans() { if (transCompleted == 0) { var obj; if (document.getElementById) { obj = document.getElementById('utmtrans'); } else if (document.utmform && document.utmform.utmtrans) { obj = document.utmform.utmtrans; } else { return; } if (obj != null) { obj = strTrim(obj.value); d = obj.split('UTM:'); var str = ''; for (var i=0; i < d.length; i++) { d[i] = strTrim(d[i]); type = d[i].charAt(0); if (type != 'T' && type != 'I') { continue; } if (type == 'T') { t = d[i].split('|'); if (strTrim(t[1]) != '') { str = '?txid=' + strTrim(t[1]); params = new Array('affil', 'total', 'tax', 'ship', 'city', 'state', 'country'); for (var ii = 0; ii < t.length-2; ii++) { str += getTxQry(params[ii], t[ii+2]); } } } else if (type == 'I') { im = d[i].split('|'); if (strTrim(im[1]) != '') { id = 'im[' + (i-1) + ']'; str += '&' + id + '[txid]=' + strTrim(im[1]); params = new Array(id + '[sku]', id + '[name]', id + '[category]', id + '[price]', id + '[qty]'); for (var ii = 0; ii < im.length-2; ii++) { id = ii+2; str += getTxQry(params[ii], im[id]); } } } } image = new Image; image.src = '/include/conversion.php' + str + '&time=' + currentTime(); } transCompleted = 1; } } function setupImages() { statusImagesLiveHelp[statusImagesLiveHelp.length] = findObj('LiveHelpStatus'); statusImagesLiveHelp[statusImagesLiveHelp.length] = findObj('LiveHelpCallback'); } function initaliseLiveHelp() { setLiveHelpTrans(); setupImages(); } if(typeof window.addEventListener != 'undefined') { // Safari, Gecko, Konqueror etc. window.addEventListener('load', initaliseLiveHelp, false); } else if(typeof document.addEventListener != 'undefined') { // Opera 7 document.addEventListener('load', initaliseLiveHelp, false); } else if(typeof window.attachEvent != 'undefined') { // Inernet Explorer window.attachEvent('onload', initaliseLiveHelp); } return { LiveHelpWindow: LiveHelpWindow, OfflineEmail: OfflineEmail, currentStatus: currentStatus, size: size, initiateOpen: initiateOpen, initiateLoaded: initiateLoaded, initiateAuto: initiateAuto, trackingInitalized: trackingInitalized, TrackingTimer: TrackingTimer, topMargin: topMargin, leftMargin: leftMargin, statusImagesLiveHelp: statusImagesLiveHelp, acceptInitiateChat: function () { acceptInitiateChat(); }, declineInitiateChat: function () { declineInitiateChat(); }, currentTime: function () { currentTime(); }, resetLayerLocation: function() { resetLayerLocation(); }, floatRefresh: function() { floatRefresh(); }, toggleInitiateChat: function() { toggleInitiateChat('floatLayer'); }, swapImage: function(a, b, c, d) { swapImage(a, b, c, d); } }; }(); function openLiveHelp(department, location, template) { if (LiveHelp.OfflineEmail == 0 && LiveHelp.currentStatus != 'Online') { return false; } else { if (typeof location == 'undefined' || location == '') { var location = 'index.php'; } if (typeof department == 'undefined' || department == '') { var department = ''; } else { department = '&DEPARTMENT=' + department; } if (typeof template == 'undefined' || template == '') { var template = ''; } else { template = '&TEMPLATE=' + template; } // TODO: Remove All # invalid characters LiveHelp.LiveHelpWindow = window.open('http://soporte.haztutienda.com/' + location + '?LANGUAGE=es' + department + template, 'LiveHelphaztutiendacom', LiveHelp.size); } if (LiveHelp.LiveHelpWindow) { LiveHelp.LiveHelpWindow.opener = self; } } function displayInitiateChat() { if (LiveHelp.initiateOpen == 0 || LiveHelp.initiateLoaded == 1) { LiveHelp.resetLayerLocation(); var obj; if (document.getElementById) { obj = document.getElementById('floatLayer'); if (obj != null) { obj.style.top = LiveHelp.topMargin + 'px'; obj.style.left = LiveHelp.leftMargin + 'px'; } } else if (document.all) { obj = document.all['floatLayer']; if (obj != null) { obj.style.pixelTop = LiveHelp.topMargin + 'px'; obj.style.pixelLeft = LiveHelp.leftMargin + 'px'; } } else if (document.layers) { obj = document.layers['floatLayer']; if (obj != null) { obj.top = LiveHelp.topMargin + 'px'; obj.left = LiveHelp.leftMargin + 'px'; } } if (obj != null) { var openingTrackerStatus = new Image; openingTrackerStatus.src = 'http://soporte.haztutienda.com/include/tracker.php?INITIATE=Opened'; if (document.getElementById) { document.getElementById('floatLayer').location = 'http://soporte.haztutienda.com/include/tracker.php?INITIATE=Opened'; } else if (document.layers) { document.layers['floatLayer'].location = 'http://soporte.haztutienda.com/include/tracker.php?INITIATE=Opened'; } else if (document.all) { document.all['floatLayer'].location = 'http://soporte.haztutienda.com/include/tracker.php?INITIATE=Opened'; } LiveHelp.floatRefresh(); LiveHelp.toggleInitiateChat(); LiveHelp.initiateOpen = 1; LiveHelp.initiateLoaded = 0; LiveHelp.initiateAuto = 0; } } } function acceptInitiateChat() { LiveHelp.acceptInitiateChat(); } function declineInitiateChat() { LiveHelp.declineInitiateChat(); } function changeStatus(status) { var statusImage = new Image; var statusImageFile; switch (status) { case 'Online': statusImageFile = 'http://soporte.haztutienda.com/locale/es/images/Online.png'; break; case 'BRB': statusImageFile = 'http://soporte.haztutienda.com/locale/es/images/BeRightBack.png'; break; case 'Away': statusImageFile = 'http://soporte.haztutienda.com/locale/es/images/Away.png'; break; default: statusImageFile = 'http://soporte.haztutienda.com/locale/es/images/Offline.png'; break; } var time = LiveHelp.currentTime(); if (LiveHelp.currentStatus != '' && LiveHelp.currentStatus != status) { for (i = 0; i < LiveHelp.statusImagesLiveHelp.length; i++) { if (LiveHelp.statusImagesLiveHelp[i] != null) { // Determine if there is an alternate image path find IMAGES= variable within statusImagesLiveHelp[i].src var getImageLocation = LiveHelp.statusImagesLiveHelp[i].src.indexOf('IMAGES='); var getDepartment = LiveHelp.statusImagesLiveHelp[i].src.indexOf('DEPARTMENT='); var getCallback = LiveHelp.statusImagesLiveHelp[i].src.indexOf('CALLBACK='); statusImage.src = statusImageFile; if (getImageLocation != -1) { // Load the IMAGES path into a variable var statusImageDirectory = LiveHelp.statusImagesLiveHelp[i].src.substring(getImageLocation + 7); if (getDepartment == -1) { var filenamePos = statusImageFile.lastIndexOf('/'); if (filenamePos != -1) { statusImage.src = statusImageDirectory + statusImageFile.substring(filenamePos + 1) + '?IMAGES=' + statusImageDirectory + '&TIME=' + time; } } } if (getDepartment != -1) { // Load the DEPARTMENT path into a variable var department = LiveHelp.statusImagesLiveHelp[i].src.substring(getDepartment + 11); var endRequestPos = department.lastIndexOf('&'); if (endRequestPos != -1) { statusImage.src = 'http://soporte.haztutienda.com/include/status.php?DEPARTMENT=' + department.substring(0, endRequestPos) + '&IMAGES=' + statusImageDirectory + '&TIME=' + time; } } if (getCallback != -1) { // Load the CALLBACK path into a variable statusImage.src = 'http://soporte.haztutienda.com/include/status.php?CALLBACK=1&TIME=' + time; } LiveHelp.statusImagesLiveHelp[i].onload = null; LiveHelp.swapImage(LiveHelp.statusImagesLiveHelp[i].id, '', statusImage.src, 1); } } } LiveHelp.currentStatus = status; if (status == 'Offline' && LiveHelp.trackingInitalized == 0) { window.clearTimeout(LiveHelp.TrackingTimer); } }