
//


//<script>

var _type=''
var _status='LOADING';
var _result='LOADING';

//window.status=_type+" , "+_status+" , "+_result

// Do modify this line
var __cc_urlbase='http://perceptivetech.com/cutelivesupport/CuteSoft_Client/CuteChat/';

var chat_visitTimerid=0;
var _chat_interval=10000;//10s

// URL of the image that pops up when you send a chat invitation to your website visitors
var URL_live_help_window = __cc_urlbase+"images/live-help-window.gif";

// URL of the close image button
var URL_close_chat_button = __cc_urlbase+"images/closechat.gif";


// Default window ornaments for the live help dialog
var _liveHelpDialogFeature = "status=1,width=500,height=400,resizable=1";
var _chat_scriptid="LiveSupportVisitorMonitorScript";

function Chat_ChangeUrl(type)
{
	var _chat_script=document.getElementById("LiveSupportVisitorMonitorScript");
	_chat_script.src=__cc_urlbase+'Support-Visitor-monitor-crossdomain.js.aspx'
		+"?_temp="+(new Date().getTime())+"&Type="
		+type+"&Referrer="+escape(document.referrer);
}

function Chat_NextRequest()
{
	Chat_ChangeUrl("VISIT")
}

if( _status=="LOADING" )
{
	//script is loading first time
	
	// write the live support window to the page
	document.write('<div id="invitechatwindow" style="position:absolute;visibility:hidden;left:0px;top:0px;"><a href="javascript:Chat_AcceptInvite();"><img src="'+URL_live_help_window+'" border=0></a><div style="margin-top:0px;margin-left:50px"><a href="javascript:closechatwindow();"><img src="'+URL_close_chat_button+'" border="0"></a></div></div>');

	chat_visitTimerid=setTimeout(Chat_NextRequest,_chat_interval);
}
else
{
	var arr=_result.split(":");
	if(_type=="VISIT")
	{
		if(_status=="INVITE")
		{
			clearTimeout(chat_visitTimerid);//suppend
			var opname=arr[1];
			Chat_InviteConfirm(opname);
		}
		else
		{
			chat_visitTimerid=setTimeout(Chat_NextRequest,_chat_interval);
		}
	}
	if(_type=="ACCEPT")
	{
		if(_status=="READY")
		{
			var locationid=arr[1];
			var win;
			try
			{
				win=window.open(__cc_urlbase+"SupportClient.aspx?Location=Support&LocationId="+locationid,'',_liveHelpDialogFeature);
			}
			catch(x)
			{
			}
			if(win==null)
			{
				alert("Pop-up blocker detected.");
			}
		}
		if(_status=="EXPIRED")
		{
			alert(" operation expired .");
		}
		if(_status=="ERROR")
		{
			alert(text.substring(6));
		}
	}
	
}


function Chat_AcceptInvite()
{
	Chat_ChangeUrl("ACCEPT")
}
function Chat_RejectInvite()
{
	Chat_ChangeUrl("REJECT")
}



var dropstart=0;
var ie=document.all;
var ns4=document.layers;
var dom=document.getElementById;
var calunits=(ns4)? "" : "px";
var crossobj;

function dropin(){
	scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
	if (parseInt(crossobj.top)<150+scroll_top) {
		crossobj.top=parseInt(crossobj.top)+40+calunits;
	} else {
		clearInterval(dropstart)
	}
}
function closechatwindow(){
	crossobj.visibility="hidden";
	Chat_RejectInvite();
}

function truebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}


function Chat_InviteConfirm(){
	if (!dom&&!ie&&!ns4) return;
	crossobj=(dom)?document.getElementById("invitechatwindow").style : ie? document.all.invitechatwindow : document.invitechatwindow;
	scroll_top=(ie)? truebody().scrollTop : window.pageYOffset;
	scroll_left=(ie)? (truebody().offsetWidth)/2+truebody().scrollLeft-(300/2): 200;
	crossobj.left=scroll_left+calunits;
	crossobj.top=scroll_top-250+calunits;
	crossobj.visibility=(dom||ie)? "visible" : "show";
	dropstart=setInterval("dropin()",60);
	window.status='Live Support';
}








