/*
Copyright © Tribal Education Ltd. 

This file has been compressed to make the page loading faster. For working version of this file, please contact Tribal's Digital Learning Studio at digitallearningsupport@tribalgroup.com.
*/
var CTAD_INCLUDED=new Array();if(typeof(CTAD_SETTINGS)=="undefined"){ctad_error("settings.js was not included before functions.js");}else{ctad_included("settings.js");}
ctad_included("functions.js");var ctad_extend=new Extend();ctad_extend.getElementById();ctad_extend.getElementsByTagName();ctad_extend.string_slice();ctad_extend.array_pop();ctad_extend.array_contains();function ctad_require(js_file_required,js_file_asking){if(typeof(CTAD_INCLUDED[js_file_required])=="undefined"){if(!js_file_asking){js_file_asking="unidentifed javascript file";}
ctad_error(js_file_asking+" requires the javascript file "+js_file_required);}}
function ctad_included(js_file_name){if(typeof(CTAD_INCLUDED[js_file_name])!="undefined"){ctad_error(js_file_name+" already included");}
CTAD_INCLUDED[js_file_name]=true;}
function ctad_error(error_string){if(CTAD_SETTINGS["functions_debug"]){alert("Developer Error\n"+error_string);}}
function ctad_error_user(error_string){alert("Sorry, an error occurred\n"+error_string);}
function Extend(){Extend.prototype.getElementById=function(){if(!document.getElementById){if(document.all){document.getElementById=function(id){return(document.all[id]);};}else{document.getElementById=function(id){alert("Sorry, this browser is not supported");return;};}}};Extend.prototype.getElementsByTagName=function(){if(!document.getElementsByTagName){if(document.all){document.getElementsByTagName=function(tag_name){return(document.all.tags[tag_name]);};}else{document.getElementsByTagName=function(id){alert("Sorry, this browser is not supported");return;};}}};Extend.prototype.string_slice=function(){if('abcde'.slice(-3,-2).length==1){return;}
String.prototype.$$slice=String.prototype.slice;String.prototype.slice=function(start,end){if(start<0){start=Math.max(0,this.length+start);}
if(!end){end=this.length;}
return this.$$slice(start,end);};};Extend.prototype.array_pop=function(){if(Array.prototype.pop){return;}
Array.prototype.pop=function(){if(this.length<1){return;}
var value=this[this.length-1];this.length=this.length-1;return(value);};};Extend.prototype.array_contains=function(){Array.prototype.contains=function(value){for(var i=0;i<this.length;i++){if(this[i]==value){return(true);}}
return(false);};};}
function MT(value){return(value==null)||(value=="");}
function inherit_object(sub_class,super_class){for(prop in super_class){sub_class[prop]=super_class[prop];}}
function style_in_stylesheet(selector,style_attribute){if(!document.styleSheets){return(false);}
for(var ss=0;ss<document.styleSheets.length;ss++){var tss=document.styleSheets[ss];if(!tss.cssRules){tss.cssRules=tss.rules;}
for(var ru=0;ru<tss.cssRules.length;ru++){if(typeof(tss.cssRules[ru].selectorText)!="undefined"){_match=new RegExp(selector,"gi");if(tss.cssRules[ru].selectorText.match(_match)){if(typeof(tss.cssRules[ru].style[style_attribute])!="undefined"){return(true);}}}}}
return(false);}
function event_install(obj,event_name,f){if(obj.addEventListener){obj.addEventListener(event_name.substr(2),f,false);}else if(obj.attachEvent){obj.attachEvent(event_name,function(){obj._f=f;obj._f();obj_f=null});}}
function cookies_available(){var use_cookies=false;if(typeof navigator.cookieEnabled=="undefined"){if(!document.cookie){document.cookie="testcookie";use_cookies=(document.cookie=="testcookie");document.cookie="";}else{use_cookies=true;}}else{use_cookies=navigator.cookieEnabled;}
return(use_cookies);}
function cookies_use(){return(cookies_available()&&!CTAD_SETTINGS["persist_force_frameset"]);}
function Cookie(document,prefix,days,path,domain,secure,max_size,max_cookies){this.$document=document;this.$prefix=prefix;if(days){this.$expiration=new Date((new Date()).getTime()+days*86400000);}else{this.$expiration=null;}
if(path){this.$path=path;}else{this.$path=null;}
if(domain){this.$domain=domain;}else{this.$domain=null;}
if(secure){this.$secure=true;}else{this.$secure=false;}
if(max_size){this.$max_size=max_size;}else{this.$max_size=4000;}
if(max_cookies){this.$max_cookies=max_cookies;}else{this.$max_cookies=20;}
var metadata=this.metadata();this.$max_size-=metadata.length;}
Cookie.prototype.store=function(){this.$ar_cookie_strings=Array();this.$cookie_index=0;for(var prop in this){if((prop.charAt(0)=='$')||((typeof this[prop])=='function')){continue;}
var pair=prop+":"+escape(this[prop]);this.fill_cookie(pair);}
for(var i=0;i<this.$cookie_index+1;i++){this.create_one(this.$prefix+i,this.$ar_cookie_strings[i]);}};Cookie.prototype.fill_cookie=function(pair){if(!this.$ar_cookie_strings[this.$cookie_index]){this.$ar_cookie_strings[this.$cookie_index]="";}
var current_cookie_length=this.$ar_cookie_strings[this.$cookie_index].length;if(current_cookie_length!=0){pair="&"+pair;}
if(pair.length>this.$max_size){ctad_error('cookie: string not saved, it was too long: '+pair.length+'/'+this.$max_size+' bytes');return;}
if((current_cookie_length+pair.length)>this.$max_size){if(this.$cookie_index+2>this.$max_cookies){ctad_error('cookie: string not saved, we ran out of cookies');return;}
this.$cookie_index++;this.fill_cookie(pair);}else{this.$ar_cookie_strings[this.$cookie_index]+=pair;}};Cookie.prototype.metadata=function(){var metadata="";if(this.$expiration)
metadata+='; expires='+this.$expiration.toGMTString();if(this.$path)metadata+='; path='+this.$path;if(this.$domain)metadata+='; domain='+this.$domain;if(this.$secure)metadata+='; secure';return(metadata);};Cookie.prototype.create_one=function(name,val){var cookie=name+'='+val;cookie+=this.metadata();this.$document.cookie=cookie;};Cookie.prototype.load=function(){var allcookies=this.$document.cookie;if(allcookies=="")return false;var ar_cookies_all=allcookies.split(/;\s*/);var cookieval="";var i=0;var ar_pairs=Array();var ar_crumb=Array();for(i=0;i<ar_cookies_all.length;i++){var ar_cookie=ar_cookies_all[i].split("=");if(ar_cookie[0].substring(0,this.$prefix.length)==this.$prefix){cookieval=ar_cookie[1];ar_crumb=cookieval.split("&");ar_pairs=ar_pairs.concat(ar_crumb);}}
for(var i=0;i<ar_pairs.length;i++){var ar_pair=ar_pairs[i].split(":");this[ar_pair[0]]=unescape(ar_pair[1]);}
return true;};Cookie.prototype.remove=function(){var cookie;cookie=this.$name+'=';if(this.$path)cookie+='; path='+this.$path;if(this.$domain)cookie+='; domain='+this.$domain;cookie+='; expires=Fri, 02-Jan-1970 00:00:00 GMT';this.$document.cookie=cookie;};var win=null;function newwindow(mypage,myname,w,h,scroll,top){var winl=(screen.width-w)/2;if(typeof(top)!="undefined"){var wint=(screen.height-h)*top;}else{var wint=(screen.height-h)/2;}
settings='height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',toolbar=no,location=no,status=no,menubar=no,resizable=yes,dependent=no'
win=window.open(mypage,myname,settings);if(parseInt(navigator.appVersion)>=4){win.window.focus();}}
function newwindowfocus(mypage,myname,w,h,scroll){if((win)&&(win.open)&&(!win.closed)){win.focus();}
else{var winl=(screen.width-w)/2;var wint=(screen.height-h)/2;settings='height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',toolbar=no,location=no,status=no,menubar=no,resizable=yes,dependent=no'
win=window.open(mypage,myname,settings)
if(parseInt(navigator.appVersion)>=4){win.window.focus();}}}
function popUp(URL){day=new Date();id="Win2";var settings="toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width="+(screen.width-13)+",height="+(screen.height-65)+",left=0,top=0";eval("page"+id+" = window.open(URL, '"+id+"', '"+settings+"');");}
function writeTestletFolder(sco){var whichFolder="";switch(sco){case "hot_topics_01":
whichFolder="l_1_t_3";break;case "hot_topics_02":
whichFolder="l_2_t_3";break;case "hot_topics_03":
whichFolder="n_2_t_3";break;case "hot_topics_04":
whichFolder="n_1_t_1";break;case "hot_topics_05":
whichFolder="l_1_t_2";break;}
return whichFolder;}
function LM_pagefix(thenum){if(thenum<10){thenum="0"+thenum;}
return thenum;}

