var userIP=0;
var userName=1;
var timestamp=2
var sourceName=3;
var sourceURL=4;
var timeStayed=5;
var targetName=6;
var targetURL=7;
var targetAuctionName=8;
var targetAuctionURL=9;
var targetCategoryName=10;
var targetCategoryURL=11;
var targetSortBy=12;
var searchString=13;
var searchEnding=14;
var searchCategory=15;
var searchSeller=16;
var bidAmount=17;
var maxBidAmount=18;
var trackRequested=19;
var bidQty=20;
var auctionStartingBid=21;
var auctionCurrentBid=22;
var auctionBidIncrement=23;
var auctionMinNextBid=24;
var auctionBuyPrice=25;
var auctionAvaQty=26;
var auctionReservedStatus=27;
var auctionNumberOfBids=28;
var auctionHighestBidder=29;
var auctionTimeLeft=30;
var auctionStartDate=31;
var auctionEndDate=32;
var auctionSellerLocation=33;
var auctionSeller=34;

function createClickRecord()
{
	var record= new Array(33);
	for(var i=0;i<record.length;i++)
	{
		record[i]='';
	}
	return record;
}
function getUserNameCookie()
{
	name="alberta.login";
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0)
		{
			c=c.substring(nameEQ.length,c.length);
			return c.substring(0,c.indexOf('|'));
		}
	}
	return "Guest";
}

var startTime=new Date().getTime();
function logRecord(record)
{
	var now=new Date();
	var duration=(now.getTime()-startTime);
	var durationTime=new Date();
	durationTime.setTime(duration);
	var durationString="";

	
	
	if(durationTime.getMinutes()<=9)
	  	durationString+="0";
	durationString+=durationTime.getMinutes()+":";

	if(durationTime.getSeconds()<=9)
	  	durationString+="0";
	
	durationString+=durationTime.getSeconds();
	record[userName]=getUserNameCookie();
	record[timestamp]=(startTime/1000);
	record[sourceName]="Page";
	record[sourceURL]=location.href;
	record[timeStayed]=durationString;
	
	
	//alert(record.length);
	var recordString=""+record[0];
	for(var i=1;i<record.length;i++)
	{
		recordString+='|'+record[i];	
	}
	
	//alert(record+"\n"+recordString);
	var logURL='/test/log/record_log.cgi?record='+decodeString(recordString)+"&dummy="+new Date().getTime();
	//alert(logURL);
	sendAjax(logURL);
}
function writeLog(param)
{
	var now=new Date();
	var duration=(now.getTime()-startTime);
	var durationTime=new Date();
	durationTime.setTime(duration);
	var durationString="";

	
	
	if(durationTime.getMinutes()<=9)
	  	durationString+="0";
	durationString+=durationTime.getMinutes()+":";

	if(durationTime.getSeconds()<=9)
	  	durationString+="0";
	
	durationString+=durationTime.getSeconds();


  	var logURL="/test/log/add_to_log2.cgi?user="+getUserNameCookie()+"&time="+(startTime/1000)+"&duration="+durationString+"&source="+decodeString("Page|"+location.href+"|")+"&target="+decodeString(param)+"&dummy="+new Date().getTime();
	alert(logURL);
  	sendAjax(logURL);  	
}

function sendAjax(pURL)
{
  	if (window.XMLHttpRequest)
  	{ // code for Mozilla, Safari, etc
  		xmlhttp=new XMLHttpRequest();
      		xmlhttp.open("GET", pURL, true);
      		xmlhttp.send(null);
		
   	} else if (window.ActiveXObject)
   	{ //IE
   		xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
      		if (xmlhttp)
      		{
      			xmlhttp.open('GET', pURL, false);
      			xmlhttp.send();
      		}
   	}
}
function setSubmitHandler()
{
	for(var i=0;i<document.forms.length;i++)    
		document.forms[i].onsubmit = submitHandler;
}
function submitHandler(evt)
{
	var e = evt ? evt : window.event;
	if (!e) return;
	if (e.target)
		activeElement = e.target;
	else if(e.srcElement) activeElement = e.srcElement;			

	var form;
	if(activeElement.tagName.toLowerCase()!='form')
		form=activeElement.form;	
	else
		form=activeElement;
	handleFormSubmission(getFormSubmitElement(form),form);
}
function clickHandler(evt)
{
	var e = evt ? evt : window.event;
	if (!e) return;
	if (e.target)
		activeElement = e.target;
	else if(e.srcElement) activeElement = e.srcElement;

	if(activeElement.tagName.toUpperCase() == 'INPUT'&&activeElement.type.toUpperCase()=='SUBMIT')
	{
		//handleFormSubmission(activeElement, activeElement.form);
	}
	else if(activeElement.tagName.toLowerCase()=='a')
		handleTextAnchorClick(activeElement);
		
        else if(activeElement.tagName.toLowerCase()=='img'&&activeElement.parentNode.tagName.toLowerCase()=='a')
            	handleImageAnchorClick(activeElement,activeElement.parentNode);
	
	//else
		//alert('other:'+activeElement+" tagName="+activeElement.tagName+", parent="+activeElement.parentNode);
}

