// javascript library

<!--hide this script

// timer vars & other globs
var lH, lM, lS, lZ;
var lDur, lTo;

function calc() { 
// add up all checked entries
var sV, i, j, aI, lT, lS;
var sP = new String('');

  lT = 0;
  with (document.mForm) {
    if (lF.value < 1) { // don't calc if form values are locked
    
      sV = new String(sI.value);
      aI = sV.split(",");
    
      for (i=0;i<aI.length; i++) {
        lS = eval('v' + aI[i]).length;
        for (j=0; j<lS; j++) {
          if (eval('v' + aI[i])[j].checked) {
            sP = eval('v' + aI[i])[j].value;
            sP = sP.substring(1, sP.indexOf('z')-1); 
            lT = lT + parseInt(sP);
            break;
          }
        }
        lMark.value = lT;
      }    
    }
  }
}

function fire (n) {
// submit after n seconds; set globs
  lDur = n;   lH = 0;
  lZ = 0;   lM = 0;   lS = 0;
  lTo = setTimeout("timer()", 1000);
}

function timer() {
var sT = '';
var Mwin;

  lS++; lZ++; 
  if (lS == 59) {
    lM++; lS = 0;
    if (lM == 59) {lH++; lM = 0; }
  }
  lH < 10 ? sT = '0' + lH : sT = lH;
  lM < 10 ? sT = sT + ':0' + lM : sT = sT + ':' + lM;
  lS < 10 ? sT = sT + ' 0' + lS : sT = sT + ' ' + lS;

  with (self.document.mForm) {
    sDur.value = sT;
    var w = (screen.availWidth||screen.width) - 60
    var h = (screen.availHeight||screen.height) - 60
    if (lZ >= lDur) {
      clearTimeout(lTo);
      //Mwin = window.open('','aWin','width=' + w + ',height=' + h + ',left=15,top=15resizable=yes,status=yes,scrollbars=yes,buttons=no,location=no,menubar=no,directories=no,toolbar=no');
      Mwin = window.open('','aWin','width=' + w + ',height=' + h + ',left=15,top=15resizable=yes,status=no,scrollbars=yes,buttons=no,location=no,menubar=no,directories=no,toolbar=no');

      target = 'aWin';
      lI.value = '1';
      submit();
      //self.close();
      setTimeout("closeme('0');", 1000);
      //closeme('0');
    }
    else {
      lTo = setTimeout ("timer()", 1000);
    }
  }
}

function closeme(n) {
  if (n == 0) {
    self.close();
  }
  else {
    self.document.mForm.submit();
    self.close();
  }
}

function checksrc (p) {
  //if ( (self.opener == null) || (! self.opener.closed && self.opener.document.mForm.lI.value == 1)) {
    //alert('Closing [' + self.name + ']');
    //self.location.href = p;
//  }
}

function langwin(u) {
window.open(u,'language','width=50,height=50,resizable=no,status=no,scrollbars=no,buttons=no,location=no,menubar=no,directories=no,toolbar=no');
self.location.reload(true);
}

function browsewin(u) {

window.open(u,'Browse','width=350,height=400,resizable=yes,status=no,scrollbars=yes,buttons=no,location=no,menubar=no,directories=no,toolbar=no');
}

function popwin(u, x, y, n) {

var r = n;
  if (r == null) {r = '1';}

window.open(u,'Browse' + n,'width=' + x + ',height=' + y + ',resizable=yes,status=no,scrollbars=yes,buttons=no,location=no,menubar=no,directories=no,toolbar=no');
}

