// (c) 2006 Copyrights Quality Unit function cs_100() { this.timeout = 15000; this.idleTimeout = 1200000; this.scriptTag = null; this.baseUrl = "//www.germax.su/liveagent/"; this.lang = ""; this.init(); } cs_100.prototype.addScript = function() { var headTag = document.getElementsByTagName("head").item(0); this.scriptTag = document.createElement("script"); this.scriptTag.setAttribute("type","text/javascript"); var trackParams = ""; if(!this.initialized) { this.initialized = true; var title = ""; if(typeof(document.title)=="object"){ title = document.title.replace(/\|/g, " "); } trackParams = "&tr=1&tit=" + escape(title) + "&url=" + escape(document.location) + "&ref=" + escape(document.referrer) + "&w=" + screen.width + "&h=" + screen.height; } this.scriptTag.setAttribute("src",this.baseUrl + "chatserver/track.php?t=" + this.now() + "&cin=" + this.cid + trackParams); headTag.appendChild(this.scriptTag); } cs_100.prototype.removeScript = function() { var headTag = document.getElementsByTagName("head").item(0); if(this.scriptTag != null) { headTag.removeChild(this.scriptTag); this.scriptTag = null; } } cs_100.prototype.now = function() { var d = new Date(); return d.getTime(); } cs_100.prototype.init = function() { this.startTime = this.now(); this.initialized = false; this.startTimer(); } cs_100.prototype.startTimer = function() { if(this.now() > this.startTime + this.idleTimeout) { return; } this.removeScript(); this.addScript(); setTimeout("cs_100.startTimer()", this.timeout); } cs_100.prototype.cs = function(st) { if(this.status == st) { return; } this.status = st; var elements = this.getElementsByClass("cs_100", null, "img"); var i; for (i = 0; i < elements.length; i++) { elements[i].setAttribute("src", this.baseUrl + "chatserver/button.php?t=" + this.now()); } } cs_100.prototype.sc = function(c) { this.cid = c; } cs_100.prototype.open = function() { var url = this.baseUrl + "chat/index.html" + "?cin=" + this.cid + "&lang=" + this.lang; chatWin = window.open(url, this.now(), 'scrollbars=no,menubar=no,resizable=1,location=no,screenX=100,screenY=100,width=600,height=700') ; chatWin.focus() ; } cs_100.prototype.getElementsByClass = function(searchClass, node, tag) { var classElements = new Array(); if ( node == null ) node = document; if ( tag == null ) tag = '*'; var els = node.getElementsByTagName(tag); var elsLen = els.length; var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)'); var i,j; for (i = 0, j = 0; i < elsLen; i++) { if ( pattern.test(els[i].className) ) { classElements[j] = els[i]; j++; } } return classElements; } var cs_100 = new cs_100();