// written by Nathan Morris

var sc = 4;                   
var s = new Array(sc);          

s[0] = 'Want to go <font color="red"><i>faster</i></font>?<br><br>Check out our "The Definitive Guide to Low-Buck Performance" eBook!<br><br><a href="http://www.ultimateresourceguides.com/cgi-bin/count.cgi?www.ultimateresourceguides.com/low-buck/index.html" onclick="exit=false">Click Here</a>';
s[1] = 'Get our <font color="red">newsletter</font> filled with useful information, tips, updates, and exclusive articles delivered to your inbox. It\'s free, and it\'s useful!<br><br><a href="http://www.ultimateresourceguides.com/cgi-bin/count.cgi?www.ultimateresourceguides.com/resources/newsletter.html" onclick="exit=false">Click Here</a> to sign up';
s[2] = '<font color="red">94-97</font> Honda Accord?<br><br>Check out our "Ultimate H22A Swap Guide" eBook!<br><br><a href="http://www.ultimateresourceguides.com/cgi-bin/count.cgi?www.ultimateresourceguides.com/h22swap-9497/index.html" onclick="exit=false">Click Here</a>';
s[3] = '<font color="red">90-93</font> Honda Accord?<br><br>Check out our "Ultimate H22A Swap Guide" eBook!<br><br><a href="http://www.ultimateresourceguides.com/cgi-bin/count.cgi?www.ultimateresourceguides.com/h22swap-9093/index.html" onclick="exit=false">Click Here</a>';

var myNumArray = crRand( sc, 0, sc-1 );

function crRand(num_elements,min,max)
{
   	var temp, nums = new Array;
	for (var element=0; element<num_elements; element++)
	{
       	while((temp=numFound(random_number(min,max),nums))==-1);
       	nums[element] = temp;
	}
	return (nums)
}

function numFound (random_number,number_array)
{
   	for (var element=0; element<number_array.length; element++)
	{
    	if (random_number==number_array[element]) return (-1);
    }
    return (random_number);
}

function random_number( min, max )
{
   	return (Math.round((max-min) * Math.random() + min));
}
   
function showAd(number) {
	document.write('<table width="120" border="0"bgcolor="#336699">');
	document.write('<tr><td align="right" valign="top" class="sidebar">');
	document.write('<font color="#FFFFFF">URG Sidebar ::.</font>&nbsp;</td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td bgcolor="#FFFFFF" class="sidetext">');
	document.writeln(s[number]);
	document.write('</td>');
	document.write('</tr>');
	document.write('</table>');
	document.write('<p></p>');
}
	
if (number_ads < 1) { number_ads = 1; }
if (number_ads > sc) { number_ads = sc; }

for (var i = 0; i < number_ads; i++) {
	showAd(myNumArray[i]);
}
