includeCommonVars();

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;
	}
	
	var navModule = "";
	var moduleLink = "", moduleName = "";
	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 "Forum":
		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" class="headerTable">')
		w('<tr>')
			w('<td class="htLeftImage">')
				w('<a href="' + 'http://' + companyHost + '" target="_blank">')
				if (ins == "989")
					w('<img src="' + Root + 'Runtime/Context/NewLF/Common/englishDiscoveries.gif" border="0" title="' + 'Visit our site &gt;&gt; &lt;' + companyHost + '&gt;">')
				else if (ins == "2")
					w('<img src="' + Root + 'Runtime/Context/NewLF/Common/englishDiscoveries.gif" border="0" title="' + 'Visit our site &gt;&gt; &lt;' + companyHost + '&gt;">')
				w('</a>')
			w('</td>')
			w('<td class="htRightImage">')
				w('<a href="' + bannerLink + '" target="_blank">')
					w('<img src="' + resPath + '/banner.gif" border="0" title="' + bannerText + '">')
				w('</a>')
			w('</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">')
					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>')
										moduleName = linkNames[i];
										moduleLink = link;
									}	
									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>')

	var navLink = "";
	var page;  
	switch(currentPage)
	{
		case "myPage":
			navLink = "&nbsp;"
	    break;
	  case "course":
			if (FromTMS)
				navLink = '<span style="color:#777777">' + courseName + '</span>';
			else	
				navLink = '<a href="myPage.asp">'+getTranslate("cxt00NbBtMyCourses")+'</a>&gt;&gt;<span style="color:#777777">' + courseName + '</span>';
	    break;
	  case "unit":
			if (FromTMS)
				navLink = '<a href="Course.asp?courseId=' + getCompositeCookie("Course", "CourseId") + "&FromTMS=" + FromTMS +'">' + courseName + '</a>&gt;&gt;<span style="color:#777777">' + unitName + '</span>';
			else	
				navLink = '<a href="myPage.asp">'+getTranslate("cxt00NbBtMyCourses")+'</a>&gt;&gt;<a href="Course.asp?courseId=' + getCompositeCookie("Course", "CourseId") + "&FromTMS=" + FromTMS +'">' + courseName + '</a>&gt;&gt;<span style="color:#777777">' + unitName + '</span>';
	    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)
				navLink = '<A href="'+urlCourse+'">' + courseName + '</a>&gt;&gt;<A href="'+urlUnit+'">' + unitName + '</a>&gt;&gt;<span style="color:#777777">' + componentName + '</span>';
			else	
				navLink = '<A href="'+urlmyPage+'">'+getTranslate("cxt00NbBtMyCourses")+'</a>&gt;&gt;<A href="'+urlCourse+'">' + courseName + '</a>&gt;&gt;<A href="'+urlUnit+'">' + unitName + '</a>&gt;&gt;<span style="color:#777777">' + componentName + '</span>';
	    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)
				navLink = '<A href="'+urlCourse+'">' + courseName + '</a>&gt;&gt;<A href="'+urlUnit+'">' + unitName + '</a>&gt;&gt;<span style="color:#777777">' + componentName + '</span>';
			else	
				navLink = '<A href="'+urlmyPage+'">'+getTranslate("cxt00NbBtMyCourses")+'</a>&gt;&gt;<A href="'+urlCourse+'">' + courseName + '</a>&gt;&gt;<A href="'+urlUnit+'">' + unitName + '</a>&gt;&gt;<span style="color:#777777">' + componentName + '</span>';
	    break;
		case "Magazine":
			if (curState == "Home")
				navLink = '<a href="'+moduleLink+'">'+moduleName+'</a>&gt;&gt;<span style="color:#777777">'+getTranslate("cxtCmMaOwStMagazine")+'</span>';
			else if (curState == "Topic" || (curState == "Article" && prevState == "Home"))
				navLink = '<a href="'+moduleLink+'">'+moduleName+'</a>&gt;&gt;<a href="'+"MagazineHome.asp"+'">'+getTranslate("cxtCmMaOwStMagazine")+'</a>&gt;&gt;<span style="color:#777777">'+stateName+'</span>';
			else
				navLink = '<a href="'+moduleLink+'">'+moduleName+'</a>&gt;&gt;<a href="'+"MagazineHome.asp"+'">'+getTranslate("cxtCmMaOwStMagazine")+'</a>&gt;&gt;<a href="'+prevLink+'">'+prevState+'</a>&gt;&gt<span style="color:#777777">'+stateName+'</span>';
			break;		
		case "TalkingIdioms":
			navLink = '<a href="'+moduleLink+'">'+moduleName+'</a>&gt;&gt;<span style="color:#777777">'+getTranslate("cxtTi000000TalkingIdioms")+'</span>';
			break;		
		case "Forum":
			navLink = '<a href="'+moduleLink+'">'+moduleName+'</a>&gt;&gt;<span style="color:#777777">'+getTranslate("cxtHoMnNtForum")+'</span>';
			break;		
		case "WebPal":
			navLink = '<a href="'+moduleLink+'">'+moduleName+'</a>&gt;&gt;<span style="color:#777777">'+getTranslate("cxtWp000000WebPals")+'</span>';
			break;		
		case "WordZone":
			navLink = '<a href="'+moduleLink+'">'+moduleName+'</a>&gt;&gt;<span style="color:#777777">'+getTranslate("cxtWz000000WordZone")+'</span>';
			break;
	}      

	w('<table id="siteNavTable" width="780" border="0" cellspacing="0" cellpadding="0" align="center" class="navbar0border">')
		w('<tr>')
			w('<td>')
				w('<div class="CurrentSiteNavigation">')
			    w(navLink)
				w('</div>')
			w('</td>')
		w('</tr>')
	w('</table>')
}

