//alert(document.cookie.indexOf('SupportAlive'))
//var sCookie = OnCheck();
//var uid = escape( sCookie );
var uid = "";
var orgid = "1";
var HOST = "www.arenaopen.com/SupportAliveClient/";
var HOST1 = "www.arenaopen.com/SAT/";
var CampainPage = "about:blank";
var Lng = "tr";
var PID = CreateID();
var isLoadedImage = true ;
var HostImg ;
var bEndSession = false ;
var SupportDivName = "SupDiv1";
var bDivVisible = false;
var m_bMoveDiv = false;
var m_bClosed = false;
var LeftBorder = 20 ;
var RightBorder = 0 ;
var Step = 1 ;
var Left = 0 ;
var omsg = "";
var Top = 0 ;
var Width = 0 ;
var Direction = "right";
var hcControlImage ;
var ishcControlImageAdded = false;
var brsn = navigator.appName;
var brsp = navigator.platform;
var brsc = navigator.appCodeName;
var brsv = navigator.appVersion;
var p = document.URL;
function set_uid(x)
{
uid = x;
}
function AcceptInvite()
{
SupportOp( '', Lng, document.referrer, true, '' );
HideDiv(SupportDivName);
}
function CheckImages()
{
var w = HostImg.width;
var h = HostImg.height;
if (w == 0)
return;
HandleWidthHeight(w,h);
}
function CheckTrackingLoop()
{
if (isLoadedImage)
{
if ( document.body )
{
if (!ishcControlImageAdded)
{
hcControlImage = document.createElement('IMG');
hcControlImage.style.visibility = "hidden";
document.body.appendChild(hcControlImage);
ishcControlImageAdded = true ;
}
if ( document.getElementById("sa") )
{
if ( document.getElementById("sa").sr== "true" )
{
SendTrackingRequest();
setTimeout('CheckTrackingLoop()', 30000);
}
else
{
return;
}
}
else
return;
}
else
{
setTimeout('CheckTrackingLoop()', 1000);
}
}
}
function CreateDiv(Left, Top)
{
if(!document.all.tags("DIV")(SupportDivName))
{
var innerHTML = "" ;
innerHTML += "
" ;
innerHTML += "
";
else
innerHTML += "Invite_en.jpg'>";
innerHTML += "";
innerHTML += "| "
innerHTML += " | "
innerHTML += ""
innerHTML += " "
innerHTML += " | " ;
innerHTML += "
";
innerHTML += "";
innerHTML += "| "
innerHTML += " | "
innerHTML += " "
innerHTML += " | "
innerHTML += "
" ;
innerHTML += "
";
innerHTML += "
";
//alert( innerHTML );
var inviteDiv = document.createElement('DIV');
inviteDiv.innerHTML = innerHTML;
document.body.appendChild(inviteDiv);
//document.body.innerHTML = innerHTML + document.body.innerHTML ;
//alert( "burası" );
if ( !m_bClosed )
ShowDiv(true) ;
}
else
{
if ( !m_bClosed && !bDivVisible )
ShowDiv(true) ;
}
}
function CreateID()
{
var now = new Date();
var strYear = now.getYear();
var strMonth = now.getMonth() + 1;
var strDay = now.getDate();
var strHours = now.getHours();
var strMinutes = now.getMinutes();
var strSeconds = now.getSeconds();
if ( parseInt(strMonth) < 10 )
{
strMonth = "0" + strMonth
}
if ( parseInt(strDay) < 10 )
{
strDay = "0" + strDay
}
if ( parseInt(strHours) < 10 )
{
strHours = "0" + strHours
}
if ( parseInt(strMinutes) < 10 )
{
strMinutes = "0" + strMinutes
}
if ( parseInt(strSeconds) < 10 )
{
strSeconds = "0" + strSeconds
}
var s = "";
for( i=0; i<16; i++)
s += String.fromCharCode(65 + Math.round(Math.random() * 25));
s += "" + strYear + strMonth + strDay + strHours + strMinutes + strSeconds;
return s;
}
function Delay( type )
{
var innerHTML = "" ;
innerHTML += "" ;
innerHTML += "
";
var ctr = 1000;
if ( type == "1" )
ctr = 3000;
for ( var i = 0; i < ctr; i++ )
{
innerHTML += "| |
";
}
innerHTML += "
";
document.body.innerHTML = innerHTML + document.body.innerHTML;
}
var tempW = -1;
var tempH = -1;
function HandleWidthHeight(w,h)
{
if ((tempH == h) && (tempW == w))
return;
hclastH = h;
hclastW = w;
if ( w == 10 )
{
CreateDiv(40, 140);
}
else
{
m_bClosed = false;
}
if ( w == 1 )
{
window.open( CampainPage + "?id=" + h );
}
isLoadedImage = true ;
}
function HideDiv()
{
document.all.tags("DIV")(SupportDivName).style.display = "None" ;
StopDiv();
bDivVisible = false;
m_bClosed = true;
}
function LoadImage()
{
var CookieName= 'SupportAlive';
var cookies = document.cookie;
//alert(cookies.indexOf(CookieName));
if (cookies.indexOf(CookieName) != -1)
{
var startpos = cookies.indexOf(CookieName)+CookieName.length+1;
var endpos = cookies.indexOf(';',startpos);
if (endpos == -1)
endpos = cookies.length;
return unescape(cookies.substring(startpos,endpos));
}
else
{
return false;
}
}
function MoveDivToLeft()
{
Direction = "left";
if(m_bMoveDiv)
{
if(Left > LeftBorder)
{
document.all.tags("DIV")(SupportDivName).style.left = Left - Step + "px" ;
Left = Left - Step ;
setTimeout("MoveDivToLeft()", 50) ;
}
else
{
MoveDivToRight() ;
}
}
}
function MoveDivToRight()
{
Direction = "right";
if(m_bMoveDiv)
{
if(Left < (document.body.offsetWidth - Width - 40))
{
document.all.tags("DIV")(SupportDivName).style.left = Left + Step + "px" ;
Left = Left + Step ;
setTimeout("MoveDivToRight()", 50) ;
}
else
{
MoveDivToLeft() ;
}
}
}
function OnCheck()
{
var MyCookie = LoadImage();
//alert( MyCookie + " " + MyCookie.length );
if(MyCookie.length == 30 )
{
var bCheck=false;
for( i=0;i<30;i++)
{
iCh = MyCookie.charCodeAt(i);
if( ((iCh >=48) && (iCh <=57)) || ((iCh >=65) && (iCh <=90)) )
{
bCheck = true;
}
else
{
bCheck = false;
break;
}
}
if(bCheck)
{
isDefinedCookie = true ;
return MyCookie.substring(0,30);
}
}
MyCookie = CreateID();
setCookie('SupportAlive=' + MyCookie );
isDefinedCookie = true ;
return MyCookie;
}
function OnInviteDivLoad()
{
document.all.tags("table")(String(SupportDivName + "_tbl")).style.borderStyle="Solid";
document.all.tags("table")(String(SupportDivName + "_tbl")).style.borderWidth="1px";
document.all.tags("table")(String(SupportDivName + "_tbl")).style.borderColor="#333333";
document.all.tags("table")(String(SupportDivName + "_tbl")).style.filter="progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='#999999', Positive='true')";
}
function RejectInvite()
{
var now = new Date();
var img = new Image();
var link = HOST1 + 'RejectInvite.aspx?&oid='
+ orgid + '&uid=' + uid + '&nowtime=' + escape(now.getTime());
img.src = link ;
HideDiv(SupportDivName);
}
function ReplaceText(t)
{
t = t.split("<").join("$$$k");
t = t.split(">").join("$$$b");
t = t.split("+").join("$$$p");
t = encodeURIComponentNew( t );
return t;
}
function SendChatRequest( lng, r, bNewWindow, subject, type, sExtraParams )
{
var p = document.location + "";
if ( r.length <= 0 )
r = document.referrer;
if ( lng == "tr" )
{
omsg = "Üzgünüz, a+b şu an size yardımcı olamıyoruz.%0ASorularınız için "
+ "offlinefromscript@supportalive.com adresine e-posta gönderebilirsiniz.";
}
else
{
omsg = "Sorry, we cannot halp you at this time.%0AFor your questions "
+ "please send an email to offlinefromscript@supportalive.com.";
}
omsg = ReplaceText( omsg );
var sLocation = HOST + "Default.aspx?uid="
+ uid
+ "&orgid=" + orgid
+ "&t=" + type
+ "&brsn=" + navigator.appName
+ "&brsp=" + navigator.platform
+ "&p=" + p.split("?")[0].split("#")[0]
+ "&r=" + r.split("?")[0].split("#")[0]
+ "&s=" + ReplaceText( subject )
+ "&omsg=" + omsg
+ "&l=" + lng;
if ( sExtraParams.length > 0 )
sLocation += sExtraParams;
if ( bNewWindow )
{
window.open(
sLocation,
"SupportAliveChat",
"height=480, width=640, left=80, top=80, location=no, menubar=no, resizable=yes, scrollbars=no, titlebar=yes, status=yes",
true
);
}
else
{
window.location = sLocation;
}
}
function SendEndVisit( type )
{
document.body.removeChild(hcControlImage);
hcControlImage = document.createElement('IMG');
hcControlImage.style.visibility = "hidden";
document.body.appendChild(hcControlImage);
var now = new Date();
var link = HOST1 + 'VisitEnd.aspx?oid='
+ orgid
+ '&uid=' + uid
+ '&e=' + type
+ '&pid=' + PID
+ '&nowtime=' + escape(now.getTime());
hcControlImage.src = link;
Delay();
}
function SendTrackingRequest()
{
var now = new Date();
isLoadedImage = false ;
HostImg = new Image();
HostImg.onload = CheckImages ;
var link = HOST1 + 'WebForm1.aspx?'
+ 'uid=' + uid
+ '&brsn=' + escape(navigator.appName)
+ '&brsp=' + escape(navigator.platform)
+ '&p=' + escape(document.location)
+ '&pid=' + PID
+ '&r=' + escape(document.referrer)
+ '&org_id=' + orgid
+ '&nowtime=' + now.getTime();
HostImg.src = link;
}
function setCookie(txt)
{
today = new Date;
today.setDate(today.getDate()+365);
document.cookie = txt + ';path=/;expires=' + today.toGMTString();
}
function ShowDiv(bMoveDiv)
{
if ( !m_bClosed )
{
m_bMoveDiv = bMoveDiv;
document.all.tags("DIV")(SupportDivName).style.display = "Block" ;
if(bMoveDiv)
{
arrLeft = document.all.tags("DIV")(SupportDivName).style.left.split("px") ;
arrWidth = document.all.tags("DIV")(SupportDivName).style.width.split("px") ;
Left = Number(arrLeft[0]) ;
Width = Number(arrWidth[0]) ;
RightBorder = (document.body.offsetWidth - Width - 40) ;
if ( Direction == "right" )
MoveDivToRight();
else
MoveDivToLeft();
}
bDivVisible = true;
}
}
function StopDiv()
{
m_bMoveDiv = false ;
}
function SupportDpt( DptID, lng, r, bNewWindow, subject )
{
var sExtraParams = "&dptid=" + DptID;
SendChatRequest( lng, r, bNewWindow, subject, '1', sExtraParams );
}
function SupportOrg( lng, r, bNewWindow, subject )
{
SendChatRequest( lng, r, bNewWindow, subject, '0', '' );
}
function SupportOp( sOpMail, lng, r, bNewWindow, subject )
{
var sExtraParams = "&opm=" + sOpMail;
SendChatRequest( lng, r, bNewWindow, subject, '2', sExtraParams );
}
function Unload()
{
//alert( window.screenLeft );
if ( document.getElementById("sa") )
{
if ( document.getElementById("sa").sr== "true" )
{
if ( window.screenLeft == 10004 )
{
SendEndVisit( "1" );
}
else
{
SendEndVisit( "0" );
}
}
}
}
function utf8(wide)
{
var c, s;
var enc = "";
var i = 0;
while(i=0xDC00 && c<0xE000) continue;
if (c>=0xD800 && c<0xDC00) {
if (i>=wide.length) continue;
s = wide.charCodeAt(i++);
if (s<0xDC00 || c>=0xDE00) continue;
c = ((c-0xD800)<<10)+(s-0xDC00)+0x10000;
}
// output value
if (c<0x80) enc += String.fromCharCode(c);
else if (c<0x800) enc += String.fromCharCode(0xC0+(c>>6),0x80+(c&0x3F));
else if (c<0x10000) enc += String.fromCharCode(0xE0+(c>>12),0x80+(c>>6&0x3F),0x80+(c&0x3F));
else enc += String.fromCharCode(0xF0+(c>>18),0x80+(c>>12&0x3F),0x80+(c>>6&0x3F),0x80+(c&0x3F));
}
return enc;
}
var hexchars = "0123456789ABCDEF";
function toHex(n) {
return hexchars.charAt(n>>4)+hexchars.charAt(n & 0xF);
}
var okURIchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
function encodeURIComponentNew(s) {
var s = utf8(s);
var c;
var enc = "";
for (var i= 0; i=0)
{
HOST = "https://" + HOST;
HOST1 = "https://" + HOST1;
}
else
{
HOST = "http://" + HOST;
HOST1 = "http://" + HOST1;
}
window.attachEvent("onunload", Unload);
window.attachEvent("onload", CheckTrackingLoop);