// Scramble function, takes parameter of number of logos to display,
// retrieves them from the database, mixes them up and returns
// the table

function sundayTimes (numberOfCells,logoRows,logoCols) {

  var numberOfCells, numberOfRows, noCols, nIndex, nRnd, arrCount,bFound, iRow, iCol,tmpCells, arr;
 
   //swap cells around
  
  numberOfRows = logoRows;
  noCols = logoCols;
  
  // select logos from table
 
  //build up array of all cell values
	dataArray = new Array();
	cellN=0;
	9 
	 
			dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/curzon_partnership' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00145/0__573_00_145223a.gif' height='40' width='100' alt='The Curzon Partnership' /></a>";
	
			cellN++;
	    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/LordSearchandSelection/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00313/lord_new_313522a.jpg' height='40' width='100' alt='Lord Search & Selection' /></a>";
	
			cellN++;
	    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/PSD/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00145/0__83527_00_145251a.gif' height='40' width='100' alt='PSD' /></a>";
	
			cellN++;
	    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/odgers/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00204/odgersselect_204858a.gif' height='40' width='100' alt='Odgers' /></a>";
	
			cellN++;
	    
	 dataArray[cellN] = "<a href='http://jobs.timesonline.co.uk/Jobs/Jobs.aspx?liCompanyID=201364' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00145/0__31262_00_145149a.gif' height='40' width='100' alt='Boyden' /></a>";
	
			cellN++;
	    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/barnaby_stewart/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00145/0__20592_00_145131a.gif' height='40' width='100' alt='Barnaby Stewart' /></a>";
	
			cellN++;
	    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/whealethomashodgins_1/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00145/0__232834_00_145132a.jpg' height='40' width='100' alt='Wheale Thomas Hodgins' /></a>";
	
			cellN++;
	    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/blt/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00145/0__76285_00_145245a.gif' height='40' width='100' alt='BLT' /></a>";
	
			cellN++;
	    
	 dataArray[cellN] = "<a href='http://jobs.timesonline.co.uk/Jobs/Jobs.aspx?liCompanyID=244637' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00145/0__382479_00_145194a.gif' height='40' width='100' alt='Q-Matic' /></a>";
	
			cellN++;
	    
	 dataArray[cellN] = "<a href='http://jobs.timesonline.co.uk/Jobs/Jobs.aspx?liCompanyID=212541' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00145/0__333231_00_145153a.gif' height='40' width='100' alt='Macmillan International' /></a>";
	
			cellN++;
	    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/aquista/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00145/0__33612_00_145158a.gif' height='40' width='100' alt='Aquista' /></a>";

			cellN++;
	    
	 dataArray[cellN] = "<a href='http://jobs.timesonline.co.uk/Jobs/Jobs.aspx?liCompanyID=206961' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00144/button_regentconsul_144540a.gif' height='40' width='100' alt='Regent Consulting' /></a>";

			cellN++;
	    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/spencerstuart/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00145/spencerlogo_145102a.gif' height='40' width='100' alt='Spencer Stuart' /></a>";

			cellN++;
										    
	 dataArray[cellN] = "<a href='http://jobs.timesonline.co.uk/Jobs/Jobs.aspx?liCompanyID=200080' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00148/hanover_148454a.gif' height='40' width='100' alt='Hanover Fox' /></a>";

			cellN++;
										    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/mercuri_urval_new_1/index.htm' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00150/mercuri_urval_custo_150549a.gif' height='40' width='100' alt='Mercuri Urval' /></a>";

			cellN++;
										    
	 dataArray[cellN] = "<a href='http://jobs.timesonline.co.uk/Jobs/Jobs.aspx?liCompanyID=244448' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00158/Strategi-with-strap_158017a.jpg' height='40' width='100' alt='Strategi' /></a>";
	
			cellN++;
			
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/harveynash2/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00162/button_harveynash_162945a.gif' height='40' width='100' alt='Harvey Nash' /></a>";

			cellN++;
			
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/tribal/site/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00165/triballogo_165411a.gif' height='40' width='100' alt='Tribal' /></a>";

			cellN++;
				 
	dataArray[cellN] = "<a href='http://jobs.timesonline.co.uk/jobs/jobs.aspx?licompanyid=246368' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00169/Mackenzie-jones-sma_169262a.gif' height='40' width='100' alt='Mackenzie Jones' /></a>";

			cellN++;
	    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/howgatesable/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00180/howgate_180165a.gif' height='40' width='100' alt='Howgate Sable' /></a>";
	
			cellN++;		
						    
	 dataArray[cellN] = "<a href='http://jobs.timesonline.co.uk/Jobs/93737/CommercialAnalyst.html' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00188/fcp_188504a.gif' height='40' width='100' alt='FCP' /></a>";

			cellN++;		
						    
	 dataArray[cellN] = "<a href='http://jobs.timesonline.co.uk/Jobs/Jobs.aspx?liCompanyID=230961' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00193/charlesfellows_193855a.gif' height='40' width='100' alt='Charles Fellows Group' /></a>";

			cellN++;		
						    
	 dataArray[cellN] = "<a href='http://jobs.timesonline.co.uk/Jobs/Jobs.aspx?liCompanyID=245079' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00213/haysexec_213078a.gif' height='40' width='100' alt='Hays' /></a>";

			cellN++;		
						    
	 dataArray[cellN] = "<a href='http://jobs.timesonline.co.uk/Jobs/Jobs.aspx?liCompanyID=206242' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00214/norman_broadbent_214652a.gif' height='40' width='100' alt='Norman Broadbent' /></a>";

			cellN++;		
						    
	 dataArray[cellN] = "<a href='http://jobs.timesonline.co.uk/Jobs/Jobs.aspx?liCompanyID=248421' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00224/la_fosse_224472a.gif' height='40' width='100' alt='La Fosse Associates' /></a>";

			cellN++;		
						    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/adderley_featherstone/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00309/adderley_feathersto_309188a.gif' height='40' width='100' alt='Adderley Featherstone' /></a>";

			cellN++;		
						    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/online_resourcing/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00309/online_resourcing_309187a.gif' height='40' width='100' alt='Online Resourcing' /></a>";
	
			cellN++;
			
	      //build up random number array based on number of logos 
    nIndex=0;
	if (cellN <= 1) {
		arr = new Array(cellN);
	} else {
		arr =new Array(cellN-1);
	}
	for (nIndex=0; nIndex < cellN; nIndex++) {
      bFound=1;
	  while (bFound == 1) {
	  	bFound=0;
		if (cellN <= 1) {
			nRnd=0;
		} else {
			nRnd=getRandomNum(cellN-1);
		}
		//check number not already in array
		for (arrCount=nIndex; arrCount >= 0; arrCount-- ) {
			if (arr[arrCount]==nRnd) {
				bFound=1;
			}  
		} 
	 }
    
	 arr[nIndex] = nRnd;
   }
  
	
		
	//assign values to new array in random fashion
	if (cellN <= 1) {
		tmpCells=new Array(cellN);
	} else {
    	tmpCells= new Array(cellN-1);
	}
	nIndex=0;
	for (x=0;x < cellN; x++) {
		tmpCells[x] = dataArray[arr[nIndex]];
		nIndex++;
			
	}

    
	//assign values to table cells
	x=0;
    logoTab = document.getElementById("logoTable1");
		
	  for (iRow=0;iRow < numberOfRows; iRow++) {
	   	 oRow=logoTab.insertRow(-1);
		 	for (iCol=0; iCol < noCols; iCol++) {
			 oRow.insertCell(-1);
			 if (x < cellN ) {
				oRow.cells[iCol].innerHTML = tmpCells[x];
				//logoBody.rows[iRow].cells[iCol].innerHTML = tmpCells[x];
				x++;
			 } else {
			 	break;
			 }
		}
	 }	
	 }

