PageRenderTime 73ms CodeModel.GetById 11ms app.highlight 53ms RepoModel.GetById 2ms app.codeStats 0ms

/protocols/smpp/docs/UML/html-docs/js/displayToc.js

http://mobicents.googlecode.com/
JavaScript | 656 lines | 531 code | 117 blank | 8 comment | 169 complexity | 492611618ef33392494c3f3aaf91d32d MD5 | raw file
  1var tocRoot, tocBranch, tocSel, tocLoading, tocLastID, tableSel, tabHead, data, tocTab, tocInitRoot, tocMemToc, rFStatus, oldData, tableSelTable;
  2var initI;
  3var icon=new Array();
  4var preloadIcons=new Array(1,10,101,102,103,104,106,107,108,11,113,116,118,16,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,19,20,21,24,25,26,28,29,31,34,4,5,52,53,56,57,6,60,68,69,7,8,82,9,99);
  5
  6var browser=browserCheck();
  7
  8function browserCheck() {
  9	browser=navigator.userAgent.toLowerCase();
 10	if (browser.indexOf('msie')!=-1) {
 11		if(browser.substring(browser.indexOf('msie')+5,browser.indexOf('.',browser.indexOf('msie')))>6) return("ie7");
 12		if(browser.substring(browser.indexOf('msie')+5,browser.indexOf('.',browser.indexOf('msie')))>5) return("ie6");
 13		else return("ie_old");
 14	}
 15	else if (browser.indexOf('firefox')!=-1) return("ff");
 16	else if (browser.indexOf('opera')!=-1) return("op");
 17	else if (browser.indexOf('gecko')!=-1) return("ff");
 18}
 19
 20function changeCSS(theClass,element,value,target) {
 21	var cssRules;
 22	target = eval(target+'.document.styleSheets'); 
 23	if (browser=='ie6'||browser=='ie7') {
 24		cssRules = 'rules';
 25	} else if (browser=='ff'||browser=='op') {
 26		cssRules = 'cssRules';
 27	}
 28	for (var S = 0; S < target.length; S++){
 29		for (var R = 0; R < target[S][cssRules].length; R++) {
 30			if (target[S][cssRules][R].selectorText == theClass) {
 31				try {
 32					target[S][cssRules][R].style[element] = value;
 33				} catch(e) {}
 34			}
 35		}
 36	}
 37}
 38
 39function initItem(item) {
 40	tableSel=null;
 41	if (cont.document.getElementById('TableGroup')!=null) {
 42		toggleItem(cont.document.getElementById('TableGroup').getElementsByTagName('li')[0].id.replace("Title",""));
 43	}
 44}
 45
 46function initLoad(src,toc,home) {
 47
 48	qs=document.location.search.substring(1);
 49
 50	if (qs.substring(0,qs.indexOf('='))=='goto') {
 51		var gotoPage = qs.substring(qs.indexOf('=')+1).split(':');
 52		var fExt = home.substring(home.lastIndexOf('.'));
 53		var home = "./EARoot/";
 54		for (var i=0; i<gotoPage.length; i++) {
 55			home += "EA"+gotoPage[i];
 56			if (i!=gotoPage.length-1)
 57				home += "/";
 58			else
 59				home += fExt;
 60		}
 61	}
 62
 63	src=src.document.location+"";
 64
 65	src=src.substring(src.lastIndexOf('/')+1);
 66	if(src.indexOf('index')==-1&&src!="") return;
 67
 68	var content = document.createElement('div');
 69	content.className = "IndexBody";
 70	content.innerHTML="	<iframe src='"+toc+"' name='toc' id='tocIFrame' frameborder='0'></iframe>\n";
 71	content.innerHTML+="	<iframe src='"+home+"' name='cont' id='contentIFrame' frameborder='0'></iframe>";
 72	content.innerHTML+="	<div id=\"resizeFrames\"></div>";
 73
 74	initPreLoad(content);
 75
 76}
 77
 78function initPage(src) {
 79
 80	if (browser=="ie_old") return;
 81
 82	if (toc.document==null) toc=top.frames[0];
 83	if (cont.document==null) cont=top.frames[1];
 84	if (cont.document==null) {
 85		setTimeout("initPage('"+src+"')","1000");
 86		return;
 87	}
 88
 89	var curPage = cont.document.location+"";
 90	if (curPage.indexOf('EARoot')!=-1) curPage = curPage.substring(curPage.indexOf('EARoot'));
 91	else curPage = curPage.substring(curPage.lastIndexOf('/')+1);
 92
 93	for (var j=0; j<cont.document.getElementsByTagName('div').length; j++) {
 94		if (cont.document.getElementsByTagName('div')[j].className=="ObjectDetailsNotes") {
 95			var tmpStr = cont.document.getElementsByTagName('div')[j].innerHTML;
 96			tmpStr=tmpStr.replace(/&nbsp;<WBR>/g," ");
 97			tmpStr=tmpStr.replace(/&gt;/g,">");
 98			tmpStr=tmpStr.replace(/&lt;/g,"<");
 99			cont.document.getElementsByTagName('div')[j].innerHTML=tmpStr;
100		}
101	}
102
103	if (src!=null) initItem();
104
105	if(curPage.substr(0,curPage.indexOf('.'))=="blank")
106		return;
107
108	//Check ToC is loaded
109	if (toc.document.body==null) {
110		setTimeout("initPage('"+src+"')","1");
111		return;
112	} else if (toc.document.body.childNodes.length==1) {
113		setTimeout("initPage('"+src+"')","1");
114		return;
115	} else if (toc.document.body.lastChild.childNodes.length==0) {
116		setTimeout("initPage('"+src+"')","1");
117		return;
118	} else {
119		var parTree = curPage.substr(0,curPage.lastIndexOf('/')).substr(curPage.indexOf('/')+1).replace(/EA/g,"").replace(/\//g,".");
120
121		if (parTree) {
122			if (parTree.indexOf('0')!=0) parTree = "0."+parTree;
123			parTree=parTree.split('.');
124			var tocTmp;
125
126			for (var j=0; parTree.length>j; j++) {
127
128				if (j>=2) tocTmp += "."+parTree[j];
129				else tocTmp = parTree[j];
130
131				if (toc.document.getElementById('toc'+tocTmp)==null) {
132					setTimeout("initPage('"+src+"')","1");
133					return;
134				}
135
136				var tmpCurToc = toc.document.getElementById('toc'+tocTmp).parentNode.childNodes;
137
138				toc.tocMemToc = parTree.length-j;
139
140				if (tmpCurToc.length>3&&tmpCurToc[tmpCurToc.length-4].src.substring(tmpCurToc[tmpCurToc.length-4].src.lastIndexOf('images')).indexOf('plus')!=-1) {
141					toc.tocClick(tmpCurToc[tmpCurToc.length-4]);
142				}
143			}
144		}
145
146		if (toc.document.getElementById(curPage)==null) {
147			setTimeout("initPage('"+src+"')","1");
148			return;
149		}
150
151		if (toc.document.getElementById(curPage).parentNode.parentNode.parentNode.parentNode&&toc.document.getElementById(curPage).parentNode.parentNode.parentNode.parentNode.childNodes.length>3) {
152			if (toc.document.getElementById(curPage).parentNode.parentNode.parentNode.parentNode.childNodes[toc.document.getElementById(curPage).parentNode.parentNode.parentNode.parentNode.childNodes.length-4].src.indexOf('plus')!=-1) {
153				toc.tocClick(toc.document.getElementById(curPage).parentNode.parentNode.parentNode.parentNode.childNodes[toc.document.getElementById(curPage).parentNode.parentNode.parentNode.parentNode.childNodes.length-4]);
154			}
155		}
156
157		if (toc.document.getElementById(curPage).parentNode.parentNode.childNodes[toc.document.getElementById(curPage).parentNode.parentNode.childNodes.length-4].src.indexOf('plus')!=-1) {
158				toc.tocClick(toc.document.getElementById(curPage).parentNode.parentNode.childNodes[toc.document.getElementById(curPage).parentNode.parentNode.childNodes.length-4]);
159		}
160
161		if (tocSel) tocSel.parentNode.childNodes[tocSel.parentNode.childNodes.length-2].style.backgroundColor = "";
162
163		//Highlight selected ToC item and store in memory
164		if (toc.document.getElementById(curPage)) {
165			tocSel = toc.document.getElementById(curPage).parentNode;
166			tocSel.parentNode.childNodes[tocSel.parentNode.childNodes.length-2].style.backgroundColor = "#B2B4BF";
167			if (tocSel.offsetTop<toc.document.body.scrollTop||tocSel.offsetTop>toc.document.body.offsetHeight+toc.document.body.scrollTop) {
168				toc.scrollTo(0, tocSel.offsetTop-20);
169			}
170		}
171	}
172}
173
174function initPreLoad(content) {
175
176	var preload=document.getElementById('IndexHeader').parentNode.insertBefore(document.createElement('div'), document.getElementById('IndexHeader').nextSibling);
177	preload.id="Preload";
178	preload.appendChild(document.createElement('p'));
179	preload.firstChild.appendChild(document.createTextNode("Loading..."));
180
181	if (browser=="ie_old") return;
182
183	if (browser=="ie6"||browser=="ie7")
184		changeCSS('#Preload','height',top.document.body.clientHeight-67+'px','this');
185	else
186		changeCSS('#Preload','height',top.innerHeight-67+'px','this');
187
188	for (var i=0; i<preloadIcons.length; i++) {
189		icon[preloadIcons[i]]=new Image();
190		icon[preloadIcons[i]].src="images/"+preloadIcons[i]+".png";
191	}
192
193	var preloader = document.body.appendChild(document.createElement('div'));
194	preloader.style.display="none";
195	preloader.id="preloader";
196	preloader.appendChild(content);
197	
198	resizeFrames('init');
199	
200}
201
202function initPreLoaded() {
203
204	if (browser=="op")
205		setCSS();
206
207	var preloader = document.getElementById('preloader');
208
209	document.getElementById('Preload').parentNode.replaceChild(preloader.firstChild, document.getElementById('Preload'));
210	preloader.parentNode.removeChild(preloader);
211
212	if (browser!="op")
213		setTimeout('setCSS();','1000');
214	
215}
216
217function resizeFrames(str) {
218
219	var resizeFrames = document.getElementById('resizeFrames');
220
221	if (str=="init") {
222		resizeFrames.onmousedown = resizeFramesOn;
223		resizeFrames.onmouseup = resizeFramesOff;
224		resizeFrames.onmouseout = resizeFramesOff;
225		resizeFrames.onmousemove = resizeFramesMove;
226	}
227		
228}
229
230function resizeFramesOn(e) {
231	rFStatus=1;
232
233	var resizeFrames = document.getElementById('resizeFrames');
234	tmpRF = resizeFrames.parentNode.appendChild(document.createElement('div'));
235
236	tmpRF.style.left=(document.getElementById('tocIFrame').clientWidth+1)+"px";
237	tmpRF.id="tmpRF";
238	resizeFrames.style.width="100%"
239	resizeFrames.style.left="0px";
240}
241
242function resizeFramesOff(e) {
243	rFStatus=0;
244
245	var resizeFrames = document.getElementById('resizeFrames');
246
247	if (document.getElementById('tmpRF')!=null)
248		document.getElementById('tmpRF').parentNode.removeChild(document.getElementById('tmpRF'));
249
250	resizeFrames.style.width="5px";
251	resizeFrames.style.left=(document.getElementById('tocIFrame').clientWidth+1)+"px";
252}
253
254function resizeFramesMove(e) {
255	if (rFStatus!=0) {
256		if (rFStatus==2)
257			var posX = e+2;
258		else if (browser=="ff")
259			var posX = e.pageX;
260		else
261			var posX = event.x;
262
263		if (posX<=150)
264			posX=150;
265		else if (posX>=top.document.body.clientWidth/2)
266			posX=top.document.body.clientWidth/2;
267
268		document.getElementById('contentIFrame').style.left=(posX+3)+"px";
269		document.getElementById('contentIFrame').style.width=(top.document.body.clientWidth-posX-4)+"px";
270		if (document.getElementById('tmpRF')!=null)
271			document.getElementById('tmpRF').style.left=(posX-2)+"px";
272		if (browser=="ie6")
273			document.getElementById('tocIFrame').style.width=(posX-4)+"px";
274		else
275			document.getElementById('tocIFrame').style.width=(posX-3)+"px";
276
277		if(tableSelTable!=null) {
278			if(tableSelTable.childNodes.length>1&&document.getElementById('tmpRF')!=null) {
279				tableSelTable.style.width=(document.body.clientWidth-(document.getElementById('tmpRF').offsetLeft+6)-20)+"px";
280				tableSelTable.childNodes[0].style.width=(tableSelTable.offsetWidth-19)+"px";
281				tableSelTable.childNodes[1].style.width=(tableSelTable.offsetWidth-19)+"px";
282			}
283		}
284	}
285}
286
287function resizePage() {
288	if(rFStatus==1) return;
289	rFStatus=2;
290
291	if(document.getElementById('resizeFrames')==null)
292		return;
293	
294	if (browser=="ie6") {
295		pHeight=top.document.body.clientHeight;
296	} else {
297		pHeight=top.document.documentElement.clientHeight;
298	}
299
300	resizeFramesMove(document.getElementById('resizeFrames').offsetLeft);
301	document.getElementById('contentIFrame').style.height=pHeight-74+'px';
302	if (browser=="ie7") {
303		document.getElementById('resizeFrames').style.height=pHeight-72+'px';
304		changeCSS('#tmpRF','height',pHeight-72+'px','this');
305	} else {
306		document.getElementById('resizeFrames').style.height=pHeight-70+'px';
307		changeCSS('#tmpRF','height',pHeight-70+'px','this');		
308	}
309	document.getElementById('tocIFrame').style.height=pHeight-74+'px';
310	rFStatus=0;
311}
312
313function setCSS() {
314	if (browser=="ie6") {
315		pHeight=top.document.body.clientHeight;
316	} else {
317		pHeight=top.document.documentElement.clientHeight;
318	}
319
320	if (browser=="ie6"||browser=="ie7") {
321		changeCSS('.IndexBody','width','','this');
322		changeCSS('.IndexBody','top','0px','this');
323		changeCSS('.IndexBody','position','relative','this');
324		changeCSS('#contentIFrame','height',pHeight-74+'px','this');
325		changeCSS('#contentIFrame','left','257px','this');
326		changeCSS('#resizeFrames','background','#000000','this');
327		changeCSS('#resizeFrames','filter','progid:DXImageTransform.Microsoft.Alpha(opacity=0)','this');
328		changeCSS('#resizeFrames','height',pHeight-72+'px','this');
329		changeCSS('#tmpRF','border','0px','this');
330		changeCSS('#tmpRF','height',pHeight-70+'px','this');
331		changeCSS('#tocIFrame','height',pHeight-74+'px','this');
332	}
333
334	if (browser=="op"||browser=="ie6"||browser=="ie7")
335		changeCSS('#contentIFrame','width',top.document.body.clientWidth-258+'px','this');
336}
337
338
339function tocBuild(data) {
340
341	var tocType = new Array();
342	var tocTypes = new Array();
343	var tocErrs = new Array();
344
345	for (var i=0; i<tocTab.length; i++) {
346		if (!tocTab[i][8]) tocTab[i][8] = 'misc';
347		if (tocTab[i][8].toLowerCase().indexOf('diagram')!=-1) tocTab[i][8] = "0Diagram";
348		if (tocTab[i][8].toLowerCase().indexOf('package')!=-1) tocTab[i][8] = "1Package";
349		if (!tocType[tocTab[i][8]]) {
350			tocType[tocTab[i][8]] = new Array();
351			tocTypes[tocTypes.length]=tocTab[i][8];
352		}
353		tocType[tocTab[i][8]][tocType[tocTab[i][8]].length] = i;
354	}
355
356	tocTypes.sort();
357
358	for (var i=0; i<tocTypes.length; i++) {
359		for (var j=0; j<tocType[tocTypes[i]].length; j++) {
360			var build = tocBuildItem(tocType[tocTypes[i]][j]);
361			if (build!=true)
362				tocErrs[tocErrs.length]=build;
363		}
364	}
365	
366	var errRuns=0;
367	var errTotal=tocErrs.length;
368
369	while(tocErrs.length!=0) {
370		if (errNums==tocErrs.length) {
371			errRuns++;
372			if (errRuns>errTotal) {
373				break;
374			}
375		}
376		var errNums=tocErrs.length;
377		var tmp=tocBuildItem(tocErrs.shift());
378		if(tmp!=true)
379			tocErrs[tocErrs.length]=tmp;
380	}
381
382	while(tocErrs.length!=0) {
383		tocTab[tocErrs[0]][6]="0";
384		tocBuildItem(tocErrs.shift());
385	}
386
387	if (tocLastID!=0) {
388		var tocLastSrc = document.getElementById("toc"+tocLastID).parentNode.childNodes[document.getElementById("toc"+tocLastID).parentNode.childNodes.length-4];
389		tocLastSrc.src = tocLastSrc.src.substring(tocLastSrc.src.lastIndexOf('images')).replace("01","02");
390	}
391}
392
393function tocBuildItem(i) {
394
395	var childItem = false;
396
397	if (tocTab[i][0].indexOf(':')!=-1) tocBranch = document.getElementById("toc"+tocTab[i][0].substring(0, tocTab[i][0].lastIndexOf(':')));
398	else if (tocTab[i][0].indexOf('.')!=-1) tocBranch = document.getElementById("toc"+tocTab[i][0].substring(0, tocTab[i][0].lastIndexOf('.')));
399	else if (tocTab[i][0]!="0") tocBranch = document.getElementById("toc0");
400	else if (tocTab[i][1]==3) tocBranch = document.getElementById("System").parentNode.lastChild;
401	else tocBranch = tocRoot;
402	
403	//Check if item is child
404	if (tocTab[i][5]&&tocTab[i][6]&&tocTab[i][6]!="0") {
405		if (document.getElementById(tocTab[i][6])==null) return i;
406		tocBranch = document.getElementById(tocTab[i][6]).parentNode.lastChild;
407		childItem = true;
408	}
409
410	tocBranch = tocBranch.appendChild(document.createElement('li'));
411
412	if (tocTab[i][0]!=0||tocTab[i][1]==3) {
413		tocImage = tocBranch.appendChild(document.createElement('img'));
414
415		if (tocTab[i][0].indexOf('.')==-1&&(tocTab[i][0].indexOf(':')==-1||tocTab[i][0].indexOf('0')==0)) tocImage.src = "images/join01.gif";
416		else if (tocTab[i][0].indexOf('.')!=-1||tocTab[i][0].indexOf(':')!=-1) {
417			var tocTmp=tocTab[i][0].replace(':','.');
418			for (var m=0; tocTmp.split('.').length>m+1; m++) {
419				if (document.getElementById("toc"+tocTmp.substring(0,tocTmp.lastIndexOf('.'))).parentNode.childNodes[m].src.substring(document.getElementById("toc"+tocTmp.substring(0,tocTmp.lastIndexOf('.'))).parentNode.childNodes[m].src.lastIndexOf('images')).indexOf('02')!=-1||document.getElementById("toc"+tocTmp.substring(0,tocTmp.lastIndexOf('.'))).parentNode.childNodes[m].src.substring(document.getElementById("toc"+tocTmp.substring(0,tocTmp.lastIndexOf('.'))).parentNode.childNodes[m].src.lastIndexOf('images')).indexOf('04')!=-1) tocImage.src = "images/join04.gif";
420				else tocImage.src = "images/join03.gif";
421				tocImage = tocBranch.appendChild(document.createElement('img'));
422			}
423			tocImage.src = "images/join01.gif";
424		}
425		tocImage.onclick = function() { tocClick(this); }
426
427		if (tocTab[i][1]==3) {
428			tocImage.src=tocImage.src.substring(tocImage.src.lastIndexOf('images')).replace("01","02");
429			if (tocImage.parentNode.parentNode.childNodes.length>1) {
430				tocTmp = tocImage.parentNode.previousSibling.childNodes[tocImage.parentNode.previousSibling.childNodes.length-4];
431				tocTmp.src=tocTmp.src.substring(tocTmp.src.lastIndexOf('images')).replace("02","01");
432			}
433		}
434
435		//Check if item has children data
436		if (tocTab[i][1]&&tocTab[i][1]!=3) {
437			tocImage.id=tocTab[i][7];
438			tocImage.alt=tocTab[i][7];
439		} else if (childItem==true) {
440			while (tocImage.parentNode.childNodes.length<document.getElementById(tocTab[i][6]).parentNode.childNodes.length-2) {
441				tocImage.parentNode.insertBefore(document.createElement('img'), tocImage).src="images/join03.gif";
442			}
443			tocImage.src=tocImage.src.substring(tocImage.src.lastIndexOf("images")).replace('01','02');
444			if (document.getElementById(tocTab[i][6]).parentNode.lastChild.childNodes.length>1) {
445				tocTmpSrc=document.getElementById(tocTab[i][6]).parentNode.lastChild.lastChild.previousSibling.childNodes[document.getElementById(tocTab[i][6]).parentNode.lastChild.lastChild.previousSibling.childNodes.length-4];
446				tocTmpSrc.src=tocTmpSrc.src.substring(tocTmpSrc.src.lastIndexOf('images')).replace('02','01');
447			}
448			tocImage = document.getElementById(tocTab[i][6]).parentNode.childNodes[document.getElementById(tocTab[i][6]).parentNode.childNodes.length-4];
449			tocImage.parentNode.lastChild.style.display = "none";
450		}
451
452		if ((tocTab[i][1]&&tocTab[i][1]!=3)||childItem==true) {
453			tocImage.id=tocImage.id.substr(1,tocImage.id.length-2);
454			tocImage.src=tocImage.src.substring(tocImage.src.lastIndexOf('images')).replace('join','plus');
455		}
456	}
457
458	//Set Icon
459	if (tocTab[i][3]) {
460		tocImg = tocBranch.appendChild(document.createElement('a'));
461		tocImg.href = tocTab[i][3];
462		tocImg.target = top.frames[1].name;
463	} else tocImg = tocBranch;
464	tocTab[i][4]=tocTab[i][4].substring(0,tocTab[i][4].indexOf('.'))
465
466	tocImg = tocImg.appendChild(document.createElement('img'));
467	if(top.icon[tocTab[i][4]])
468		tocImg.src = top.icon[tocTab[i][4]].src;
469	else
470		tocImg.src = "images/"+tocTab[i][4]+".png";
471
472	if (tocTab[i][3])
473		tocImg.id=tocTab[i][3];
474
475	//Set Text/Link
476	if (tocTab[i][5]&&tocTab[i][8]!="0Diagram") tocBranch.lastChild.id=tocTab[i][5];
477	else tocBranch.lastChild.id="0";
478	tocBranch.lastChild.style.marginRight="4px";
479	if (tocTab[i][3]) {
480		tocText = tocBranch.appendChild(document.createElement('a'));
481		tocText.href = tocTab[i][3];
482		tocText.target = top.frames[1].name;
483	}
484	else tocText = tocBranch;
485	var j=0;
486
487	//Replace values
488	while (tocTab[i][2].indexOf('&quot;')!=-1) tocTab[i][2] = tocTab[i][2].replace('&quot;','\"');
489	while (tocTab[i][2].indexOf('<br />')!=-1) tocTab[i][2] = tocTab[i][2].replace('<br />','\n');
490	while (tocTab[i][2].indexOf('&#39;')!=-1) tocTab[i][2] = tocTab[i][2].replace('&#39;','\'');
491	if (tocTab[i][2]=="") tocTab[i][2]="               ";
492
493	tocText.appendChild(document.createTextNode(tocTab[i][2]));
494	tocBranch.appendChild(document.createElement('ul')).id = "toc"+tocTab[i][0];
495
496	tocLastID = tocTab[i][0];
497
498	return true;
499
500}
501
502function tocClick(tocSrc) {
503
504	if (tocSrc.src.substring(tocSrc.src.lastIndexOf('images')).indexOf('minus')!=-1) {
505
506		tocSrc.parentNode.childNodes[tocSrc.parentNode.childNodes.length-1].style.display = "none";
507		tocSrc.src=tocSrc.src.substring(tocSrc.src.lastIndexOf('images')).replace('minus','plus');
508
509	} else if (tocSrc.src.substring(tocSrc.src.lastIndexOf('images')).indexOf('plus')!=-1) {
510
511		tocSrc.parentNode.childNodes[tocSrc.parentNode.childNodes.length-1].style.display = "block";
512		tocSrc.src=tocSrc.src.substring(tocSrc.src.lastIndexOf('images')).replace('plus','minus');
513
514		//Check if children data built
515		if (tocSrc.parentNode.childNodes[tocSrc.parentNode.childNodes.length-1].childNodes.length==0) {
516			tocLoadData(tocSrc.id+".xml");
517		}
518
519	}
520
521}
522
523function tocInit() {
524	if (browser=="ie_old") {
525				top.document.getElementById('Preload').childNodes[0].innerHTML="<strong>It appears you are using an outdated version of Internet Explorer, please download a later version from <a href=\"http://www.microsoft.com/windows/ie/default.mspx\">Microsoft</a></strong>";
526				return;
527	}
528	tocLoading = document.body.appendChild(document.createElement('div'));
529	tocRoot = document.body.appendChild(document.createElement('ul'));
530	tocRoot.id = "tocRoot";
531	tocInitRoot = 1;
532	tocLoadData('root.xml');
533}
534
535function tocLoadData(src) {
536
537	var tmp=document.location+"";
538	tmp=tmp.substring(0,tmp.indexOf('toc.'));
539
540	src = tmp+"js/data/"+src;
541	tocTab = new Array();
542
543	try {
544		data = new XMLHttpRequest();
545		data.onreadystatechange = tocLoadDataProcess;
546		data.open("GET", src, true);
547		data.send(null);
548	} catch(e) {
549		if (browser=="ie6"||browser=="ie7") {
550			data = new ActiveXObject("Microsoft.XMLHTTP");
551			if (data) {
552				data.onreadystatechange = tocLoadDataProcess;
553				data.open("GET", src, true);
554				data.send();
555			}
556		} else {
557			alert(e);
558		}
559	}
560}
561
562function tocLoadDataProcess() {
563	if (data.readyState == 4) {
564		if (oldData==data)
565			return;
566		oldData=data;
567		try {
568			eval(data.responseText);
569			tocBuild();
570			tocInitRoot++;
571			if (tocInitRoot==2) {
572				tocLoadData(tocTab[0][7].substring(1,tocTab[0][7].length-1)+".xml");
573			} else if (tocInitRoot==3&&top.document.getElementById('Preload')!=null) {
574				tocInitRoot=0;
575				top.initPreLoaded();
576			}
577		} catch(e) {
578			if(top.document.getElementById('Preload')!=null)
579				top.document.getElementById('Preload').childNodes[0].innerHTML="<strong>An error occured while loading data files, please confirm that all files have been generated and are intact.</strong>";
580			return;
581		}
582	}
583}
584
585function toggleData(src) {
586	var dataRoot = cont.document.getElementById(src).parentNode.parentNode.parentNode;
587	if (cont.document.getElementById(src).src.substring(cont.document.getElementById(src).src.lastIndexOf('images')).indexOf('plus')!=-1) cont.document.getElementById(src).src=cont.document.getElementById(src).src.substring(0,cont.document.getElementById(src).src.lastIndexOf('images'))+cont.document.getElementById(src).src.substring(cont.document.getElementById(src).src.lastIndexOf('images')).replace('plus','minus');
588	else cont.document.getElementById(src).src=cont.document.getElementById(src).src.substring(0,cont.document.getElementById(src).src.lastIndexOf('images'))+cont.document.getElementById(src).src.substring(cont.document.getElementById(src).src.lastIndexOf('images')).replace('minus','plus');
589	for (var i=0; i<dataRoot.getElementsByTagName('tr').length; i++) {
590		if (dataRoot.getElementsByTagName('tr')[i].id.indexOf(src)!=-1&&cont.document.getElementById(src).src.substring(cont.document.getElementById(src).src.lastIndexOf('images')).indexOf('minus')!=-1&&dataRoot.getElementsByTagName('tr')[i].getElementsByTagName('td')[1].firstChild!=null) dataRoot.getElementsByTagName('tr')[i].style.display="";
591		else if (dataRoot.getElementsByTagName('tr')[i].id.indexOf(src)!=-1) dataRoot.getElementsByTagName('tr')[i].style.display="none";
592	}
593	if (cont.document.getElementById('TableGroup')!=null) {
594		toggleItem(tableSel,2);
595	}
596}
597
598function toggleItem(item,type) {
599
600	if (tableSel!=null) {
601		cont.document.getElementById(tableSel+"Title").style.background="#FFFFFF";
602		cont.document.getElementById(tableSel+"Title").style.color="#000000";
603		cont.document.getElementById(tableSel+"Table").style.display="none";	
604	}
605	tableSel=item;
606	tableSelTable = cont.document.getElementById(item+"Table");
607	tableSelTitle = cont.document.getElementById(item+"Title");
608
609	tableSelTitle.style.background="#DDDDDD";
610	tableSelTitle.style.color="#666666";
611	tableSelTable.style.display="block";
612	
613	if (browser=="ff"||browser=="op"||browser=="ie7") {
614		var contWHeight = document.documentElement.clientHeight-78;
615		var contWWidth = cont.document.documentElement.clientWidth;
616	} else {
617		var contWHeight = document.body.clientHeight-74;
618		var contWWidth = document.body.clientWidth-(top.document.getElementById('resizeFrames').offsetLeft+6);
619	}
620
621	if (cont.document.body.offsetHeight-contWHeight>0) {
622		if (tableSelTable.id!="LinkedDocumentTable")
623			tableSelTable.style.overflow="scroll";
624		if (browser=="ff"||browser=="op") {
625			tableSelTable.style.height=tableSelTable.offsetHeight-(cont.document.body.offsetHeight-cont.innerHeight)-12+"px";
626		} else {
627			tableSelTable.style.height=tableSelTable.offsetHeight-(cont.document.body.offsetHeight-contWHeight)-3+"px";
628			if (cont.document.body.offsetWidth>contWWidth||type==null) {
629				tableSelTable.style.width=contWWidth-20+"px";
630				if(tableSelTable.getElementsByTagName('table').length!=0)
631					tableSelTable.getElementsByTagName('table')[0].style.width=tableSelTable.getElementsByTagName('table')[0].offsetWidth-18+"px";
632			}
633		}
634		if(tableSelTable.getElementsByTagName('table').length!=0) {
635			tabHead = tableSelTable.appendChild(tableSelTable.getElementsByTagName('table')[0].cloneNode(true));
636			tabHead.style.position="absolute";
637			if (browser=="ff"||browser=="op")
638				tabHead.style.width=tableSelTable.offsetWidth+"px";
639			tabHead.style.top=tableSelTable.offsetTop+1+"px";
640			for (var i=0; i<tabHead.getElementsByTagName('tr').length; i++) {
641				if (i!=0) tabHead.getElementsByTagName('tr')[i].style.display="none";
642			}
643		}
644	} else if (cont.document.getElementById('TableGroup').offsetHeight+cont.document.getElementById('TableGroup').offsetTop<(contWHeight-6)&&tableSelTable.style.overflow=="scroll") {
645		if (browser=="ff"||browser=="op") {
646			tableSelTable.style.height=tableSelTable.offsetHeight-(cont.document.body.offsetHeight-cont.innerHeight)-12+"px";
647		} else {
648			tableSelTable.style.height=tableSelTable.offsetHeight+((contWHeight-8)-(cont.document.getElementById('TableGroup').offsetHeight+cont.document.getElementById('TableGroup').offsetTop))+"px";
649		}
650	}
651	if(tableSelTable.childNodes.length>1) {
652		tableSelTable.style.width=(document.body.clientWidth-(top.document.getElementById('resizeFrames').offsetLeft+6)-20)+"px";
653		tableSelTable.childNodes[0].style.width=(tableSelTable.offsetWidth-19)+"px";
654		tableSelTable.childNodes[1].style.width=(tableSelTable.offsetWidth-19)+"px";
655	}
656}