function getFormSubmitElement(form)
{
	for(var i=0;i<form.elements.length;i++)
		if(form.elements[i].type.toLowerCase()=='submit')
			return form.elements[i];
	return null;
}

function handleFormSubmission(submitButton, form)
{	
	if(form.action.toLowerCase()=='http://www.campusauctionmarket.com/display.cgi')
	{
		if(submitButton.value == "Search!")
			//type=quick-search|term|time
		{
			var record= createClickRecord();
			record[targetName]='Quick Search';
			record[targetURL]=form.action+'?searchtext='+form.searchtext.value+'&time='+form.time.options[form.time.selectedIndex].value;
			record[searchString]=form.searchtext.value;
			record[searchEnding]=form.time.options[form.time.selectedIndex].text;
			logRecord(record);
			//alert(record);
			//writeLog('Quick Search|'+form.action+'?searchtext='+form.searchtext.value+'&time='+form.time.options[form.time.selectedIndex].value+'|'+form.searchtext.value+"|"+form.time.options[form.time.selectedIndex].text);
		}
		else if(submitButton.value == " Auction Search ")
			//type=Advanced Search|term|time|
		{
			var record= createClickRecord();
			record[targetName]='Advanced Search';
			record[targetURL]=form.action+'?searchtext='+form.searchtext.value+'&time='+form.time.options[form.time.selectedIndex].value+'&categories='+form.categories.options[form.categories.selectedIndex].value+'&seller='+form.seller.options[form.seller.selectedIndex].value;
			record[searchString]=form.searchtext.value;
			record[searchEnding]=form.time.options[form.time.selectedIndex].text;
			record[searchCategory]=form.categories.options[form.categories.selectedIndex].tex;
			record[searchSeller]=form.seller.options[form.seller.selectedIndex].text;
			logRecord(record);
			//alert(record);
			//writeLog('Advanced Search|'+form.action+'?searchtext='+form.searchtext.value+'&time='+form.time.options[form.time.selectedIndex].value+'&categories='+form.categories.options[form.categories.selectedIndex].value+'&seller='+form.seller.options[form.seller.selectedIndex].value+'|'+form.searchtext.value+"|"+form.time.options[form.time.selectedIndex].text+"|"+form.categories.options[form.categories.selectedIndex].text+"|"+form.seller.options[form.seller.selectedIndex].text);
		}
	}	
	else if(form.action.toLowerCase()=='http://www.campusauctionmarket.com/bid.cgi')	
	{
		if(location.href.toLowerCase().indexOf('bid.cgi')!=-1)
			getBiddingAgainInfos();
		if(location.href.toLowerCase().indexOf('item.cgi')!=-1)
			getShowItemBidingInfos();		
		else
			getQuickBidingInfos(getQuickBidingAuctionIds(document.getElementsByTagName('INPUT')));
	}
	else if(form.action.toLowerCase()=='http://www.campusauctionmarket.com/display_ratings.cgi')
	{
		var record= createClickRecord();
		record[targetName]='View Member Feedback';
		record[targetURL]=form.action+'?view_user='+form.view_user.value;
		record[searchSeller]=form.view_user.value;
		logRecord(record);
		//writeLog('View Member Feedback|'+form.action+'?view_user='+form.view_user.value+'|'+form.view_user.value);	
	}
}

