//
// AdScript v2.0 by Marcin Marszalek <azzie@astronet.pl>
// http://www.astronet.pl/
//
// Feel free to use this script anywhere and to change it
// to suit your needs, but please, leave the copyright above
//

//
// Configuration section
//

var border = 0;        // Sets border size around ads
var target = "_blank"; // Sets target frame for ads' urls

var chance = 100;       // Sets the chance that rotated ad will be shown
var latency = 10000;    // Sets rotation time in ms for rotated ad

var width = 400;       // Sets ads' dimensions
var height = 50;

	// To add a new ad, just copy the last entry
	// from below and increase entry position number by one

var ads = new Array();
var rot = new Array();

	
	// Start of standard ad entry




ads[0] = new ad(             // Here you have entry position number!
	"http://www.astronomia.pl/baner_n.php?18",     // Image location
	"http://www.astronomia.pl/baner_p.php?18", // Destination URL
	"Polski Portal Astronomiczny ASTRONOMIA.PL"    // Image description
);	

ads[1] = new ad(             // Here you have entry position number!
	"banery/astrofotografia.gif",            // Image location
	"http://www.astrofotografia.dip.pl/", // Destination URL
	"Astrofotografia"                // Image description
);


ads[2] = new ad(             // Here you have entry position number!
	"banery/banw_mti.jpg",            // Image location
	"http://www.meteoryt.z.pl", // Destination URL
	""                // Image description
);


ads[3] = new ad(             // Here you have entry position number!
	"http://ads.astronet.pl/banner/astronet_n.cgi?view&58",            // Image location
	"http://ads.astronet.pl/banner/astronet_n.cgi?hit&58", // Destination URL
	"Astronet"                 // Image description
);


ads[4] = new ad(             // Here you have entry position number!
	"http://www.astrovision.pl/data/banner400x50.gif",            // Image location
	"http://www.astrovision.pl", // Destination URL
	"AstroVisioN - Internetowy Portal Astronomiczny"       // Image description
);		


ads[5] = new ad(             // Here you have entry position number!
	"banery/ssw-baner.gif",            // Image location
	"http://sswdob.republika.pl", // Destination URL
	"Wizualne obserwacje gwiazd zmiennych"                // Image description
);	


ads[6] = new ad(             // Here you have entry position number!
	"http://astro_zone.w.interia.pl/baner2.gif",            // Image location
	"http://http://www.astro-zone.go.pl", // Destination URL
	"Strona domowa Grzegorza Czechowskiego"                // Image description
);	


ads[7] = new ad(             // Here you have entry position number!
	"banery/NGBanerBig.gif",            // Image location
	"http://gwiazdozbiory.eulersoft.com.pl", // Destination URL
	"Nasze Gwiazdozbiory"                // Image description
);	


ads[8] = new ad(             // Here you have entry position number!
	"http://www.astrohobby.pl/images/astrohobby_portal.jpg",            // Image location
	"http://www.astrohobby.pl", // Destination URL
	"ASTROHOBBY.PL - Polski Portal Astronomiczny"                // Image description
);


//
// Code section
// Do not change anything below this line
//

function ad(src,url,alt)
{
	this.src=src;
	this.url=url;
	this.alt=alt;
}

var t = Math.floor(Math.random()*100);

function adinit()
{
//	if (t >= chance) adload();
}

if (t < chance)
{
	var i,r;
	var src,url,alt;

	for (i=0;ads[i];i++);
	r=Math.floor(Math.random()*i);

	src=ads[r].src;
	alt=ads[r].alt;
	url=ads[r].url;

	document.write('<A HREF="',url,'" TARGET="',target,'">',
		'<IMG SRC="',src,'" ALT="',alt,'" BORDER="',border,'" WIDTH=',width,' HEIGHT=',height,'></A>');

} else {

	var cache = new Array();
	var j;
	var s;

	function adload()
	{
		for (i=0;rot[i];i++)
		{
			cache[i] = new Image();
			cache[i].src = rot[i].src;
		}
		for (j=0;document.links[j];j++)
		{
			s=document.links[j].href;
			if (s.substring(s.lastIndexOf("#"),s.length) == "#adlink") break;
		}
		
		r=Math.floor(Math.random()*i);

		change(r);
	}

	function change(n) {
		if ( n == i ) n = 0;
		document.images["adimg"].src = cache[n].src;
		document.links[j].href = rot[n].url;
		document.images["adimg"].alt = rot[n].alt;
		setTimeout ("change("+(n+1)+")",latency);
	}

	document.write('<A TARGET="',target,'" HREF="#adlink" ALT="">',
		'<IMG WIDTH=',width,' HEIGHT=',height,' BORDER="',border,'" NAME=adimg></A>');
}

//
// End of AdScript
//
