function createPlayer(theFile,placeholder,anid,wide,high,img) {
if (high > 200) {
var flashvars = {
file:theFile,
autostart:"false",
shuffle:"false",
repeat:"list",
playlistsize:"0",
playlist:"none",
skin:"modieus.swf"};
var params = {
allowfullscreen:"true",
allowscriptaccess:"always",
wmode:"opaque"
}
}else{
var flashvars = {
file:theFile,
autostart:"false",
shuffle:"false",
repeat:"list",
playlistsize:"0",
playlist:"none",
skin:"modieus.swf",
plugins:"spectrumvisualizer-1"}
var params = {
allowfullscreen:"false",
allowscriptaccess:"always",
wmode:"opaque"
}
};
var attributes = {
id:anid,
name:anid
}
swfobject.embedSWF("/flash/player.swf", placeholder, wide,high, "9.0.115", false, flashvars, params, attributes);
};
function GetXmlHttpObject(handler)
{
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("txtResult").innerHTML= xmlHttp.responseText;
}
else {
//alert(xmlHttp.status);
}
}
// Will populate Testlist (update_programme page) data based on input
function htmlData(qStr)
{
var url = 'TestList.asp?LevelID='+qStr
if (url.length==0)
{
document.getElementById("txtResult").innerHTML="";
return;
}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true) ;
xmlHttp.send(null);
}
function appendTestRow(tblId,c1)
{
var tbl = document.getElementById(tblId);
var ord = document.getElementById('NewSeq').value;
var TestList = document.getElementById('TestList');
var TestID = TestList.value;
var TestText = TestList.options[TestList.selectedIndex].text;
var newRow = tbl.insertRow(tbl.rows.length-1);
var newCell = newRow.insertCell(0);
newCell.innerHTML = '' + TestText;
newCell = newRow.insertCell(0);
newCell.innerHTML = '';
}
function appendRow(tblId,c1,c2)
{
var tbl = document.getElementById(tblId);
var newRow = tbl.insertRow(tbl.rows.length);
var newCell = newRow.insertCell(0);
newCell.innerHTML = c2;
newCell = newRow.insertCell(0);
newCell.innerHTML = c1;
}
function deleteLastRow(tblId)
{
var tbl = document.getElementById(tblId);
if (tbl.rows.length > 0) tbl.deleteRow(tbl.rows.length - 1);
}
function insertRow(tblId, txtIndex, txtError)
{
var tbl = document.getElementById(tblId);
var rowIndex = document.getElementById(txtIndex).value;
try {
var newRow = tbl.insertRow(rowIndex);
var newCell = newRow.insertCell(0);
newCell.innerHTML = 'Hello World! insert';
} catch (ex) {
document.getElementById(txtError).value = ex;
}
}
function deleteRow(tblId, txtIndex, txtError)
{
var tbl = document.getElementById(tblId);
var rowIndex = document.getElementById(txtIndex).value;
try {
tbl.deleteRow(rowIndex);
} catch (ex) {
document.getElementById(txtError).value = ex;
}
}
function sendEvent(typ,prm) {
thisMovie("amediaplayer").sendEvent(typ,prm);
};
function loadFile(fil) {
thisMovie("amediaplayer").loadFile(fil);
};
function thisMovie(movieName) {
if(navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
} else {
return document[movieName];
}
};
function getUpdate(typ,pr1,pr2) {
var id = document.getElementById(typ);
id.innerHTML = typ+ ": "+Math.round(pr1);
pr2 == undefined ? null: id.innerHTML += ", "+Math.round(pr2);
};
function itemData(obj) {
var nodes = "";
for(var i in obj) {
nodes += "
"+i+": "+obj[i]+"";
}
document.getElementById("data").innerHTML = nodes;
};
var cookiename
cookiename = 'LLETextSize';
var currentSize;
currentSize=readCookie(cookiename);
if (currentSize==undefined) {currentSize = 100};
currentSize=parseFloat(currentSize);
var AdLoaded = false;
var bsid = '20534';
var bsads = '6';
var bswx = 728;
var bshx = 90;
var bsw = '_top';
var bsb = 'FFFFFF';
var bsf = '000000';
var bsalt = 'off';
bspop = 1;
function echeck(str) {
var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(at,(lat+1))!=-1){
alert("Invalid E-mail ID")
return false
}
if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(dot,(lat+2))==-1){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(" ")!=-1){
alert("Invalid E-mail ID")
return false
}
return true
}
function playSource()
{
if (navigator.appName == "Netscape") {
document.RAOCX.DoPlay();
}
else {
document.RAOCX.DoPlay();
}
}
function setSRC() {
if (navigator.appName == "Netscape") {
var list = document.form1.text1;
document.RAOCX.SetSource(list.options[list.selectedIndex].value)
}
else {
document.RAOCX.Source=document.form1.text1.value
}
}
function playClip(aClip) {
if (navigator.appName == "Netscape") {
document.j1.SetSource(aClip);
document.j1.DoPlay();
}
else {
document.RAOCX.Source=aClip;
document.RAOCX.DoPlay();
}
}
function dorow(obj) {
if (obj != -1) {
document.form1.level.value = obj;
var D = document.getElementsByTagName('*');
for(var i=0;i1) alert('There are fields which need correction before sending');
if (errs==1) alert('There is a field which needs correction before sending');
return (errs==0);
};
function checkfiles(frm) {
var numchecked = 0
var afilename = ""
var form_name = ""
var form_value = ""
var form_field = ""
var good = ""
var bad = ""
// Run through all the form fields
for (var i=0; i < frm.elements.length; ++i) {
// Get the current field
form_field = frm.elements[i];
// Get the field's name
form_name = form_field.name;
form_value = form_field.value;
// Is it a "file" field?
if (form_name.substring(0,4) == "file") {
// keep a list of checked and unchecked filenames
if (form_field.checked) {
numchecked++;
good = good + form_value + "|";
}else{
bad = bad + form_value + "|";
};
};
replaceButtonText('selectedcount', numchecked);
frm.filelist.value = good;
frm.incorrectlist.value = bad;
}
}
function replaceButtonText(buttonId, text)
{
if (document.getElementById)
{
var button=document.getElementById(buttonId);
if (button)
{
if (button.childNodes[0])
{
button.childNodes[0].nodeValue=text;
}
else if (button.value)
{
button.value=text;
}
else //if (button.innerHTML)
{
button.innerHTML=text;
}
}
}
}
function PassFlash(){
thisMovie(movieName).Rewind();
thisMovie(movieName).SetVariable("ColnamesStr", "<%=colnamesstr%>");
thisMovie(movieName).SetVariable("LoopDelay", "<%=speed%>");
thisMovie(movieName).SetVariable("words", " <%=words%>");
thisMovie(movieName).SetVariable("incorrect", " <%=incorrect%>");
thisMovie(movieName).Play();
}
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function SetupSize() {
if (document.getElementById && document.getElementById("CurrentSize") != null) {
if(document.getElementById("CurrentSize").value == "")
resetCurrentsize();
else
setCurrentsize(document.getElementById("CurrentSize").value);
//document.getElementById("textSizer").style.cssText = "display: block; float: right;";
}
}
function getCurrentsize() {
return currentSize;
}
function setCurrentsize(newsize) {
currentSize = newsize;
createCookie(cookiename,currentSize,60);
if (document.getElementById) {
document.getElementById("CurrentSize").value = currentSize;
document.getElementById("mainbody").style.cssText = "font-size:"+currentSize+"%";
document.getElementById("textSizer").style.cssText = "display: block;";
}
}
function resetCurrentsize() {
currentSize = 100;
createCookie(cookiename,currentSize,60);
document.getElementById("CurrentSize").value = currentSize;
if (document.getElementById) {
document.getElementById("mainbody").style.cssText = "font-size:"+currentSize+"%";
}
}
function sizeUp() {
if (document.getElementById) {
currentSize=currentSize+5;
createCookie(cookiename,currentSize,60);
document.getElementById("CurrentSize").value = currentSize;
document.getElementById("mainbody").style.cssText = "font-size:"+currentSize+"%";
}
}
function sizeDown() {
if (document.getElementById) {
currentSize=currentSize-5;
createCookie(cookiename,currentSize,60);
document.getElementById("CurrentSize").value = currentSize;
document.getElementById("mainbody").style.cssText = "font-size:"+currentSize+"%";
}
}
//Function to choose how the members list is sorted
//function MembersSort(SelectSort){
// if (SelectSort != "") {self.location.href = "select_forum_members.asp?find=<% = Server.URLEncode(Request.QueryString("find")) %>&searchin=<%=SearchIn%>&sort=" + SelectSort.options[SelectSort.selectedIndex].value};
// return true;
//}
//Function to move to another page of members
//function MembersPage(SelectPage){
// if (SelectPage != -1) {self.location.href = "select_forum_members.asp?find=<% = Request.QueryString("find") %>&searchin=<%=SearchIn%>&sort=<% = Request.QueryString("sort") %>&MemPagePosition=" + SelectPage.options[SelectPage.selectedIndex].value};
// return true;
//}
//*************************************************************
// MATCHING PAIRS
//*************************************************************
function BrowserCheck() {
var b = navigator.appName
this.mac = (navigator.appVersion.indexOf('Mac') != -1)
if (b=="Netscape") this.b = 'ns'
else if (b=="Microsoft Internet Explorer") this.b = 'ie'
else this.b = b
this.version = navigator.appVersion
this.v = parseInt(this.version)
this.ns = (this.b=="ns" && this.v>=5)
this.ns5 = (this.b=="ns" && this.v==5)
this.ns6 = (this.b=="ns" && this.v==5)
this.ie = (this.b=="ie" && this.v>=4)
this.ie4 = (this.version.indexOf('MSIE 4')>0)
this.ie5 = (this.version.indexOf('MSIE 5')>0)
if (this.mac) this.ie = this.ie5
this.ie5mac = (this.ie5 && this.mac);
this.min = (this.ns||this.ie)
}
is = new BrowserCheck();
if ((is.min == false)||(is.ie5mac)){
alert('Your browser cant handle this page. You need Internet Explorer 6 or newer, or Firefox 2+');
}
function Card(ID){
this.elm=document.getElementById(ID);
this.name=ID;
this.css=this.elm.style;
this.elm.style.left = 0 +'px';
this.elm.style.top = 0 +'px';
this.HomeL = 0;
this.HomeT = 0;
this.tag=-1;
this.index=-1;
}
function CardGetL(){return parseInt(this.css.left)}
Card.prototype.GetL=CardGetL;
function CardGetT(){return parseInt(this.css.top)}
Card.prototype.GetT=CardGetT;
function CardGetW(){return parseInt(this.elm.offsetWidth)}
Card.prototype.GetW=CardGetW;
function CardGetH(){return parseInt(this.elm.offsetHeight)}
Card.prototype.GetH=CardGetH;
function CardGetB(){return this.GetT()+this.GetH()}
Card.prototype.GetB=CardGetB;
function CardGetR(){return this.GetL()+this.GetW()}
Card.prototype.GetR=CardGetR;
function CardSetL(NewL){this.css.left = NewL+'px'}
Card.prototype.SetL=CardSetL;
function CardSetT(NewT){this.css.top = NewT+'px'}
Card.prototype.SetT=CardSetT;
function CardSetW(NewW){this.css.width = NewW+'px'}
Card.prototype.SetW=CardSetW;
function CardSetH(NewH){this.css.height = NewH+'px'}
Card.prototype.SetH=CardSetH;
function CardInside(X,Y){
var Result=false;
if(X>=this.GetL()){if(X<=this.GetR()){if(Y>=this.GetT()){if(Y<=this.GetB()){Result=true;}}}}
return Result;
}
Card.prototype.Inside=CardInside;
function CardSwapColours(){
var c=this.css.backgroundColor;
this.css.backgroundColor=this.css.color;
this.css.color=c;
}
Card.prototype.SwapColours=CardSwapColours;
function CardHighlight(){
this.css.backgroundColor='#000000';
this.css.color='#c4c4ff';
}
Card.prototype.Highlight=CardHighlight;
function CardUnhighlight(){
this.css.backgroundColor='#00FF99';
this.css.color='#000000';
}
Card.prototype.Unhighlight=CardUnhighlight;
function CardOverlap(OtherCard){
var smR=(this.GetR()<(OtherCard.GetR()+10))? this.GetR(): (OtherCard.GetR()+10);
var lgL=(this.GetL()>OtherCard.GetL())? this.GetL(): OtherCard.GetL();
var HDim=smR-lgL;
if (HDim<1){return 0;}
var smB=(this.GetB()OtherCard.GetT())? this.GetT(): OtherCard.GetT();
var VDim=smB-lgT;
if (VDim<1){return 0;}
return (HDim*VDim);
}
Card.prototype.Overlap=CardOverlap;
function CardDockToR(OtherCard){
this.SetL(OtherCard.GetR() + 5);
this.SetT(OtherCard.GetT());
}
Card.prototype.DockToR=CardDockToR;
function CardSetHome(){
this.HomeL=this.GetL();
this.HomeT=this.GetT();
}
Card.prototype.SetHome=CardSetHome;
function CardGoHome(){
this.SetL(this.HomeL);
this.SetT(this.HomeT);
}
Card.prototype.GoHome=CardGoHome;
var CorrectResponse = 'Correct! ';
var IncorrectResponse = 'Sorry! Try again. Incorrect matches have been removed.';
var YourScoreIs = 'Your score is ';
var Correction = '[strCorrection]';
var DivWidth = 300; //default value
var FeedbackWidth = 2; //default
var ExBGColor = '#c4c4ff';
var PageBGColor = '#dfefff';
var TextColor = '#000000';
var TitleColor = '#000033';
var Penalties = 0;
var CurrDrag = -1;
var topZ = 100;
function PageDim(){
//Get the page width and height
this.W = 500;
this.H = 400;
if (is.ns) this.W = window.innerWidth;
if (is.ie) this.W = document.body.clientWidth;
if (is.ns) this.H = window.innerHeight;
if (is.ie) this.H = document.body.clientHeight;
}
var pg = null;
var DivWidth = 150; // 600
var DragWidth = 200;
var LeftColPos = 200; // 200
var RightColPos = 450;//500
var DragTop = 200;//300
var RightColOffset = 70
//Fixed and draggable card arrays
FC = new Array();
DC = new Array();
function doDrag(e) {
if (CurrDrag == -1) {return};
if (is.ie){var Ev = window.event}else{var Ev = e}
var difX = Ev.clientX-window.lastX;
var difY = Ev.clientY-window.lastY;
var newX = DC[CurrDrag].GetL()+difX;
var newY = DC[CurrDrag].GetT()+difY;
DC[CurrDrag].SetL(newX);
DC[CurrDrag].SetT(newY);
window.lastX = Ev.clientX;
window.lastY = Ev.clientY;
return false;
}
function beginDrag(e, DragNum) {
CurrDrag = DragNum;
if (is.ie){
var Ev = window.event;
document.onmousemove=doDrag;
document.onmouseup=endDrag;
}
else{
var Ev = e;
window.onmousemove=doDrag;
window.onmouseup=endDrag;
}
DC[CurrDrag].Highlight();
topZ++;
DC[CurrDrag].css.zIndex = topZ;
window.lastX=Ev.clientX;
window.lastY=Ev.clientY;
return true;
}
function endDrag(e) {
if (CurrDrag == -1) {return};
DC[CurrDrag].Unhighlight();
if (is.ie){document.onmousemove=null}else{window.onmousemove=null;}
onEndDrag();
CurrDrag = -1;
return true;
}
function onEndDrag(){
//Is it dropped on any of the fixed cards?
var Docked = false;
var DropTarget = DroppedOnFixed(CurrDrag);
if (DropTarget > -1){
//If so, send home any card that is currently docked there
for (var i=0; i OverlapArea){
OverlapArea = Temp;
Result = i;
}
}
return Result;
}
function StartUp(){
//Calculate page dimensions and positions
pg = new PageDim();
DivWidth = Math.floor((pg.W*4)/6);
DragWidth = 200;//Math.floor((DivWidth*3)/10);
LeftColPos = Math.floor(pg.W/2)-250;
RightColPos = LeftColPos + (DragWidth*2);
//pg.W - ((DivWidth*2) + LeftColPos)-24;
DragTop = parseInt(document.getElementById('introtable').offsetHeight) + parseInt(document.getElementById('introtable').offsetTop) + 180;
//Shuffle the items on the right
D = Shuffle(D);
var CurrTop = DragTop;
var TempInt = 0;
var DropHome = 0;
var Widest = 0;
for (var i=0; i'; //required for Navigator rendering bug with images
if (FC[i].GetW() > Widest){
Widest = FC[i].GetW();
}
}
if (Widest > DragWidth){Widest = DragWidth;}
CurrTop = DragTop;
DragWidth = Math.floor((DivWidth-Widest)/2) - 24;
RightColPos = DivWidth + LeftColPos - DragWidth;
//RightColPos = LeftColPos + DragWidth * 2;
//DivWidth + LeftColPos - (DragWidth + 14) - RightColOffset;
var Highest = 0;
var WidestRight = 0;
for (i=0; i'; //required for Navigator rendering bug with images
if (DC[i].GetW() > DragWidth){DC[i].SetW(DragWidth);}
DC[i].css.cursor = 'move';
DC[i].css.backgroundColor = '#00FF99';
DC[i].css.color = '#000000';
TempInt = DC[i].GetH();
if (TempInt > Highest){Highest = TempInt;}
TempInt = DC[i].GetW();
if (TempInt > WidestRight){WidestRight = TempInt;}
}
var HeightToSet = Highest;
if (is.ns||is.ie5mac){HeightToSet -= 12;}
var WidthToSet = WidestRight;
if (is.ns||is.ie5mac){WidthToSet -= 12;}
for (i=0; i 0){
DC[i].tag = D[i][1];
D[i][2] = D[i][1];
var TopChange = 0;
var TargetLeft = FC[D[i][2]-1].GetR() + 5;
var TargetTop = FC[D[i][1]-1].GetT();
if (TargetTop < DC[i].GetT()){
TopChange = -3;
}
else {
if (TargetTop > DC[i].GetT()){
TopChange = 3;
}
}
Slide(i, TargetLeft, TargetTop, TopChange);
}
}
var CurrDiv = document.getElementById('GradeBut');
CurrDiv.style.top = CurrTop + 25 + 'px';
}
function Slide(MoverNum, TargL, TargT, TopChange){
var TempInt = DC[MoverNum].GetL();
if (TempInt > TargL){
DC[MoverNum].SetL(TempInt - 5);
}
TempInt = DC[MoverNum].GetT();
if (TopChange < 0) {
if (TempInt > TargT){
DC[MoverNum].SetT(TempInt + TopChange);
}
}
if (TopChange > 0) {
if (TempInt < TargT){
DC[MoverNum].SetT(TempInt + TopChange);
}
}
if ((DC[MoverNum].GetL() > TargL)||(DC[MoverNum].GetT() != TargT)){
setTimeout('Slide('+MoverNum+','+TargL+','+TargT+','+TopChange+')', 1);
}
else{
DC[MoverNum].SetL(TargL);
}
}
function Shuffle(InArray){
Temp = new Array();
var Len = InArray.length;
var j = Len;
var Correct = '';
for (var i=0; i 0) {
AttemptArray[(D[i][2])-1] = D[i][1];
};
if ((D[i][2] == D[i][1])&&(D[i][2] > 0)){
TotalCorrect++;
}
else{
//DC[i].GoHome();
};
};
//Score = Math.floor((100*(TotalCorrect-Penalties))/F.length);
Score = Math.floor((100*(TotalCorrect))/F.length);
//document.dform.currentdate.value
document.getElementById('Attempt').value = AttemptArray.join('|');
if (TotalCorrect == F.length) {
Response = YourScoreIs + ' ' + Score + '%.
' + CorrectResponse;
//WriteFeedback(Response);
}
else {
Response = IncorrectResponse + '
' + YourScoreIs + ' ' + Score + '%.';
//WriteFeedback(Response);
Penalties++; // Penalty for inaccurate check
}
document.form1.submit();
}
function WriteFeedback(Feedback){
var Output = Feedback + '
';
Output += '';
var FDiv = document.getElementById('FeedbackDiv');
FDiv.innerHTML = Output;
//Calculate and set its left setting
topZ++;
FDiv.style.zIndex = topZ;
//Add a border to the feedback div
document.getElementById('FeedbackDiv').style.borderStyle = 'solid';
FDiv.style.display='';
}
function HideFeedback(){
var FDiv = document.getElementById('FeedbackDiv');
FDiv.innerHTML = '';
FDiv.style.display='none';
}
//*****************************************
// PROOFREADING plugin
//*****************************************
//ALL THIS SITE CODE COPYRIGHT TREVOR HAWES
function BrowserCheck() {
var b = navigator.appName
this.mac = (navigator.appVersion.indexOf('Mac') != -1)
if (b=="Netscape") this.b = 'ns'
else if (b=="Microsoft Internet Explorer") this.b = 'ie'
else this.b = b
this.version = navigator.appVersion
this.v = parseInt(this.version)
this.ns = (this.b=="ns" && this.v>=5)
this.ns5 = (this.b=="ns" && this.v==5)
this.ns6 = (this.b=="ns" && this.v==5)
this.ie = (this.b=="ie" && this.v>=4)
this.ie4 = (this.version.indexOf('MSIE 4')>0)
this.ie5 = (this.version.indexOf('MSIE 5')>0)
if (this.mac) this.ie = this.ie5
this.ie5mac = (this.ie5 && this.mac);
this.min = (this.ns||this.ie)
}
/*
Example:
function test()
{
if (document.layers) getMouseLoc; //NS
else if (document.all) getMouseLoc(); //IE
alert(mouseLocation.x+","+mouseLocation.y);
}
in the BODY:
test
*/
function Point(x,y) { this.x = x; this.y = y; }
mouseLocation = new Point(-500,-500);
function getMouseLoc(e)
{
if(!document.all) //NS
{
mouseLocation.x = e.pageX;
mouseLocation.y = e.pageY;
}
else //IE
{
mouseLocation.x = event.x + document.body.scrollLeft;
mouseLocation.y = event.y + document.body.scrollTop;
}
return true;
}
//NS init:
if(document.layers){ document.captureEvents(Event.MOUSEMOVE); document.onMouseMove = getMouseLoc; }
var currentWord = '';
is = new BrowserCheck();
//if ((is.min == false)||(is.ie5mac)){
// alert('Your browser can't handle this page. You need NS6 or IE5 on Windows, or NS6 on Mac.');
//}
function replaceElementWithHTML (element, html) {
if (document.all) {
if (element)
element.outerHTML = html;
}
else if (document.createRange && document.getElementById) {
if (element) {
var range = document.createRange();
range.selectNode(element);
var docFrag = range.createContextualFragment(html);
element.parentNode.replaceChild(docFrag, element);
}
}
}
function replaceElementidWithHTML (elementid, html) {
if (document.all) {
var element = document.all[elementId];
if (element)
document.all[elementId].outerHTML = html;
}
else if (document.createRange && document.getElementById) {
var element = document.getElementById(elementId);
if (element) {
var range = document.createRange();
range.selectNode(element);
var docFrag = range.createContextualFragment(html);
element.parentNode.replaceChild(docFrag, element);
}
}
}
function clickWord(aword){
closePopup();
var aedpopup = '';
var apopuporigword = '';
var ThisWord = trim(aword.innerHTML);
aedpopup = document.getElementById('edpopup');
aedpopup.style.visibility='visible';
apopuporigword = document.getElementById('popuporigword');
apopuporigword.innerHTML=ThisWord;
currentWord = aword;
apopuporigword.style.textDecoration = currentWord.style.textDecoration;
apopuporigword.style.color = currentWord.style.color;
document.getElementById('popupchangedword').value = ThisWord;
document.getElementById('popupchangedword').focus();
middle("edpopup");
}
function closePopup(){
var aedpopup = document.getElementById('edpopup');
aedpopup.style.visibility='hidden';
aedpopup = document.getElementById('insertpopup');
aedpopup.style.visibility='hidden';
}
function middle(layername) {
if (document.layers) {
document.layers[layername].pageX = document.width/2;
document.layers[layername].pageY = document.height/2;
}
else if (document.all) {
document.all(layername).style.posLeft = document.width/2;
document.all(layername).style.posTop = document.height/2;
}
}
function clickSpace(aword){
closePopup();
var aedpopup = '';
var apopuporigword = '';
currentWord = aword;
aedpopup = document.getElementById('insertpopup');
aedpopup.style.visibility='visible';
document.getElementById('popupinsertedword').value = '';
document.getElementById('popupinsertedword').focus();
middle("insertpopup");
}
function changeWord(){
closePopup();
var apopupchangedword = '';
var aplus = '';
apopupchangedword = document.getElementById('popupchangedword');
apopupchangedword.value = trim(apopupchangedword.value);
if (apopupchangedword.value > ' '){
if ((currentWord.innerHTML != apopupchangedword.value) || (currentWord.style.textDecoration != 'none' )) {
currentWord.innerHTML = aplus + trim(apopupchangedword.value);
currentWord.style.textDecoration = 'none';
if ((currentWord.style.color != '#009900') && (currentWord.style.color != 'rgb(0, 153, 0)')) {
currentWord.style.color = '#0000ff';
}
gradeTest();
}
}else{
deleteWord();
}
}
function insertWord(){
closePopup();
var apopupchangedword = '';
apopupchangedword = document.getElementById('popupinsertedword');
if (apopupchangedword.value > ' '){
//
var spacebit = ' ';
var toadd = spacebit + '' + apopupchangedword.value + '';
toadd = toadd + spacebit;
replaceElementWithHTML(currentWord,trim(toadd));
gradeTest();
}
}
function deleteWord(){
closePopup();
if ((currentWord.style.color == '#009900')||(currentWord.style.color == 'rgb(0, 153, 0)'))
{currentWord.parentNode.removeChild(currentWord);
}else{
currentWord.style.textDecoration = 'line-through';
currentWord.style.color = '#990000';
};
gradeTest();
}
function gradeTest(){
//var aTry = document.getElementById('tryPassage');
var aObjText = '';
var aWord = '';
var att = '';
var aTag;
att = document.getElementById("tryPassage").innerHTML;
document.form1.attemptPassage.value = att;
att = replace(att,'',"");
att = replace(att,'',"");
att = replace(att,'',"");
att = replace(att,'',"");
att = replace(att,"","");
att = replace(att,"","");
att = replace(att,'',"");
att = replace(att,'',"");
att = replace(att,'',"");
att = replace(att,'',"");
att = replace(att,'',"");
att = replace(att,"<>","");
att = replace(att,"","");
att = replace(att,"","");
att = replace(att,"","");
att = replace(att," ","");
att = replace(att,"","");
att = replace(att,"","");
att = replace(att,'| ',"");
att = replace(att,' | ',"");
att = replace(att,' | ',"");
att = replace(att,' | ',"");
att = replace(att,' | ',"");
att = replace(att,' | ',"");
att = replace(att," | ","");
att = replace(att," ","");
att = replace(att,"","");
att = replace(att," ","");
//alert(att);
document.getElementById("tryPassage3").value = att;
document.getElementById("tryPassage2").innerHTML = att;
var numel = document.getElementById('tryPassage2').childNodes.length;
for (var cc = 0; cc < numel; cc++) {
aTag = document.getElementById('tryPassage2').childNodes[cc];
aWord = aTag.innerHTML;
if (aTag.nodeType == 1){
if ((aWord != ' ') & (aWord != ' ') & (Left(aWord,2) != ' |