includeCommonVars();

ins =  "2"

//***************************************************************************
function buildComponentNavigation(linkArr)
{
	var page = "";
	var buildBack = true;
	switch(currentPage)
	{
		case "Home":
		case "MyCourses":
		case "Store":
		case "Community":
		case "MyProfile":
		case "LogIn":
		case "myPage":   
		case "Support":
			buildBack = false;
			url = "#";
			break;	
		case "babylonAdd":
		case "Forum":
		case "Magazine":
		case "InSite":
		case "TalkingIdioms":
		case "WordZone":
		case "WebPal":
		case "WebChallenge":
			url = Root + "Runtime/MidScreens/Community.asp";
			break;	
		case "course": 
			url="myPage.asp"
			if (FromTMS)
				buildBack = false;
			break;
		case "unit": 
			url="Course.asp?courseId=" + getCompositeCookie("Course", "CourseId") + "&FromTMS=" + FromTMS 
			break;
		case "component":   
		case "viewComponent": 
			page = "Unit.asp?unitId=" + getCompositeCookie("Unit", "UnitId") + "&FromTMS=" + FromTMS + "&SID=" + getCompositeCookie("Student", "SID")
			url = 'javaScript:SavePage(&quot;'+ page +'&quot;,&quot;'+ appName +'&quot;,' + obj.Id + ',&quot;' + appletMode + '&quot;)'	   
			break;		
		case "customComponent":
		case "viewCustomComponent":
			page = "Unit.asp?unitId=" + getCompositeCookie("Unit", "UnitId") + "&FromTMS=" + FromTMS + "&SID=" + getCompositeCookie("Student", "SID")
			url = 'javaScript:saveCCData(&quot;'+ page +'&quot;)'	   
			break;		
	}

	w('<table width="556" border="0" cellspacing="0" cellpadding="0" height="5">')
  w('<tr><td height="5" class="BgChange"><IMG height=5 src=' + Root + 'Runtime/Context/common/transparent.gif width=20></td></tr>')
	w('</table>')
	w('<table width="556" border="0" cellspacing="0" cellpadding="0" class="BgChange" height="20">')
	w('<tr> ')
  w('<td width="10"><IMG height=20 src=' + Root + 'Runtime/Context/common/transparent.gif width=10></td>')

  if (buildBack)
  {
		w('<td id="buildBack1" width="30" align="middle" valign="top"><A href="'+url+'"><IMG id=IMG1 border=0 height=15 src=' + Root + 'Runtime/Context/common/BackLink.gif width=30></a></td>')
		w('<td id="buildBack2" align="left" valign="top" nowrap width="100%"><A class=BackLink href="'+url+'">'+getTranslate("cxtNv00NtBackToMenu")+'</a></td>')
  }
  else
  {
		w('<td width="30" align="middle" valign="top"><IMG id="IMG1" border=0 height=15 src="' + Root + 'Runtime/Context/common/transparent.gif" width=30></td>')
		w('<td align="left" valign="top" nowrap width="100%"><IMG height=20 src="' + Root + 'Runtime/Context/common/transparent.gif" width=20></td>')
  }
    
	// Temporarily
	switch (currentPage)
	{
		case "Magazine":
			var subPages = new Array("Current Issue", "Archive");
			var names = new Array("currentissue", "archive");
			var links = linkArr
			//var links = new Array("MagazineHome.asp", "MagazineTopic.asp");
			var linkNames = new Array("Current Issue", getTranslate("cxtTi0000NvArchive"));
			//var linkNames = new Array(getTranslate("cxtIs00NvNtCurrent"), getTranslate("cxtTi0000NvArchive"));
			break;		
		case "InSite":
			var subPages = new Array("CurrentReview", "PastReviews");
			var names = new Array("currentreview", "pastreviews");
			var links = new Array("InSite.asp", "InSiteArchive.asp");
			var linkNames = new Array(getTranslate("cxtIs00NvNtCurrent"), getTranslate("cxtIs00NvNtPast"));
			break;		
		case "TalkingIdioms":
			var subPages = new Array("Idioms", "Archive");
			var names = new Array("idioms", "archive");
			var links = new Array("IdiomsF.asp", "IdiomsArchive.asp");
			var linkNames = new Array(getTranslate("cxtTi0000NvIdioms"), getTranslate("cxtTi0000NvArchive"));
			break;		
		case "WebPal":
			var subPages = new Array("Inbox", "Pals", "Search Pals", "Sent Items");
			var names = new Array("inbox", "pals", "search", "sent");
			var links = new Array("NWP_Inbox.asp", "NWP_Pals.asp", "NWP_SearchSwitch.asp", "NWP_Sent.asp");
			var linkNames = new Array(getTranslate("cxtWp0000NvInbox"), getTranslate("cxtWp0000NvPals"), getTranslate("cxtWp0000NvSearchPals"), getTranslate("cxtWp0000NvSent"));
			break;
		case "Support":
			var subPages = new Array("Inbox", "Teachers", "Sent");
			var names = new Array("inbox", "teachers", "sent");
			var links = new Array("Inbox.asp", "Teachers.asp", "Sent.asp");
			var linkNames = new Array(getTranslate("cxtTsNv00NtInbox"), getTranslate("cxtTsNv00NtWrite"), getTranslate("cxtTsNv00NtSentItems"));
			break;		
	}

	switch (currentPage)
	{
		case "component":
		case "viewComponent":  
			for (var i = 0; i < subCompNameArr.length; i++)
			{
				idName = subCompNameArr[i].toLowerCase()
				do {
					idName = idName.replace(" ","_")
		    } while (idName.indexOf(" ") > -1)	
				do {
					idName = idName.replace("-","_")
		    } while (idName.indexOf("-") > -1)	
			  
				if (subCompNameArr[i] == obj.SubComponent)
				{
					w('<td height="20"  align="middle" valign="center" width="20"><IMG height=20 src="' + Root + 'Runtime/Context/common/0_0_ept_highlight.gif" width=20 name="i'+idName+'"></td>')
				  w('<td align="middle" valign="center" class="ept0bg0highlight" nowrap id="'+ idName +'"><span class="sinput">&nbsp;</span><A class=ept0links href="#" >&nbsp;'+getEPTTranslate(subCompNameArr[i])+'&nbsp;</A></td>')
				}
				else
				{    
					var sSubCompName = subCompNameArr[i]  
				  if (subCompNameArr[i] != "Test")
						var sSubCompName = skill + sSubCompName
				  w('<td height="20" align="middle" valign="center" width="20"><IMG height=20 src="' + Root + 'Runtime/Context/common/transparent.gif" width=20 name="i'+ idName +'"></td>')
				  w('<td height="20" align="middle" valign="center" nowrap  id="'+ idName +'" class="ept0bg" onMouseOver = "this.className = &quot;ept0bg0highlight&quot;; document.i' + idName + '.src=&quot;' + Root + 'Runtime/Context/common/0_0_ept_highlight.gif&quot;" onMouseOut = "this.className = &quot;ept0bg&quot;; document.i'+ idName +'.src=&quot;' + Root + 'Runtime/Context/common/transparent.gif&quot;" ><A class=ept0links href="javascript:getSubComp('+ subCompIdArr[i] +',&quot;'+ sSubCompName +'&quot;)">&nbsp;'+ getEPTTranslate(subCompNameArr[i]) +'&nbsp;</A></td>')
				}    
			} 
			break;
		case "customComponent":
		case "viewCustomComponent":
			for (var i = 0; i < subCompNameArr.length; i++)
			{
				idName = subCompNameArr[i].toLowerCase()
				do {
					idName = idName.replace(" ","_")
		    } while (idName.indexOf(" ") > -1)	
				do {
					idName = idName.replace("-","_")
		    } while (idName.indexOf("-") > -1)	

				//if (subCompNameArr[i] == obj.SubComponent)
				if (subCompIdArr[i] == getCompositeCookie("Component", "ItemId"))
				{
					w('<td height="20"  align="middle" valign="center" width="20"><IMG height=20 src="' + Root + 'Runtime/Context/common/0_0_ept_highlight.gif" width=20 name="i'+idName+'"></td>')
				  w('<td align="middle" valign="center" class="ept0bg0highlight" nowrap id="'+ idName +'"><span class="sinput">&nbsp;</span><A class=ept0links href="#" >&nbsp;'+subCompNameArr[i]+'&nbsp;</A></td>')
				}
				else
				{    
				  w('<td height="20" align="middle" valign="center" width="20"><IMG height=20 src="' + Root + 'Runtime/Context/common/transparent.gif" width=20 name="i'+ idName +'"></td>')
				  w('<td height="20" align="middle" valign="center" nowrap  id="'+ idName +'" class="ept0bg" onMouseOver = "this.className = &quot;ept0bg0highlight&quot;; document.i' + idName + '.src=&quot;' + Root + 'Runtime/Context/common/0_0_ept_highlight.gif&quot;" onMouseOut = "this.className = &quot;ept0bg&quot;; document.i'+ idName +'.src=&quot;' + Root + 'Runtime/Context/common/transparent.gif&quot;" ><A class=ept0links href="javascript:getCustSubComp('+subCompIdArr[i]+')">&nbsp;'+subCompNameArr[i]+'&nbsp;</A></td>')
				}    
			} 
			break;
		case "InSite":
		case "TalkingIdioms":
		case "WebPal":
		case "Support":
		case "Magazine":
			for (var i = 0; i < subPages.length; i++)
			{
				w('<td align="center" valign="middle" width="20">');
				var strImg = (subPages[i] == subPage) ? "Runtime/Context/common/0_0_ept_highlight.gif" : "Runtime/Context/common/transparent.gif";
				w('<img src=' + Root + strImg +' width=20 height=20 name=' + names[i] + '></td>');
				if (subPages[i] == subPage)
				{
					w('<td style="padding-left:5;padding-right:10" align="center" valign="middle" class="ept0bg0highlight" nowrap>');
					w('<a href="#" class=ept0links>' + linkNames[i] + '</a></td>');
				}
				else
				{
					w('<td style="padding-left:5;padding-right:10" id=' + names[i] + ' height="20" align="center" valign="middle" nowrap class="ept0bg" onMouseOver="this.className=&quot;ept0bg0highlight&quot;; document.' + names[i] + '.src=&quot;' + Root + 'Runtime/Context/common/0_0_ept_highlight.gif&quot;" onMouseOut="this.className=&quot;ept0bg&quot;; document.' + names[i] + '.src=&quot;' + Root + 'Runtime/Context/common/transparent.gif&quot;" >');
			    w('<a href=' + links[i] + ' class=ept0links>&nbsp;&nbsp;' + linkNames[i] + '</a></td>');
				}
			}
			break;
		default:
			w('<td height="20" align="right" width="20"><IMG height=20 src=' + Root + 'Runtime/Context/common/transparent.gif width=20 name=iexplore></td>')
			w('<td height="20" align="middle" width="60" class="ept0bg" id="explore"><IMG id=IMG1 height=10 src=' + Root + 'Runtime/Context/common/transparent.gif width=60 ></td>')
			w('<td height="20" align="right" width="21"><IMG height=20 src=' + Root + 'Runtime/Context/common/transparent.gif width=20 name=ipractice></td>')
			w('<td height="20" align="middle" width="60" id= "practice" class="ept0bg"><IMG id=IMG1 height=10 src=' + Root + 'Runtime/Context/common/transparent.gif width=60 ></td>')
			w('<td height="20" align="right" width="20"><IMG height=20 src=' + Root + 'Runtime/Context/common/transparent.gif width=20 name=itest></td>')
			w('<td height="20" align="middle" width="60" id="test"><IMG id=IMG1 height=10 src=' + Root + 'Runtime/Context/common/transparent.gif width=60></td>')
      break;   		  
	}
	w('</tr>')
  w('</table>')
}
//***************************************************************************
function buildSkillIcon()
{
	if (currentPage == "component" || currentPage == "viewComponent")  
	{
		w('<table width="110" border="0" cellspacing="0" cellpadding="0" class="layout0thin0line" id=TABLE1>')
			w('<tr>')
				w('<td height="100" class="BgChange" align="center" valign="middle" width="110">')
					w('<span><img id=IMG1 src="' + Root + 'Runtime/Context/common/component_icons/' + skill.toLowerCase() + '_icon.gif" width=70 height=60 alt="' + getSkillTranslate(skill) + '"></span><br>')
					w('<span class="component0title">' + getSkillTranslate(skill) + '</span>')
	      w('</td>')
			w('</tr>')
		w('</table>')
	}
	else
	{
		w('<table  width="110" border="0" cellspacing="0" cellpadding="0">')
			w('<tr>')
			if (currentPage == "Home")  
				w('<td height="80" align="center" valign="top" class="BgChange"><span class="BgChange"><br><br>')
			else      
				w('<td height="80" align="center" valign="middle" class="BgChange"><span class="BgChange">')
          w('<img name=Image98 width=70 height=60 src="' + Root + 'Runtime/Context/common/transparent.gif" border=0></span><br>')
          w('<span class="component0title" id="ComponentIcon" name="ComponentIcon"></span>')
        w('</td>')
      w('</tr>')
		w('</table>')   
	}
}