// Random number generator , used to randomly fill an array with logos 

function getRandomNum(maxValue) {
	//Create new instance of date
	var now=new Date();
	
	//Create a random number
	var randNum = now.getTime() * now.getSeconds() * Math.random();
	
	//Cut random number to an integer to an integer value between 0 and maxValue
	return Math.round(randNum % maxValue);
}

function creme (numberOfCells,logoRows,logoCols) {

  var numberOfCells, numberOfRows, noCols, nIndex, nRnd, arrCount,bFound, iRow, iCol,tmpCells, arr;
 
   //swap cells around
  
  numberOfRows = logoRows;
  noCols = logoCols;
  
  // select logos from table
 
  //build up array of all cell values
	dataArray = new Array();
	cellN=0;
	9 
			dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/mainetucker/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00145/0__619_00_145234a.gif' height='40' width='100' alt='Main Tucker' /></a>";
	
			cellN++;
	    
	 dataArray[cellN] = "<a href='http://jobs.timesonline.co.uk/Jobs/Jobs.aspx?liCompanyID=202506' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00145/0__30413_00_145148a.gif' height='40' width='100' alt='Directors Secretaries' /></a>";
	
			cellN++;
	    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/norma_skemp/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00145/0__334208_00_145156a.gif' height='40' width='100' alt='Norma Skemp' /></a>";

			cellN++;
	    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/tiger/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00145/logotiger_145264a.gif' height='40' width='100' alt='Tiger' /></a>";

			cellN++;
	    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/michael_page/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00154/miclogo_154569a.gif' height='40' width='100' alt='Michael Page' /></a>";

			cellN++;
	    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/aldrich_new/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00178/aldrich_178229a.gif' height='40' width='100' alt='Aldrich' /></a>";

			cellN++;
	    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/anderson_hoare/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00178/anderson_178230a.gif' height='40' width='100' alt='Anderson Hoare' /></a>";

			cellN++;
	    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/tay/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00204/taysbutton100x40_204300a.gif' height='40' width='100' alt='Tay' /></a>";

			cellN++;
	    
	 dataArray[cellN] = "<a href='http://www.thetimescreme.co.uk/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00268/cremeshow_268638a.gif' height='40' width='100' alt='Creme' /></a>";

			cellN++;
	    
	 dataArray[cellN] = "<a href='http://jobs.timesonline.co.uk/Jobs/Jobs.aspx?liCompanyID=244089' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00220/kingandtoben_220521a.gif' height='40' width='100' alt='King &amp; Toben' /></a>";
	
			cellN++;
				    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/rms_recruitment/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00305/rms_logo_305196a.gif' height='40' width='100' alt='RMS Recruitment' /></a>";
	
			cellN++;
	    
	      //build up random number array based on number of logos 
    nIndex=0;
	if (cellN <= 1) {
		arr = new Array(cellN);
	} else {
		arr =new Array(cellN-1);
	}
	for (nIndex=0; nIndex < cellN; nIndex++) {
      bFound=1;
	  while (bFound == 1) {
	  	bFound=0;
		if (cellN <= 1) {
			nRnd=0;
		} else {
			nRnd=getRandomNum(cellN-1);
		}
		//check number not already in array
		for (arrCount=nIndex; arrCount >= 0; arrCount-- ) {
			if (arr[arrCount]==nRnd) {
				bFound=1;
			}  
		} 
	 }
    
	 arr[nIndex] = nRnd;
   }
		
	//assign values to new array in random fashion
	if (cellN <= 1) {
		tmpCells=new Array(cellN);
	} else {
    	tmpCells= new Array(cellN-1);
	}
	nIndex=0;
	for (x=0;x < cellN; x++) {
		tmpCells[x] = dataArray[arr[nIndex]];
		nIndex++;
			
	}

	//assign values to table cells
	x=0;
    logoTab = document.getElementById("logoTable2");
		
	  for (iRow=0;iRow < numberOfRows; iRow++) {
	   	 oRow=logoTab.insertRow(-1);
		 	for (iCol=0; iCol < noCols; iCol++) {
			 oRow.insertCell(-1);
			 if (x < cellN ) {
				oRow.cells[iCol].innerHTML = tmpCells[x];
				//logoBody.rows[iRow].cells[iCol].innerHTML = tmpCells[x];
				x++;
			 } else {
			 	break;
			 }
		}
	 }	
	 }

