// #######  Dynamic alocation of the files in Mikranet                                                #######
// #######  This function detects the current section and show an hierarchic tree #######
// #######  Author: Jansenson Yehuda - 10.07.06                                                      #######
// #######  Put this script call on the page you want to show the Alocation bar ########
//		  		  		  <!-- ##### Textual Alocation bar  ##### -->
//		



var onSection,onSection3,onUrl,onSectionOut;
var level1,level2,level3;

// the second and third level to be written
var arrLevel2=new Array("activity.html","activity.html?page=1","activity.html?page=2","activity.html?page=3","search","activities","teachers","main","sachlav","cgi-bin","feedback2.html","env","ques.html","teacherQues.html","studQues2.html","generalQues.html", "ques.html","activity_eli2.html");
var arrLevel3=new Array('act',"maphmar");


var arrNavLevel2=new Array('<span style="font-size:13px; color: #820A0A" dir="rtl"><a href="http://www.mikranet.org.il/" style="text-decoration: none;color: #820A0A">על יסודי</a> > <a href="http://www.mikranet.org.il/activity.html" style="text-decoration: none;color: #820A0A">קריאה מודרכת</a>',
'<span style="font-size:13px; color: #820A0A" dir="rtl"><a href="http://www.mikranet.org.il/" style="text-decoration: none;color: #820A0A">על יסודי</a> > <a href="http://www.mikranet.org.il/activity.html" style="text-decoration: none;color: #820A0A">קריאה מודרכת</a>',
'<span style="font-size:13px; color: #820A0A" dir="rtl"><a href="http://www.mikranet.org.il/" style="text-decoration: none;color: #820A0A">על יסודי</a> > <a href="http://www.mikranet.org.il/activity.html" style="text-decoration: none;color: #820A0A">פעילויות ממוחשבות</a>',
'<span style="font-size:13px; color: #820A0A" dir="rtl"><a href="http://www.mikranet.org.il/" style="text-decoration: none;color: #820A0A">על יסודי</a> > <a href="http://www.mikranet.org.il/activity.html" style="text-decoration: none;color: #820A0A">קריאה מוטעמת</a>',

'<a href="javaScript:window.location.href=window.location.href" style="text-decoration: none;color: #820A0A">חיפוש בכל האתר</a>',
'<a href="http://www.mikranet.org.il/activity.html" style="text-decoration: none;color: #820A0A">הפעלות ממוחשבות</a>',
'<a href="http://www.mikranet.org.il/teachers/" style="text-decoration: none;color: #820A0A">מורים</a>',
'<a href="http://www.mikranet.org.il/teachers/" style="text-decoration: none;color: #820A0A">מורים</a>',
'<a href="http://www.mikranet.org.il/teachers/" style="text-decoration: none;color: #820A0A">מורים</a>',
'<a href="http://www.mikranet.org.il/teachers/" style="text-decoration: none;color: #820A0A">מורים</a>',
'<span style="font-size:13px; color: #820A0A" dir="rtl"><a href="http://www.mikranet.org.il/" style="text-decoration: none;color: #820A0A">מורים</a> > <a href="http://www.mikranet.org.il/feedback2.html" style="text-decoration: none;color: #820A0A">אחיתופל</a>',
'<span style="font-size:13px; color: #820A0A" dir="rtl"><a href="http://www.mikranet.org.il/" style="text-decoration: none;color: #820A0A">דף ראשי</a> > <a href="http://www.mikranet.org.il/env/contact.html" style="text-decoration: none;color: #820A0A">צרו קשר</a></span>',
'<a href="http://www.mikranet.org.il/ques.html" style="text-decoration: none;color: #820A0A">שאלוני הערכה</a>',
'<a href="http://www.mikranet.org.il/ques.html" style="text-decoration: none;color: #820A0A">שאלוני הערכה</a>',
'<a href="http://www.mikranet.org.il/ques.html" style="text-decoration: none;color: #820A0A">שאלוני הערכה</a>',
'<a href="http://www.mikranet.org.il/ques.html" style="text-decoration: none;color: #820A0A">שאלוני הערכה</a>',
'<span style="font-size:13px; color: #820A0A" dir="rtl"><a href="http://www.mikranet.org.il/" style="text-decoration: none;color: #820A0A">מורים</a> > <a href="http://www.mikranet.org.il/feedback2.html" style="text-decoration: none;color: #820A0A">אחיתופל</a>',
'<a href="http://www.mikranet.org.il/activity_eli2.html" style="text-decoration: none;color: #820A0A">הפעלות ממוחשבות</a>');