//***************************************************************************
function buildLogo()
{
	var urlCourse = "";
	var url = "";
	var page = "";
	switch (currentPage)
	{
		case "Home":
		case "MyCourses":
		case "Store":
		case "Magazine":
		case "Community":
		case "MyProfile":
		case "WebChallenge":
		case "WordZone":
		case "WebPal":
		case "Support":
		case "TalkingIdioms":
		case "InSite":
    case "LogIn":
    case "myPage":
    case "course": 
			urlCourse="#"
			courseTitle=""	   
			break;
		case "unit": 
			urlCourse="Course.asp?courseId=" + getCompositeCookie("Course","CourseId") + "&FromTMS=" + FromTMS 
			courseTitle = courseName
			break;
		case "component":
		case "viewComponent": 
			page = "Course.asp?courseId=" + getCompositeCookie("Course","CourseId") + "&FromTMS=" + FromTMS 
			courseTitle = courseName
			urlCourse = 'javaScript:SavePage(&quot;'+ page +'&quot;,&quot;'+ appName +'&quot;,' + obj.Id + ',&quot;' + appletMode + '&quot;)'	   
      break; 
		case "customComponent":
		case "viewCustomComponent":
			page = "Course.asp?courseId=" + getCompositeCookie("Course","CourseId") + "&FromTMS=" + FromTMS 
			courseTitle = courseName
			urlCourse = 'javaScript:saveCCData(&quot;'+ page +'&quot;)'	   
      break; 
	} 
          
	w('<table width="110" border="0" cellspacing="0" cellpadding="0">')
  w('<tr>') 
  w('<td align="middle" valign="top" class="bgchange"><IMG id=IMG1  src=' + Root + 'Runtime/Context/common/logo_connect.gif ></td>')
  w('</tr>')
  
  w('<tr>') 
  w('<td height="1" align="middle" valign="top" class="layout0thin0line"><IMG height=1 src=' + Root + 'Runtime/Context/common/transparent.gif width=105></td>')
  w('</tr>')
	if (urlCourse != "#")
	{
		w('<tr>') 
		w('<td height="20" align="middle" valign="center" class="unitTitleBg"><A class=unitTitle href="' + urlCourse + '"><span class="unitTitle">' + courseTitle + '</span></a><span class="unitTitle"></span></td>')
		w('</tr>')
		w('<tr>') 
		w('<td height="1" align="middle" valign="top" class="layout0thin0line"><IMG height=1 src=' + Root + 'Runtime/Context/common/transparent.gif width=105></td>')
		w('</tr>')
	}
	w('</table>')

	switch(currentPage)
	{
		case "Home":
			w('<img src=' + Root + 'Runtime/Context/Home/IllLeft.gif width="110" height="240">')
      break;      
		case "Magazine":
			buildPictureContainer(graphicMode, 110, 210, "p1=" + Root + "Runtime/Context/MidScreens/MagazineIllLeft", "", "", "leftIll");
			w('<img height=5 src=' + Root + 'Runtime/Context/common/transparent.gif width=20>') 
      break;      
		case "Community":
			buildPictureContainer(graphicMode, 110, 210, "p1=" + Root + "Runtime/Context/MidScreens/CommunityIllLeft", "", "", "leftIll");
			w('<img height=5 src=' + Root + 'Runtime/Context/common/transparent.gif width=20>') 
      break;      
		case "MyProfile":
      buildPictureContainer(graphicMode, 110, 210, "p1=" + Root + "Runtime/Context/MyProfile/IllLeft", "", "", "leftIll");
			w('<span class="UnitLink"><img height=5 src=' + Root + 'Runtime/Context/common/transparent.gif width=20><br>' + getTranslate("cxt00NbBtMyProfile") + '</span>') 
      break;       
		case "WordZone":
			buildPictureContainer(graphicMode, 110, 210, "p1=" + Root + "Runtime/Context/WordZone/IllLeft", "", "", "leftIll");
			w('<span class="UnitLink"><img height=5 src=' + Root + 'Runtime/Context/common/transparent.gif width=20><br>' + getTranslate("cxtWz000000WordZone") + '</span>') 
      break;   
		case "WebPal":
			buildPictureContainer(graphicMode, 110, 210, "p1=" + Root + "Runtime/Context/WebPals/IllLeft", "", "", "leftIll");
			w('<span class="UnitLink"><img height=5 src=' + Root + 'Runtime/Context/common/transparent.gif width=20><br>' + getTranslate("cxtWp000000WebPals") + '</span>') 
      break;      
		case "Support":
			buildPictureContainer(graphicMode, 110, 210, "p1=" + Root + "Runtime/Context/Support/IllLeft", "", "", "leftIll");
			w('<span class="UnitLink"><img height=5 src=' + Root + 'Runtime/Context/common/transparent.gif width=20><br>' + getTranslate("cxt00NbBtSupport") + '</span>') 
			//w('<span class="UnitLink"><img height=5 src=' + Root + 'Runtime/Context/common/transparent.gif width=20><br>' + getTranslate("") + '</span>') 
      break;      
		case "TalkingIdioms":
			buildPictureContainer(graphicMode, 110, 210, "p1=" + Root + "Runtime/Context/TalkingIdioms/IllLeft", "", "", "leftIll");
			w('<span class="UnitLink"><img height=5 src=' + Root + 'Runtime/Context/common/transparent.gif width=20><br>' + getTranslate("cxtTi000000TalkingIdioms") + '</span>') 
      break;      
		case "InSite":
			buildPictureContainer(graphicMode, 110, 210, "p1=" + Root + "Runtime/Context/InSite/IllLeft", "", "", "leftIll");
			w('<span class="UnitLink"><img height=5 src=' + Root + 'Runtime/Context/common/transparent.gif width=20><br>' + getTranslate("cxtIs000000Insite") + '</span>') 
      break;      
		case "WebChallenge":
			buildPictureContainer(graphicMode, 110, 210, "p1=" + Root + "Runtime/Context/WebChallenge/IllLeft", "", "", "leftIll");
			w('<span class="UnitLink"><img height=5 src=' + Root + 'Runtime/Context/common/transparent.gif width=20><br>Web Challenge</span>') 
      break;      
		case "myPage":
			buildPictureContainer(graphicMode, 110, 210, "p1=" + Root + "Runtime/Context/Courses/MyCoursesIllLeft", "", "", "leftIll");
      break;
    case "course":
			buildPictureContainer(graphicMode, 110, 210, "p1=" + Root + "Runtime/Context/Courses/CoursesIllLeft", "", "", "leftIll");
      break;           
    case "unit":
			buildPictureContainer(graphicMode, 110, 280, "p1=" + Root + "Runtime/Context/Unit/" + unitFolderName + "/unit_illustration_left", "", "", "leftIll");
      break;           
		case "component": 
    case "viewComponent":
			buildPictureContainer(graphicMode, 110, 210, "p1=" + Root + "Runtime/Context/Unit/" + unitFolderName + "/" + skill + "_illustration_left", "", "", "leftIll");
			page = "Unit.asp?unitId=" + getCompositeCookie("Unit", "UnitId") + "&FromTMS=" + FromTMS + "&SID=" + getCompositeCookie("Student", "SID")

	    url = 'javaScript:SavePage(&quot;'+ page +'&quot;,&quot;'+ appName +'&quot;,' + obj.Id + ',&quot;' + appletMode + '&quot;)'	   
			w('<a href="' + url + '" class="UnitLink"><img src="' + Root + 'Runtime/Context/common/transparent.gif" width="15" height="10" border="0"><br>' + unitName + '</a><br>')
      break;
		case "customComponent":
		case "viewCustomComponent":
			buildPictureContainer(graphicMode, 110, 280, "p1=" + Root + "Runtime/Context/Unit/default/unit_illustration_left", "", "", "leftIll");
			page = "Unit.asp?unitId=" + getCompositeCookie("Unit", "UnitId") + "&FromTMS=" + FromTMS + "&SID=" + getCompositeCookie("Student", "SID")
			url = 'javaScript:saveCCData(&quot;'+ page +'&quot;)'	   
			w('<a href="' + url + '" class="UnitLink"><img src="' + Root + 'Runtime/Context/common/transparent.gif" width="15" height="10" border="0"><br>' + unitName + '</a><br>')
      break;
	}
}

