
function banner(name, url, image, margin, date)
{
	this.name	= name;
	this.url	= url;
	this.image	= image;
	this.margin = margin;
	this.date	= date;
}

var banners = new Array();


// if 1, all images will be resized to img_width and img_height, else images will display their correct size
var force_size	= 0;
// desired height and width of images, only takes affect if above is = 1
var img_width	= 728;
var img_height	= 90;

// banner list syntax: banners[x] = new banner(website_name, website_url, margin_top_right_bottom_left, website_image_url, show_until_date);  DATE FORMAT: dd/mm/yyyy
//banners[0] = new banner('AwesomeStyles', 'http://www.awesomestyles.com', 'http://www.awesomestyles.com/images/aimg/728x90-1.gif', '30/04/2009');
//banners[1] = new banner('spyka.net Webmaster', 'http://www.spyka.net', 'http://spyka.net/images/88x31.jpg', '10/04/2009');


function show_banners()
{
	var am = banners.length;
	var rand = Math.floor(Math.random()*am);	
	var bn = banners[rand];
	
	var image_size = (force_size == 1) ? ' width="' + img_width + '" height="' + img_height + '"' : '';
	var html = '<div style="text-align:center; margin:' + bn.margin + ';">';
	html = html + '<a href="' + bn.url + '" title="' + bn.name + '" target="_blank"><img border="0" src="' + bn.image + '"' + image_size + ' alt="' + bn.name+ '" /></a>';
	html = html + '</div>';
	// get current date string
	var now = new Date(); 
	
	var input = bn.date;
	input = input.split('/', 3);
	var end_date = new Date();
	end_date = end_date.setFullYear(parseFloat(input[2]), parseFloat(input[1]), parseFloat(input[0]));
	
	
	//(now < end_date) ? document.write(html) : show_banners();
	//(Date.parse(now) < Date.parse(bn.date)) ? alert(now) : alert(bn.date);
	//alert()
	(Date.parse(now) < Date.parse(bn.date)) ? document.write(html) : document.write('');
}

