// Simple banner rotator
// (c) spyka Web Group 2008
// version info: 1.1.2
// Download & support: http://www.spyka.net
// Forums: http://www.spyka.net/forums
// Please keep this notice in place

function banner(name, url, image, date)
{
	this.name	= name;
	this.url	= url;
	this.image	= image;
	this.date	= date;
}

var banners = new Array();
///////////////////////////////////////////////////////////////////////////////////
//
//         						START EDITS HERE
//
///////////////////////////////////////////////////////////////////////////////////

// Full documentation & support: http://www.spyka.net/forums 

// if 1, all images will be resized to img_width and img_height, else images will display their correct size
var force_size	= 1;
// desired height and width of images, only takes affect if above is = 1
var img_width	= 400;
var img_height	= 120;

// banner list syntax: banners[x] = new banner(website_name, website_url, website_image_url, show_until_date);  DATE FORMAT: dd/mm/yyyy
banners[0] = new banner('We buy', 'http://www.webuy.co.nz/register.php?ref=Reusable', 'http://www.reusable.co.nz/header/webuyNZauction300x60.gif', '20/11/2010');
banners[1] = new banner('Buy New Zealand made and support kiwis click here now .....', 'http://ProductsFromNZ.com/625', 'http://www.reusable.co.nz/header/productsfromnz-bigbanner.jpg', '20/11/2010');
banners[2] = new banner('Pop web city classifieds, click here Now.....', 'http://www.popwebcity.com/ShoppersRegistration.aspx?RefID=AR586', 'http://www.reusable.co.nz/header/popwebcity-largetopbanner.jpg', '20/11/2010');
banners[3] = new banner('', 'http://www.newzealandnz.co.nz/banners/cgi-bin/adcredir.pl', 'http://www.newzealandnz.co.nz/banners/cgi-bin/adcnet.pl?kiwilite&0.9560893145560819', '20/11/2010');
banners[4] = new banner('Be PaintWise! Bring unwanted paint and paint containers into your local Resene ColorShop and let us recycle or dispose of them responsibly. Resene will offer good quality Resene paint to community groups for reuse, recycle packaging materials that are recyclable, send solventborne paints to solvent recovery, find alternative uses for waterborne paints, such as graffiti abatement, and dispose of the rest for you. ', 'http://www.resene.co.nz/paintwise.htm', 'http://www.resene.co.nz/comn/envissue/picts/paintwise_450.jpg', '20/11/2010');
banners[5] = new banner('Be PaintWise!  Bring unwanted paint and paint containers into your local Resene ColorShop and let us recycle or dispose of them responsibly. Resene will offer good quality Resene paint to community groups for reuse,', 'http://www.resene.co.nz/paintwise.htm', 'http://www.reusable.co.nz/header/enviro.JPG', '20/11/2010');
banners[6] = new banner('"Be PaintWise!"  Bring unwanted paint and paint containers into your local Resene ColorShop and let us recycle or dispose of them responsibly. Resene will offer good quality Resene paint to community groups for reuse,', 'http://www.resene.co.nz/paintwise.htm', 'http://www.resene.co.nz/comn/envissue/picts/resenefoundation.jpg', '20/11/2010');



///////////////////////////////////////////////////////////////////////////////////
//
//         						END EDITS HERE
//
///////////////////////////////////////////////////////////////////////////////////

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 		= '<a href="' + bn.url + '" title="' + bn.name + '" target="_blank"><img border="0" src="' + bn.image + '"' + image_size + ' alt="' + bn.name+ '" /></a>';
	
	// 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();
}