//***************************************************************************
function buildNavigationBar()
{
	if (GetCookie("Student") != null && getCompositeCookie("Student", "SID") != -1)
	{
		if (FromTMS)
		{
			var isUserReg = true;
		}
		else
		{
			var isUserReg = true;
			var navRights = getCompositeCookie("Student", "Rights");
			var rights = navRights.split("|");
			var length = rights.length;
		}
	}
	else if(getCompositeCookie("Community", "Rights") != null)
	{
		var isUserReg = false;
		var navRights = getCompositeCookie("Community", "Rights");
		var rights = navRights.split("|");
		var length = rights.length;
	}
	else
	{
		var isUserReg = false;
		var navRights = "1|1|0|0|1|1|1|1|0";
		var rights = navRights.split("|");
		var length = rights.length;
	}
	// Debug for Barak: Support = 0
	//rights[7] = 0;
	
	var navModule = ""
	switch (currentPage)
	{
		case "Home":
			navModule = "Home"
			break;
	  case "myPage":
		case "MyCourses":
	  case "course":
	  case "unit":
	  case "component":
		case "viewComponent":
		case "customComponent":
		case "viewCustomComponent":
			navModule = "MyCourses"
			break;
		case "Store":
			navModule = "Store"
			break;
		case "Community":
		case "Magazine":
		case "WebPal":
		case "WordZone":
		case "TalkingIdioms":
		case "InSite":
		case "WebChallenge":
			navModule = "Community"
			break;
		case "MyProfile":
			navModule = "MyProfile"
			break;
		case "Support":
			navModule = "Support"
			break;
	}

	var navModules = new Array("Home", "MyCourses", "Store", "Magazine", "Community", "MyProfile", "Teachers Corner", "Support") 
	if (isUserReg)
		var links = new Array("Runtime/Home/Home.asp", "Runtime/myPage.asp", "#", "Runtime/MidScreens/Magazine.asp", "Runtime/MidScreens/Community.asp", "Runtime/MyProfile/MyProfile.asp", "javascript:gotoTMS()", "javascript:getSupport()", "javascript:LogOut()", "javascript:register()") 
	else if (currentPage == "Home")
	{
		if (CDUser)
			var links = new Array("Runtime/Home/Home.asp", "#", "#", "javascript:loginAlert()", "javascript:loginAlert()", "javascript:loginAlert()", "javascript:loginAlert()", "javascript:loginAlert()", "#", "javascript:register()") 
		else
		{
			if (getCompositeCookie("Community", "Entry") == "Free")
				var linkCommunity = "Runtime/MidScreens/Community.asp";
			else	
				var linkCommunity = "javascript:loginAlert()";
	
			var links = new Array("Runtime/Home/Home.asp", "javascript:loginAlert()", "#", "Runtime/MidScreens/Magazine.asp", linkCommunity, "javascript:loginAlert()", "javascript:loginAlert()", "javascript:loginAlert()", "#", "javascript:register()") 
		}	
	}	
	else
		var links = new Array("Runtime/Home/Home.asp", "javascript:openLoginWindow('MyCourses', '')", "#", "Runtime/MidScreens/Magazine.asp", "Runtime/MidScreens/Community.asp", "javascript:openLoginWindow('MyProfile', '')", "javascript:openLoginWindow('Teachers Corner', '')", "javascript:openLoginWindow('Support', '')", "#", "javascript:register()")

	var linkNames = new Array(getTranslate("cxt00NbBtHome"), getTranslate("cxt00NbBtMyCourses"), getTranslate("cxt00NbBtStore"), getTranslate("cxt00NbBtMagazine"), getTranslate("cxt00NbBtCommunity"), getTranslate("cxt00NbBtMyProfile"), getTranslate("cxt00NbBtTeacherCorner"), getTranslate("cxt00NbBtSupport"), getTranslate("cxt00NbBtLogOut"), "Register")
	var link = ""
	var url = ""

	w('<table width="780" border="0" cellspacing="0" cellpadding="0" align="center">')
		w('<tr>')
			w('<td height="60" align="center" valign="top"><a href="' + bannerLink + '" target="_blank"><img src="' + resPath + 'banner.gif" alt="' + bannerText + '" width="780" height="60" border="0"></a></td>')
		w('</tr>')
	w('</table>')
	
	w('<table id="navTable" width="780" border="0" cellspacing="0" cellpadding="0" align="center" class="navbar0border">')
		w('<tr>')
			w('<td>')
				w('<table width="780" border="0" cellspacing="1" cellpadding="2" height="25" id=TABLE1>')
					w('<tr align="center" valign="middle">')
						if (!FromTMS)
						{
							for (var i = 0; i < length; i++)
							{
								if (rights[i] == 1)
								{
									link = links[i];
									if (link != "#" && link.indexOf("javascript") == -1)
										link = Root + link;
									if (currentPage == "component")
										url = 'javaScript:SavePage(&quot;' + link + '&quot;, &quot;' + appName + '&quot;, ' + obj.Id + ', &quot;' + appletMode + '&quot;)';	   
									else if (currentPage == "customComponent")
										url = 'javaScript:saveCCData(&quot;'+ link +'&quot;)';	   
									else
										url = link;														
									if (navModules[i] == navModule)
										w('<td class="navbarBgSelected" nowrap><a href="'+ url + '" class="NavLinksSelected" style="text-decoration:none">' + linkNames[i] + '</a></td>')
									else
										w('<td class="navbarBg" nowrap><a href="'+ url + '" class="NavLinks" style="text-decoration:none">' + linkNames[i] + '</a></td>')
								}        
							}
						}
					w('</tr>')
				w('</table>')
			w('</td>')
		w('</tr>')
	w('</table>')
}

