function A2L(videoID, videoTitle, userID)
{
	var currentDate = new Date();
	var uniqueValue = Date.UTC(currentDate.getYear(), currentDate.getMonth(), currentDate.getDay(), currentDate.getHours(), currentDate.getMinutes(), currentDate.getSeconds(), currentDate.getMilliseconds());
	
	var buttonImages = document.getElementsByName('a2l_' + videoID);
	
	for(var buttonIndex = 0 ; buttonIndex < buttonImages.length ; buttonIndex++)
	{
		var isAddToList = buttonImages[buttonIndex].src.toLowerCase().indexOf("addtolist") != -1;
		var isAdding = buttonImages[buttonIndex].src.toLowerCase().indexOf("adding") != -1;
		
		if(isAddToList)
		{
			var addToListCallSrc = '/rentalqueue/addproduct.aspx?showui=false&queueProductIDs=' + videoID ;
			var filename = buttonImages[buttonIndex].src.toLowerCase().replace("addtolist", "adding");
			
			var title = buttonImages[buttonIndex].alt;
			var posStart = title.indexOf("\"");
			var posEnd = title.lastIndexOf("\"");
			if(posStart != -1 && posEnd != -1)
				title = title.substring(posStart, posEnd + 1);
			else
				title = "This title";
			
			var alt = "adding " + title + " to your list";
			
			buttonImages[buttonIndex].src = filename;
			buttonImages[buttonIndex].alt = alt;
			
			var a2lCallImgage = new Image();
			a2lCallImgage.onload = function() {a2lCallBack(videoID, a2lCallImgage, userID, videoTitle)};
			a2lCallImgage.src = addToListCallSrc + '&uv=' + uniqueValue;
			
			
		}
		else if(isAdding)
		{
		}
		else	
		{
			window.location.href = "/rentalqueue/mylist.aspx?productID=" + videoID;
		}
	}
}

function a2lCallBack(vid, image, userID, videoTitle)
{
	if(image.width == 2)
	{
		//change the add to list button to added to list
		//get all the buttons on the page for the particular video
		var buttonImages = document.getElementsByName('a2l_' + vid);
	
		for(var buttonIndex = 0 ; buttonIndex < buttonImages.length ; buttonIndex++)
		{
			//get the added image url
			var filename = buttonImages[buttonIndex].src.toLowerCase().replace("adding", "added");
			
			//get the title of the disc
			var title = buttonImages[buttonIndex].alt;
			var posStart = title.indexOf("\"");
			var posEnd = title.lastIndexOf("\"");
			if(posStart != -1 && posEnd != -1)
				title = title.substring(posStart, posEnd + 1);
			else
				title = "This title";
			
			//get the new alt text string
			var alt = title + " is in your List - Click to View";
			
			//change the image url and the alt text
			buttonImages[buttonIndex].src = filename;
			buttonImages[buttonIndex].alt = alt;
		}		
		
		try
		{
			var pageTracker = _gat._getTracker("UA-534229-1");
			pageTracker._initData();
			pageTracker._addTrans(userID,"","0.01","","","","","");
			pageTracker._addItem(userID, videoTitle, "Add to list", "Add to list", "0.01", "1");
			pageTracker._trackTrans();
		}
		catch(e)
		{
			// does the textarea already exist?
			var t = document.getElementById('utmtrans');
			if (!t) {
				// if not, create and add it
				var d = document.createElement('div');
				d.setAttribute("style", "display:none;");
				d.style.cssText = "display:none;";
				var f = document.createElement('form');
				f.setAttribute("style", "display:none;");
				f.style.cssText = "display:none;";
				d.appendChild(f);
				f.id = "utmform";
				t = document.createElement('textarea');
				t.id = "utmtrans";
				f.appendChild(t);
				document.body.appendChild(d);
			}
			
			// construct record information in the textarea
			t.value = "UTM:T|" + userID + "||0.01|||||\n";
			t.value += "UTM:I|" + userID + "|" + videoTitle + "|Add to List|Add to List||0.01|0.01\n";

			// call google analytics transaction tracking			
			__utmSetTrans();
		}
		
	}
	if(image.width == 4)
	{
		window.location.href = '/rentalqueue/addproduct.aspx?showui=true&queueProductIDs=' + vid + '&href=' + getURL();
	}
	else if(image.width == 3)
	{
		//TEMP MEASURE
		//change the add to list button to added to list
		//get all the buttons on the page for the particular video		
		var buttonImages = document.getElementsByName('a2l_' + vid);
	
		for(var buttonIndex = 0 ; buttonIndex < buttonImages.length ; buttonIndex++)
		{
			//get the added image url
			var filename = buttonImages[buttonIndex].src.toLowerCase().replace("adding", "addtolist");
			
			//get the title of the disc
			var title = buttonImages[buttonIndex].alt;
			var posStart = title.indexOf("\"");
			var posEnd = title.lastIndexOf("\"");
			if(posStart != -1 && posEnd != -1)
				title = title.substring(posStart, posEnd + 1);
			else
				title = "This title";
			
			//get the new alt text string
			var alt = "Add " + title + " To Your List";
			
			//change the image url and the alt text
			buttonImages[buttonIndex].src = filename;
			buttonImages[buttonIndex].alt = alt;
		}		
	}	
}

function getURL()
{
	var url = location.href;
	//remove the http:// bit
	url = url.replace("http://","");
	//remove the host
	url = url.substring(url.indexOf("/"), url.length);
	
	//encode all the characters so not to interfere with the rest of the querystring
	url = encodeURIComponent(url);
	
	return url;
}

function printBasicSearch()
{
	document.write("<input type='text' id='f1' name='field' class='siteSearch' onkeypress='return noenter(event)'><a ID='hypSearch' href='javascript:DoBasicSearch();'><img alt='Search' border='0' align='absmiddle' width='15' height='24' src='/bbimages/UK/buttons/BlueArrowOnWhite.gif' /></a><input type='text' name='field2' onkeypress='return false' style='visibility:hidden;width:1px'>");
}