//=====================
// Copyright (c) 2001-2003
// Kayako Web Solutions
// http://www.kayako.com
//=====================
var visitorid = "3108b68747cbacda323f2d8985204691";

var mim;
var inCall = 0;
var firsttime = 0;
var debug = 1;
var timer = 0;
var onlineurl = "http://www.blasthosting.com/liveresponse/cust_img/online.gif";
var offlineurl = "http://www.blasthosting.com/liveresponse/cust_img/offline.gif";
var refer = escape(document.referrer);

function doDebug(cont)
{
	if (debug == 1) {
		alert(cont);
	}
}

function doRand()
{
	var num;
	now=new Date();
	num=(now.getSeconds());
	num=num+1;
	return num;
}

function changeInCall(nc)
{
	inCall = nc;
}

function getCookie(name) {
	var crumb = document.cookie;
	var index = crumb.indexOf(name + "=");
	if (index == -1) return null;
	index = crumb.indexOf("=", index) + 1;
	var endstr = crumb.indexOf(";", index);
	if (endstr == -1) endstr = crumb.length;
	return unescape(crumb.substring(index, endstr));
}

function checkStatus()
{
	if (getCookie("statusm") == "changeonline") {
		document.statusimg.src = onlineurl;
	} else if (getCookie("statusm") == "changeoffline") {
		document.statusimg.src = offlineurl;
	} else if (getCookie("statusc") == "popchat" && inCall == 0) {
		doChat();
		changeInCall(1);
	} else if (getCookie("statusc") == "nochat" && inCall == 1) {
		changeInCall(0);
	}
}

function elapsedTime()
{
	timer = timer+1;
	setTimeout("elapsedTime()",1000);
}

function doChat()
{
	screen_width = screen.width;
	screen_height = screen.height;
	widthm = (screen_width/2)-250;
	heightm = (screen_height/2)-250;
	window.open("http://www.blasthosting.com/liveresponse/sessioncore.php?_d=output&_m=startdirect"+"&referer2="+refer+"&visitorid="+visitorid,"customerchat", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=550,height=500,left="+widthm+",top="+heightm);
}

function doPull() {
	doChat();
}

function doImageLoop()
{
	if (timer <= 3600) {
		mim = new Image();
		dm = new Date();
				mim.src = "http://www.blasthosting.com/liveresponse/sessioncore.php?_d=output&_m=visitor&_h="+dm.getTime()+"&_r="+doRand()+"&_u="+escape(window.location)+"&firsttime="+firsttime+"&visitorid="+visitorid+"&referer2="+refer+"&name23="+escape('');
		checkStatus();
		mim.onload = doPull;
		firsttime = 1;
		setTimeout("doImageLoop()",8000);
	}
}

function startChat()
{
	screen_width = screen.width;
	screen_height = screen.height;
	widthm = (screen_width/2)-250;
	heightm = (screen_height/2)-250;
	window.open("http://www.blasthosting.com/liveresponse/sessioncore.php?_d=output&_m=start&gdepartment=&_u="+escape(window.location)+"&referer2="+refer+"&lresolution="+screen.width+"x"+screen.height+"&lplatform="+escape(navigator.platform)+"&lappversion="+escape(navigator.appVersion)+"&lappname="+escape(navigator.appName),"customerchat"+doRand(), "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=550,height=500,left="+widthm+",top="+heightm);
}
document.write("<a href=\"javascript:startChat(0);\"><img src=\"http://www.blasthosting.com/liveresponse/cust_img/offline.gif\" border=\"0\" alt=\"Chat with a Live Representative\" name=\"statusimg\"></a>");
doImageLoop();
elapsedTime();