function getBiddingAgainInfoss()
{
	var auctions=document.getElementsByTagName("ul");
	var name,bid,nextBid,index,str,value;
	for(var i=2;i<auctions.length;i++)
	{
		value=getInputValue(auctions[i].childNodes[1]);
		if(value!='')
		{
			str=auctions[i].innerHTML.toLowerCase();
			//name="<a href=\""+auctions[i].childNodes[0]+"\">"+auctions[i].childNodes[0].innerHTML+"</a>";
			index=str.indexOf("bid is:")+7;
			nextBid=str.substring(index,str.indexOf("<br>")-1);
			var record=createClickRecord();
			record[targetName]='Bid Again';
			record[targetAuctionName]=auctions[i].childNodes[0];
			record[targetAuctionURL]=auctions[i].childNodes[0].innerHTML;
			record[bidAmount]=value;
			record[auctionMinNextBid]=nextBid;
			logRecord(record);
			//writeLog('Bid Again|'+auctions[i].childNodes[0]+'|'+auctions[i].childNodes[0].innerHTML+'|'+value+'|'+nextBid);
		}
		
	}
}
function getInputValue(node)
{
	for(var i=0;i<node.childNodes.length;i++)
		if(node.childNodes[i].type=='text')
			return node.childNodes[i].value;
	return '';
}


String.prototype.endsWith = function (str)
{
	return (this.match(str+"$")==str)
}

Array.prototype.contains = function (obj)
{
	var len=this.length;
	for(var i=0;i<len;i++)
	if(this[i]===obj)
		return true;
	return false;
}

function getQuickBidingAuctionIds(inputs)
{
	var auctions=new Array();
	var s;
	
	for(i=0,k=0;i<inputs.length;i++)
	{
		
		var index=inputs[i].name.indexOf("-max");
		if(index==-1)
			index=inputs[i].name.indexOf("-track");
	
		if(index!=-1&&!auctions.contains(inputs[i].name.substring(0,index)))
			auctions[k++]=inputs[i].name.substring(0,index);
	}
	return auctions;
}

function getQuickBidingInfos(auctions)
{
	//alert(auctions);
	var bid,max,qty,track,bidNode,parent,name,str,data,item,value,ends,ends_in,startBid,buyPrice,reserveStatus,currentBid,nextBid,highestBidder;
	for(i=0;i<auctions.length;i++)
	{
		bidNode=null;
		
		if(document.getElementsByName(auctions[i]).length>0)
		{
			bid=document.getElementsByName(auctions[i])[0].value;
			bidNode=document.getElementsByName(auctions[i])[0];
		}
		else
			bid="";

		if(document.getElementsByName(auctions[i]+'-max').length>0)
		{
			max=document.getElementsByName(auctions[i]+'-max')[0].value;
			bidNode=document.getElementsByName(auctions[i]+'-max')[0];
		}
		else
			max="";

		if(document.getElementsByName(auctions[i]+'-q').length>0)
		{
			qty=document.getElementsByName(auctions[i]+'-q')[0].value;
			bidNode=document.getElementsByName(auctions[i]+'-q')[0];
		}
		else
			qty="";

		if(document.getElementsByName(auctions[i]+'-track').length>0)
		{
			track=document.getElementsByName(auctions[i]+'-track')[0].checked;
			bidNode=document.getElementsByName(auctions[i]+'-track')[0];
		}
		else
			track="";

		if(bid!=""||max!=""||track!=""||qty!="")
		{			
			ends_in="";
			ends="";
			startBid="";
			buyPrice="";
			reserveStatus="";
			currentBid="";
			highestBidder="";
			nextBid="";
			value="";

			

			parent=bidNode.parentNode.parentNode.parentNode;			
			if(window.XMLHttpRequest)
				name=parent.childNodes[2].childNodes[0].childNodes[0].innerHTML;
			else
				name=parent.childNodes[1].childNodes[0].childNodes[0].innerHTML;

			if(name)
				name=name.substring(0,name.toLowerCase().indexOf('<br>'));
			
			if(window.XMLHttpRequest)
				str=parent.childNodes[4].childNodes[0].innerHTML;
			else
				str=parent.childNodes[2].childNodes[0].innerHTML;


			data=str.toLowerCase().split("<br>");
			for(var j=0;j<data.length;j++)
			{
				value=data[j].toLowerCase();
				if(value.indexOf('ends in')!=-1)
					ends_in=value.substring(8,value.length);
				else if(value.indexOf('ends')!=-1)
					ends=value.substring(4,value.length);
				else if(value.indexOf('starting bid')!=-1)
					startBid=value.substring(value.indexOf("$"),value.length);
				else if(data[j].toLowerCase().indexOf('buy')!=-1)
					buyPrice=value.substring(value.indexOf("$"),value.length);
				else if(data[j].toLowerCase().indexOf('reserve price')!=-1)
					reserveStatus=value.substring(14,value.length);
				else if(data[j].toLowerCase().indexOf('high bid')!=-1)
				{
					currentBid=value.substring(value.indexOf("$"),value.indexOf("--"));
					highestBidder=value.substring(value.indexOf("--")+2,value.length);
				}
				else if(data[j].toLowerCase().indexOf('next bid')!=-1)
					nextBid=value.substring(value.indexOf("$"),value.length);
			}		
		/*	
		alert(	"bid:"+bid+"\n"+
				"max:"+max+"\n"+
				"qty:"+qty+"\n"+
				"track:"+track+"\n"+
				"ends_in:"+ends_in+"\n"+
				"ends:"+ends+"\n"+
				"starting:"+startBid+"\n"+
				"buy:"+buyPrice+"\n"+
				"reserve:"+reserveStatus+"\n"+
				"currentBid:"+currentBid+"\n"+
				"highest bidder:"+ highestBidder+"\n"+
				"nextBid:"+nextBid);
	*/
			
			var record=createClickRecord();
			record[targetName]='Quick Bid';
			record[targetAuctionName]=name;
			record[targetAuctionURL]='http://www.campusauctionmarket.com/item.cgi?show_item='+auctions[i];
			record[bidAmount]=bid;
			record[maxBidAmount]=max;
			record[trackRequested]=track;
			record[bidQty]=qty;
			record[auctionStartingBid]=startBid;
			record[auctionCurrentBid]=currentBid;
			record[auctionMinNextBid]=nextBid;
			record[auctionBuyPrice]=buyPrice;
			record[auctionReservedStatus]=reserveStatus;
			record[auctionHighestBidder]=highestBidder;
			record[auctionTimeLeft]=ends_in;
			record[auctionEndDate]=ends;
			logRecord(record);
			//writeLog('Quick Bid|http://www.campusauctionmarket.com/item.cgi?show_item='+auctions[i]+'|'+name+'|'+bid+'|'+max+'|'+track+'|'+qty+'|'+startBid+'|'+currentBid+'|'+nextBid+'|'+buyPrice+'|'+reserveStatus+'|'+highestBidder+'|'+ends_in+'|'+ends);
		}
	}
}

