function WatchThisLot(AuctionID,LotID,LotNum,Status){
	if(BidderID != ""){
		var RequestURL = "/asp/xml/WatchThisLotXML.asp?lid=" + LotID + "&sts=" + Status;
		var wRequest = new Sys.Net.WebRequest();
		wRequest.set_url(RequestURL);
		wRequest.set_httpVerb("GET");
			    
		wRequest.add_completed(WatchThisLotDone);
	    
		var executor = wRequest.get_executor(); 
	    
		wRequest.invoke();

	}
	else{
		var rsp;
		rsp = confirm("You must be logged in to use this feature, Would you like to login now?");
		if(rsp){
			var newURI = "LoginBidder.asp?aid=" + AuctionID + "&lid=" + LotID + "&lnm=" + LotNum;;
			var loc = document.location.href;
			if(loc.match(/SearchAdvanced.asp/gi)){
				newURI += "&qs=" + document.getElementById("SearchTerms").value;
			}
			window.location = newURI;
		}
	}
}

function WatchThisLotDone(executor){
	var XMLOutput, WatchStatus, lotId;
	if(executor.get_responseAvailable()){
		XMLOutput = executor.get_xml();
		WatchStatus = XMLOutput.getElementsByTagName("Status")[0].childNodes[0].nodeValue; 
		lotId = XMLOutput.getElementsByTagName("LotID")[0].childNodes[0].nodeValue; 
		
		if(WatchStatus == 1){
			//alert("Lot watch set");
			setWatchStyle(lotId, true);
		}else{
			//alert("Lot watch removed");	
			setWatchStyle(lotId, false);
		}
	}
}

function setWatchStyle(lotId, isOn){
	var t = document.getElementById("LotTable:"+lotId);
	var a = document.getElementById("LotWatchAnc:"+lotId);
	
	if(isOn){
		a.href = a.href.replace(/,1\)/,",0)");
		a.title="you are watching this lot. click to remove it from your watch list.";
		a.innerHTML = a.innerHTML.replace('Watch this Lot','You are watching this lot');
		$j(t).find('.lotWatchOverlay').fadeIn('slow');
		$j('.lotDetailWatchOverlay').fadeIn('slow');
		}
	else{
		a.href = a.href.replace(/,0\)/,",1)");
		a.title="click to add this lot to your watch list.";
		a.innerHTML = a.innerHTML.replace('You are watching this lot','Watch this Lot');
		$j(t).find('.lotWatchOverlay').fadeOut('slow');
		$j('.lotDetailWatchOverlay').fadeOut('slow');
	}
}
