function Event_Looker (lookerId,interval,pMemberId,pUserName) {
	this.enabled=0
	this.busy=0
	this.Id=lookerId
	this.interval=interval
	this.memId=pMemberId
	this.userName=pUserName
	this.startLooking=startLooking
	this.serverLook=serverLook
	this.yelp=yelp
	this.stopLooking=stopLooking
	this.flowResponse=60
	this.flowFloor=800
	this.flowCeiling=5000
	this.getFlow=getFlow
	currentLookerObject=this
}


var lookerTimer
function startLooking() {
currentLookerObject.enabled=1
currentLookerObject.serverLook()
}
function stopLooking() {
	this.enabled=0
	lookerTimer=null
}

function yelp(pMsg) {
currentLookerObject.busy=1
var url="../yelpserver.asp?actionid=2&memid=" + currentLookerObject.memId + "&username=" + currentLookerObject.userName + "&msg=" + pMsg
lookerXML=GetXmlHttpObject(checkServerResponsePost)
lookerXML.open("GET", url , true)
lookerXML.send(null)
}
var currentLookerObject
function serverLook() {
	if (looker.enabled==1) {
	currentLookerObject.interval=this.getFlow(this.flowResponse)
	lookerTimer=setTimeout("checkServer()",currentLookerObject.interval)
	}
}

function getFlow(pOffset) {
	var tNewFlow=this.interval + pOffset
	if (this.flowFloor>tNewFlow) {
		tNewFlow=this.flowFloor
		} 
	if (this.flowCeiling<tNewFlow) {
			tNewFlow=this.flowCeiling
	}
	return tNewFlow
}
var lookerXML
function checkServer(){
if (currentLookerObject.busy==0) {
var url="../yelpserver.asp?actionid=1&memId=" + memId
lookerXML=GetXmlHttpObject(checkServerResponse)
lookerXML.open("GET", url , true)
lookerXML.send(null)
} else {
currentLookerObject.serverLook()
}
}
function growBackDown() {

var obj=document.getElementById("yelpBox")
displayEffect(obj, 1000,  0, 12, false, backAtNorm)

}

function backAtNorm() {
var yc=document.getElementById("yelpCell")
var obj=document.getElementById("yelpBox")
yc.removeChild(obj)
 }
function checkServerResponsePost() {

    if (lookerXML.readyState==4 || lookerXML.readyState=="complete"){
	
var rt=lookerXML.responseText
if (rt.split("**")[0]=="1") {
	currentLookerObject.interval=currentLookerObject.getFlow((-200*currentLookerObject.flowResponse))
	var newBox=document.createElement("DIV");
	newBox.id="yelpBox"
	var linkText = document.createTextNode(rt.split("**")[3]);
	newBox.appendChild(linkText)
	newBox.className="yelpStartStyle"
	var yc=document.getElementById("yelpCell")
	yc.appendChild(newBox)
	displayEffect(newBox, 3000,  0, 2, false, growBackDown)
	addYelpToBox("yelpDisplayBox",rt.split("**")[1],rt.split("**")[2],rt.split("**")[3])
}
currentLookerObject.busy=0
}
}


function checkServerResponse() {

    if (lookerXML.readyState==4 || lookerXML.readyState=="complete") {
var rt=lookerXML.responseText
if (rt.split("**")[0]=="1") {
	currentLookerObject.interval=currentLookerObject.getFlow((-200*currentLookerObject.flowResponse))
	var newBox=document.createElement("DIV");
	newBox.id="yelpBox"
	var linkText = document.createTextNode(rt.split("**")[3]);
	newBox.appendChild(linkText)
	newBox.className="yelpStartStyle"
	var yc=document.getElementById("yelpCell")
	yc.appendChild(newBox)
	displayEffect(newBox, 3000,  0, 2, false, growBackDown)
	addYelpToBox("yelpDisplayBox",rt.split("**")[1],rt.split("**")[2],rt.split("**")[3])
}
currentLookerObject.serverLook()
}
}

