var callFlag = "N";
var imgType = "static";
var f_interval = null;
var f_urlParam = "";
var f_urlParamTemp = "";
var f_urlParamDifferentFlag = false;
var f_hostname = window.location.href;
var f_pathname ="";
var f_search = window.location.search;
var f_referrer = document.referrer;
var f_appVersion = navigator.appVersion;
f_appVersion = f_appVersion.replace("(","_"); // (
f_appVersion = f_appVersion.replace(")","_"); // )
f_appVersion = f_appVersion.replace("; ","_"); // ;
var f_appName = navigator.appName;
if(f_appVersion == ""){ f_appVersion = "NODATA"; }
if(f_appName == ""){ f_appName = "NODATA"; }
if(f_referrer == ""){ f_referrer = "NODATA"; }
if(f_pathname == ""){ f_pathname = "NODATA"; }
if(f_hostname == ""){ f_hostname = "NODATA"; }
if(f_search == ""){ f_search = "NODATA"; }
f_urlParamTemp= "&hostname="+f_hostname+"&pathname="+f_pathname+"&search="+f_search+"&referrer="+f_referrer+"&appVersion="+f_appVersion+"&appName="+f_appName;
if(f_urlParam != f_urlParamTemp){
f_urlParamDifferentFlag = true;
f_urlParam = f_urlParamTemp;
}else {
f_urlParamDifferentFlag = false;
}
var changeFlag = "N";
var moveObjName = "moveinbound"; //ibokpage ibnopage
if(imgType == "static"){
moveObjName = "staticinbound";
}
document.writeln('
');
document.writeln('

');
document.writeln('
');
document.writeln('');
document.writeln(' ');
document.writeln(' |
');
document.writeln('');
document.writeln('
');
document.writeln('
');
document.writeln('');
document.writeln('
');
document.writeln('
');
function f_changefImage(){
if(callFlag=="Y"){
window.clearInterval("f_interval" );
return;
}
var getimg1 = new Image;
getimg1 = document.getElementById("moveimg");
getimg1.src = "http://www.liveweb.co.kr/lwpchat/GetImage?szMethodName=GetOnOffImage&site_id=eonair1&site_index=235&group=system&agentid=&count="+f_count;
f_count++;
if(getimg1.width == 3 ){ //ibokpage
if(moveObjName != "ibokpage"){
changeFlag = "Y";
}
moveObjName = "ibokpage";
document.getElementById("moveinbound").style.visibility = "hidden";
document.getElementById("staticinbound").style.visibility = "hidden";
document.getElementById("ibokpage").style.visibility = "visible";
document.getElementById("ibnopage").style.visibility = "hidden";
}else if(getimg1.width == 4 ){ //ibnopage
if(moveObjName != "ibnopage"){
changeFlag = "Y";
}
moveObjName = "ibnopage";
document.getElementById("moveinbound").style.visibility = "hidden";
document.getElementById("staticinbound").style.visibility = "hidden";
document.getElementById("ibokpage").style.visibility = "hidden";
document.getElementById("ibnopage").style.visibility = "visible";
}else{
if(moveObjName != "moveinbound"){
changeFlag = "Y";
}
// moveObjName = "moveinbound";
if(imgType == "static"){
moveObjName = "staticinbound";
}else{
moveObjName = "moveinbound";
}
document.getElementById("moveinbound").style.visibility = "hidden";
document.getElementById("staticinbound").style.visibility = "hidden";
document.getElementById(moveObjName).style.visibility = "visible";
document.getElementById("ibokpage").style.visibility = "hidden";
document.getElementById("ibnopage").style.visibility = "hidden";
}
if(changeFlag == "Y"){
changeFlag = "N"
if(imgType != "static"){
setLocation(moveObjName);
}
}
if(imgType != "static"){
locReset();
}
getimg1 = null;
}
function f_hidden_all(){
document.getElementById("moveinbound").style.visibility = "hidden";
document.getElementById("staticinbound").style.visibility = "hidden";
document.getElementById("ibokpage").style.visibility = "hidden";
document.getElementById("ibnopage").style.visibility = "hidden";
callFlag = "Y";
}
//var ibOKimgtype = "<%IBOKIMGTYPE%>";
//var ibNOimgtype = "<%IBNOIMGTYPE%>";
var ibfloctype = "01";
var f_count = 0;
var dragapproved=false;
var dragapproved2=false;
var callMsg = "";
var x,y;
var temp11=document.getElementById(moveObjName).style.pixelLeft;
var temp22=document.getElementById(moveObjName).style.pixelTop;
var magineLeft = temp11 - document.body.scrollLeft;
var magineTop = temp22 - document.body.scrollTop;
function f_move(){
var objImgLoc = document.getElementById(moveObjName);
if (event.button==1&&dragapproved){
if(event.clientX>0 ){
objImgLoc.style.left = temp11 + event.clientX - x + 1;
if(objImgLoc.style.pixelLeft - document.body.scrollLeft < 0){
objImgLoc.style.left = document.body.scrollLeft;
}
}
if(event.clientX > document.body.clientWidth - objImgLoc.offsetWidth){
objImgLoc.style.left = document.body.scrollLeft + document.body.clientWidth - objImgLoc.offsetWidth;
}
if(event.clientY>0){
objImgLoc.style.top = temp22 + event.clientY - y ;
if(objImgLoc.style.pixelTop - document.body.scrollTop< 0){
objImgLoc.style.top = document.body.scrollTop;
}
}
if(event.clientY > document.body.clientHeight - objImgLoc.offsetHeight){
objImgLoc.style.top = document.body.scrollTop + document.body.clientHeight - objImgLoc.offsetHeight;
}
dragapproved2=true;
return false;
}
}
function drags(){
locReset();
if (!document.all)
return ;
if (event.srcElement.className=="drag_liveweb"){
dragapproved=true ;
dragapproved2=false ;
x=event.clientX ;
y=event.clientY ;
window.document.onmousemove=f_move ;
}
}
function initdragapproved(){
if(!dragapproved2 && moveObjName == "moveinbound"){
var winopen = window.open('http://www.liveweb.co.kr/lwpchat/Check/?szMethodName=InboundCall&site_id=eonair1&site_index=235&group=system&agentid=&action=Y'+f_urlParamTemp,'_blank','resizable=no, width=190, height=200, top=100, left=100, titlebar=no,status=no,scrollbars=no');
dragapproved2=true;
}
dragapproved=false;
locReset();
}
function callInboundChat(){
callMsg = document.getElementById("inboundmsg").value;
var winopen = window.open('http://www.liveweb.co.kr/lwpchat/Check/?szMethodName=InboundCall&site_id=eonair1&site_index=235&group=system&agentid=&action=Y&callmsg='+callMsg+f_urlParamTemp,'_blank','resizable=no, width=190, height=200, top=100, left=100, titlebar=no,status=no,scrollbars=no');
document.getElementById("ibokpage").style.visibility = "hidden";
callFlag = "Y";
}
function callInboundImgChat(){
var winopen = window.open('http://www.liveweb.co.kr/lwpchat/Check/?szMethodName=InboundCall&site_id=eonair1&site_index=235&group=system&agentid=&action=Y'+f_urlParamTemp,'_blank','resizable=no, width=190, height=200, top=100, left=100, titlebar=no,status=no,scrollbars=no');
}
function callInboundNoChat(){
var durContent = document.getElementById("durcontent").value;
var cusName = document.getElementById("cusname").value;
var cusPhone1 = document.getElementById("p1").value;
var cusPhone2 = document.getElementById("p2").value;
var cusPhone3 = document.getElementById("p3").value;
var cusPhone = cusPhone1 + "-" + cusPhone2 + "-" + cusPhone3;
var setDurData = new Image;
setDurData.src = "http://www.liveweb.co.kr/lwpchat/GetImage?szMethodName=InsertDurData&site_id=eonair1&site_index=235&group=system&agentid=&cusname="+cusName+"&cusphone="+cusPhone+"&durcontent="+durContent;
setDurData = null;
document.getElementById("ibnopage").style.visibility = "hidden";
callFlag = "Y";
}
window.onload=function(){
if(imgType != "static"){
// setLocation('staticinbound');
setLocation('moveinbound');
setLocation('ibokpage');
setLocation('ibnopage');
locReset();
}
f_interval = window.setInterval("f_changefImage()", 3000);
// if(ibOKimgtype != "01" || ibNOimgtype != "01"){
// var f_checkType = window.setInterval("f_checkIBType()", 5000);
// }
}
window.onscroll=function(){
if(imgType != "static"){
var xScroll = document.body.scrollLeft + magineLeft;
var yScroll = document.body.scrollTop + magineTop;
redrawImg(xScroll, yScroll);
}
}
window.onresize = function(){
if(imgType != "static"){
var objImgLoc = document.getElementById(moveObjName);
if(magineTop + objImgLoc.offsetHeight > document.body.clientHeight){
objImgLoc.style.top = document.body.scrollTop + document.body.clientHeight - objImgLoc.offsetHeight;
}
if(objImgLoc.style.pixelTop - document.body.scrollTop <0){
objImgLoc.style.top = document.body.scrollTop;
}
if(objImgLoc.style.pixelLeft + objImgLoc.offsetWidth > document.body.clientWidth){
objImgLoc.style.left = document.body.scrollLeft + document.body.clientWidth - objImgLoc.offsetWidth;
}
locReset();
}
}
function redrawImg(xx, yy){
document.getElementById(moveObjName).style.left = xx;
document.getElementById(moveObjName).style.top =yy;
}
function locReset(){
temp11=document.getElementById(moveObjName).style.pixelLeft;
temp22=document.getElementById(moveObjName).style.pixelTop;
magineLeft = temp11 - document.body.scrollLeft;
magineTop = temp22 - document.body.scrollTop;
}
function setLocation(objName){
var objImgLoc = document.getElementById(objName);
if(ibfloctype == "01"){
objImgLoc.style.left= (document.body.clientWidth - objImgLoc.offsetWidth )/2 ;
objImgLoc.style.top= (document.body.clientHeight - objImgLoc.offsetHeight)/2 + document.body.scrollTop;
}else if(ibfloctype == "02"){
objImgLoc.style.left= '0' ;
objImgLoc.style.top= '0' ;
}else if(ibfloctype == "11"){
objImgLoc.style.left= 0 ;
objImgLoc.style.top= document.body.scrollTop ;
}else if(ibfloctype == "12"){
objImgLoc.style.left= 0 ;
objImgLoc.style.top= 0 ;
}else if(ibfloctype == "13"){
objImgLoc.style.left= document.body.clientWidth - objImgLoc.offsetWidth ;
objImgLoc.style.top= document.body.scrollTop ;
}else if(ibfloctype == "14"){
objImgLoc.style.left= 0 ;
objImgLoc.style.top= 0 ;
}else if(ibfloctype == "15"){
objImgLoc.style.left= (document.body.clientWidth - objImgLoc.offsetWidth )/2 ;
objImgLoc.style.top= (document.body.clientHeight - objImgLoc.offsetHeight)/2 + document.body.scrollTop ;
}else if(ibfloctype == "16"){
objImgLoc.style.left= 0 ;
objImgLoc.style.top= 0 ;
}else if(ibfloctype == "17"){
objImgLoc.style.left= 0 ;
objImgLoc.style.top= document.body.scrollTop + document.body.clientHeight - objImgLoc.offsetHeight ;
}else if(ibfloctype == "18"){
objImgLoc.style.left= 0;
objImgLoc.style.top= 0 ;
}else if(ibfloctype == "19"){
objImgLoc.style.left= document.body.clientWidth - objImgLoc.offsetWidth ;
objImgLoc.style.top= document.body.scrollTop + document.body.clientHeight - objImgLoc.offsetHeight ;
}else{
objImgLoc.style.left= '0' ;
objImgLoc.style.top= '0' ;
}
}
function f_keyP(e,type)
{
var keycode = e.keyCode;
if (keycode == 13)
{
if(type == 1){
callInboundChat();
}else{
callInboundNoChat();
}
}
}