function modimage(u, t) {
 var w = (screen.availWidth||screen.width) - 60
 var h = (screen.availHeight||screen.height) - 60
 var st = t;
 var iwin = window.open('','modimg','width=' + w + ',height=' + h + ',left=15,top=15,resizable=yes,status=no,scrollbars=yes,buttons=no,location=no,menubar=no,directories=no,toolbar=no');
 if (st == null) { st = "image"; }
 iwin.document.open();
 with (iwin.document) {
  write('<body marginwidth="0" marginheight="0" topmargin="3" leftmargin="3" rightmargin="3" bgcolor="#f2f2f2">\n');
  write('<table border=0 cellpadding=1 cellspacing=0 align="center" background="/img/black.gif" width="1">\n');
  write('<tr><td>\n');
  write('<table border=0 cellpadding=0 cellspacing=0 wwidth="100%"><tr>\n');
  write('<td background="/img/close0.gif"><a href="javascript:self.close()"><img src="/img/0.gif" width="76" height="15" border="0" alt="close box"></a></td>\n');
  write('<td background="/img/black.gif" width="100%"><img src="/img/0.gif" width="1" height="1"></td>\n');
  write('<td background="/img/printimg0.gif"><a href="javascript:self.print()"><img src="/img/0.gif" width="76" height="15" border="0" alt="close box"></a></td>\n');
  write('</tr></table></td></tr><tr><td><img src="' + u + '" border=0 alt="' + t + '"></td></tr>\n');
  write('</table></body>\</html>\n');
 }
 iwin.document.close();
}

function modimage2(u, t, z) {
 var w = (screen.availWidth||screen.width) - 60
 var h = (screen.availHeight||screen.height) - 60
 var st = t;
 var iwin = window.open('','modimg','width=' + w + ',height=' + h + ',left=15,top=15,resizable=yes,status=no,scrollbars=yes,buttons=no,location=no,menubar=no,directories=no,toolbar=no');
 if (st == null) { st = "image"; }
 iwin.document.open();
 with (iwin.document) {
  write('<body marginwidth="0" marginheight="0" topmargin="3" leftmargin="3" rightmargin="3" bgcolor="#f2f2f2">\n');
  write('<table border=0 cellpadding=1 cellspacing=0 align="center" background="/img/black.gif" width="1">\n');
  write('<tr><td>\n');
  write('<table border=0 cellpadding=0 cellspacing=0 wwidth="100%"><tr>\n');
  write('<td background="/img/close0.gif"><a href="javascript:self.close()"><img src="/img/0.gif" width="76" height="15" border="0" alt="close box"></a></td>\n');
  write('<td background="/img/black.gif" width="100%"><img src="/img/0.gif" width="1" height="1"></td>\n');
  write('<td background="/img/printimg0.gif"><a href="javascript:self.print()"><img src="/img/0.gif" width="76" height="15" border="0" alt="close box"></a></td>\n');
  write('</tr></table></td></tr><tr><td><img src="' + u + '" border=0 alt="' + t + '"></td></tr>\n');
  write('<td colspan=3 background="/img/black.gif" valign="bottom" style="color:white;font-family:arial;font-size:smaller"><img src="/img/0.gif" width="1" height="1">' + z + '</td></tr>\n');
  write('</table></body>\</html>\n');
 }
 iwin.document.close();
}

