var pid = null;
var venue = null;
var sz = "80x15";

function parseopts()
{
	if(typeof _boxxetopts !="undefined" && _boxxetopts!=null)
	{
		if (typeof(_boxxetopts.boxxetId)=='string')
			pid = _boxxetopts.boxxetId;
		if (typeof(_boxxetopts.size)=='string')
			sz = _boxxetopts.size;	
		if (typeof(_boxxetopts.venue)=='string')
			venue = _boxxetopts.venue;	
	}
	_boxxetopts=null;
}
function scanspan()
{
	var els = document.getElementsByTagName('span')
	var sw = new RegExp("(^|\\s)boxxetId_");
	var ew = new RegExp("_ph($|\\s)");
	var bothExp = new RegExp("(^|\\s)boxxetId_(.*)_ph($|\\s)");
	var count = 0;
	var bId;
	for(var i = 0; i < els.length; i++)
	{
		var el = els[i];
		var name = el.getAttribute('name');
		if(name && sw.test(name) && ew.test(name))
		{
			bId = name.replace(sw,'');
			bId = bId.replace(ew,'');
			el.parentNode.removeChild(el);
			count++;
		}
	}
	return bId;
}
function execute()
{
	parseopts();
	param = scanspan();
	if (!pid)
		pid = param;
	if (!venue)
		venue='boxxet';
	var venueHost = venue+'.com';
	var host = "http://api.boxxet.com/";
	var szArr = sz.split("x");
	var szX = parseInt(szArr[0]);
	var szY = parseInt(szArr[1]);
	var qryId = '';
	if(pid)
		qryId = '?boxxetId='+pid;
	if(venueHost=='boxxet.com')
		venueHost='www.boxxet.com';
	document.write('<a href="http://'+venueHost+'/'+qryId+'">');
	document.write('<img width="'+szX+'" height="'+szY+'" border="0" src="'+host+'static/'+venue+'/img/badge_'+sz+'.gif">');
	document.write('</a>');
}
execute();


