var edit_mode = "3";
var treecolor = "FFFFFFFF";
var dirty = false;
var site_nav_index = {'p':[1],'a':[2],'aa':[2,3],'ab':[2,4],'ac':[2,5],'ad':[2,6],'af':[2,7],'aj':[2,8],'ai':[2,9],'ag':[2,10],'ae':[2,11],'ah':[2,12],'al':[2,13],'f':[14],'fa':[14,15],'fb':[14,16],'fc':[14,17],'fd':[14,18],'fe':[14,19],'ff':[14,20],'fg':[14,21],'k':[14,22],'fi':[14,23],'fj':[14,24],'fk':[14,25],'fl':[14,26],'i':[14,27],'ia':[14,27,28],'ib':[14,27,29],'ja':[14,30],'jb':[14,31],'jd':[14,32],'jc':[14,33],'je':[14,34],'jf':[14,35],'jg':[14,36],'c':[37],'ka':[38],'kb':[38,39],'ke':[38,40],'dl':[38,41],'kg':[38,42],'kk':[38,43],'ko':[38,44],'fh':[38,45],'dg':[38,46],'d':[47],'da':[47,48],'db':[47,49],'dc':[47,50],'dd':[47,51],'de':[47,52],'df':[47,53],'em':[47,54],'dh':[47,55],'e':[56],'ea':[56,57],'eb':[56,58],'ec':[56,59],'ed':[56,60],'ee':[56,61],'ef':[56,62],'eg':[56,63],'eh':[56,64],'ei':[56,65],'ej':[56,66],'ek':[56,67],'el':[56,68],'g':[69],'gg':[69,70],'gb':[69,71],'gk':[69,72],'gm':[69,73],'ga':[69,74],'gc':[69,75],'gd':[69,76],'ge':[69,77],'gf':[69,78],'gh':[69,79],'gj':[69,80],'gi':[69,81],'gl':[69,82],'gn':[69,83],'go':[69,84],'gp':[69,85],'b':[69,86],'pa':[69,87],'h':[88],'ha':[88,89],'j':[90],'l':[91],'le':[91,92],'lf':[91,93],'lg':[91,94],'lh':[91,95],'li':[91,96],'lj':[91,97],'lk':[91,98],'ll':[91,99],'lm':[91,100],'n':[91,101],'nb':[91,102],'nc':[91,103],'nd':[91,104],'nf':[91,105],'ng':[91,106],'m':[107],'me':[107,108],'mf':[107,109],'ma':[107,110],'mb':[107,111],'mc':[107,112],'md':[107,113],'o':[114],'oa':[114,115],'oh':[114,116],'ob':[114,117],'oc':[114,118],'od':[114,119],'oe':[114,120],'of':[114,121],'og':[114,122],'ol':[114,123],'ak':[114,124],'am':[114,125],'an':[114,125,126],'ao':[114,125,127],'ap':[114,125,128]};
var nav_path = site_nav_index[page];

