
// Ninja Piglet Dojo Webcomic Link Exchange v1.0 by pOnju
//
// Original banner ad rotator by
/****
* Banner Ad Rotater v3.02
* Anarchos > anarchos3@hotmail.com
* http://anarchos.xs.mw/bannerad.phtml
**/

function goto_URL(object) {
    open(object.options[object.selectedIndex].value)
};

function Banner(refreshTime, width, height, altText, start, random){
	this.objName = "piggyAd" + (Banner.count++);
	eval(this.objName + "=this");
	if (!refreshTime) this.refreshTime = 60000; else this.refreshTime = refreshTime*1000;
	if (!width) this.width = 200; else this.width = width;
	if (!height) this.height = 40; else this.height = height;
	if (random == null) this.random = 1; else this.random = random;
	this.altText = altText;
	this.ads = [];
	if (start) this.currentAd = start-1; else start = null;
	this.mySize = 0;

	this.Ad = function(src, href, target, mouseover) {
		var tempImage = new Image();
		tempImage.src = src;
		this.ads[this.mySize] = new Object();
		var ad = this.ads[this.mySize];
		ad.src = src;
		if (typeof(target) == "undefined" || target == null) ad.target = "_blank"; else ad.target = target;
		ad.href = href;
		ad.mouseover = mouseover;
		this.mySize++;
	}

	this.link = function(){
		var	ad = this.ads[this.currentAd];
		if (ad.target == "_self"){
			location.href = ad.href;
		}
		else if (ad.target == "_blank" || ad.target == "_blank"){
			open(ad.href,this.objName + "Win");
		}
		else top.frames[ad.target].location.href = ad.href;
	}

	this.showStatus = function(){
		var ad = this.ads[this.currentAd];
		if (ad.mouseover) status = ad.mouseover;
		else status = ad.href;
	}

	this.randomAd = function(){
		var n;
		do { n = Math.floor(Math.random() * (this.mySize)); } 
		while(n == this.currentAd);
		this.currentAd = n;
	}

	this.output = function(){
		var tempCode = "";
		if (this.mySize > 1){
			if (this.currentAd == null) this.randomAd();
			if (this.currentAd >= this.mySize) this.currentAd = this.mySize - 1;
			tempCode = '<a href="javascript:'+this.objName+'.link();"';
			tempCode += ' onMouseOver="' + this.objName + '.showStatus(); return true"';
			tempCode += ' onMouseOut="status=\'\';return true">';
			tempCode += '<img src="' + this.ads[this.currentAd].src + '" width="' + this.width;
			tempCode += '" name="' + this.objName + 'Img" height="' + this.height + '" ';
			if (this.altText) tempCode += 'alt="'+this.altText + '" ';
			tempCode += 'border="0" /></a>';
			document.write(tempCode);
			this.nextAd();
		} else document.write("Error: two banners must be defined for the script to work.");
	}

	this.newAd = function(){
		if (!this.random){	
			this.currentAd++;
			if (this.currentAd >= this.mySize)
			   this.currentAd = 0;
		}
		else {
			this.randomAd();
		}
		this.nextAd();
	}

	this.nextAd = function(){
		document.images[this.objName+ 'Img'].src = this.ads[this.currentAd].src;
		setTimeout(this.objName+'.newAd()',this.refreshTime)
	}
}
Banner.count = 0;
document.writeln('<TABLE width=200 bgcolor="#666699" BORDER="0" CELLSPACING="0" CELLPADDING="0"><FORM><TR><TD colspan=2>');