function handleTextAnchorClick(anchor)
{
	if(anchor.innerHTML=='Ending')
	{
		var record=createClickRecord();
		record[targetName]='Sorted Display';
		record[targetURL]=anchor.href;
		record[targetSortBy]='Ending';
		logRecord(record);
		//writeLog('Category Display|'+anchor.href+'|Ending');	
	}
	else if(anchor.innerHTML=='Title')
	{
		var record=createClickRecord();
		record[targetName]='Sorted Display';
		record[targetURL]=anchor.href;
		record[targetSortBy]='Title';
		logRecord(record);
		//writeLog('Category Display|'+anchor.href+'|Title');	
	}
	else if(anchor.innerHTML=='Price')
	{
		var record=createClickRecord();
		record[targetName]='Sorted Display';
		record[targetURL]=anchor.href;
		record[targetSortBy]='Price';
		logRecord(record);
		//writeLog('Category Display|'+anchor.href+'|Price');	
	}
	else if(isCategoryLink(anchor.href)==2)
	{
		var record=createClickRecord();
		record[targetName]='Directory Display';
		record[targetCategoryName]=anchor.innerHTML;
		record[targetCategoryURL]=anchor.href;
		logRecord(record);
		//writeLog('Category Directory|'+anchor.href+'|'+anchor.innerHTML);
	}
	else if(anchor.href.toLowerCase().substring(0,58)=='http://www.campusauctionmarket.com/display.cgi?categories=')
	{
		var record=createClickRecord();
		record[targetName]='Directory Display';
		record[targetCategoryName]=anchor.innerHTML;
		record[targetCategoryURL]=anchor.href;
		logRecord(record);
		//writeLog('Category Directory|'+anchor.href+'|'+anchor.innerHTML);
	}
	else if(anchor.href.toLowerCase().substring(0,54)=='http://www.campusauctionmarket.com/item.cgi?show_item=')
	{
		var record=createClickRecord();
		record[targetName]='Category Auctions Display';
		record[targetAuctionName]=anchor.innerHTML;
		record[targetAuctionURL]=anchor.href;
		logRecord(record);
		//writeLog('Auction Details|'+anchor.href+'|'+anchor.innerHTML);
	}
	else
	{
		var record=createClickRecord();
		record[targetName]=anchor.innerHTML;
		record[targetURL]=anchor.href;
		logRecord(record);
		//writeLog('Link|'+anchor.href+"|"+anchor.innerHTML);
	}
}