function modinteract(u, x, y, z) {
 var sz = z
 var w = x-35
 var h = y-90
 var iwin = window.open('','modimg','width=' + x + ',height=' + y + ',resizable=yes,status=no,scrollbars=yes,buttons=no,location=no,menubar=no,directories=no,toolbar=no');
 if (sz == null) { sz = "interactive image"; }
 iwin.document.open();
 with (iwin.document) {
  write('<html><head><title>Interactive Image</title></head>\n');
  write('<link rel="StyleSheet" href="/inc/styles.css" type="text/css">\n');
  write('<body marginwidth="0" marginheight="0" topmargin="3" leftmargin="3" rightmargin="3" bgcolor="#f2f2f2">\n');
  write('<table border=0 cellpadding=1 cellspacing=0 align="center" background="/img/black.gif" width="1"><tr><td>\n');
  write(' <table border=0 cellpadding=4 bgcolor="#ffffff"><tr><td>\n');
  write('  <table border=0 cellpadding=0 cellspacing=0 bgcolor="#ffffff" width="1" height="1"><tr><td background="/img/interactive.gif">\n');
  write('  <img src="/img/0.gif" width="172" height="43" alt="Interactive" align="left"></td></tr>\n');
  write('  </table></td>\n');
  write(' <td valign="top" class="instruct" align="right">' + sz + '</td> </tr>\n');
  write(' <tr><td colspan=2><embed src="' + u + '" border=0 width="' + w + '" height="' + h + '"></td></tr></table>\n');
  write('</td></tr>\n');
  write('<tr><td colspan=2>\n');
  write('<table border=0 cellpadding=0 cellspacing=0 width="100%"><tr>\n');
  write('<td background="/img/close0.gif"><a href="javascript:self.close()"><img src="/img/0.gif" width="76" height="15" border="0" alt="close box"></a></td>\n');
  write('<td background="/img/black.gif" width="100%"><img src="/img/0.gif" width="1" height="1"></td>\n');
  write('<td background="/img/printimg0.gif"><a href="javascript:self.print()"><img src="/img/0.gif" width="76" height="15" border="0" alt="close box"></a></td>\n');
  write('</tr></table></td></tr></table></body>\</html>\n');

 }
 iwin.document.close();
}

function imagewin(u, t) {
 var st = t;
 var iwin = window.open('','iwin','width=300,height=300,resizable=yes,status=no,scrollbars=yes,buttons=no,location=no,menubar=no,directories=no,toolbar=no');
 if (st == null) { st = "image"; }
 iwin.document.open();
 with (iwin.document) {
  write('<center><img src="' + u + '" border=0 alt="' + t + '"><p>\n');
  write('<a href="javascript:self.close()"><img src="/img/close0.gif" border="0" alt="close box"></a>\n');
 }
 iwin.document.close();
}

function viewurl(u) {
  var vWin = window.open(u,'vWin');
}

function gotourl(u) {
  document.location.href= u;
}

function printpage(u) {
  window.print();
}

function chatwindow()
{
window.open ("/asp/chat.asp","new_window","width=600,height=400,resizable=yes,status=yes,scrollbars=yes,buttons=no,location=no,menubar=no,directories=no,toolbar=no"); 
}

function modulewin(u) {
var w = (screen.availWidth||screen.width) - 60
var h = (screen.availHeight||screen.height) - 60
var ModWin = window.open(u,'Module','width=' + w + ',height=' + h + ',left=15,top=15,resizable=yes,status=no,scrollbars=yes,buttons=no,location=no,menubar=no,directories=no,toolbar=no');
ModWin.focus();
}