function buildComponentNavigation(linkArr)
{
	var page = "";
	url = "#";
	switch(currentPage)
	{
		case "course": 
			url="myPage.asp"
			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 class="navTable" border="0">')
	w('<tr>')

	switch (currentPage)
	{
		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 class="selectedNav"><a href="#">&nbsp;'+getEPTTranslate(subCompNameArr[i])+'&nbsp;</a></td>')
				}
				else {    
					var sSubCompName = subCompNameArr[i]  
				  if (subCompNameArr[i] != "Test")
						var sSubCompName = skill + sSubCompName
					w('<td class="unselectedNav"><a href="javascript:getSubComp('+ itemIdArr[i] +',&quot;'+ sSubCompName +'&quot;,'+ subCompIdArr[i] + ')">&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 (subCompIdArr[i] == getCompositeCookie("Component", "ItemId")) {
					w('<td class="selectedNav"><a href="#">&nbsp;'+getEPTTranslate(subCompNameArr[i])+'&nbsp;</a></td>')
				}
				else {    
					w('<td class="unselectedNav"><a href="javascript:getCustSubComp('+subCompIdArr[i]+')">&nbsp;'+subCompNameArr[i]+'&nbsp;</a></td>')
				}    
			} 
			break;
		case "InSite":
		case "TalkingIdioms":
		case "WebPal":
		case "Support":
			for (var i = 0; i < subPages.length; i++) {
				if (subPages[i] == subPage) {
					w('<td class="selectedNav"><a href="#">&nbsp;'+linkNames[i]+'&nbsp;</a></td>')
				}
				else {
					w('<td class="unselectedNav"><a href="' + links[i] + '">&nbsp;'+linkNames[i]+'&nbsp;</a></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()
{
	w('<table width="110" border="0" cellspacing="0" cellpadding="0" class="bgchange">')
  w('<tr>') 
  w('<td height="1" align="center" valign="top"><img height=68 src=' + Root + 'Runtime/Context/common/transparent.gif width=105></td>')
  w('</tr>')
	w('</table>')

  var folderName;
	switch(currentPage) {
		case "Home":
			folderName = "home"		
      break;      
		case "Magazine":
			folderName = "magazine"		
      break;      
		case "Community":
			folderName = "community"		
			//w('<div style="padding-left:2px;">')
				//w('<img src="' + Root + 'Runtime/Context/NewLF/Community/Community.jpg" border="0">')
			//w('</div>')
      break;      
		case "MyProfile":
			folderName = "myProfile"		
      break;       
		case "WordZone":
			folderName = "wordZone"
      break;   
		case "WebPal":
			folderName = "webPals"		
      break;      
		case "Support":
			folderName = "support"		
      break;      
		case "TalkingIdioms":
			folderName = "talkingIdioms"		
      break;      
		case "InSite":
			folderName = "insite"
      break;      
		case "WebChallenge":
			folderName = ""		
      break;      
		case "myPage":
			folderName = "myPage"		
      break;
    case "course":
			folderName = "courses"		
      break;           
    case "unit":
			folderName = unitFolderName;		
      break;           
		case "component": 
    case "viewComponent":
			folderName = unitFolderName;		
      break;
		case "customComponent":
		case "viewCustomComponent":
			folderName = "default"		
      break;
	}
	w('<div style="padding-left:0px;">')
		w('<img src="' + Root + 'Runtime/Context/leftSideImages/'+ folderName + '/left.jpg" border="0">')
	w('</div>')

}

function gotoTMS(From)
{
	if (typeof From == "undefined")
		From = "";
  window.open(Root + "Runtime/gotoTMS.asp?From=" + From, 'TMS', 'width=800,height=600,left=0,top=0,toolbar=yes,scrollbars=yes,resizable,menubar=yes')
}

function checkYWCP(){
	if(document.readyState == "complete"){
		var objYWCP = document.getElementById("YWCounterFR") ;
		if(objYWCP){
			objYWCP.setAttribute("src",Root + "Runtime/FriendsOnline/YWCPage.asp");
		}
	}
	else
		setTimeout("checkYWCP()",2000) ;
}

function buildTools()
{
	var link = "", isUserReg;

	if (isNumber(studentId))
		isUserReg = true;
	else
		isUserReg = false;

	link = "javascript:OnDicClick(1)";

	w('<div class="toolsContainer">')
	w('<table width="110" border="0" cellspacing="0" cellpadding="0" class="toolsLightBg">')
		w('<form name="DicForm" action="' + link + '">')
			w('<tr>')
				w('<td class="toolsLight">')
					w('<div style="height:80px;border-bottom:dashed 1px #d7d7d7">')
						w('<div class="toolsIcons" style="vertical-align:middle;">')
						w('<img src="' + Root + 'Runtime/Context/NewLF/Tools/dictionary.gif">')
						w('</div>')
						w('<span class="DictionayTitle">'+getTranslate("cxt00ToBtDictionary")+'</span>')
						w('<table width="108" border="0" cellspacing="0" cellpadding="0">')
							w('<tr>')
								w('<td colspan="2" height="18">')
								w('<div class="inputContainer">')
									w('<input type="text" name="WDQString" maxlength="40" style="width:78;" class="toolsText">')
									w('<a href="#" class="DictionaryGo" onclick="' + link + '">')
									w('<img src="' + Root + 'Runtime/Context/NewLF/Tools/btnGo.gif" class="DictionaryGo">')
									w('</a></div></td></tr>')
							w('<tr>')
								w('<td width="16" height="20">')
									w('<div class="inputContainer">')
										w('<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")>')
										w('<img src="' + Root + 'Runtime/Context/NewLF/Tools/dictionary_ico.gif" border="0"></a>')
									w('</div></td>')
									w('<td align="right" height="20">')
										w('<div onClick="setLangTools()" class="toolsRightOpt" style="cursor:pointer;">')
											w('<span class="sideToolsLinks">settings</span>')
										w('</div>')
							w('</td></tr></table>')
			w('</div></td></tr>')
		w('</form>')

		if (isUserReg)
			link = "javascript:openYouWho();setMsgState(0)";
		else
			link = "javascript:openLoginWindow('YouWho', '')";

		w('<tr>')
			w('<td class="toolsLight" style="padding-top:3px;">')
				w('<div style="height:50px;border-bottom:dashed 1px #d7d7d7">')
					w('<div style="vertical-align:middle;cursor:pointer" onClick="' + link + '" class="toolsIcons">')
						w('<img id="msgFrYW" src="' + Root + 'Runtime/Context/NewLF/Tools/youwho.gif">')
					w('</div>')
					w('<a href="' + link + '" class="toolsLinks">You! Who?</a>')
					w('<marquee id="RunningLine" scrolldelay="250" style="visibility:hidden">')
						w('<table border="0" height="15">')
						w('<tr><td class="toolsYWNowOnline" nowrap valign="middle">')
						w('Now online:' + '&nbsp;<b><span id="NOLUCount"></span></b>' + '</a>')
						w('</td></tr></table>')
					w('</marquee>')
				if (GetCookie("Student") != null && getCompositeCookie("Student", "SID") != "-1")	{
					var wmGLT = getCompositeCookie("Student", "CMode") ;
					wmGLT = wmGLT == null ? "l" : wmGLT.toLowerCase() ;
					if (wmGLT == "l" || FromTMS || studentId == "") {
						if (needsMSJava())
							w('<applet id="YWCounter" name="YWCounter" code="YWCounter.class" codebase=' + Root + 'Runtime/FriendsOnline/ width="0" height="0" archive="YWCounter.zip" viewastext mayscript>')
						else
							w('<applet id="YWCounter" name="YWCounter" code="YWCounter/YWCounter.class"  codebase=' + Root + 'Runtime/FriendsOnline/ width="0" height="0" archive="YWCounter.jar" viewastext mayscript>')
						w('<param NAME="RefreshDelay" VALUE="45000">')
						w('<param NAME="background" VALUE="15000804">')
						w('<param NAME="foreground" VALUE="4868940">')
						w('<param NAME="StudentId" VALUE="' + studentId + '">')
						w('</applet>')
					}
					else {
						w('<iframe src="" id="YWCounterFR" name="YWCounterFR" width="0" height="0" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>')
						checkYWCP();
						if (needsMSJava())
							w('<applet id="YWCounterLU" name="YWCounterLU" code="YWCounter.class" codebase=' + Root + 'Runtime/FriendsOnline/ width="0" height="0" archive="YWCounter.zip" viewastext mayscript>')
						else
							w('<applet id="YWCounterLU" name="YWCounterLU" code="YWCounter/YWCounter.class" codebase=' + Root + 'Runtime/FriendsOnline/ width="0" height="0" archive="YWCounter.jar" viewastext mayscript>')
						w('<param NAME="RefreshDelay" VALUE="60000">')
						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('</div>')
			w('</td>')
		w('</tr>')

		if (!needsMSJava()) {
			if (isUserReg)
				link = "javascript:openGrammarBook()";
			else
				link = "javascript:openLoginWindow('', '')";

			w('<tr>')
				w('<td class="toolsLight">')
	//	if (!isUserReg || (isUserReg && getCompositeCookie("Student", "GB") == "1")) {							
					w('<div style="height:30px;border-bottom:dashed 1px #d7d7d7">')
						w('<div class="toolsIcons" style="vertical-align:middle;cursor:pointer" onClick="' + link + '">')
							w('<img src="' + Root + 'Runtime/Context/NewLF/Tools/grammarbook.gif">')
						w('</div>')
						w('<a href="' + link + '" class="toolsLinks">Grammar Book</a>')
					w('</div>')
				w('</td>')
			w('</tr>')
		}

		w('<tr>')
			w('<td class="toolsLight">')
				w('<div style="height:30px;border-bottom:dashed 1px #d7d7d7">')
					w('<div class="toolsIcons" style="vertical-align:middle;cursor:pointer" onClick="getHelp()">')
						w('<img src="' + Root + 'Runtime/Context/NewLF/Tools/help.gif">')
					w('</div>')
					w('<a href="#" class="toolsLinks" onclick="getHelp()">'+getTranslate("cxt00ToBtHelp")+'</a>')
				w('</div>')
			w('</td>')
		w('</tr>')

		if (!CDUser) {
			if (isUserReg)
				link = "openMyProgress()";
			else
				link = "openLoginWindow('MyProgress', '')";
			var Courses = getCompositeCookie("Student", "Courses")
			if (!isUserReg || (isUserReg && Courses == "1")) {
				w('<tr>') 
					w('<td class="toolsLight">')
						w('<div style="height:30px;border-bottom:dashed 1px #d7d7d7">')
							w('<div class="toolsIcons" style="vertical-align:middle;cursor:pointer" onClick="' + link + '">')
								w('<img src="' + Root + 'Runtime/Context/NewLF/Tools/myprogress.gif">')
							w('</div>')
							w('<a href="javascript:' + link + '" class="toolsLinks">' + getTranslate("cxt00ToBtMyProgress") + '</a>')
						w('</div>')
					w('</td>')
				w('</tr>')
			}
		}

		if (getCompositeCookie("Student", "UserType") == "s") {
			if (isUserReg)
				link = "openMyRecordings(0)";
			else
				link = "openLoginWindow('', '')";

			w('<tr>')
				w('<td class="toolsLight">')
					w('<div style="height:30px;border-bottom:dashed 1px #d7d7d7">')
						w('<div class="toolsIcons" style="vertical-align:middle;cursor:pointer" onClick="' + link + '">')
							w('<img src="' + Root + 'Runtime/Context/NewLF/Tools/myRecordings.gif">')
						w('</div>')
						w('<a href="javascript:' + link + '" class="toolsLinks">' + getTranslate("cxt000BtTitleMyRecordings") + '</a>')
					w('</div>')
				w('</td>')
			w('</tr>')
		}

		w('<tr>') 
			w('<td class="toolsLight">')
			if (isUserReg && ST != null && ST != -1)
				w('<div style="height:30px;border-bottom:dashed 1px #d7d7d7">')
			else
				w('<div style="height:30px;">')
				if (Root.indexOf("/acdp/") > -1) {}
				else {
					w('<div class="toolsIcons" style="vertical-align:middle;cursor:pointer" onClick="downloads()">')
					w('<img src="' + Root + 'Runtime/Context/NewLF/Tools/downloads.gif">')
					w('</div>')
					w('<a href="#" onclick="downloads()" class="toolsLinks">'+getTranslate("cxtCoOwStDownloads")+'</a>')
				}
				w('</div>')
			w('</td>')
		w('</tr>')

		if (isUserReg && ST != null && ST != -1) {
			w('<tr id="CTBtn" style="display:none">') 
				w('<td class="toolsLight" align="center" style="padding-bottom:5px">')
					w('<img src="' + Root + 'Runtime/Context/NewLF/Tools/CourseTest.gif" style="margin:5px 0px 5px 0px"><br>')
					w('<div id="CTText" class="toolsLinks"></div>')
				w('</td>')
			w('</tr>')
			CTTimer(ST, diff);
		}
	w('</table>')
	w('</div>')
}

function buildFooter()
{  
	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('<table width="780" style="height:80px;" border="0" cellspacing="0" cellpadding="0" align="center" class="upper0footer0bg">')
		w('<tr>')
			w('<td class="footerContent" height="40" align="center" style="margin-top:20px;"><span class="BackLink" style="font-size:11px">'+getTranslate("cxt00FoBtEdusoft")+'</span><br><a class=BackLink style="font-size:11px" href="' + contactLink + '" target="_blank">'+getTranslate("cxt00FoBtContact")+'</a>&nbsp;<span class=BackLink style="width:10;font-size:11px;filter:Alpha(Opacity=50)">I</span>&nbsp;<A class=BackLink style="font-size:11px" href="mailto:?Subject=Putting%20the%20E%20in%20English%20Learning">'+getTranslate("cxt00FoBtTell")+'</A>&nbsp;<span class=BackLink style="width:10;font-size:11px;filter:Alpha(Opacity=50)">I</span>&nbsp; <a href="http://www.edusoft.co.il" target="_blank" class=BackLink style="font-size:11px">'+getTranslate("cxt00FoBtAbout")+'</a> &nbsp;<span class=BackLink style="width:10;font-size:11px;filter:Alpha(Opacity=50)">I</span>&nbsp; <A href="#anchor" class=BackLink style="font-size:11px" 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:11px;filter:Alpha(Opacity=50)">I</span>&nbsp; <a href="#anchor" class=BackLink style="font-size:11px" onClick=window.open("'+privacyURL+'","PrivacyStatement","width=800,height=600,left=0,top=0,resizable=no,scrollbars=no")>'+getTranslate("cxt00FoBtPrivacy")+'</a></td>')
		w('</tr>')
		w('<tr>')
			w('<td class="bgChange" align="center">')
				w('<a href="' + "http://" + companyHost + '" target="_blank">')
					w('<img src="' + Root + 'Runtime/Context/NewLF/Common/edusoft_logo.gif" border="0" title="' + 'Visit our website &gt;&gt; &lt;' + companyHost + '&gt;">')
        w('</a>')
			w('</td>')
		w('</tr>')
	w('</table>')
}

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/NewLF/Tools/youwho' + (iCount > 0 ? 'Message' : '') + '.gif' ;
//		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();
}