function handleImageAnchorClick(img,anchor)
{
	
	if(isCategoryLink(anchor.href)==1)
	{
		var record=createClickRecord();
		record[targetName]='Directory Display';
		record[targetCategoryName]='All Categories';
		record[targetCategoryURL]=anchor.href;
		logRecord(record);
		//writeLog('Category Navigation|'+anchor.href+'|All Categories');
	}
	else if(anchor.href=='http://www.campusauctionmarket.com/index.htm')
	{
		var record=createClickRecord();
		record[targetName]='Home Page';
		record[targetURL]=anchor.href;
		logRecord(record);
		//writeLog('Home Page|'+anchor.href);
	}
		
	//else
		//alert('type=anchor2|'+img.alt+"|"+anchor.href);
}

function isCategoryLink(href)
{
	var s1=href.substring(0,40);
	if(s1=='http://www.campusauctionmarket.com/html/')
	{
		if(href.substring(40,54)=='categories.htm')
			return 1;
		else if(href.substring(40,49)=='category/')
			return 2;
	}
	return 0;
}

function decodeString(str)
{
	str=str.replace(/\?/g, "%3F");	
	str=str.replace(/=/g, "%3D");	
	str=str.replace(/&amp;/g, "%26");
	str=str.replace(/&nbsp;/g,"");
	str=str.replace(/&/g, "%26");	
	return str;
}
function getShowItemBidingInfos()
{
	var table=document.getElementsByTagName('table')[9];
	
	var parent=getNthRealChild(getNthRealChild(getNthRealChild(getNthRealChild(getNthRealChild(table,0),0),0),0),0);
	
	var 	node,startBid="",qty="",currentBid="",reserveStatus="",buyPrice="",noOfBids="",highestBidder="",
		startDate="",endDate="",seller="",sellerLocation="",bidIncrement="",minNextBid="",initialBid="",maxBid="",
		track="",qty2="",timeLeft="",categoryName="",name="";
	for(var i=0;i<parent.childNodes.length;i++)
	{
		node=getNthRealChild(parent,i);
		
		if(node!=null&&node.innerHTML.indexOf("Starting")!=-1)
			startBid=getNthRealChild(getNthRealChild(getNthRealChild(getNthRealChild(node,1),0),0),0).innerHTML;
		if(node!=null&&node.innerHTML.indexOf("Quantity")!=-1)
			qty=getNthRealChild(getNthRealChild(getNthRealChild(getNthRealChild(node,1),0),0),0).innerHTML;
			
		if(node!=null&&node.innerHTML.indexOf("Current Bid")!=-1)
			currentBid=getNthRealChild(getNthRealChild(getNthRealChild(node,1),0),0).innerHTML;
			
		if(node!=null&&node.innerHTML.indexOf("Reserve Status")!=-1)
			reserveStatus=getNthRealChild(getNthRealChild(node,1),0).innerHTML;
		
		if(node!=null&&node.innerHTML.indexOf("Buy Price")!=-1)
			buyPrice=getNthRealChild(getNthRealChild(node,1),0).innerHTML;
			
		if(node!=null&&node.innerHTML.indexOf("Number")!=-1)
			noOfBids=getNthRealChild(getNthRealChild(getNthRealChild(getNthRealChild(node,1),0),0),0).innerHTML;
			
		if(node!=null&&node.innerHTML.indexOf("Highest")!=-1)
			highestBidder=getNthRealChild(getNthRealChild(getNthRealChild(getNthRealChild(node,1),0),0),0).innerHTML;
			
		if(node!=null&&node.innerHTML.indexOf("Start Date")!=-1)
			startDate=getNthRealChild(getNthRealChild(getNthRealChild(getNthRealChild(node,1),0),0),0).innerHTML;

		if(node!=null&&node.innerHTML.indexOf("End Date")!=-1)
			endDate=getNthRealChild(getNthRealChild(getNthRealChild(getNthRealChild(node,1),0),0),0).innerHTML;
			
		if(node!=null&&node.innerHTML.indexOf("Seller:")!=-1)
			seller=getNthRealChild(getNthRealChild(getNthRealChild(getNthRealChild(node,1),0),0),0).innerHTML;
			
		if(node!=null&&node.innerHTML.indexOf("Location:")!=-1)
			sellerLocation=getNthRealChild(getNthRealChild(getNthRealChild(node,1),0),0).innerHTML;	
		
		
	}
	
	
	
	table=document.getElementsByTagName('table')[26];
	parent=getNthRealChild(getNthRealChild(getNthRealChild(getNthRealChild(getNthRealChild(table,0),0),0),0),0);
	if(parent==null)
		parent=getNthRealChild(table,0);

	for(var i=0;i<parent.childNodes.length;i++)
	{
		node=getNthRealChild(parent,i);
		if(node!=null&&node.innerHTML.indexOf("Increment:")!=-1)
			bidIncrement=getNthRealChild(getNthRealChild(getNthRealChild(node,1),0),0).innerHTML;	
			
		if(node!=null&&node.innerHTML.indexOf("Min")!=-1)
			minNextBid=getNthRealChild(getNthRealChild(node,1),0).innerHTML;			
	}	
	
	
	var auctionId=getQuickBidingAuctionIds(document.getElementsByTagName('INPUT'))[0];
	initialBid=document.getElementsByName(auctionId)[0].value;
	if(document.getElementsByName(auctionId+'-max').length>0)
		maxBid=document.getElementsByName(auctionId+'-max')[0].value
	else
		qty2=document.getElementsByName(auctionId+'-q')[0].value;
		
	track=document.getElementsByName(auctionId+'-track')[0].checked;
	
	
	
	table=document.getElementsByTagName('table')[13];
	timeLeft=getNthRealChild(getNthRealChild(getNthRealChild(getNthRealChild(table,0),1),0),0).innerHTML;
	if(timeLeft.indexOf("<br>")!=-1)
		timeLeft=timeLeft.substring(timeLeft.indexOf("<br>")+4);
		
	node=getNthRealChild(getNthRealChild(getNthRealChild(getNthRealChild(getNthRealChild(table,0),2),1),0),0);
	
	categoryName="<a href=\""+node.href+"\">"+node.innerHTML+"</a>";
	
	
	table=document.getElementsByTagName('table')[8];
	name=getNthRealChild(getNthRealChild(getNthRealChild(getNthRealChild(table,0),4),0),0).innerHTML;
	
	
	var record=createClickRecord();
	record[targetName]='Bid';
	record[targetAuctionName]=name;
	record[targetAuctionURL]='http://www.campusauctionmarket.com/item.cgi?show_item='+auctionId;
	record[targetCategoryName]=categoryName;
	record[bidAmount]=initialBid;
	record[maxBidAmount]=maxBid;
	record[trackRequested]=track;
	record[bidQty]=qty2;
	record[auctionStartingBid]=startBid;
	record[auctionCurrentBid]=currentBid;
	record[auctionBidIncrement]=bidIncrement;
	record[auctionMinNextBid]=minNextBid;
	record[auctionBuyPrice]=buyPrice;
	record[auctionAvaQty]=qty;
	record[auctionReservedStatus]=reserveStatus;
	record[auctionNumberOfBids]=noOfBids;
	record[auctionHighestBidder]=highestBidder;
	record[auctionTimeLeft]=timeLeft;
	record[auctionStartDate]=startDate;
	record[auctionEndDate]=endDate;
	record[auctionSellerLocation]=sellerLocation;
	record[auctionSeller]=seller;
	logRecord(record);

	//writeLog('Bid|http://www.campusauctionmarket.com/item.cgi?show_item='+auctionId+'|'+name+'|'+categoryName+'|'+initialBid+'|'+maxBid+'|'+track+'|'+qty2+'|'+startBid+'|'+currentBid+'|'+bidIncrement+'|'+minNextBid+'|'+buyPrice+'|'+qty+'|'+reserveStatus+'|'+noOfBids+'|'+highestBidder+'|'+timeLeft+'|'+startDate+'|'+endDate+'|'+sellerLocation+'|'+seller);
}

function getNthRealChild(node,n)
{
	var k=0;
	for(var i=0;i<node.childNodes.length;i++)
	{		
		if(node.childNodes[i].innerHTML)
		{
			if(k==n)
				return node.childNodes[i];
			k++;
		}	
	}
	return null;
}