//*****************************************************************************
function gotoTMS()
{
  window.open(Root + "Runtime/gotoTMS.asp", 'TMS', 'width=800,height=600,left=0,top=0,toolbar=yes,scrollbars=yes,resizable,menubar=yes')
}

//***************************************************************************
function buildTools()
{
	var link = "";
	
	if (GetCookie("Student") != null && getCompositeCookie("Student", "SID") != -1)
	{
		var isUserReg = true;
	}
	else
	{
		var isUserReg = false;
	}
	if (isUserReg)
	{
		link = "javascript:OnDicClick(1)";
	}
	else if (currentPage == "Home" && CDUser)
	{
		link = "javascript:loginAlert()";
	}
	else
	{
		link = "javascript:OnDicClick(1)";
	}
	w('<table width="110" border="0" cellspacing="0" cellpadding="3" class="toolsLightBg">')
		w('<form name="DicForm" action="' + link + '">')
			w('<tr>')
				w('<td class="toolsLight" align="center"><span class="DictionayTitle">'+getTranslate("cxt00ToBtDictionary")+'</span>')
					w('<table width="97" border="0" cellspacing="0" cellpadding="0">')
						w('<tr align="center" valign="middle">') 
							w('<td colspan="3" height="25">') 
								w('<input type="text" name="WDQString" size="10" style="width:95" class="stext">')
							w('</td>')
						w('</tr>')
						w('<tr>')
							w('<td width="26" height="30"><a href="#" onClick=window.open("'+Root+'Runtime/Window.asp?Width=290&Height=345&Title=cxt00ToBtDictionary&Feature=cxt00ToBtDictionary&Source='+Root+'Runtime/Dictionary/kerneman_page.htm","Dictionary","width=300,height=400,left=200,top=200,resizable=no,scrollbars=no")><img src=' + Root + 'Runtime/Context/Tools/toheb0_KernemanLogo.gif width="26" height="25" border=0 alt="' + getTranslate("cxtDi0000NtKernemanDi") + '"></a></td>')
							w('<td width="53" align="right" class="DictionaryGo" height="30"><a href="#" class="DictionaryGo" onclick="' + link + '">' + getTranslate("cxt00ToBtGo") + '</a></td>')
							w('<td width="28" align="right" height="30"><a href="#" onclick="' + link + '"><img src=' + Root + 'Runtime/Context/Tools/todib0_go.gif width="22" height="17" border=0 alt="' + getTranslate("cxtDLook") + '"></a></td>')
						w('</tr>')
					w('</table>')
			  w('</td>')
			w('</tr>')
		w('</form>')
		
		var StudentId = ""
		if (isUserReg)
		{
			link = "javascript:openYouWho();setMsgState(0)";
			StudentId = getCompositeCookie("Student", "StudentID")
		}
		else if (currentPage == "Home")
		{
			link = "javascript:loginAlert()";
		}
		else
		{
			link = "javascript:openLoginWindow('YouWho', '')";
		}
		w('<tr>')
			w('<td class="toolsLight" align="center"><a href="' + link + '"><img id="msgFrYW" src=' + Root + 'Runtime/Context/Tools/toheb0_YouWho.gif width="25" height="25" border="0"></a><br>')
				w('<a href="' + link + '" class="toolsLinks"><b>'+ 'You! Who?')
				w('</b><br>');
				w('<div style="padding:2;line-height:1.1em"> Instant Messenger </div>');
				w('<marquee id="RunningLine" scrolldelay="250" style="visibility:hidden">')
				w('<table border="0" height="30"><tr><td class="toolsLinks" nowrap valign="middle">');
				w('Now online:' + '&nbsp;<b><span id="NOLUCount"></span></b>' + '</a>');
				w('</td>');
				w('</tr></table>');
				w('</marquee>')
			if (GetCookie("Student") != null)
			{
				var wmGLT = getCompositeCookie("Student", "CMode") ;
				wmGLT = wmGLT == null ? "l" : wmGLT.toLowerCase() ;
				if(wmGLT == "l" || FromTMS || StudentId == ""){
					w('<applet id="YWCounter" name="YWCounter" code="YWCounter.class" codebase=' + Root + 'Runtime/FriendsOnline/ width="0" height="0" archive="YWCounter.zip" viewastext mayscript>')
					w('<param NAME="RefreshDelay" VALUE="30000">')
					w('<param NAME="background" VALUE="15000804">')
					w('<param NAME="foreground" VALUE="4868940">')
					w('<param NAME="StudentId" VALUE="' + StudentId + '">')
					w('</applet>')
				}
				else{
					w('<iframe src=' + Root + 'Runtime/FriendsOnline/YWCPage.asp name="YWCounterFR" width="0" height="0" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>')
//					w('<iframe name="LDBChecker" id="LDBChecker" src="" frameborder="1" width="0" height="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>')
					w('<applet id="YWCounterLU" name="YWCounterLU" code="YWCounter.class" codebase=' + Root + 'Runtime/FriendsOnline/ width="0" height="0" archive="YWCounter.zip" viewastext mayscript>')
					w('<param NAME="RefreshDelay" VALUE="30000">')
					w('<param NAME="background" VALUE="15000804">')
					w('<param NAME="foreground" VALUE="4868940">')
					w('<param NAME="StudentId" VALUE="' + StudentId + '">')
					w('<param NAME="LocalUpdate" VALUE="1">')
					w('</applet>')
				}
			}
			w('</td>')
		w('</tr>')
		w('<tr>')
			w('<td class="toolsLight" align="center"><a href="#" class="toolsLinks" onClick="getHelp()"><img src=' + Root + 'Runtime/Context/Tools/toheb0_help.gif width="25" height="25" border="0"></a><br>')
				w('<a href="#" class="toolsLinks" onclick="getHelp()">'+getTranslate("cxt00ToBtHelp")+'</a>')
			w('</td>')
		w('</tr>')

		if (!CDUser)
		{
			if (isUserReg)
			{
				link = "javascript:MM_openBrWindow('" + Root + "Runtime/MyProgress/MyProgress.asp?Type=Unit','MyProgress','width=700,height=460,left=" + (screen.width-700)/2 + ",top=" + (screen.Height-460)/2 +",scrollbars=no,resizable=no')";
			}
			else if (currentPage == "Home")
			{
				link = "javascript:loginAlert()";
			}
			else
			{
				link = "javascript:openLoginWindow('MyProgress', '')";
			}
			var Courses = getCompositeCookie("Student", "Courses")
			if (!isUserReg || (isUserReg && Courses == "1"))
			{
				w('<tr>') 
					w('<td class="toolsLight" align="center"><a href="' + link + '"><img src=' + Root + 'Runtime/Context/Tools/toheb0_myProgress.gif width="25" height="25" border="0"></a><br>')
						w('<a href="' + link + '" class="toolsLinks">' + getTranslate("cxt00ToBtMyProgress") + '</a>')
					w('</td>')
				w('</tr>')
			}
		}
		//if (currentPage == "myPage")
		//{
			w('<tr>') 
				w('<td class="toolsLight" align="center"><a href="#" onclick="downloads()"><img src=' + Root + 'Runtime/Context/Tools/toheb0_Downloads.gif width="25" height="25" border="0"></a><br>')
					w('<a href="#" onclick="downloads()" class="toolsLinks">'+getTranslate("cxtCoOwStDownloads")+'</a>')				
				w('</td>')
			w('</tr>')
		//}
	w('</table>')
}

