var ad_spots = new Object;
var ad_spot_codes = new Object;
var ad_spot_zones = new Object;
							 // name      // zone	// width, height
ad_spot_codes.leaderboard = ['a9dd1509', 	1, 			728, 90]
ad_spot_codes.footer = 		['a64cd0cb', 	5, 			728, 90]
ad_spot_codes.middle = 		['a69cf99e', 	4, 			468, 60]
ad_spot_codes.sidebar1 = 	['af3b846e', 	2, 			300, 250]
ad_spot_codes.sidebar2 = 	['a7edc46b', 	3, 			300, 250]

function displayAds()
{
	// Loop through each spot and insert the iFrame.
	for (var spot in ad_spots)
	{
		var zone = ad_spots[spot]
		var ad = ad_spot_codes[zone]
		
		code = ad[0]
		zone_id = ad[1]
		width = ad[2]
		height = ad[3]
		
		div = document.getElementById(spot)
		
 		html = "<iframe id='"+ code +"' name='"+ code +"' src='http://www.eviplist.com/ads/www/delivery/afr.php?n="+ code +"&amp;zoneid="+zone_id+"' framespacing='0' frameborder='no' scrolling='no' width='"+ width +"' height='"+ height +"'>";
		html += "<a href='http://www.eviplist.com/ads/www/delivery/ck.php?n="+ code +"' target='_blank'>";
		html += "<img src='http://www.eviplist.com/ads/www/delivery/avw.php?zoneid="+ zone_id +"&amp;n="+ code + "' border='0' alt='' /></a></iframe>";
		
		div.innerHTML = html
	}
	
	// Include the OpenX javascript at the end of the page.
	$('body').innerHTML += "<script type='text/javascript' src='http://eviplist.com/ads/www/delivery/ag.php'></script>"
}

function load_menu(x,menu_items) {
	var len = (menu_items.length) - 1;
	var menu_pre;
	var menu_post;
	var menu;
	var per;
	var post;
	var factor = 10;
	per = x-1;
	post = x+1;
	//1 = 0-9
	//2 = 10-19
	//3 = 20-29
	menu = "<strong>POPULAR TOPICS:</strong>";
	z2 = x * factor;
	z1 = z2 - factor;
	if(z2 > len) z2 = len;

	if(z1 > 0) menu_pre = '<strong><a href="#" onclick="load_menu('+per+',menu_items);">&laquo; Prev</a></strong>';
	else menu_pre = '';

	menu += menu_pre;
	for (var i = z1; i < z2; i++)
	{
		menu += menu_items[i];
	}
	
	if(z2 < len) menu_post = '<strong><a href="#" onclick="load_menu('+post+',menu_items);">Next &raquo;</a></strong>';
	else menu_post = '';
	menu += menu_post;

	document.getElementById("sub_categories").innerHTML = menu;
	document.getElementById('sub_categories').className = 'show_sub_categories'
}