function studentfeedback(p) {
var fWin = self.opener;
  if ( (fWin == null) || (fWin.closed) ) {
    fWin = window.open();
  }
  fWin.location.href = p;
  fWin.focus();
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

/* Functions that swaps images. */
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

/* Functions that handle preload. */
function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function help(u) {
window.open('/help/help.asp','Help','width=360,height=400,resizable=yes,status=yes,scrollbars=yes,buttons=no,location=no,menubar=no,directories=no,toolbar=no');
}

function setlang (n) {
// change lang from n1 (current) to n2 (new)

var u1, u2, p1, p2, r;

  u1 = new String (self.location.href); // current url

  if (n == 2) {
    u2 = u1.replace (/dir2/ig, "dir1");
    u2 = u2.replace (/lang2/ig, "lang1");
  }
  else {
    u2 = u1.replace (/dir1/ig, "dir2");
    u2 = u2.replace (/lang1/ig, "lang2");
  }

  //alert(u1 + '; ' + u2);

  self.location.href = '/asp/setlanguage.asp?lL=' + n + '&sP=' + u2;
}

function setlang_old (n, m) {
// n is current language
// m = 10 will get current url, m = 0 will get url of opener window
// assume there's a form called xfs; if not available, get session("sP") (ie current URL)

var s, r, u;

  r = 10; // assume no form

  if (self.document.xfs != null) { // this form exists

    r = 0; 
    with (self.document.xfs) {

      if (isdef(self.document.xfs, 'xfss')) { 
        s = new String(xfss.value);
      }
      else {
        s = new String(action);
      }

//alert(s);

      if (n==1) { 
        s = s.replace(/asp2/, 'asp1');
        s = s.replace(/mod2/, 'mod1');
      }
      else {
        s = s.replace(/asp1/, 'asp2');
        s = s.replace(/mod1/, 'mod2');
      }

      action = s;

//alert(s + '; L: ' + n);

      //submit();     
    }
  }
  else { // get referer URL
    if (m > 0) {
      s = self.opener.location.href; // from current window
    }
    else {
      s = self.location.href; // parent window
    }
  }

  // run ASP script
  u = '/asp/setmodlanguage.asp?lP=' + r + '&lM=' + m + '&sU=' + escape(s);

  if (self.top.sCF != null) {
    self.top.sCF.location.href = u + '&lF=10';
  }
  else {
    window.open(u,'','height=1,width=1,resizable=no,status=no,scrollbars=no,buttons=no,location=no,menubar=no,directories=no,toolbar=no');
  }

//alert(s);

}


//simple browser check 
f7_v4=(parseInt(navigator.appVersion)>=4 && parseInt(navigator.appVersion)<=5)?1:0 
f7_ie=(document.all && f7_v4)?1:0 
f7_ns=(document.layers && f7_v4)?1:0

//code for drops
function f7_showdrop(thelayer){
  f7_keep=thelayer; f7_hideall(); f7_showitnow=1
  f7_showit(thelayer)
  }
function f7_showit(thelayer){
  if(f7_ie){ eval(f7_droplayer[thelayer]+ '.style.visibility="visible"') }
  if(f7_ns){ eval('document.'+f7_droplayer[thelayer]+ '.visibility="show"');}
  }
function f7_hidedrop(){
  f7_keep=-1; setTimeout('f7_hideall()',500)
  }
f7_keep=-1
function f7_hideall(){
  for(i=0;i<f7_droplayer.length;i++){ 
    f7_hideit=0; f7_checkmousepos(i)
    if(f7_ie && f7_keep!=i){ 
      if(f7_hideit){ eval(f7_droplayer[i]+'.style.visibility="hidden"') } 
      }
    if(f7_ns && f7_keep!=i){ 
      if(f7_hideit){ eval('document.'+f7_droplayer[i]+'.visibility="hide"') }
      }
    }
  }

//deal with cursor over layer
document.onmousemove = f7_getmousepos
if (f7_ns) document.captureEvents(Event.MOUSEMOVE)
function f7_getmousepos(e){
  if(f7_ns){f7_mousex=e.pageX; f7_mousey=e.pageY}
  if(f7_ie){f7_mousex=event.clientX; f7_mousey=event.clientY;}
  }
function f7_checkmousepos(i){ 
  if(f7_ns){ 
    f7_x_min=eval('document.'+f7_droplayer[i]+'.left')
    f7_x_max=f7_x_min+eval('document.'+ f7_droplayer[i]+ '.clip.width')
    f7_y_min=eval('document.'+f7_droplayer[i]+'.top')
    f7_y_max=f7_y_min+eval('document.'+ f7_droplayer[i]+ '.clip.height')
    } 
  if(f7_ie){ 
    f7_x_min=eval(f7_droplayer[i]+'.style.pixelLeft')
    f7_x_max=f7_x_min+eval(f7_droplayer[i]+ '.style.pixelWidth')
    f7_y_min=eval(f7_droplayer[i]+'.style.pixelTop')
    f7_y_max=f7_y_min+eval(f7_droplayer[i]+ '.style.pixelHeight')
    }
  if (f7_mousex>=f7_x_min && f7_mousex<=f7_x_max && f7_mousey>=f7_y_min && f7_mousey<=f7_y_max){
  f7_hideit=0; setTimeout('f7_hideall()',500)
    }
  else { f7_hideit=1 }
  return f7_hideit
  }

// stop hiding -->