// Version check based upon the values entered above in "Globals"
//var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

rndVsn = false;
byDecVsn = false;
  
try {
    if(randomVersion) {
	rndVsn = true;
    }
} catch (err) {}
  
try {
    if(byDecade) {
	byDecVsn = true;
    }
} catch (err) {}

if(rndVsn) {
    loadRandomVersion();
} else {
    loadTableVersion();
}


function loadTableVersion() {

	document.write('<div id=\"asyncContent\"></div>');
	document.write('<div id=\"asyncContentSupport\"></div>');

	if (window.ActiveXObject){
		loadXMLDoc('catalogue.xml', true); // Our content loader uses proprietary innerHTML for async load.
	} else {
		loadXMLDoc('catalogue.xml', false); // Have to be synchronous for Mozilla until we become more sophiticated with the content load.
	}
	   
}



function loadRandomVersion() {

		 numCollections=33;
		 var collectionArray = new Array();
		 // Added more than one for extra weighting 
		 collectionArray[0] = "../courtEquipmentCollection/catalogue.xml";
		 collectionArray[1] = "../manufPromosCollection1/catalogue.xml";
		 collectionArray[2] = "../manufPromosCollection2/catalogue.xml";
		 collectionArray[3] = "../pictureRacketsCollection/catalogue.xml";
		 collectionArray[4] = "../picturesCollection1/catalogue.xml";
		 collectionArray[5] = "../picturesCollection2/catalogue.xml";
		 collectionArray[6] = "../playersRacketsCollection/catalogue.xml";
		 collectionArray[7] = "../porcelainCollection/catalogue.xml";
		 collectionArray[8] = "../picturesCollection1/catalogue.xml";
		 collectionArray[9] = "../racketPressesCollection/catalogue.xml";
		 collectionArray[10] = "../racketsCollection1/catalogue.xml";
		 collectionArray[11] = "../racketsCollection2/catalogue.xml";
		 collectionArray[12] = "../racketsCollection3/catalogue.xml";
		 collectionArray[13] = "../souveniersCollection/catalogue.xml";
		 collectionArray[14] = "../stringingCollection/catalogue.xml";
		 collectionArray[15] = "../stringingMachinesCollection/catalogue.xml";
		 collectionArray[16] = "../bookMagCollection1/catalogue.xml";
		 collectionArray[17] = "../bookMagCollection2/catalogue.xml";
		 collectionArray[18] = "../pictureRacketsCollection/catalogue.xml";
		 collectionArray[19] = "../playersRacketsCollection/catalogue.xml";
		 collectionArray[20] = "../racketPressesCollection/catalogue.xml";
		 collectionArray[21] = "../racketsCollection1/catalogue.xml";
		 collectionArray[22] = "../racketsCollection2/catalogue.xml";
		 collectionArray[23] = "../picturesCollection3/catalogue.xml";
		 collectionArray[24] = "../bookMagCollection3/catalogue.xml";
		 collectionArray[25] = "../bookMagCollection4/catalogue.xml";
		 collectionArray[26] = "../bookMagCollection5/catalogue.xml";
		 collectionArray[27] = "../courtEquipmentCollection2/catalogue.xml";
		 collectionArray[28] = "../cardsCollection1/catalogue.xml";
		 collectionArray[29] = "../cardsCollection2/catalogue.xml";
		 collectionArray[30] = "../cardsCollection3/catalogue.xml";
		 collectionArray[31] = "../bookMagCollection6/catalogue.xml";
		 collectionArray[32] = "../stampsCollection1/catalogue.xml";
		 collectionArray[numCollections] = "../racketsCollection3/catalogue.xml";

		 // Descriptions
		 var descriptionArray = new Array();
		 descriptionArray[0] = "Court Equipment";
		 descriptionArray[1] = "Manufacturers\' Promos";
		 descriptionArray[2] = "Manufacturers\' Promos";
		 descriptionArray[3] = "Picture Rackets";
		 descriptionArray[4] = "Pictures";
		 descriptionArray[5] = "Pictures";
		 descriptionArray[6] = "Players\' Rackets";
		 descriptionArray[7] = "Porcelain";
		 descriptionArray[8] = "Pictures";
		 descriptionArray[9] = "Racket Presses";
		 descriptionArray[10] = "Rackets";
		 descriptionArray[11] = "Rackets";
		 descriptionArray[12] = "Rackets";
		 descriptionArray[13] = "Souveniers";
		 descriptionArray[14] = "Strings &amp; Things";
		 descriptionArray[15] = "Stringing Machines";
		 descriptionArray[16] = "Books and Magazines";
		 descriptionArray[17] = "Books and Magazines";
		 descriptionArray[18] = "Picture Rackets";
		 descriptionArray[19] = "Players\' Rackets";
		 descriptionArray[20] = "Racket Presses";
		 descriptionArray[21] = "Rackets";
		 descriptionArray[22] = "Rackets";
		 descriptionArray[23] = "Pictures";
		 descriptionArray[24] = "Books and Magazines";
		 descriptionArray[25] = "Books and Magazines";
		 descriptionArray[26] = "Books and Magazines";
		 descriptionArray[27] = "Court Equipment";
		 descriptionArray[28] = "Souvenir Cards";
		 descriptionArray[29] = "Souvenir Cards";
		 descriptionArray[30] = "Souvenir Cards";
		 descriptionArray[31] = "Books and Magazines";
		 descriptionArray[32] = "Stamps";
		 descriptionArray[numCollections] = "Rackets";

		 // URLs
		 var urlArray = new Array();
		 urlArray[0] = "../courtEquipmentCollection/courtEquipment.html";
		 urlArray[1] = "../manufPromosCollection1/promos.html";
		 urlArray[2] = "../manufPromosCollection2/promos.html";
		 urlArray[3] = "../pictureRacketsCollection/rackets.html";
		 urlArray[4] = "../picturesCollection1/pictures.html";
		 urlArray[5] = "../picturesCollection2/pictures.html";
		 urlArray[6] = "../playersRacketsCollection/rackets.html";
		 urlArray[7] = "../porcelainCollection/porcelain.html";
		 urlArray[8] = "../picturesCollection1/pictures.html";
		 urlArray[9] = "../racketPressesCollection/presses.html";
		 urlArray[10] = "../racketsCollection1/rackets.html";
		 urlArray[11] = "../racketsCollection2/rackets.html";
		 urlArray[12] = "../racketsCollection3/rackets.html";
		 urlArray[13] = "../souveniersCollection/souveniers.html";
		 urlArray[14] = "../stringingCollection/stringing.html";
		 urlArray[15] = "../stringingMachinesCollection/stringingMachines.html";
		 urlArray[16] = "../bookMagCollection1/bookMag.html";
		 urlArray[17] = "../bookMagCollection2/bookMag.html";
		 urlArray[18] = "../pictureRacketsCollection/rackets.html";
		 urlArray[19] = "../playersRacketsCollection/rackets.html";
		 urlArray[20] = "../racketPressesCollection/presses.html";
		 urlArray[21] = "../racketsCollection1/rackets.html";
		 urlArray[22] = "../racketsCollection2/rackets.html";
		 urlArray[23] = "../picturesCollection3/pictures.html";
		 urlArray[24] = "../bookMagCollection3/bookMag.html";
		 urlArray[25] = "../bookMagCollection4/bookMag.html";
		 urlArray[26] = "../bookMagCollection5/bookMag.html";
		 urlArray[27] = "../courtEquipmentCollection2/courtEquipment.html";
		 urlArray[28] = "../cardsCollection1/cards.html";
		 urlArray[29] = "../cardsCollection2/cards.html";
		 urlArray[30] = "../cardsCollection3/cards.html";
		 urlArray[31] = "../bookMagCollection6/bookMag.html";
		 urlArray[32] = "../stampsCollection1/stamps.html";
		 urlArray[numCollections] = "../racketsCollection3/rackets.html";
		 
		 
		 randomNum = 99;
		 
		 while(randomNum > numCollections) {
		 
		 	 randomNum = Math.floor(Math.random() * 100);
		 }

		var titleContent = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class=\"menuSectionHeadingLink\" href=\"'+urlArray[randomNum]+'\">'+descriptionArray[randomNum]+' Collection</a>';

		try {
			document.getElementById('asyncTitle').innerHTML=titleContent; // InnerHTML supported by IE.

			document.getElementById('asyncContent').innerHTML='<br><br>Loading...'; 
		} catch (err) {
			document.write(txt);
//			alert("Error:"+txt);
		}

		 		 
  	   if (window.ActiveXObject){
	   	 loadXMLDoc(collectionArray[randomNum], true); // Our content loader uses proprietary innerHTML for async load.
	   } else {
	   	 loadXMLDoc(collectionArray[randomNum], false); // Have to be synchronous for Mozilla until we become more sophiticated with the content load.
	   }
}