myAd = new Banner(15,200,40,"",0,0);
myAd.Ad("http://chibi.pixelatedempire.net/gfx/NPDban1.gif","http://chibi.pixelatedempire.net/","_blank","32-Bit Orchestra");
myAd.Ad("http://www.ponju.com/piggydojo/blatah.jpg","http://blatah.keenspace.com","_blank","Blatah&#33;");
myAd.Ad("http://www.ponju.com/piggydojo/bluedreaming.jpg","http://xepher.net/~jun","_blank","Blue Dreaming");
myAd.Ad("http://www.burningprose.com/images/bp200x40.GIF","http://www.burningprose.com/","_blank","Burning Prose");
myAd.Ad("http://www.cafenox.net/images/ciban.gif","http://www.cafenox.net/","_blank","Café Nox");
myAd.Ad("http://i73.photobucket.com/albums/i215/Yukime89/yukimesigbanner4vh.jpg","http://yukime.kawanda.net","_blank","Calamity Academy");
myAd.Ad("http://i11.photobucket.com/albums/a180/yuko00/cdbannerpiggy.png","http://cdance.comicgenesis.com/","_blank","Coyote Dance");
myAd.Ad("http://img120.imageshack.us/img120/1122/fcbbanner56ua.png","http://weird-remnants.com/","_blank","FletusCanisBellicus");
myAd.Ad("http://www.jimmysworld.net/links/linkbanner1.jpg","http://www.jimmysworld.net/","_blank","Jimmy&#39;s World");
myAd.Ad("http://i13.photobucket.com/albums/a294/pukuu/banner.gif","http://www.livejournal.com/community/loli_design","_blank","Lolita Designs");
myAd.Ad("http://palabok.com/lovaria/images/la200x40.jpg","http://drunkduck.com/Lovarian_Adventures/","_blank","Lovarian Adventures");
myAd.Ad("http://img231.imageshack.us/img231/6482/oolb35es.jpg","http://www.strangecandy.net","_blank","OO: Strange Candy");
myAd.Ad("http://rankline.com/downloads/rankline.gif","http://www.rankline.com","_blank","RANKLine");
myAd.Ad("http://img295.imageshack.us/img295/8057/remembrance200x402ef.jpg","http://remembrance.keenspace.com","_blank","Remembrance");
myAd.Ad("http://www.ponju.net/External/rombtop.jpg","http://www.jushin-manga.com","_blank","RulesOfMakeBelieve");
myAd.Ad("http://www.twosparrows.5gigs.com/images/banner20040.gif","http://sexpercussions.spiderforest.com/","_blank","Sex Percussions");
myAd.Ad("http://img171.imageshack.us/img171/3752/15lp.gif","http://bart.keenspace.com","_blank","The Holy Strawberry");
myAd.Ad("http://www.vaultofages.net/link_img.jpg","http://www.vaultofages.net/","_blank","The Vault of Ages");
myAd.Ad("http://img.photobucket.com/albums/v84/Naoyo/Random/Usagi_no_Mori_banner_01.gif","http://usaginomori.comicgen.com/","_blank","Usagi no Mori");
myAd.Ad("http://www.ponju.com/piggydojo/wish3.jpg","http://www.wish3.net","_blank","Wish³");

myAd.output();

document.writeln('<\/td><\/tr>');
document.writeln('<TR><TD align="left"><SELECT NAME="selectName" onChange="goto_URL(this.form.selectName)">');
// Web Exchange Home
document.write('<OPTION VALUE="http://www.ponju.net/ninja_piggy_dojo.php">The Ninja Piglet Dojo<\/OPTION>');
document.write('<OPTION VALUE="http://chibi.pixelatedempire.net/">32-Bit Orchestra<\/OPTION>');
document.write('<OPTION VALUE="http://blatah.keenspace.com">Blatah&#33;<\/OPTION>');
document.write('<OPTION VALUE="http://xepher.net/~jun">Blue Dreaming<\/OPTION>');
document.write('<OPTION VALUE="http://www.burningprose.com/">Burning Prose<\/OPTION>');
document.write('<OPTION VALUE="http://www.cafenox.net/">Café Nox<\/OPTION>');
document.write('<OPTION VALUE="http://yukime.kawanda.net">Calamity Academy<\/OPTION>');
document.write('<OPTION VALUE="http://cdance.comicgenesis.com/">Coyote Dance<\/OPTION>');
document.write('<OPTION VALUE="http://weird-remnants.com/">FletusCanisBellicus<\/OPTION>');
document.write('<OPTION VALUE="http://www.jimmysworld.net/">Jimmy&#39;s World<\/OPTION>');
document.write('<OPTION VALUE="http://www.livejournal.com/community/loli_design">Lolita Designs<\/OPTION>');
document.write('<OPTION VALUE="http://drunkduck.com/Lovarian_Adventures/">Lovarian Adventures<\/OPTION>');
document.write('<OPTION VALUE="http://www.strangecandy.net">OO: Strange Candy<\/OPTION>');
document.write('<OPTION VALUE="http://www.rankline.com">RANKLine<\/OPTION>');
document.write('<OPTION VALUE="http://remembrance.keenspace.com">Remembrance<\/OPTION>');
document.write('<OPTION VALUE="http://www.jushin-manga.com">RulesOfMakeBelieve<\/OPTION>');
document.write('<OPTION VALUE="http://sexpercussions.spiderforest.com/">Sex Percussions<\/OPTION>');
document.write('<OPTION VALUE="http://bart.keenspace.com">The Holy Strawberry<\/OPTION>');
document.write('<OPTION VALUE="http://www.vaultofages.net/">The Vault of Ages<\/OPTION>');
document.write('<OPTION VALUE="http://usaginomori.comicgen.com/">Usagi no Mori<\/OPTION>');
document.write('<OPTION VALUE="http://www.wish3.net">Wish³<\/OPTION>');

document.writeln('<\/SELECT><\/TD>');
document.writeln('<TD align="right"><a href="http://www.ponju.net/ninja_piggy_dojo.php"><img src="http://www.ponju.com/pbeicon.gif" border=0 alt="The Ninja Piggy Dojo"><\/A><\/TD>');
//document.writeln('<\/TR><\/TD><\/TR><\/FORM><\/TABLE>');
document.writeln('<\/TR><\/FORM><\/TABLE>');
