// Updated 09/06/2009

var AdList=new Array
(
"A|B|0|ben_hur|1|Ben Hur : 4 Disc Special Edition DVD",
"A|B|1|corpse_bride|1|The Corpse Bride",
"A|B|2|kiss_kiss_bang_bang|1|Kiss Kiss Bang Bang DVD",
"A|B|3|revolver|1|Revolver DVD",
"A|B|4|the_island|1|The Island DVD",
"A|B|5|sparks|1|Sparks : Hello Young Lovers CD",
"A|B|6|performance|1|Performance",
"A|B|7|shaunthesheep_1|1|Shaun the Sheep",
"A|B|7|shaunthesheep_2|1|Shaun the Sheep",
"A|B|8|black_sheep|1|Black Sheep",
"A|B|9|gary_lineker|1|Gary Lineker's Action Replay",
"A|B|10|30_days_of_night|1|30 Days of Night",
"A|B|11|apocalypto2|1|Apocalypto",
"A|B|12|smartpeople|1|Smart People",
"A|B|13|tattooist|1|The Tatooist",
"A|B|14|awake|1|Awake",
"A|B|15|sherylcrow|1|Sheryl Crow",
"A|B|16|sarahsilverstonedvd|1|Sarah Silverman",
"A|B|17|splinter|1|splinter",
"A|B|18|transporter3|1|The Transporter 3",
"A|B|19|rowan|1|Rowan Atkinson Live",
"A|B|20|unearthed|1|Unearthed",
"A|B|21|solstice|1|Solstice",
"A|B|22|bogeyman3|1|Bogeyman 3",
"A|B|23|push|1|Push",
"A|B|24|neighbours|1|Neighbours : Volume 2",
"A|B|25|prisoner|1|Prisoner Cell Block H",
"A|B|26|globalswarming|1|Infestation",
"A|B|27|triangle|1|Triangle",
"A|B|28|opengraves|1|Open Graves",
"A|B|29|mollyhartley|1|The Haunting of Molly Hartley",
"A|B|30|paranormalactivity|1|Paranormal Activity",

"S|X|X|ddalt|dynamicdrive.com|Visit Dynamic Drive for free, original DHTML scripts",
"S|X|X|foxlogo|fox.co.uk|Visit fox.co.uk",
"S|X|X|artsmagicdvd3|artsmagicdvd.com|ARTSMAGICDVD.com - The Japanese Film Specialist",
"S|X|X|fp460x60|theprizefinder.com|Visit ThePrizeFinder.com",
"S|X|X|AAC_468_60_1|allaboutcompetitions.co.uk|All About Competitions - Free to Enter, No Registration, Win Great Prizes"
);

//"A|1|X|dvd_banner1|1|DVDs","A|1|X|dvd_banner1|1|DVDs",
//"U|B|1|eq_banner1|X|Equilibrium","U|B|1|eq_banner2|X|Equilibrium",

var AsinList=new Array // Direct item link
("B000CDINOU","B000BPCUTS","B000BLI0SC","B000BKUY78","B000BLEO8W","B000CFWNNK","B000KCI92E","B000LRYSXC","B000ZK9T5M","B000V6W6FU","B000ZK9T5W","B000GNOKQG","B001AU3FX8","B0018SHUF6","B0018SHUCY","B001B1G81C","B000F1IO3O","B001K859QG","B001Q94TH4","B001EDG2BS","B0018SHUEM","B001E25MF6","B001QK9WMK","B00206U5XY","B0023TZ3K8","B0023TZ3KI","B0027ISJ1A","B002Y2K2KA","B002T5QMEM","B0027ISJ0Q","B0030IMZ3E");
var UKPath=new Array // Product link
("books","dvd","electronics","music","amazon","videogames","software","diytools","outdoors","personal");
var USPath=new Array // Bizare US product link
("tg/browse/-/130","tg/browse/-/283155/","subst/home/home.html","tg/browse/-/6M301793");
var CAPath=new Array // Bizare CA product link
("tg/browse/-/917972","tg/browse/-/916514","tg/browse/-/915398");

function GetRandomAdvert(num,associate,up){
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;
}

while (AdIdx==LastIdx){ 
 AdIdx=Math.floor( Math.random()*AdList.length );

 if (AdIdx>=0 && AdIdx<=AdList.length)
  AdRec=AdList[AdIdx].split('|');  
 else AdIdx=LastIdx;
}
LastIdx = AdIdx;
if (docObj!=null){
 docObj.write('<p align="center">');  
 if (AdRec[1]=='B')
  LinkTxt="amazon.co.uk/exec/obidos/ASIN/"+AsinList[AdRec[2]]+"/dvd3netdvdforthe";
 else if (AdRec[1]=='1')
  LinkTxt="amazon.co.uk/exec/obidos/redirect-home?tag=dvd3netdvdforthe&site="+UKPath[AdRec[4]];
 else if (AdRec[1]=='P')
  LinkTxt="amazon.co.uk/exec/obidos/redirect?tag=dvd3netdvdforthe&path="+UKPath[AdRec[4]];
 else if (AdRec[1]=='2')
  LinkTxt="amazon.com/exec/obidos/redirect?tag=dvd365net&path="+USPath[AdRec[4]];
 else if (AdRec[1]=='3')
  LinkTxt="amazon.ca/exec/obidos/redirect?tag=dvd365net-20&path="+CAPath[AdRec[4]];
 else if (AdRec[1]=='C')
  LinkTxt="cd-wow.com?affid=11205";
 else LinkTxt=AdRec[4];

 if (AdRec[0]=='S'&&AdRec[1]=='L') 
  docObj.write('<a href="'+LinkTxt+'" target="main">');
 else docObj.write('<a href="http://www.'+LinkTxt+'" target="_blank">');

 docObj.write('<img border="0" src="');
 if (up!=null && AdRec[0]!='W')
 while (up--!=0) {
  docObj.write("../");
 }

 if (AdRec[0]=='C') docObj.write( "adverts/cdwow/" );
 else if (AdRec[0]=='U') docObj.write( "adverts/universal/" );
 else if (AdRec[0]=='S') docObj.write( "adverts/other/" );
 else if (AdRec[1]=='1'||AdRec[1]=='B'||AdRec[1]=='P') docObj.write( "adverts/amazonuk/" );
 else if (AdRec[1]=='2') docObj.write( "adverts/amazoncom/" );
 else if (AdRec[1]=='3') docObj.write( "adverts/amazonca/" );

 docObj.write(AdRec[3]+'.gif" alt="');

 if (AdRec[1]=='B') docObj.write("Buy "+AdRec[5]+" from Amazon.co.uk");
 else if (AdRec[1]=='C') docObj.write("Chart CDs, DVDs and Video Games at CD WOW!");
 else if (AdRec[0]=='A'){
  docObj.write(AdRec[5]+" in association with Amazon.");
  if (AdRec[1]=='1'||AdRec[1]=='B'||AdRec[1]=='P') docObj.write("co.uk");
  if (AdRec[1]=='2') docObj.write("com");
  if (AdRec[1]=='3') docObj.write("ca");
 }
 else docObj.write(AdRec[5]);
 docObj.write( '"></a></p>' );
}
}

function WriteStatsCode(){
 var docObj=window.document;
 docObj.write('<script src="http://my.stats2.com/103802.js" type="text/javascript"></script>');
}
