// JavaScript Document

//fixSale('sale1');
//fixSale('sale2');

fixSales();

function fixSales() {
	obj1 = document.getElementById('sale1');
	saleText1 = obj1.innerHTML;
	obj2 = document.getElementById('sale2');
	saleText2 = obj2.innerHTML;
	
//	alert('['+saleText1 + '] [' + saleText2+ ']');
	theArray1 = saleText1.match(/(.*)\<.*code.(.*).at.*xpires.(.*)\</);
	theArray2 = saleText2.match(/(.*)\<.*code.(.*).at.*xpires.(.*)\</);
	obj1.innerHTML = "<img src='http://www.beatgopgear.com/skin/default/images/bullet_sale.gif'>&nbsp;<b>"+theArray1[1]+"</b> use the code <b>"+theArray1[2]+"</b> at checkout. Expires "+theArray1[3];

// Doesn't work because the two texts seem to be including the scripts???
	if (theArray1[2] == theArray2[2])
	{	
		obj2.innerHTML = '';
		obj1.innerHTML = '<span style="font-size:130%">'+obj1.innerHTML+'</span>';
	}
	else {
		obj2.innerHTML = "<img src='http://www.beatgopgear.com/skin/default/images/bullet_sale.gif'>&nbsp;<b>"+theArray2[1]+"</b> use the code <b>"+theArray2[2]+"</b> at checkout. Expires "+theArray2[3];
	}

		
}