// Random number generator , used to randomly fill an array with logos 

function getRandomNum(maxValue) {
	//Create new instance of date
	var now=new Date();
	
	//Create a random number
	var randNum = now.getTime() * now.getSeconds() * Math.random();
	
	//Cut random number to an integer to an integer value between 0 and maxValue
	return Math.round(randNum % maxValue);
}

function law (numberOfCells,logoRows,logoCols) {

  var numberOfCells, numberOfRows, noCols, nIndex, nRnd, arrCount,bFound, iRow, iCol,tmpCells, arr;
 
   //swap cells around
  
  numberOfRows = logoRows;
  noCols = logoCols;
  
  // select logos from table
 
  //build up array of all cell values
	dataArray = new Array();
	cellN=0;
	9 
			dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/chaseportland/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00145/0__393772_00_145197a.gif' height='40' width='100' alt='Chase Portland' /></a>";
	
			cellN++;
	    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/burgessalmon/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00145/0__369825_00_145189a.gif' height='40' width='100' alt='Burges Salmon' /></a>";

			cellN++;
	    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/pure/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00164/pure_logo_164641a.gif' height='40' width='100' alt='Pure' /></a>";

			cellN++;
	    
	 dataArray[cellN] = "<a href='http://jobs.timesonline.co.uk/Jobs/87017/COMEFORTHEGLOBALINVESTMENTMANAGEMENT.html' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00178/Baillie-Gifford-But_178597a.gif' height='40' width='100' alt='Baillie Gifford' /></a>";

			cellN++;
	    
	      //build up random number array based on number of logos 
    nIndex=0;
	if (cellN <= 1) {
		arr = new Array(cellN);
	} else {
		arr =new Array(cellN-1);
	}
	for (nIndex=0; nIndex < cellN; nIndex++) {
      bFound=1;
	  while (bFound == 1) {
	  	bFound=0;
		if (cellN <= 1) {
			nRnd=0;
		} else {
			nRnd=getRandomNum(cellN-1);
		}
		//check number not already in array
		for (arrCount=nIndex; arrCount >= 0; arrCount-- ) {
			if (arr[arrCount]==nRnd) {
				bFound=1;
			}  
		} 
	 }
    
	 arr[nIndex] = nRnd;
   }
		
	//assign values to new array in random fashion
	if (cellN <= 1) {
		tmpCells=new Array(cellN);
	} else {
    	tmpCells= new Array(cellN-1);
	}
	nIndex=0;
	for (x=0;x < cellN; x++) {
		tmpCells[x] = dataArray[arr[nIndex]];
		nIndex++;
			
	}

	//assign values to table cells
	x=0;
    logoTab = document.getElementById("logoTable3");
		
	  for (iRow=0;iRow < numberOfRows; iRow++) {
	   	 oRow=logoTab.insertRow(-1);
		 	for (iCol=0; iCol < noCols; iCol++) {
			 oRow.insertCell(-1);
			 if (x < cellN ) {
				oRow.cells[iCol].innerHTML = tmpCells[x];
				//logoBody.rows[iRow].cells[iCol].innerHTML = tmpCells[x];
				x++;
			 } else {
			 	break;
			 }
		}
	 }	
	 }

