var edit_mode = "3";
var treecolor = "FFFFFFFF";
var dirty = false;
var site_nav_index = {'a':[1],'ab':[1,2],'ac':[1,3],'ae':[1,4],'af':[1,5],'ag':[1,6],'ah':[1,7],'ai':[1,8],'aj':[1,9],'b':[10],'ba':[10,11],'bb':[10,12],'bd':[10,13],'be':[10,14],'bf':[10,15],'bh':[10,16],'bi':[10,17],'bj':[10,18],'bk':[10,19],'bl':[10,20],'bm':[10,21],'bo':[10,22],'bp':[10,23],'bq':[10,24],'br':[10,25],'bs':[10,26],'bv':[10,27],'c':[28],'cb':[28,29],'cc':[28,30],'ca':[28,31],'ck':[28,32],'cl':[28,33],'cm':[28,34],'cn':[28,35],'cw':[28,36],'e':[37],'ea':[37,38],'ec':[37,39],'ed':[37,40],'ee':[37,41],'ek':[37,42],'el':[37,43],'em':[37,44],'en':[37,45],'eo':[37,46],'ep':[37,47],'es':[37,48],'et':[37,49],'eu':[37,50],'ev':[37,51],'ew':[37,52],'ex':[37,53],'ey':[37,54],'d':[55],'da':[55,56],'db':[55,57],'dc':[55,58],'dd':[55,59],'de':[55,60],'df':[55,61],'dg':[55,62],'dh':[55,63],'di':[55,64],'dj':[55,65],'dk':[55,66],'dl':[55,67],'f':[68],'fa':[68,69],'fb':[68,70],'fc':[68,71],'fe':[68,72],'fh':[68,73],'fn':[68,74],'fp':[68,75],'fv':[68,76],'g':[77],'gg':[77,78],'h':[79],'hb':[79,80],'hc':[79,81],'hd':[79,82],'he':[79,83],'hi':[79,84],'i':[85],'k':[86],'l':[87],'m':[88],'n':[89],'na':[89,90],'nb':[89,91],'nc':[89,92],'ne':[89,93],'nf':[89,94],'ni':[89,95],'nj':[89,96],'o':[97],'oa':[97,98],'p':[99],'pa':[99,100],'pd':[99,101],'pe':[99,102],'pg':[99,103],'ph':[99,104],'pi':[99,105],'pm':[99,106],'q':[107],'qa':[107,108],'qb':[107,109],'qd':[107,110],'qe':[107,111],'qf':[107,112],'qg':[107,113],'qh':[107,114],'qi':[107,115],'qj':[107,116],'qk':[107,117],'qm':[107,118],'qo':[107,119],'qp':[107,120],'qr':[107,121],'t':[122],'ta':[122,123],'tb':[122,124],'tc':[122,125]};
var nav_path = site_nav_index[page];

