var runChatSetting = {}; runChatSetting.offlinestatus = 1; runChatSetting.onlinecount = 0; var default_style = "position: absolute;right:30px;"; var windowtype = 'T'; var runchat_movemode = 'N'; var leftpos, toppos; var defaulttop = 300; var scrolltype = '1'; var runChatherf = encodeURIComponent(document.location.href); if(!runChatInfo) { var runChatInfo = {"loginId":"","loginName":""}; } function activeRunChat(){ if(runChatSetting.onlinecount > 0 || (runChatSetting.onlinecount < 1 && runChatSetting.offlinestatus > 1)) { var rcCSS = document.createElement('link'); var rcContainer = document.createElement('div'); rcCSS.rel = "stylesheet"; rcCSS.type = "text/css"; rcCSS.href = "http://www.runremote.net/css/runchatapi.css?2015102701"; rcContainer.style.cssText = "position: absolute;top:0px;right:0;z-index: 9999;"; rcContainer.id = "rcContainer"; rcContainer.innerHTML = "
지금은 모든 상담원이 부재중입니다.
△ 가격상담
실시간 가격상담
"; document.getElementsByTagName('head')[0].appendChild(rcCSS); document.getElementsByTagName('body')[0].appendChild(rcContainer); moveRunChatWindow(); if(windowtype == 'T') setTimeout(viewrunChatBubbble, 3000); if(windowtype == 'T')runChatScroll.tabmode(); else if(scrolltype == 1)runChatScroll.start(); } }; function zoomrunChat() { var zoombtn = document.getElementById('runChatsize'); var rcContainer = document.getElementById('runChat_Container'); if(runChatsize.title == "확대") { zoombtn.title = "축소"; document.runChatsizeimg.src = '//www.runremote.net/images/icon/sizedown.png'; rcContainer.style.width = "350px"; rcContainer.style.height = "450px"; runChatContentdiv.style.height = "450px"; } else { zoombtn.title = "확대"; document.runChatsizeimg.src = '//www.runremote.net/images/icon/sizeup.png'; rcContainer.style.width = "200px"; rcContainer.style.height = "230px"; runChatContentdiv.style.height = "230px"; } } function viewrunChatBubbble() { var obj = document.getElementById("commentbubble"); obj.style.opacity = 0; obj.style.display = "block"; obj.style.top = -1*(obj.offsetHeight+10)+"px"; var s = 0; var view = setInterval(function() { obj.style.opacity = 0.01 * s; s++; if(s == 100) { clearInterval(view); setTimeout(hiddenChatBubbble,3000); } }, 10); } function hiddenChatBubbble() { var obj = document.getElementById("commentbubble"); obj.style.opacity = 1; obj.style.display = "block"; var s = 0; var hidden = setInterval(function() { obj.style.opacity = 1-(0.01 * s); s++; if(s == 100) { clearInterval(hidden); obj.style.display = "none"; } }, 10); } function viewRunChat() { var obj = document.getElementById('runChatContentdiv'); var dp = obj.style.display; if(dp == "block") { obj.style.display = "none"; document.getElementById('runChatClosediv').style.display = "none"; if(document.getElementById('runChatTitlediv')) document.getElementById('runChatTitlediv').style.display = "block"; else document.getElementById('runChatTitlediv2').style.display = "block"; document.getElementById('runChat_Container').style.cssText = default_style; if(windowtype == 'T') runchatTabPosition(); else { document.getElementById('runChat_Container').style.width = 150+"px"; document.getElementById('runChat_Container').style.height = 30+"px"; runchatPosition(); } if(windowtype == 'T') runChatScroll.tabmode(); } else { obj.style.display = "block"; document.getElementById('runChatClosediv').style.display = "block"; if(document.getElementById('runChatTitlediv')) { document.getElementById('runChatTitlediv').style.display = "none"; document.getElementById('runChat_Container').style.bottom = null; runchatTabMaxPosition(); //document.getElementById('runChat_Container').style.top = 250+"px"; } else { document.getElementById('runChatTitlediv2').style.display = "none"; zoomrunChat(); } if(windowtype == 'T') runChatScroll.stop(); } } function runChatLoad(func) { var oldonload = window.onload; if(typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } function moveRunChatWindow() { var movebtn = document.getElementById('runChatmove'); var moveobj = document.getElementById('runChat_Container'); movebtn.onmousedown = function(event){ runchat_movemode = 'Y'; var pagexy = runChateventPageXY(event); leftpos = window.event.clientX - parseInt(moveobj.offsetLeft); toppos = window.event.clientY - parseInt(moveobj.offsetTop-pagexy[2]); } if(document.addEventListener) { document.addEventListener('mousemove', function(event) { runChatMouseMove(event); }, false); document.addEventListener('mouseup', function(event) { runchat_movemode = 'N'; }, false); } else if(document.attachEvent) { document.attachEvent('onmousemove', function(event) { runChatMouseMove(event); } ); document.attachEvent('onmouseup', function(event) { runchat_movemode = 'N';} ); } } function runChatMouseMove(event){ if(runchat_movemode == 'Y') { var moveobj = document.getElementById('runChat_Container'); var pagexy = runChateventPageXY(event); moveX = parseInt(leftpos)-parseInt(pagexy[0]); moveY = parseInt(toppos)-parseInt(pagexy[1]); moveobj.style.left = -moveX+"px"; moveobj.style.top = -moveY+"px" ; } } var runChatScroll = { start : function() { if(window.addEventListener) { window.addEventListener('resize', runchatPosition, false); window.addEventListener('scroll', runchatPosition, false); } else if(window.attachEvent) { window.attachEvent('onresize', runchatPosition); window.attachEvent('onscroll', runchatPosition); } }, tabmode : function(){ runchatTabPosition(); if(window.addEventListener) { window.addEventListener('resize', runchatTabPosition, false); window.addEventListener('scroll', runchatTabPosition, false); } else if(window.attachEvent) { window.attachEvent('onresize', runchatTabPosition); window.attachEvent('onscroll', runchatTabPosition); } } , stop : function(){ if(window.removeEventListener) { window.removeEventListener('resize', runchatTabPosition, false); window.removeEventListener('scroll', runchatTabPosition, false); } else if(window.detachEvent) { window.detachEvent('onresize', runchatTabPosition); window.detachEvent('onscroll', runchatTabPosition); } } } function runchatPosition() { var obj = document.getElementById("runChat_Container"); if(obj) { var pagexy = runChateventPageXY(event); var newtop = defaulttop + pagexy[2]; obj.style.top = newtop+ "px"; } } function runchatTabPosition() { var obj = document.getElementById("runChat_Container"); if(obj) { var pagexy = runChateventPageXY(event); var windowxy = runChatWindowXY(event); var scrollwidth = isScroll(event); var newtop = windowxy[1] + pagexy[2]-36; newtop = newtop - scrollwidth; obj.style.top= newtop+ "px"; } } function runchatTabMaxPosition() { var obj = document.getElementById("runChat_Container"); var pagexy = runChateventPageXY(event); var windowxy = runChatWindowXY(event); var maxtop = windowxy[1] + pagexy[2]; var scrollwidth = isScroll(event); var newtop = (windowxy[1] - 450 > 0) ? maxtop - 500 : pagexy[2]; newtop = newtop - scrollwidth; obj.style.top= newtop+ "px"; } function runChatWindowXY() { var w = 0, h = 0; if (typeof (window.innerWidth) == 'number') { //Chrome w = window.innerWidth; h = window.innerHeight; } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { w = document.documentElement.clientWidth; h = document.documentElement.clientHeight; } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { //IE9 w = document.body.clientWidth; h = document.body.clientHeight; } return [w,h]; } function isScroll(e) { var scrollWidth = 0; var clientWidth = 0; //var outer = screen.width; if( document.body && document.body.scrollWidth){ scrollWidth = document.body.scrollWidth; clientWidth = document.body.clientWidth; } else { scrollWidth = document.documentElement.scrollWidth; clientWidth = document.documentElement.clientWidth; } var res = scrollWidth - clientWidth > 0 ? 18 : 0; return res; } function runChateventPageXY(e) { var event = e ? e:window.event; var clientHeight = 0; var scrollTop = 0; var scrollLeft = 0; var clickX = 0; var clickY = 0; if( document.body && document.body.scrollTop){ scrollHeight = document.body.scrollHeight; clientHeight = document.body.clientHeight; scrollTop = document.body.scrollTop; scrollLeft = document.body.scrollLeft; } else { scrollHeight = document.documentElement.scrollHeight; clientHeight = document.documentElement.clientHeight; scrollTop = document.documentElement.scrollTop; scrollLeft = document.documentElement.scrollLeft; } if (event && (event.clientX || event.clientY) && document.body ) { clickX = event.clientX + scrollLeft; clickY = event.clientY + scrollTop; } else if (event && (event.pageX || event.pageY)) { clickX = event.pageX; clickY = event.pageY; } return [clickX,clickY,scrollTop,scrollLeft]; } runChatLoad(activeRunChat); //activeRunChat();