//Written by Mike hutchinson 28/03/06

//This script holds all the ongoing sponsor info used on the ccc website wef 280306

//Each row in the array to contain in the following order: 
//the Name of sponsor
//their url (if they have one). 
//Their address
//Their Tel no
//If they don't have a url make sure the second element on each row is ""

//Note the last two items are for archive viewing only and for use by CCC for subsequent conatact by the choir.
//Add new rows incrementing up the [row number]

//To get sponsors details to appear on the webpage enter the line 
//    list_sponsors("n,n,n") 
//in the current concerts cccdefault_xxxxxx.js file.
//where each 'n' is the row number in the array below that you wish to have displayed on the web page.

//make sure when calling this function you place all the n,n,n etc inside a single set of double quotes.

//NOTE: when calling the function below, the order you pass it the row numbers is the actual display order for sponsors.

//NOTE: If you pass more row nos than are held in the array you do get a controlled error popup but 
//      no checks currently built in to see if individual row nos being passed are too high.


sponsors = new Array()
sponsors[0]= new Array("GRAHAMS Hi-Fi Ltd","http://www.grahams.co.uk","Canonbury Yard, 190a New North Road, London N1 7BS","020 7226 5500")
sponsors[1]= new Array("hair @ canonbury, 12 Canonbury Place, N1","","12,canonbury place, London,N1 2NQ","020 7226 6280")
sponsors[2]= new Array("The Northgate, 113 Southgate Road, N1","","113 Southgate Road, London N1","020 7359 7392")

//no changes required below this line.

sponsorlink='<b>Sponsorship for this concert:</b><br>We gratefully acknowledge the support of the following people who are advertising in our concert program:'


function list_sponsors(required_sponsors){

var temp = new Array();
temp = required_sponsors.split(',')
sourcemax=sponsors.length
checklen=temp.length

if(required_sponsors!=""){


	if(checklen>sourcemax){
		alert('Sponsers.js script validation failed:\n\nYou are passing too many row numbers to the Array.\nYou tried to call List_Sponsors() function using the following\nList_sponsors("'+required_sponsors+'")\n in the current cccdefault_xxxxxx.js concert file\n\nYou can only pass: '+sourcemax+' row numbers to this array unless you add some more sponsors!')
	}else{

		max=temp.length

		counter=0
		output='<ul>'


		for (i=0;i<max;i++){

			counter=temp[i]
			tmp=sponsors[counter][1]
				
				if(tmp!=""){

					output +='<li><a HREF="'+sponsors[counter][1]+'" target="_blank" Title="'+sponsors[counter][0]+'">'+sponsors[counter][0]+'</a></li>'

				} else{

					output +='<li>'+sponsors[counter][0]+'</li>'

				} // end of if no 3

		}

	final_list=sponsorlink+output+'</ul>'

	}// end of if no 2


}else{

final_list=""

} // end of if no 1
sponsorlink=""
return final_list

} // end of function