function process_nav()
{
	var nav = [['a','Welcome','St Mary\'s Church of England Primary',1,1,'',''],[['ab','Latest News','Click on these windows to view more details',2,1,'',''],['ac','Contact','Contact Us',3,1,'',''],['ae','Newsletters',' Newsletters from School',4,1,'',''],['af','Older News','Previous Newsletters to view by weeks',5,1,'',''],['ag','Ofsted','Ofsted Report February 2009',6,1,'',''],['ah','Uniform','Details of School Uniform',7,1,'',''],['ai','Meals','Breakfast Club and School Lunches',8,1,'',''],['aj','Fruit Snacks','Great Snacks at Break with the Healthy Fruit Trolley',9,1,'',''],],['b','Nursery & Foundation','\<a href=&quot;http://www.glitter-graphics.com/myspace/text_gener',10,1,'',''],[['ba','Big Toddle','Barnardo\'s Big Toddle',11,1,'',''],['bb','Action','It\'s A Great Place to Have Fun and Learn',12,1,'',''],['bd','Healthy Fruit','Tasting Different Healthy Fruit!',13,1,'',''],['be','World Cup Day','World Cup Day 2010',14,1,'',''],['bf','Open Day May 7th','OPEN DAY MAY 7th 2008',15,1,'',''],['bh','Communication, Language and Literacy','Communication, Language and Literacy',16,1,'',''],['bi','Problem solving, Reasoning and Numeracy','Problem solving, Reasoning and Numeracy',17,1,'',''],['bj','Personal, Social and Emotional Development.','Personal, Social and Emotional Development.',18,1,'',''],['bk','Physical Development','Physical Development',19,1,'',''],['bl','Knowledge and understanding of the world.','Knowledge and understanding of the world.',20,1,'',''],['bm','Creative Development','Creative Development',21,1,'',''],['bo','YR','Our Reception Classes',22,1,'',''],['bp','The Curriculum','The Curriculum',23,1,'',''],['bq','Parents as Partners','Parents as Partners',24,1,'',''],['br','Preparation for Starting School','Preparation for Starting School',25,1,'',''],['bs','A Typical Day in Reception','A Typical Day in Reception',26,1,'',''],['bv','Newsletter Spring 2010','Reception Newsletter Spring 2010',27,1,'',''],],['c','KS1',' KS1 at work...Reception to Year 2',28,1,'',''],[['cb','Year one Newsletter Spring 2010','Year 1 Spring newsletter 2010',29,1,'',''],['cc','Cross Phase Day','Cross Phase Days',30,1,'',''],['ca','Easter','Creative  Easter Gardens from Nursery, Foundation and KS1 (2009)',31,1,'',''],['ck','Year 2 Newsletter Spring 2010','Year 2 Newsletter Spring 2010',32,1,'',''],['cl','Planets Activity Afternoon 2010','Winter Art Work by Planets',33,1,'',''],['cm','Garden Time','Y2 Garden Time',34,1,'',''],['cn','Parent & Child Maths','Parent & Child Maths',35,1,'',''],['cw','Nativity 2008','The Christmas Story at St Mary\'s CEP 2008',36,1,'',''],],['e','KS2','A Glimpse of the Work Covered at KS2',37,1,'',''],[['ea','Year 3 Newsletter','Newsletter',38,1,'',''],['ec','Y3SMW Picture Frames','We\'ve Been Framed!',39,1,'',''],['ed','Y3CC Bird Watch','Year 3cc\'s RSPB\'s Great School Bird Watch Activities',40,1,'',''],['ee','Celts & Romans','Celts and Romans visit Year 3',41,1,'',''],['ek','Y4SB','Class Y4SB',42,1,'',''],['el','Summer Newsletter 2010','Summer Newsletter 2010',43,1,'',''],['em','Roman painted House','Year 5 visit Roman Painted House',44,1,'',''],['en','Y5 News 2010','News from Year 5 Classes',45,1,'',''],['eo','Science Y5','Investigating in Science in Y5',46,1,'',''],['ep','Victorian Day','The Day Year 5 went back in time to the Victorian  Age',47,1,'',''],['es','Y6 Caribbean Party','Year 6 Caribbean Party Evening',48,0,'',''],['et','Swimming TTble','Swimming Times for Year 6',49,1,'',''],['eu','Swattenden 2009','[colour=Red]Swattenden 2009[/colour]',50,1,'',''],['ev','Y6KS Newsletter Summer 2010','Year 6 KS Newsletter Summer 2010',51,1,'',''],['ew','Y6 Multi-Cultural day','Y6 visit Folkestone University',52,1,'',''],['ex','Y6 Coastal Park 2010','Year 6 visit to Coastal Park 2010',53,1,'',''],['ey','Info Swattenden','Swattenden Information for parents 2010',54,1,'Y',''],],['d','Policies','School Policies',55,1,'',''],[['da','Admissions Policy','Admissions Policy',56,1,'',''],['db','Data','Data Safety of your children',57,1,'',''],['dc','ICT Safety','School\'s Policy on ICT  and Safety Links',58,1,'',''],['dd','Early Years Foundation Stage Policy','Early Years Foundation Stage Policy',59,1,'',''],['de','Equality Plan','Equality Plan',60,1,'',''],['df','Disability Policy (Staff and Visitors)','Disability Policy (Staff and Visitors)',61,1,'',''],['dg','Disability Policy (Pupils)','Disability Policy (Pupils)',62,1,'',''],['dh','Accessability Policy','Accessability Policy',63,1,'',''],['di','Inappropriate behaviour based on Racism','Inappropriate behaviour based on Racism',64,1,'',''],['dj','Complaints Policy','Complaints Policy',65,1,'',''],['dk','Special and Additional Needs Policy','Special and Additional Needs Policy',66,1,'',''],['dl','Commitment to Equality','Ongoing practice to ensure overarching commitment to equality',67,1,'',''],],['f','Events','Snow at Last',68,1,'',''],[['fa','Y2 Eco','Year 2 Eco Day',69,1,'',''],['fb','Fete 2010','[colour=FF3300]Summer Fete 2010[/colour]',70,0,'',''],['fc','Charivari 2010','Charivari Street Carnival',71,1,'',''],['fe','New Authors!','KS2 had an exciting and motivating writers workshop for 3 sessio',72,1,'',''],['fh','BLP Days','Building Learning Power days at St Mary\'s',73,1,'',''],['fn','Harvest \'09','\'Thank you\' Harvest Festival at School',74,1,'',''],['fp','Easter Bonnets 2010','[colour=green] Easter Bonnets and Gardens [/colour]',75,1,'',''],['fv','Fete 2008','The Circus Clowns came to our Fete this Year 2008!',76,1,'',''],],['g','Charities','Thinking of Others Less Fortunate Than Us',77,1,'',''],[['gg','Poppy Day','Remembrance Day',78,1,'',''],],['h','Sports','SPORTS at St Mary\'s is very important',79,1,'',''],[['hb','Netball final 2010','Shepway Netball Finals 2010',80,1,'',''],['hc','Y3/4 Sports Day','Lower Junior Sports day 2010',81,1,'',''],['hd','Y5/6 Sports Day 2010','Upper Juniors Sports Day',82,1,'',''],['he','KS1 Sports Day','Infants Sports Day 2010',83,1,'',''],['hi','Swimming','What are your goals in Swimming?',84,1,'',''],],['i','Safe websites','Safe Websites to use at Home',85,1,'',''],['k','Feedback','Let us know what you think',86,1,'',''],['l','ICT Safety','School\'s Policy on ICT  and Safety Links',87,1,'',''],['m','Parents','Useful links for Parents',88,1,'',''],['n','ICT','ICT at St Mary\'s and what we get up to in and out of the Comput',89,1,'',''],[['na','Tesco Vouchers','New Technology Equipment presented to us by our local MP at Tesc',90,1,'',''],['nb','Litton','Using ICT to link with Litton Primary School in the Peak Distric',91,1,'',''],['nc','Robotics','Kent Education Robotics Festival',92,1,'',''],['ne','Charles Clarke','Year 5 talk to the Rt Honourable Charles Clarke',93,1,'',''],['nf','Animation','Learning Animation with Miss Bird',94,1,'',''],['ni','Mobile Learning','New Laptops. What do we think?',95,1,'',''],['nj','TV + Data','Teacher\'s TV films Year 5!',96,1,'',''],],['o','Earthquake','Earthquake in Folkestone...courtesy of the BBC',97,1,'',''],[['oa','Earthquake 2','Pupils accounts of the Earthquake on the 28th April 2007',98,1,'',''],],['p','Environment','The Newly Developed School Pond Area',99,1,'',''],[['pa','Pond','Everyone\'s Booking a Time in the Pond Area!',100,1,'',''],['pd','Folkestone','Welcome to Folkestone',101,1,'',''],['pe','Bird Watch 2010','Nest Cam',102,1,'',''],['pg','Polytunnel','Our New Polytunnel',103,1,'',''],['ph','Chickens','Spring Time Chickens (arrived)',104,1,'',''],['pi','Yellow Pages Day','Yellow Pages Sculptures',105,1,'',''],['pm','Y3 & 4 visit to Show','Year 3 & 4 visit to Living World at the Kent Show Ground',106,1,'',''],],['q','International','View our Global Links across the school.',107,1,'',''],[['qa','Podcasts','Podcasts Multimedia Work',108,1,'',''],['qb','ISA Portfolio','International School Award Portfolio online',109,1,'',''],['qd','Italy Earth Class','Earth Class are continuing their links from last year with Solor',110,1,'',''],['qe','Scotland in Planets Class','Y2 Planets Go Scottish for International Week',111,1,'',''],['qf','Africa Y3EB','Africa',112,1,'',''],['qg','Africa Y3SMW','Africa',113,1,'',''],['qh','Native America Y4KQ','Our International Week',114,1,'',''],['qi','India by Y1','Sunshine and Rainbow classes are linking to a school in India',115,1,'',''],['qj','French visit','L\'Ecole Delaroche et Ecole Greuze 1 spend a day at our school w',116,1,'',''],['qk','BBC','BBC World Class The Credit Crunch',117,1,'',''],['qm','Poland','Year6 LW link with Szkola 707 in Poland.',118,1,'',''],['qo','Kherad School','Kherad School visit to St Mary\'s',119,1,'',''],['qp','Kherad School 2','Exciting activities during our visit to St Mary\'s',120,1,'',''],['qr','Y5CU','Mrs Uden\'s Year 5 class are linking with L\'Ecole de la Roche i',121,1,'',''],],['t','Funky Monkeys After School Club','t',122,1,'',''],[['ta','Club Information','[colour=339900]Funky Monkey Parent Information[/colour]',123,1,'',''],['tb','Funky Monkey Activities','\<a href=&quot;http://www.glitter-graphics.com/myspace/text_gener',124,1,'',''],['tc','Staff','                        Meet the staff',125,1,'',''],]];
	_process_nav(nav, 0, '');
}

