
function hh(id, name) {
    this.id = id;
	this.name = name;
	this.children = new Array();
	this.add = hh_add;
}

function hh_add(code, name) {
	this.children[this.children.length] = {"code" : code, "name" : name};
}

var h = new Array();

h[19] = new hh('19','Cinema');
h[19].add('9691','Valentine\'s Day film advert');
h[17] = new hh('17','TV');
h[17].add('9669','TV AD 03/10');
h[17].add('9816','Angela and Friends');
h[17].add('9818','This Morning');
h[11] = new hh('11','On another website');
h[11].add('9870','Womanandhome.co.uk');
h[11].add('9805','Anna Richardson');
h[11].add('9845','AOL.co.uk');
h[11].add('9853','BBC.co.uk');
h[11].add('9828','Dailyexpress.co.uk');
h[11].add('9841','Dailymail.co.uk');
h[11].add('5464','Facebook Fan Page');
h[11].add('9843','Independant.co.uk');
h[11].add('6445','Other');
h[11].add('9867','Quidco.com');
h[11].add('9868','Safebuyer.co.uk');
h[11].add('9641','Skinny Cow/Valentines Day');
h[11].add('9840','Thesun.co.uk');
h[11].add('7219','Website Video Chat Show');
h[11].add('9645','Woman & Home (online directory)');
h[11].add('7585','YouTube');
h[2] = new hh('2','Email');
h[2].add('9640','Skinny Cow/Valentines Day');
h[5] = new hh('5','Leaflet in a magazine/newspaper');
h[5].add('9780','Bella (code IBELLA 03/10B)');
h[5].add('9776','Bella (code IBELLA 03/10A)');
h[5].add('9748','Best (code IBEST 0310B)');
h[5].add('9744','Best (code IBEST 03/10A)');
h[5].add('9764','Good Housekeeping (code 04/10B)');
h[5].add('9760','Good Housekeeping (code IGHK 04/10A)');
h[5].add('9772','Grazia (code IGRAZIA 03/10B)');
h[5].add('9768','Grazia (code IGRAZIA 03/10A)');
h[5].add('9756','Hello (code IHELLO 03/10B)');
h[5].add('9752','Hello (code IHELLO 03/10A)');
h[5].add('9796','Sainsbury\'s (code ISAINS 04/10B)');
h[5].add('9792','Sainsbury\'s magazine (code ISAINS 04/10A)');
h[5].add('9788','She (code ISHE 04/10B)');
h[5].add('9784','She (code ISHE 04/10A)');
h[6] = new hh('6','Magazine advertisement');
h[6].add('9733','Bliss (code Bliss FP 04/10)');
h[6].add('9717','Closer (code Closer FP 03/10)');
h[6].add('9442','COMPANY (CODE COMPANY FP 12/09)');
h[6].add('9584','Company (code Company 03/10 ad)');
h[6].add('9713','Company (code Company FP 04/10)');
h[6].add('9564','Cosmopolitan (code Cosmo 03/10 ad)');
h[6].add('9721','Cosmopolitan (code Cosmo FP 04/10)');
h[6].add('9653','Country Living (code 04/10 ad)');
h[6].add('9725','Easy Living (code Easy FP 04/10)');
h[6].add('9562','Good Housekeeping (code GHK 02/10 ad)');
h[6].add('9823','Good Housekeeping (code 03/10 ad)');
h[6].add('9655','Glamour (code 04/10 ad)');
h[6].add('9729','Marie Claire (code MC FP 04/10)');
h[6].add('9556','Prima (code 02/10 ad)');
h[6].add('9647','Prima (code 04/10 ad)');
h[6].add('9554','Red (code 02/10 ad)');
h[6].add('9657','Red (code 04/10 ad)');
h[6].add('9550','She (code 02/10 ad)');
h[6].add('9741','Stylist (code Stylist FP 03/10)');
h[6].add('9649','Woman & Home (code 04/10 ad)');
h[6].add('9651','Woman\'s Own (code 03/10 ad)');
h[6].add('6201','Other');
h[14] = new hh('14','Radio');
h[14].add('9875','Red Dragon Supporting Wales Competition');
h[14].add('9813','BBC WM Valentine Lingerie Interview');
h[7] = new hh('7','Magazine article/feature/review');
h[7].add('9589','Best');
h[7].add('9661','Image Magazine');
h[7].add('9666','Prima Magazine');
h[7].add('9820','Rosemary Conley');
h[7].add('9664','Style Magazine');
h[7].add('6930','STYLIST MAGAZINE');
h[7].add('6202','Other');
h[7].add('6143','Local magazine article');
h[13] = new hh('13','Passing by a Bravissimo Shop');
h[13].add('6848','Aberdeen');
h[13].add('4871','Brighton');
h[13].add('4881','Cambridge');
h[13].add('6849','Cardiff');
h[13].add('4904','Chester');
h[13].add('5175','Covent Garden');
h[13].add('5304','Ealing');
h[13].add('5336','Edinburgh');
h[13].add('5594','Glasgow');
h[13].add('6850','Leamington');
h[13].add('6103','Leeds');
h[13].add('6120','Liverpool Shop');
h[13].add('6205','Manchester');
h[13].add('6851','Milton Keynes Shop');
h[13].add('6343','Newcastle');
h[13].add('6351','Norwich Shop');
h[13].add('6357','Nottingham');
h[13].add('6448','Oxford');
h[13].add('6892','Solihull');
h[10] = new hh('10','Newspaper article/feature/review');
h[10].add('9871','The Sunday Times');
h[10].add('9849','Metro.co.uk');
h[10].add('9839','The Sun');
h[10].add('9827','Daily Express');
h[10].add('9667','Dailystar.co.uk');
h[10].add('9807','The Independant');
h[10].add('9370','NEWCASTLE EVENING CHRONICLE');
h[10].add('9367','Liverpool Echo Oct 09 (Reg PR)');
h[10].add('6345','Other');
h[10].add('6149','local newspaper article');
h[3] = new hh('3','Event/Exhibition');
h[3].add('9880','Enable Ladies lunch at Oran Mor');
h[3].add('9855','Home Retail Group Fitting Evening');
h[3].add('9851','Marie Curie Cahrity Event');
h[3].add('9825','Sally Fletcher/London Marathon');
h[3].add('9618','Valentines Day Competition');
h[3].add('9359','VQ  SHOPIING AFFAIR');
h[15] = new hh('15','Recommended by friend/family/other');
h[15].add('9496','Recommendation');
h[15].add('9362','Nancy Stevens');


function bindHowHeard() {
	select = $.$(pageId+"howHeardDdl");
	if (select == null) {
		return;
	}
	select.onchange = function() {
		bindHowHeard2(select);
	}
	if (select.selectedIndex > 0) {
		var s = $.$(pageId + "howHeardDdl2");
		if (s.options.length > 0) {
			row = $.$("howheardrow");
			row.className = "show";
		}
	}
}

function bindHowHeard2(el) {
	row = $.$("howheardrow");
	if (el.selectedIndex == 0) {
		row.className = "";
		return;
	}
	var s = $.$(pageId + "howHeardDdl2");
	s.options.length = 0;
	
	ix = -1;
	thisText = el.options[el.selectedIndex].value;
	for (i in h) {
		if (h[i].id == thisText) {
			ix = i;
			break;
		}
	}
	if (ix == -1) {
		row.className = "";
		return;
	}
	o = h[ix];
	
	if (o.children.length == 0) {
		row.className = "";
		return;			
	}
	
	s.options.add(new Option("-- please select --", "null"));
	for (i=0; i<o.children.length; i++) {
		s.options.add(new Option(o.children[i].name, o.children[i].code));	
	}		
	row.className = "show";
}