/** CONFIG **/
// update 2nd Nov 2009 , remove SMH
// update 29th Feb 2009, add ND
// update 18th Nov 2008, update SST and CS
// update 5th Nov 2008, remove SPM and PGZ

var adWidth=468;
var adHeight=60;

var adTime=30; //seconds to show ad for

/** AD DATA **/

var file=Array(); //initialize the master index of images/swf
var link=Array(); //initialize the master index links


file[0]=Array(); //initialize the first row index
link[0]=Array(); //intiialize the first row links

file[0][0]="http://www.smartinvestment.ca/images/EAS.banner.1.jpg";
link[0][0]="http://www.eaminerals.com/";

file[0][2]="http://www.smartinvestment.ca/images/bannerad.jpg";
link[0][2]="http://www.banderagold.com/";

file[0][1]="http://www.smartinvestment.ca/images/ER102108.gif";
link[0][1]="http://www.eastmain.com/";

file[1]=Array(); //initialize the second row index
link[1]=Array(); //intiialize the second row links

//file[1][0]="http://www.smartinvestment.ca/images/silverstoneinv.swf";
//link[1][0]="http://www.silverstonecorp.com/";

file[1][0]="http://www.smartinvestment.ca/images/ecu_banner.swf";
link[1][0]="http://www.ecu.ca/s/Home.asp";

file[1][1]="http://www.smartinvestment.ca/images/capstoneinv.swf";
link[1][1]="http://www.capstonemining.com/";

file[1][2]="http://www.smartinvestment.ca/images/oym05-11-2010.swf";
link[1][2]="http://www.olympuspacific.com//";

file[2]=Array(); //initialize the third row index
link[2]=Array(); //intiialize the third row links

file[2][0]="http://www.smartinvestment.ca/images/ucresources_468x60.swf";
link[2][0]="http://www.ucresources.net/";

//file[2][1]="http://www.smartinvestment.ca/images/scorpio.swf";
//link[2][1]="http://www.scorpiomining.com/s/Home.asp";

//file[2][1]="http://www.smartinvestment.ca/images/shoreham-banner.swf";
//link[2][1]="http://http://www.shoreham.ca/";

file[2][1]="http://www.smartinvestment.ca/images/nd468x60.swf";
link[2][1]="http://www.newdawnmining.com/";


/** CODE **/

var currentAd=Array();
var seed=Array();

for(var i=0;i<file.length;i++)
	{
	currentAd[i]=-1;
	seed[i]=-1;
	
	writeAd(i);
	}

function writeAd(rowID)
	{
	if(file.length>1)
		{
		while(seed[rowID]==currentAd[rowID])
			{
			seed[rowID]=Math.floor(Math.random()*file[rowID].length);
			}
			
		currentAd[rowID]=seed[rowID];
		}
	
	var ext=file[rowID][seed[rowID]].substr(file[rowID][seed[rowID]].length-3).toLowerCase();

	var adframe=document.getElementById('adframe'+rowID);
	
	var str='<div style="position:absolute;z-index:2;">';
	
	str+='<a style="display:block;width:'+adWidth+'px;height:'+adHeight+'px;background:url(\'layout/blank.gif\');" href="'+link[rowID][seed[rowID]]+'" target="_blank"></a>';
	
	str+='</div><div style="z-index:1;">';
	
	if(ext=='swf')
		{
		str+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+adWidth+'" height="'+adHeight+'">';
		str+='<param name="movie" value="'+file[rowID][seed[rowID]]+'"><param name="quality" value="high"><param name="wmode" value="transparent"><embed src="'+file[rowID][seed[rowID]]+'" quality="high" wmode="transparent" width="'+adWidth+'" height="'+adHeight+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';
		str+='</object>';
		}
	else
		{
		str+='<img alt="Advertisement" width="'+adWidth+'" height="'+adHeight+'" src="'+file[rowID][seed[rowID]]+'">';
		}
		
	str+='</div>';
	
	adframe.innerHTML=str;
	
	if(file.length>1) { setTimeout('writeAd('+rowID+')',adTime*1000); }
	}

	
function log(text)
	{
	document.getElementById('log').innerHTML+=text+'<br />';
	}