function _process_nav(nav, level, state)
{
	nav_div = document.getElementById('navblock');
	navigation = write_nav(nav, level, state);
	if (nav_div.hasChildNodes())
	{
		nav_div.removeChild(nav_div.childNodes[0]);
	}
	nav_div.appendChild(navigation);
}


function write_nav(nav, level, state)
{
	var navigation = document.createElement("ul");
	if (nav == 'undefined')
	{
		alert('Deary me, this isn\'t right!');
	}
	if (state == '' && nav_path.length >= (level + 1)) {navigation.style.display = "block";}
	navigation.className ='uln';
	for (var x = 0; x < nav.length; x++)
	{
		var item = nav[x];
		if (item && typeof(item[0]) == 'string')
		{
			if (typeof(nav[x+1]) != 'undefined' && typeof(nav[x+1][0]) != 'string' && typeof(nav[x+1][0]) != 'undefined')
			{
				var citem = write_nav_item(item, level, 'nf', state);
				if (citem != null)
				{
					x++;
					item = nav[x];
					if (nav[x - 1] != 'undefined' && nav[x-1][3] == nav_path[level] && item[4] != 0)
					{
						var child_nav = write_nav(item, level + 1, '');
						citem.appendChild(child_nav);
					}
					else
					{
						if (item[4] != 0)						{
							citem.appendChild(write_nav(item, level + 1, '_x'));
						}
					}
					navigation.appendChild(citem);
				}
			}
			else
			{
				citem = write_nav_item(item, level, 'np', state);
				if (citem != null)
				{
					navigation.appendChild(citem);
				}
			}
		}
	}
	return navigation;
}

