//===================== // Copyright (c) 2006-2009 // Surwing Technologies Co., Ltd. // http://www.surwing.com //===================== //===================== // Copyright (c) 2006-2009 // Surwing Technologies Co., Ltd. // http://www.surwing.com //===================== if ( typeof SWGC2CT !== 'object' ) { var SWGC2CT=function() { var fls = []; var flsn = {}; // viewport size var viewport = {w:0,h:0}; var doc = {w:0,h:0}; // scrollPos var scrollPos = {x:0,y:0}; var flInit = false; function getViewport() { var myWidth = 0, myHeight = 0; if( document.documentElement && document.documentElement.clientWidth && document.compatMode == "CSS1Compat" ) { // FF2+, Safari 1+, or IE 6+ in 'standards compliant mode' myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { // FF2+, Safari 1+, IE5-5.5, or IE6+ in 'quirks' mode //IE 4 compatible myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; } viewport.w = myWidth; viewport.h = myHeight; if ( document.compatMode == "CSS1Compat" ) { doc.w = document.documentElement.scrollWidth; doc.h = document.documentElement.scrollHeight; } else { doc.w = document.body.scrollWidth; doc.h = document.body.scrollHeight; } //console.log('doc.w='+doc.w+',h='+doc.h); } function getScrollPos() { var scrOfX = 0, scrOfY = 0; if( typeof( window.pageYOffset ) == 'number' ) { //Netscape compliant scrOfY = window.pageYOffset; scrOfX = window.pageXOffset; } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { //DOM compliant scrOfY = document.body.scrollTop; scrOfX = document.body.scrollLeft; } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { //IE6 standards compliant mode scrOfY = document.documentElement.scrollTop; scrOfX = document.documentElement.scrollLeft; } scrollPos.x = scrOfX; scrollPos.y = scrOfY; } function alignFloatLayers(){ for(var i=0;i0) ? 1 : 0; }else { cx = Math.round(dx/this.steps); } if (dy < this.steps/2) { cy = (dy>0) ? 1 : 0; } else { cy = Math.round(dy/this.steps); } this.prevX += (this.floatX > this.prevX)? cx:-cx; this.prevY += (this.floatY > this.prevY)? cy:-cy; this.el.style.left = this.prevX+'px'; this.el.style.top = this.prevY+'px'; if (cx!==0||cy!==0) { if(this.tm===null) { this.tm=scheduleAdj(this.index); } } else { alignFloatLayers(); } }; // register event handlers function chainFunc(oldfunc, newfunc) { if ( typeof oldfunc != 'function' ) { return newfunc; } return function() { if ( oldfunc ) { oldfunc.apply(this); } newfunc.apply(this); }; } window.onscroll = chainFunc( window.onscroll, function() { getScrollPos();alignFloatLayers(); } ); window.onresize = chainFunc( window.onresize, function() { getViewport();alignFloatLayers(); } ); window.onload = chainFunc( window.onload, alignFloatLayers ); return { FloatLayer: FloatLayer, getFloatLayer: function(n) { return flsn[n]; }, onTO:function(idx) { fls[idx].adjust(); } }; }(); } if ( typeof SWGC2CT.liveChat !== 'object' ) { SWGC2CT.liveChat=function() { // utility functions used by the public object methods // Array of all open windows var windows = []; var idx = 0; // 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) { } } } // 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(); } } // 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=no,resizable=yes,top=" + winUp + ",left=" + winleft + ","; defaultOptions += "width=" + width + ",height=" + height; launchWinWithOptions(name, url, defaultOptions); } // return object return { launchWin: launchWin, showChatButton: function(workgroup) { var d = new Date(); var v1 = d.getSeconds() + '' + d.getDay(); var img = "http://service.c2contact.com.au/webchat/live?action=isAvailable&workgroup=" + workgroup; var gotoURL = "http://service.c2contact.com.au/webchat/start.jsp?workgroup=" + workgroup + "&location=" + window.location.href; document.write( ""); }, displayWorkgroup: function(workgroup,online,offline) { var d = new Date(); var v1 = d.getSeconds() + '' + d.getDay(); var img = "http://service.c2contact.com.au/webchat/live?action=isAvailable&workgroup=" + workgroup +"&online="+ online + "&offline="+offline; var gotoURL = "http://service.c2contact.com.au/webchat/start.jsp?workgroup=" + workgroup + "&location=" + window.location.href; document.write( ""); }, showChatButtonWithAgent: function(workgroup, agent) { var d = new Date(); var v1 = d.getSeconds() + '' + d.getDay(); var img = "http://service.c2contact.com.au/webchat/live?action=isAvailable&workgroup=" + workgroup; var gotoURL = "http://service.c2contact.com.au/webchat/start.jsp?workgroup=" + workgroup + "&agent=" + agent + "&location=" + window.location.href; document.write(""); }, showButtonWithoutUI: function(workgroup, params){ var d = new Date(); var v1 = d.getSeconds() + '' + d.getDay(); var img = "http://service.c2contact.com.au/webchat/live?action=isAvailable&workgroup=" + workgroup; var gotoURL = "http://service.c2contact.com.au/webchat/start.jsp?workgroup=" + workgroup + "&location=" + window.location.href + "&noUI=true&"+params; document.write(""); }, getId: function() { return idx++; } }; // end of return }(); } (function(){ var elid = 'c2ct-lb-'+SWGC2CT.liveChat.getId(); document.write(''); new SWGC2CT.FloatLayer(elid,false,'-10','100','null'); })();