var AdList = new Array
(
"X|blahdvd|blahdvd.com|Blah DVD sells cheap DVDs, discounted music CDs and the cheapest movies in the UK",
"X|dsubanner|dvdshoppinguk.co.uk|Region 2 site for news, reviews and bargain roundups",
"X|dvdcomparelogo|bytesandbobs.com/dvdcompare|Impartial reviews and comparisons on R1 and R2 discs",
"X|dvdlink1|dvdlink.co.uk|The only DVD link portal on the web",
"X|cddvd_banner|cdanddvdbargains.com|Looking for cheap CD's and DVD's?",
"X|hcc|homecinemachoice.com|Home Cinema Choice Online",
"X|artsmagicdvd3|artsmagicdvd.com|ARTSMAGICDVD.com - The Japanese Film Specialist",
"W|http://www.ecoustics.com/images/468banner2|ecoustics.com|eCoustics.com - Everything Hi-Fi Online"
);

function GetRandomAdvert(num,associate)
{
var docObj=window.document;
var AdRec=new Array();  
var LastIdx=-1;
var AdIdx=-1;

if ( window.parent.frames.banner == null ){
 // No frames so probably come via a search engine so allow them to go to the main site

 if ( window.location.pathname.charAt(0) == '/' )
  window.location.replace("http://www.dvd365.net/?"+window.location.pathname.substr(1));
 else
  window.location.replace("http://www.dvd365.net/?"+window.location.pathname);
 return;
}

for (i=0;i<num;i++)
{
 while (AdIdx==LastIdx)
 { 
  AdIdx=Math.floor( Math.random()*AdList.length );

  if ( AdIdx>=0 && AdIdx<=AdList.length )
   AdRec=AdList[AdIdx].split( '|' );
 }
 LastIdx=AdIdx;
 if ( docObj != null )
 {
   docObj.write('<p align="center">' );
   docObj.write('<a href="http://www.'+AdRec[2]+'" target="_blank">');
   docObj.write('<img border="0" src="' );
 
   if (AdRec[0]=='X')
    docObj.write('adverts/other/' );
   docObj.write(AdRec[1]+'.gif" alt="');
   docObj.write(AdRec[3]+'"></a></p>');
 }
}
}