var arrNavLevel3=new Array('<a href="http://www.mikranet.org.il/activities/act4/index.html" style="text-decoration: none;color: #820A0A">קריאה מודרכת</a>',
'<a href="http://www.mikranet.org.il/activities/act6/index.html" style="text-decoration: none;color: #820A0A">קריאה רהוטה</a>',
'<a href="http://www.mikranet.org.il/activities/act1/index.html" style="text-decoration: none;color: #820A0A">נושאים מתוך תוכנית הלימודים</a>',
'<a href="http://www.mikranet.org.il/teachers/teacher_serch_file.html" style="text-decoration: none;color: #820A0A">כלים שלובים (מערכי שיעור)</a>',
'<a href="http://www.mikranet.org.il/teachers/maphmar.html" style="text-decoration: none;color: #820A0A">פינת מפמ"ר</a>',
'<a href="http://www.mikranet.org.il/teachers/maphmar.html" style="text-decoration: none;color: #820A0A">פינת מפמ"ר</a>',
'<a href="http://www.mikranet.org.il/teachers/freinds.html" style="text-decoration: none;color: #820A0A">חברי מקראנט</a>');

var navTxt ='<br><span style="font-size:13px; color: #820A0A" dir="rtl"><a href="http://www.mikranet.org.il/" style="text-decoration: none;color: #820A0A">דף ראשי</a> > ';

// function that write on the page top the navigation bar
function sectionDetect()
{
	onUrl=window.location.href;
	onSection=onUrl.split("/");  // separate the strings after the mikranet Url to detect where we are
	//alert("+"+onSection.length);
	onSectionOut=onSection[3].split("?");
	
	// second level
	for (i=0;i<arrLevel2.length ;i++ )
	{
		
		if (arrLevel2[i]==onSection[3])
		{
			//alert(onSection[3]);
					level2=arrNavLevel2[i];
					//alert(level2);
		}
		else if (arrLevel2[i]==onSectionOut[0])
		{
			level2=arrNavLevel2[i];
		}
	}
	
	// third level
	if(onSection[4]!=undefined && onSection[4]!="")
	{
		//alert(onSection.length);
		onSection3=onSection[4].split("act");  // inside activities
		if (onSection3[1]!=undefined)
			{
				if(onSection3[1]=='2' || onSection3[1]=='3' || onSection3[1]=='5' || onSection3[1]=='4')
						level3=arrNavLevel3[0];
				if(onSection3[1]=='6' || onSection3[1]=='7' || onSection3[1]=='8' || onSection3[1]=='9' || onSection3[1]=='10')
						level3=arrNavLevel3[1];
				if(onSection3[1]=='1')
						level3=arrNavLevel3[2];
				if(onSection3[1]=='.html')
						level3='';
			}	
		else
			{
			onSection3=onSection[5].split("study_plan");  // inside KEHILAT MORIM
			if (onSection3[1]!=undefined)
					level3='';
			else
				{
				
					onSection3=onSection[3].split("cgi-bin");  // inside KEHILAT MORIM
					if (onSection3[1]!=undefined)
							level3='';
					else
						{
							onSection3=onSection[4].split("teacher_serch_file");  // inside teachers --> search
							if (onSection3[1]!=undefined)
									level3=arrNavLevel3[3];
							else
								{
									onSection3=onSection[4].split("maphmar");  // inside maphmar
									if (onSection3[1]!=undefined)
											level3=arrNavLevel3[4];
									else
										{
										onSection3=onSection[4].split("upload_file.html");  // inside Kelim Shluvim
										if (onSection3[1]!=undefined)
											level3=arrNavLevel3[3];
										else
											{
											onSection3=onSection[4].split("upload");  // inside maphmar
											if (onSection3[1]!=undefined)
												level3=arrNavLevel3[4];
											else
												{
												onSection3=onSection[4].split("freinds.html");  // Mikranet friends
												if (onSection3[1]!=undefined)
													level3=arrNavLevel3[6];
												else
													{
													onSection3=onSection[4].split("mikranet");  // inside mafmar or ajitofel or Kelim Shluvim
													if (onSection3[1]!=undefined)
														{
															onSection3=onSection[5].split("search_question.pl");  // inside Ajitofel
															if (onSection3[1]!=undefined)
															{
																level2=arrNavLevel2[7];
																level3=''
															}
															else
															{
																onSection3=onSection[5].split("search_files.pl");  // inside Kelim Shluvim
																if (onSection3[1]!=undefined)
																	level3=arrNavLevel3[3];
																else
																	level3=arrNavLevel3[5];
															}
														}							
													else
														level3='';
										}
									}
								}
							}
						}
					}
				}
			}
	}
	else
		level3='';
	//document.write (navTxt);
	document.write(level2);
	if(level3!='' && level3!=undefined)
		document.write(' >  '+level3);
	document.write('</span><br><br> ');

}

sectionDetect();

