/*----------------------------------------------------
||Banner Ad Rotater v1.01                            ||
||                                                   ||
||Script by:                                         ||
||Anarchos                                           ||
||URL: http://www.xs.mw/anarchos                     ||
||E-mail: anarchos3@hotmail.com                      ||
||ICQ: 12007422                                      ||
||                                                   ||
||E-mail or ICQ me if you have any questions or need ||
||help setting up your banner ad rotator. Check out  ||
||my webpage every once in a while for updates to    ||
||this script.                                       ||
-----------------------------------------------------*/


//Setup Instructions:
//-0) Modify this file then copy and paste it into the <head> of the webpage to use the banner ad script

/*---------------------------
1) add into your <head>:
 
<script language="javascript" src="bannerscript.js"></script>

<style>
<!--
#bannerAd{visibility:visible;}
-->
</style>
 
-----------------------------*/

/*----------------------------
2) add this code into your webpage where you want the banner ad to be displayed:

<!-- Banner Ad code -->
<div id="bannerAd">
<script language="JavaScript">
<!-- 
document.write(myCode)
// -->
</script>
</div>
<!-- End Banner Ad-->

-----------------------------*/

//-3) time between switching the ad, in milliseconds -\\

var refreshTime = 20000; //- 5000 ms = 5 seconds -\\

//-4) number of ads to rotate -\\

var numAds = 7

function makeAd()
{
	this.width = ''
	this.height = ''
	this.src = ''
	this.href = ''
	this.target = ''
	this.mouseover = ''
	this.sponsor = ''
}

var ads = new Array()

for(var i = 1; i <= numAds; i++)
{
	ads[i] = new makeAd()
}

//- 5) Copy and paste the lines between the banner definition for 
//each banner you want to rotate and be sure to change numAds to 
//the number of banners (look about 15 lines up for numAds)

i = 1;


/*------------begin banner definition----------*/
//ads[i].width = "468"                                            // width of image
//ads[i].height = "60"                                            // height of image
//ads[i].src = "/banners/pub01.gif"  	        // image url
//ads[i].href = "/publicidade/publicidade.htm"           	        // link url
//ads[i].target = "_self"                                         // target window
//ads[i].mouseover = "Clique aqui para ver detalhes"              // text to display when mouse moves over banner
//ads[i].sponsor = ""                                             // text to display for text link under banner
//i++

ads[i].width = "468"    
ads[i].height = "60"                  
ads[i].src = "/banners/atlanticoil.jpg"  			
ads[i].href = "http://www.atlanticoil.pt"
ads[i].target = "_blank"           	 
ads[i].mouseover = "Comércio de energia, gasolina, gasóleo, biodiesel, energias renováveis,energia eólica."
ads[i].sponsor = ""                 
i++

ads[i].width = "468"    
ads[i].height = "60"                  
ads[i].src = "/banners/iguarias.gif"  			
ads[i].href = "http://www.quintadasiguarias.pt"
ads[i].target = "_blank"           	 
ads[i].mouseover = "Queijos, fumados, vinhos, biscoitos, mel, compotas, azeites, vinagres,..."
ads[i].sponsor = ""                 
i++

ads[i].width = "468"    
ads[i].height = "60"                  
ads[i].src = "/banners/flexi468x60.gif"  			
ads[i].href = "http://www.flexigest.com/"
ads[i].target = "_blank"           	 
ads[i].mouseover = "Veja mais informações em www.flexigest.com"
ads[i].sponsor = ""                 
i++

ads[i].width = "468"    
ads[i].height = "60"                  
ads[i].src = "/banners/ergomol.gif"  			
ads[i].href = "http://www.gondomaronline.com/anunciantes/paginas/ergomol.htm"
ads[i].target = "_self"           	 
ads[i].mouseover = ""       
ads[i].sponsor = ""                 
i++

ads[i].width = "468"    
ads[i].height = "60"                  
ads[i].src = "/banners/estores_gondomar.jpg"  			
ads[i].href = "http://www.estoresgondomar.com" 
ads[i].target = "_blank"          	 
ads[i].mouseover = "Fabricantes de todo o tipo de Estores e Acessórios."       
ads[i].sponsor = ""                 
i++

ads[i].width = "468"    
ads[i].height = "60"                  
ads[i].src = "/banners/jspereira_bnr.gif"  			
ads[i].href = "http://www.jspereira.pt"
ads[i].target = "_self"           	 
ads[i].mouseover = "Consultoria - Gestão de conteúdos - Webdesign - Webmarketing - Registo de domínios - Alojamento - Intranets"       
ads[i].sponsor = ""                 
i++

ads[i].width = "468"
ads[i].height = "60"
ads[i].src = "/banners/GMbanner.gif"
ads[i].href = "#" 
ads[i].target = "_self"
ads[i].mouseover = "Gondomar - telef.: 224 832 944 - fax: 224 649 119" 
ads[i].sponsor = ""
i++
/*
ads[i].width = "468"
ads[i].height = "60"
ads[i].src = "/banners/rgr_bnr.gif"
ads[i].href = "http://www.rgrimobiliaria.com" 
ads[i].target = "_blank"
ads[i].mouseover = "Rodrigues, Guedes & Ribeiro, Sociedade de Mediação Imobiliária, Lda." 
ads[i].sponsor = ""
i++
*/
/*-------------end banner definition-----------*/

var myCode = ''

do
{
	var n= Math.floor(Math.random() * (numAds + 1) + 1);
} while(n > numAds);

var current_ad = n;

myCode = getCode(current_ad);

function getCode(adNumber)
{	
	var tempCode = ""
	tempCode += ('<a href="'+ ads[adNumber].href +'" target="'+ ads[adNumber].target +'" \n')
	tempCode += ('onMouseOver="status=\''+ ads[adNumber].mouseover +'\';return true" \n')
	tempCode += ('onMouseOut="status=\'\'"> \n')
	tempCode += ('<img src = "' + ads[adNumber].src + '" width=' + ads[adNumber].width)
	tempCode += (' onLoad="setTimeout(\'newAd();\',' + refreshTime + ');"')
	tempCode += ('\n height=' + ads[adNumber].height + ' border=0 >')
	// tempCode += ('<br>Patrocinado por: <b>' + ads[adNumber].sponsor + '</b>') // delete this line if you don't want any text to be displayed under your banner
	tempCode += ('</a>')

	return tempCode;
}

function newAd()
{
	current_ad++;

	if (current_ad > numAds)
		current_ad = 1

	if (document.all)
	{

		write(getCode(current_ad));
	}
}

function write(text)
{

	if (document.layers)
	{
		document.bannerAd.document.write(text)
		document.bannerAd.document.close();
	}
	else
		if (document.all)
			document.all.bannerAd.innerHTML = text
	
}