//***************************************************************************
function buildFooter()
{  
	var linkNav = "";
	var page;  
	switch(currentPage)
	{
		case "myPage":
			linkNav = "&nbsp;"
	    break;
	  case "course":
			if (FromTMS)
				linkNav = "&nbsp;"
			else	
				linkNav = '<A class=breadCrambs href="myPage.asp">'+getTranslate("cxt00NbBtMyCourses")+'</a>'
	    break;
	  case "unit":
			if (FromTMS)
				linkNav = '<A class=breadCrambs href="Course.asp?courseId=' + getCompositeCookie("Course", "CourseId") + "&FromTMS=" + FromTMS +'">' + courseName + '</a>'
			else	
				linkNav = '<A class=breadCrambs href="myPage.asp">'+getTranslate("cxt00NbBtMyCourses")+'</a>&gt;&gt;<A class=breadCrambs href="Course.asp?courseId=' + getCompositeCookie("Course", "CourseId") + "&FromTMS=" + FromTMS +'">' + courseName + '</a>'
	    break;
	  case "component":
		case "viewComponent":
      page = "myPage.asp";
	    urlmyPage = 'javaScript:SavePage(&quot;'+ page +'&quot;,&quot;'+ appName +'&quot;,' + obj.Id + ',&quot;' + appletMode + '&quot;)';	          
	    page = "Course.asp?courseId=" + getCompositeCookie("Course", "CourseId") + "&FromTMS=" + FromTMS;
	    urlCourse = 'javaScript:SavePage(&quot;'+ page +'&quot;,&quot;'+ appName +'&quot;,' + obj.Id + ',&quot;' + appletMode + '&quot;)';	          
	    page = "Unit.asp?unitId=" +  getCompositeCookie("Unit", "UnitId") + "&FromTMS=" + FromTMS + "&SID=" + getCompositeCookie("Student", "SID");
	    urlUnit = 'javaScript:SavePage(&quot;'+ page +'&quot;,&quot;'+ appName +'&quot;,' + obj.Id + ',&quot;' + appletMode + '&quot;)';	          
			if (FromTMS)
				linkNav = '<A class=breadCrambs href="'+urlCourse+'">' + courseName + '</a>&gt;&gt;<A class=breadCrambs href="'+urlUnit+'">' + unitName + '</a>'
			else	
				linkNav = '<A class=breadCrambs href="'+urlmyPage+'">'+getTranslate("cxt00NbBtMyCourses")+'</a>&gt;&gt;<A class=breadCrambs href="'+urlCourse+'">' + courseName + '</a>&gt;&gt;<A class=breadCrambs href="'+urlUnit+'">' + unitName + '</a>'
	    break;
		case "customComponent":
		case "viewCustomComponent":
	    page = "myPage.asp";
	    urlmyPage = 'javaScript:saveCCData(&quot;'+ page +'&quot;)';	   
	    page = "Course.asp?courseId=" + getCompositeCookie("Course", "CourseId") + "&FromTMS=" + FromTMS
	    urlCourse = 'javaScript:saveCCData(&quot;'+ page +'&quot;)';	   
	    page = "Unit.asp?unitId=" +  getCompositeCookie("Unit", "UnitId") + "&FromTMS=" + FromTMS + "&SID=" + getCompositeCookie("Student", "SID")
	    urlUnit = 'javaScript:saveCCData(&quot;'+ page +'&quot;)';	   
			if (FromTMS)
				linkNav = '<A class=breadCrambs href="'+urlCourse+'">' + courseName + '</a>&gt;&gt;<A class=breadCrambs href="'+urlUnit+'">' + unitName + '</a>'
			else	
				linkNav = '<A class=breadCrambs href="'+urlmyPage+'">'+getTranslate("cxt00NbBtMyCourses")+'</a>&gt;&gt;<A class=breadCrambs href="'+urlCourse+'">' + courseName + '</a>&gt;&gt;<A class=breadCrambs href="'+urlUnit+'">' + unitName + '</a>'
	    break;
	}      

	w('<table width="780" border="0" cellspacing="0" cellpadding="0" align="center" id=TABLE1 class="upper0footer0bg">')
		w('<tr>')
			w('<td class="layout0thin0line" width="1"><IMG height=1 src="' + Root + 'Runtime/Context/common/transparent.gif" width=1></td>')
	    w('<td width="110" class="BgChange" height="1"><IMG height=1 src="' + Root + 'Runtime/Context/common/transparent.gif" width=110></td>')
	    w('<td class="layout0thin0line" width="10" height="1"><IMG height=1 src="' + Root + 'Runtime/Context/common/transparent.gif" width=1></td>')
	    w('<td width="556" class="layout0thin0line" height="1"><IMG height=1 src="' + Root + 'Runtime/Context/common/transparent.gif" width=556></td>')
	    w('<td class="layout0thin0line" width="1" height="1"><IMG height=1 src="' + Root + 'Runtime/Context/common/transparent.gif" width=1></td>')
	    w('<td width="110" class="toolsDark" height="1"><IMG height=1 src="' + Root + 'Runtime/Context/common/transparent.gif" width=110></td>')
	    w('<td class="layout0thin0line" width="1"><IMG height=1 src="' + Root + 'Runtime/Context/common/transparent.gif" width=1></td>')
	  w('</tr>')

		var privacyURL = Root+"Runtime/Window.asp?Width=790&Height=545&Title=cxt00FoBtPrivacy&Feature=cxt00FoBtPrivacy&Source="+Root+"Runtime/Localization/PrivacyStatement/" + instLang + "/PrivacyStatement.asp";	
		var legalURL = Root+"Runtime/Window.asp?Width=790&Height=545&Title=cxt00FoBtLegal&Feature=cxt00FoBtLegal&Source="+Root+"Runtime/Localization/LegalNotices/" + instLang + "/LegalNotices.asp";	

	  w('<tr>')
	    w('<td class="layout0thin0line" width="1"><IMG height=20 src="' + Root + 'Runtime/Context/common/transparent.gif" width=1></td>')
	    w('<td width="110" class="BgChange" height="18">&nbsp;</td>')
	    w('<td class="upper0footer0bg" width="10" height="18"><IMG height=20 src="' + Root + 'Runtime/Context/common/transparent.gif" width=1></td><!--top footer  TD -->')
	    w('<td width="556" class="breadCrambs" height="18" align="left" valign="center" style="padding-left:10">'+linkNav+'</td><!--end of top footer TD -->')
	    w('<td class="upper0footer0bg" width="1" height="18"><IMG height=20 src="' + Root + 'Runtime/Context/common/transparent.gif" width=1></td>')
	    w('<td width="110" class="toolsDark" height="18">&nbsp;</td>')
	    w('<td class="layout0thin0line" width="1"><IMG height=20 src="' + Root + 'Runtime/Context/common/transparent.gif" width=1></td>')
	  w('</tr>')
	  w('<tr>')
	    w('<td class="layout0thin0line" width="1"><IMG height=20 src="' + Root + 'Runtime/Context/common/transparent.gif" width=1></td>')
	    w('<td width="110" class="bgChange" height="50">&nbsp;</td>')
	    w('<td class="bgChange" width="10" height="50"><IMG height=20 src="' + Root + 'Runtime/Context/common/transparent.gif" width=1></td>')
	    w('<td width="556" class="bgChange" height="50" align="middle" valign="center"><span class=BackLink style="font-size:0.7 em">'+getTranslate("cxt00FoBtEdusoft")+'</span><br><a class=BackLink style="font-size:0.7 em" href="' + contactLink + '" target="_blank">'+getTranslate("cxt00FoBtContact")+'</a>&nbsp;<span class=BackLink style="width:10;font-size:0.7em;filter:Alpha(Opacity=50)">I</span>&nbsp;<A class=BackLink style="font-size:0.7 em" href="mailto:?Subject=Putting%20the%20E%20in%20English%20Learning">'+getTranslate("cxt00FoBtTell")+'</A>&nbsp;<span class=BackLink style="width:10;font-size:0.7em;filter:Alpha(Opacity=50)">I</span>&nbsp; <a href="http://www.comlearning.us" target="_blank" class=BackLink style="font-size:0.7 em">'+getTranslate("cxt00FoBtAbout")+'</a> &nbsp;<span class=BackLink style="width:10;font-size:0.7em;filter:Alpha(Opacity=50)">I</span>&nbsp; <A href="#" class=BackLink style="font-size:0.7 em" onClick=window.open("'+legalURL+'","LegalNotices","width=800,height=600,left=0,top=0,resizable=no,scrollbars=no")>'+getTranslate("cxt00FoBtLegal")+'</a>&nbsp;<span class=BackLink style="width:10;font-size:0.7em;filter:Alpha(Opacity=50)">I</span>&nbsp; <a href="#" class=BackLink style="font-size:0.7 em" onClick=window.open("'+privacyURL+'","PrivacyStatement","width=800,height=600,left=0,top=0,resizable=no,scrollbars=no")>'+getTranslate("cxt00FoBtPrivacy")+'</a></td>')
	    w('<td class="bgChange" width="1" height="50"><IMG height=20 src="' + Root + 'Runtime/Context/common/transparent.gif" width=1></td>')
	    w('<td width="110" class="bgChange" height="50">&nbsp;</td>')
	    w('<td class="layout0thin0line" width="1"><IMG height=20 src="' + Root + 'Runtime/Context/common/transparent.gif" width=1></td>')
	  w('</tr>')
	w('</table>')
	/*
	if (currentPage == "myPage" || currentPage == "unit" || currentPage == "course")
	{
	  w('<applet id="AppletPreloader"  name="AppletPreloader" code="edweb.tools.Preloader.class" width="0" height="0" archive="Programmers/Tools/Preloader.zip" viewastext mayscript>')
			w('<param NAME="preloadlist" VALUE="'+preloadList+'">')
			w('<param NAME="foreground" VALUE="FFFFFF">')
			w('<param NAME="background" VALUE="008080">')
			w('<param NAME="label" VALUE="This string was passed from the HTML host.">')
	  w('</applet>')
	}
	*/
}