function write_nav_item(item, level, navtype, state)
{
	var on_style = "";
	var list_on_style = "";
	var mode = 3;
	
	if (item[1] == '')
	{
		item[1] = 'Untitled';
	}
	if (item[3] == nav_path[level])	{
		on_style = " " + navtype;
		on_style += item[3] == nav_path[level] ? '_on' : '';

		list_on_style = " l" + navtype;
		list_on_style += item[3] == nav_path[level] ? '_on' : '';
	}
	else	{
		list_on_style = " l" + navtype;
		list_on_style += '_off';
	}
	if (item[4] == 0 && mode == 3)
	{
		on_style = '_hidden';
		list_on_style = '_hidden';
	}

	if (item[4] == 0 && mode == 3)
	{
		return null;
	}

	var nav_item = document.createElement("li");
	nav_item.setAttribute('id', "_" + item);
	//nav_item.setAttribute('class', "l" + navtype + list_on_style);
	nav_item.className = "l" + navtype + list_on_style;
	//if (level > 0 || navtype == 'np') {nav_item.style.display = "none";}

	div1 = document.createElement("div");
	div1.className = "nbg";

	div2 = document.createElement("div");
	//div2.setAttribute('class', navtype + on_style);
	div2.className = navtype + on_style;

// create disclosure
	if (navtype == 'nf')
	{
		d_b = document.createElement("a");
		d_b.setAttribute('name', '');
		d_b.setAttribute('onclick', 'disclose(this);');
		d_b.className="d_i";	// disclosure icon

		d_a = document.createElement("img");
		d_a.setAttribute('src', 'http://www.take2theweb.com/images/FIG.GIF');
		d_a.setAttribute('onclick', 'disclose(event);');
		d_a.onclick = disclose;
		d_a.setAttribute('height', '16');
		d_a.setAttribute('width', '16');
		d_a.className = 'nfi';
		//d_b.appendChild(d_a);
		div2.appendChild(d_a);
	}
	
//
	
	d_a = document.createElement("a");
	d_a.className = 'n_l';		// navigation link
	if (item[6] != undefined && item[6] != '')	{
		d_a.setAttribute('href', item[6]);
		d_a.setAttribute('target', '_top');
	}
	else
	{
		d_a.setAttribute('href', item[0] + '.html');
	}
	d_a.setAttribute('title', item[2]);
	d_a.setAttribute('alt', "This is a disclosure item");
	if (item[5] != '') {d_a.setAttribute('accesskey', item[5]);}
	
	d_a_txt = document.createTextNode(item[1]);
	
	d_a.appendChild(d_a_txt);
	div2.appendChild(d_a);
	div1.appendChild(div2);
	nav_item.appendChild(div1);
	return nav_item;
}

function disclose(e)
{
	if (!e) var e = window.event;
	e = e.target || e.srcElement;
	p = e.parentNode.parentNode.parentNode.lastChild;
	var state = p.style.display;
	switch(state)
	{
		case '':
		case null:
		case 'none':
			p.style.display='block';
			{
				e.className ='nfi_on';
			}
			break;
		default:
			p.style.display='none';
			{
				e.className ='nfi';
			}
	}
}