// Random number generator , used to randomly fill an array with logos 

function getRandomNum(maxValue) {
	//Create new instance of date
	var now=new Date();
	
	//Create a random number
	var randNum = now.getTime() * now.getSeconds() * Math.random();
	
	//Cut random number to an integer to an integer value between 0 and maxValue
	return Math.round(randNum % maxValue);
}

function career (numberOfCells,logoRows,logoCols) {

  var numberOfCells, numberOfRows, noCols, nIndex, nRnd, arrCount,bFound, iRow, iCol,tmpCells, arr;
 
   //swap cells around
  
  numberOfRows = logoRows;
  noCols = logoCols;
  
  // select logos from table
 
  //build up array of all cell values
	dataArray = new Array();
	cellN=0;
	10 
			dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/networx_v1/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00145/0__255632_00_145139a.gif' height='40' width='100' alt='Networx' /></a>";
	
			cellN++;
	    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/whealethomashodgins_1/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00145/0__232834_00_145132a.jpg' height='40' width='100' alt='Wheale Thomas Hodgins' /></a>";
	
			cellN++;
	    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/mercuri_new/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00145/0__820_00_145250a.gif' height='40' width='100' alt='Mercuri Urval' /></a>";

			cellN++;
										    
	 dataArray[cellN] = "<a href='http://www.foxtons.co.uk/foxtons/careers/?timesonline2' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00154/foxtons_button_100x_154929a.gif' height='40' width='100' alt='Foxtons' /></a>";

			cellN++;
										    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/bms' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00295/TimesOnline-Banner_295650a.gif' height='40' width='100' alt='BMS' /></a>";

			cellN++;		
						    
	 dataArray[cellN] = "<a href='http://ukjobs.pwcglobal.com/fe/tpl_pwclhs.asp?newms=jj&aid=15448' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00262/price_262809a.gif' height='40' width='100' alt='PricewaterhouseCoopers' /></a>";
	
			cellN++;
	    
	      //build up random number array based on number of logos 
    nIndex=0;
	if (cellN <= 1) {
		arr = new Array(cellN);
	} else {
		arr =new Array(cellN-1);
	}
	for (nIndex=0; nIndex < cellN; nIndex++) {
      bFound=1;
	  while (bFound == 1) {
	  	bFound=0;
		if (cellN <= 1) {
			nRnd=0;
		} else {
			nRnd=getRandomNum(cellN-1);
		}
		//check number not already in array
		for (arrCount=nIndex; arrCount >= 0; arrCount-- ) {
			if (arr[arrCount]==nRnd) {
				bFound=1;
			}  
		} 
	 }
    
	 arr[nIndex] = nRnd;
   }
  
	//assign values to new array in random fashion
	if (cellN <= 1) {
		tmpCells=new Array(cellN);
	} else {
    	tmpCells= new Array(cellN-1);
	}
	nIndex=0;
	for (x=0;x < cellN; x++) {
		tmpCells[x] = dataArray[arr[nIndex]];
		nIndex++;
			
	}

	//assign values to table cells
	x=0;
    logoTab = document.getElementById("logoTable4");
		
	  for (iRow=0;iRow < numberOfRows; iRow++) {
	   	 oRow=logoTab.insertRow(-1);
		 	for (iCol=0; iCol < noCols; iCol++) {
			 oRow.insertCell(-1);
			 if (x < cellN ) {
				oRow.cells[iCol].innerHTML = tmpCells[x];
				//logoBody.rows[iRow].cells[iCol].innerHTML = tmpCells[x];
				x++;
			 } else {
			 	break;
			 }
		}
	 }	
	 }