//*****************************************************************************
function buildDevider(last)
{
	if (last == true)
	{
		w('<td width="1" id="vdevider" class="layout0thin0line"><img height="20" src="' + Root + 'Runtime/Context/common/transparent.gif" width="1"></td>')
	}
	else
	{
		w('<td width="1" id="vdevider" class="BgChange"><img height="20" src="' + Root + 'Runtime/Context/common/transparent.gif" width="1"></td>')
	}
}

//*****************************************************************************
function setMsgState(iCount){
	var d = document.all , el ;
	if(d && (el = d.item('msgFrYW'))){
		el.src = Root + 'Runtime/Context/Tools/toheb0_YouWho' + (iCount > 0 ? 'Message' : '') + '.gif' ;
	}
}

//*****************************************************************************
function setMarqMode(iCount){
	var bVisible = iCount > 10 ;
	var d = document.all , el , spEl ;
	if(d && (el = d.item('RunningLine'))){
		var vsb = el.style.visibility ;
		if(vsb == "" || (bVisible && vsb == "hidden") ||(!bVisible && vsb == "visible")){
			el.style.visibility = bVisible ? "visible" : "hidden" ;
			eval("el." + (bVisible ? "start()" : "stop()"));
		}
		vsb = el.style.visibility ;
		if(vsb != "hidden"){
			if(el.all && (spEl = el.all.item('NOLUCount'))){
				var strIT = spEl.innerText ;
				if(strIT != iCount)
					spEl.innerText = iCount ;
			}
		}
	}
}

//*****************************************************************************
function resetOLUC(){
	var dbCFr = document.all.item('LDBChecker') ;
	if(dbCFr && dbCFr.tagName == 'IFRAME')
		dbCFr.src = Root + "Runtime/FriendsOnline/Script/YWUserCount.asp?StudentId=" + getCompositeCookie("Student", "StudentID") + "&dtRND=" + new Date().getTime();
}