function process_nav()
{
	var nav = [['p','Recently Updated','p',1,0,'',''],['a','Our School','\<FONT SIZE=&quot;6&quot; FACE=&quot;Verdana&quot;\>\<I\>\<B\>Welcome',2,1,'',''],[['aa','Files','Files',3,0,'',''],['ab','Our Location','Where To Find Us',4,1,'',''],['ac','School Grounds','Our School Setting',5,1,'',''],['ad',' Surroundings','The Surrounding Area',6,0,'',''],['af','School Aims','What We Are Trying To Achieve',7,1,'',''],['aj','School Profile','School Profile 2007',8,0,'',''],['ai','School Governors','Governing Body',9,1,'',''],['ag','Headteacher','Headteacher\'s Message',10,1,'',''],['ae','School History','Down the Years at Michael Drayton',11,0,'',''],['ah','Michael Drayton','Michael Drayton - Poet Laureate ?',12,1,'',''],['al','Contact Us','Contact Us!',13,1,'',''],],['f','School Information','f',14,1,'',''],[['fa','Admissions','Admissions',15,1,'',''],['fb','Our Uniform','Equipped and Ready for Action',16,1,'',''],['fc','Discipline','Behaviour Expectations',17,1,'',''],['fd','Home / School Contact','Home / School Contact',18,1,'',''],['fe','Special Needs','Special Educational Needs',19,1,'',''],['ff','School Meals','Lunchtime Arrangements',20,1,'',''],['fg','Health & Safety','Health and Safety at School',21,1,'',''],['k','Term Dates','Academic Year 2010/11 & 2011/12',22,1,'',''],['fi','Use of Internet','Internet Policy',23,1,'',''],['fj','School Council','School Council',24,1,'',''],['fk','Homework','Homework',25,1,'',''],['fl','Further Information','Further Information',26,1,'',''],['i','PTA','THE SCHOOL ASSOCIATION',27,0,'',''],[['ia','PTA Members','PTA Members',28,1,'',''],['ib','Christmas Bingo','Christmas Bingo',29,1,'',''],],['ja','Computers','Information and Communications Technology',30,1,'',''],['jb','Library','Our School Library',31,1,'',''],['jd','The Courtyard','Our Showpiece Centrepiece',32,1,'',''],['jc','Play Areas','Playgrounds',33,1,'',''],['je','School Halls','Our Indoor Halls',34,1,'',''],['jf','Cookery Area','Watch Out Children Cooking',35,1,'',''],['jg','Music Room','Let The Music Play',36,1,'',''],],['c','Assemblies','Assemblies',37,0,'',''],['ka','Pupils\' Zone','Pupils\' Zone',38,1,'',''],[['kb','E-Safety Posters','E-Safety',39,1,'',''],['ke','Yr 5 Spanish Armada','Year 5 Spanish Armada Presentations',40,1,'',''],['dl','Yr 5 Photo Stories','Year 5 Photo Stories',41,1,'',''],['kg','Yr 6 PowerPoint Games','Yr 6 PowerPoint Games',42,1,'',''],['kk','Yr 5 Digital Movies','Year 5 Digital Movies',43,1,'',''],['ko','Amazing Artists by WJ','Guessepe Arcimboldo',44,0,'',''],['fh','Funny Stories - LD','Funny Stories',45,0,'',''],['dg','Yr 5 PowerPoint Games','Yr 5 PowerPoint Games',46,1,'',''],],['d','Year Groups','Year Group Information',47,1,'',''],[['da','Year 3','Youngest and Finest!',48,1,'',''],['db','Year 4','A Force To Be Reckoned With!',49,1,'',''],['dc','Year 5','Simmering Nicely',50,1,'',''],['dd','Year 6','The Final Countdown',51,1,'',''],['de','Year 3 Links','Year Three Themes and Topics',52,1,'',''],['df','Year 4 Links','Year Four Themes and Topics',53,1,'',''],['em','Year 5 Links','Year Five Websites',54,1,'',''],['dh','Year 6 Links','Year Six Websites',55,1,'',''],],['e','Curriculum','Teaching and Learning',56,1,'',''],[['ea','English','The English Curriculum',57,1,'',''],['eb','Mathematics','The Maths Curriculum',58,1,'',''],['ec','Science','The Science Curriculum',59,1,'',''],['ed','I.C.T.','Information and Communications Technology',60,1,'',''],['ee','D.T.','Design Technology',61,1,'',''],['ef','Humanities','History and Geography',62,1,'',''],['eg','P.E.','Physical Education',63,1,'',''],['eh','Art','Art and Design',64,1,'',''],['ei','Music','Music',65,1,'',''],['ej','R.E.','Religious Education',66,1,'',''],['ek','P.S.H.E.','Personal Social and Health Education',67,1,'',''],['el','Homework Help','Helping with Homework',68,1,'',''],],['g','Recent Events','Recent Events',69,1,'',''],[['gg','MDYT Panto 2008','MDYT Panto 2008',70,0,'',''],['gb','Young Voices Choir 2008','Young Voices Choir 2008',71,0,'',''],['gk','Singing in Signs Jan 08','Singing Signs Jan 08',72,0,'',''],['gm','Children\'s University 2007','Children\'s University 2007',73,0,'',''],['ga','Y3 Music Show','Stars in the Making!',74,0,'',''],['gc','gc','gc',75,0,'',''],['gd','Red Nose 2007','Red Nose 07 - The Big One',76,0,'',''],['ge','Y3 Egyptians 07','Egyptian Day',77,0,'',''],['gf','Bosworth 2006','Bosworth 2006',78,0,'',''],['gh','Waterstones 2006','Roald Dahl Event',79,0,'',''],['gj','Childrens Uni','Graduation Ceremony at Warwick University  November 2006',80,0,'',''],['gi','gi','gi',81,0,'',''],['gl','gl','gl',82,0,'',''],['gn','New Play Area at Hartshill Hayes - Nov 07','New Play Area at Hartshill Hayes',83,0,'',''],['go','go','go',84,0,'',''],['gp','Files','Files',85,0,'',''],['b','b','b',86,0,'',''],['pa','pa','pa',87,0,'',''],],['h','Performance Data','Pupils\' Performance',88,0,'',''],[['ha','Test Results','National Curriculum Test Results',89,0,'',''],],['j','Facilities','Have a look at some of our facilities',90,0,'',''],['l','Internet Links','l',91,1,'',''],[['le','Teachers Page','Ideas, Activities and Resources for Teachers and their Pupils',92,1,'',''],['lf','Literacy Links','Literacy Websites',93,1,'',''],['lg','Numeracy Links','Numeracy Websites',94,1,'',''],['lh','Science Links','Science Websites',95,1,'',''],['li','History Links','Websites for History Students',96,1,'',''],['lj','Geography Links','Get  Your Geographical Information Here!',97,1,'',''],['lk','More Great Sites','',98,1,'',''],['ll','School Sites','Brilliant School Sites!',99,1,'',''],['lm','Website Visitor Map','lm',100,1,'',''],['n','We-Learn Portal','We-Learn Portal',101,1,'',''],['nb','3Ga Gymnastics','Budding Olympians',102,0,'',''],['nc','Rosh Hashanah','Jewish Food Laws - Report from 3BB',103,0,'',''],['nd','Y6 Art Workshop','Y6 Art Workshop',104,0,'',''],['nf','Year 3 Art Work','Art Work',105,0,'',''],['ng','Arts Festival','Intercultural Arts Workshops',106,0,'',''],],['m','Art Gallery','Take a trip through our Art Gallery',107,1,'',''],[['me','Lion Pastels Yr 4 08','Lion Pastels Yr 4 08',108,1,'',''],['mf','Monet Matisse Yr 4 08','Monet Matisse Yr 4 08',109,1,'',''],['ma','4BU Sumac leaves','The Sumac Leaves of 4BU',110,1,'',''],['mb','Santa Faces','The Face of Santa',111,1,'',''],['mc','Y6 Xmas trees','\'Treemendous \'Art',112,1,'',''],['md','Y5 Poinsettas','Points for the Poinsettas',113,1,'',''],],['o','News & Letters','Information for Parents',114,1,'',''],[['oa','Latest News','Latest News from MDJS',115,1,'',''],['oh','Latest Newsletter','Latest Newsletter',116,0,'',''],['ob','Big Wild Read 07','Big Wild Read Summer 2007',117,0,'',''],['oc','Newsletter Archive','Newsletter Archive',118,0,'',''],['od','Year 3 Autumn 06','Year 3 Autumn 2006',119,0,'',''],['oe','Year 4 Spring 07','Year 4 Spring 2007',120,0,'',''],['of','Year 5 Spring 07','Year 5 Spring 2007',121,0,'',''],['og','Year 6 Spring 07','Year 6 Spring 2007',122,0,'',''],['ol','Letter Links','Letter Links',123,0,'',''],['ak','Parents\' Letters','Parents\' Letters',124,1,'',''],['am','Untitled','am',125,0,'',''],[['an','Untitled','an',126,0,'',''],['ao','Untitled','ao',127,0,'',''],['ap','Untitled','ap',128,0,'',''],]]];
	_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';
			}
	}
}