// Random number generator , used to randomly fill an array with logos 

function getRandomNum(maxValue) {
	//Create new instance of date
	var now=new Date();
	
	//Create a random number
	var randNum = now.getTime() * now.getSeconds() * Math.random();
	
	//Cut random number to an integer to an integer value between 0 and maxValue
	return Math.round(randNum % maxValue);
}

function publicSector (numberOfCells,logoRows,logoCols) {

  var numberOfCells, numberOfRows, noCols, nIndex, nRnd, arrCount,bFound, iRow, iCol,tmpCells, arr;
 
   //swap cells around
  
  numberOfRows = logoRows;
  noCols = logoCols;
  
  // select logos from table
 
  //build up array of all cell values
	dataArray = new Array();
	cellN=0;
	9 
			dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/PSD/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00145/0__83527_00_145251a.gif' height='40' width='100' alt='PSD' /></a>";
	
			cellN++;
	    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/odgers/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00204/odgersselect_204858a.gif' height='40' width='100' alt='Odgers' /></a>";
	
			cellN++;
	    
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/mercuri_new/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00145/0__820_00_145250a.gif' height='40' width='100' alt='Mercuri Urval' /></a>";

			cellN++;
			
	 dataArray[cellN] = "<a href='http://appointments.timesonline.co.uk/Sites/tribal/site/' target='_blank'><img border='0' src='http://www.timesonline.co.uk/multimedia/archive/00165/triballogo_165411a.gif' height='40' width='100' alt='Tribal' /></a>";

			cellN++;
	    
	    
	      //build up random number array based on number of logos 
    nIndex=0;
	if (cellN <= 1) {
		arr = new Array(cellN);
	} else {
		arr =new Array(cellN-1);
	}
	for (nIndex=0; nIndex < cellN; nIndex++) {
      bFound=1;
	  while (bFound == 1) {
	  	bFound=0;
		if (cellN <= 1) {
			nRnd=0;
		} else {
			nRnd=getRandomNum(cellN-1);
		}
		//check number not already in array
		for (arrCount=nIndex; arrCount >= 0; arrCount-- ) {
			if (arr[arrCount]==nRnd) {
				bFound=1;
			}  
		} 
	 }
    
	 arr[nIndex] = nRnd;
   }
		
	//assign values to new array in random fashion
	if (cellN <= 1) {
		tmpCells=new Array(cellN);
	} else {
    	tmpCells= new Array(cellN-1);
	}
	nIndex=0;
	for (x=0;x < cellN; x++) {
		tmpCells[x] = dataArray[arr[nIndex]];
		nIndex++;
			
	}

	//assign values to table cells
	x=0;
    logoTab = document.getElementById("logoTable5");
		
	  for (iRow=0;iRow < numberOfRows; iRow++) {
	   	 oRow=logoTab.insertRow(-1);
		 	for (iCol=0; iCol < noCols; iCol++) {
			 oRow.insertCell(-1);
			 if (x < cellN ) {
				oRow.cells[iCol].innerHTML = tmpCells[x];
				//logoBody.rows[iRow].cells[iCol].innerHTML = tmpCells[x];
				x++;
			 } else {
			 	break;
			 }
		}
	 }	
	 }

// Random number generator , used to randomly fill an array with logos 

function getRandomNum(maxValue) {
	//Create new instance of date
	var now=new Date();
	
	//Create a random number
	var randNum = now.getTime() * now.getSeconds() * Math.random();
	
	//Cut random number to an integer to an integer value between 0 and maxValue
	return Math.round(randNum % maxValue);
}
