if (document.cookie.length > 0) { // if there are any cookies
if ((document.cookie.indexOf('xlaALSleadlocal') ==-1) && (document.referrer.length>0)){ // lead cookie does not exist and theres a referer
document.cookie='xlaALSleadlocal=1';
document.write('<img width=0 height=0 src="http://www.tvcc.edu/itservices/livesupport/tracklead.aspx?rid=5651&lead=' + escape(document.referrer) + '">');}}


floatX=10;
floatY=10;
layerwidth=325;
layerheight=280;
halign="center";
valign="center";
delayspeed=2;

NS6=false;
IE4=(document.all);
if (!IE4) {NS6=(document.getElementById);}
NS4=(document.layers);

function adjust() {
if ((NS4) || (NS6)) {
if (lastX==-1 || delayspeed==0)
{
lastX=window.pageXOffset + floatX;
lastY=window.pageYOffset + floatY;
}
else
{
var dx=Math.abs(window.pageXOffset+floatX-lastX);
var dy=Math.abs(window.pageYOffset+floatY-lastY);
var d=Math.sqrt(dx*dx+dy*dy);
var c=Math.round(d/10);
if (window.pageXOffset+floatX>lastX) {lastX=lastX+delayspeed+c;}
if (window.pageXOffset+floatX<lastX) {lastX=lastX-delayspeed-c;}
if (window.pageYOffset+floatY>lastY) {lastY=lastY+delayspeed+c;}
if (window.pageYOffset+floatY<lastY) {lastY=lastY-delayspeed-c;}
}
if (NS4){
document.layers['floatlayer'].pageX = lastX;
document.layers['floatlayer'].pageY = lastY;
}
if (NS6){
document.getElementById('floatlayer').style.left=lastX;
document.getElementById('floatlayer').style.top=lastY;
}
}
else if (IE4){
if (lastX==-1 || delayspeed==0)
{
lastX=document.body.scrollLeft + floatX;
lastY=document.body.scrollTop + floatY;
}
else
{
var dx=Math.abs(document.body.scrollLeft+floatX-lastX);
var dy=Math.abs(document.body.scrollTop+floatY-lastY);
var d=Math.sqrt(dx*dx+dy*dy);
var c=Math.round(d/10);
if (document.body.scrollLeft+floatX>lastX) {lastX=lastX+delayspeed+c;}
if (document.body.scrollLeft+floatX<lastX) {lastX=lastX-delayspeed-c;}
if (document.body.scrollTop+floatY>lastY) {lastY=lastY+delayspeed+c;}
if (document.body.scrollTop+floatY<lastY) {lastY=lastY-delayspeed-c;}
}
document.all['floatlayer'].style.posLeft = lastX;
document.all['floatlayer'].style.posTop = lastY;
} 
setTimeout('adjust()',50);
}

function define()
{
if ((NS4) || (NS6)) 
{ 
if (halign=="left") {floatX=ifloatX};
if (halign=="right") {floatX=window.innerWidth-ifloatX-layerwidth-20};
if (halign=="center") {floatX=Math.round((window.innerWidth-20)/2)-Math.round(layerwidth/2)};
if (valign=="top") {floatY=ifloatY};
if (valign=="bottom") {floatY=window.innerHeight-ifloatY-layerheight};
if (valign=="center") {floatY=Math.round((window.innerHeight-20)/2)-Math.round(layerheight/2)};
}
if (IE4) 
{
if (halign=="left") {floatX=ifloatX};
if (halign=="right") {floatX=document.body.offsetWidth-ifloatX-layerwidth-20}
if (halign=="center") {floatX=Math.round((document.body.offsetWidth-20)/2)-Math.round(layerwidth/2)}
if (valign=="top") {floatY=ifloatY};
if (valign=="bottom") {floatY=document.body.offsetHeight-ifloatY-layerheight}
if (valign=="center") {floatY=Math.round((document.body.offsetHeight-20)/2)-Math.round(layerheight/2)}
}
}





if (NS4) {document.write('LAYER NAME="floatlayer" LEFT="'+floatX+'" TOP="'+floatY+'">');}
if ((IE4) || (NS6)) {document.write('<div id="floatlayer" style="position:absolute; left:'+floatX+'; top:'+floatY+';">');}

document.write("<img src=http://www.tvcc.edu/itservices/livesupport/images/proactiveoff.gif id=xlaALSprotrack style=visibility:hidden><div id=xlaALSinvite STYLE='visibility:hide;display:none;'><table border=0 cellspacing=0 cellpadding=0><tr><td><div style='position:relative;left:140px;top:128px;width:158px;height:86px;z-index:1;'><iframe id=xlaALSinvitemsg src=http://www.tvcc.edu/itservices/livesupport/proactivemsg.aspx frameborder=0 scrolling=auto width=100% height=86></iframe></div><a href=javascript:; onclick=xlaALSacceptinvite();><img src=http://www.tvcc.edu/itservices/livesupport/files/invite.gif border=0></a></td></tr><tr><td><a href=javascript:xlaALScancelinvite();><img src=http://www.tvcc.edu/itservices/livesupport/files/invite-close.gif border=0></a></td></tr></table></div>");



if (NS4) 
{
document.write('</LAYER>');
}
if ((IE4) || (NS6)) 
{
document.write('</DIV>');
}
ifloatX=floatX;
ifloatY=floatY;
define();
window.onresize=define;
lastX=-1;
lastY=-1;
adjust();


var rnd = 0;
function xlaALSshowinvite(){
	if (xlaALSinvited!=0){
		return(0);
	} 
	if (xlaALSinvite.style.display) {
		xlaALSinvite.style.display = "";
	} else {
		xlaALSinvite.visibility= "show";
	}
	
}

var xlaALSproactive_hit=0;
var xlaALSinvited=0;
function xlaALScheckproactive(){
	if (xlaALSproactive_hit==0){
		var time = new Date()
 		var ms = time.getMilliseconds()
		var xlaALSprosize=document.getElementById('xlaALSprotrack');

		if (xlaALSprosize.width==2){
			document.getElementById('xlaALSinvitemsg').src='http://www.tvcc.edu/itservices/livesupport/proactivemsg.aspx?r=' + ms;

			xlaALSproactive_hit=1;
			//Initiate Proactive Chat
			xlaALSshowinvite();
		} else {
			xlaALSprosize.src='http://www.tvcc.edu/itservices/livesupport/proactiveimg.aspx?r=' + ms;
			setTimeout( "xlaALScheckproactive()",5000);
		}
	}
}

function xlaALScancelinvite(){
	document.getElementById("xlaALSinvite").innerHtml='';
	document.getElementById("xlaALSinvite").style.display='none';
	document.getElementById('xlaALSprotrack').src='http://www.tvcc.edu/itservices/livesupport/proactiveimg.aspx?action=cancel';
	xlaALSinvited=1;
}

function xlaALSacceptinvite(){
	var w = 640, h = 480;
	if (document.all || document.layers) {
	   w = screen.availWidth;
	   h = screen.availHeight;
	}
	var leftPos = (w-740)/2, topPos = (h-500)/2;
	xlaALSwindow=window.open("http://www.tvcc.edu/itservices/livesupport/UserAcceptInvite.aspx?d=&u=&bypass=","ALSRoom","toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=740,height=500,top=" + topPos + ",left=" + leftPos);
	xlaALSwindow.focus();
	xlaALScancelinvite();
}

