var timeToKeep = 31536000000;  // one year
function MM_findObj(n, d) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function flvS3(v1){//v1.2
var v2=MM_findObj(v1);if (!v2){this.x=this.y=this.h=this.w=0;return;}var v3,v4,v5,v6,v7=(document.layers)?v2:v2.style;v3=isNaN(parseInt(v7.left))?v2.offsetLeft:parseInt(v7.left);v4=isNaN(parseInt(v7.top))?v4=v2.offsetTop:parseInt(v7.top);if (v2.offsetHeight){v5=v2.offsetHeight;v6=v2.offsetWidth;}else if (document.layers){v5=v7.clip.height;v6=v7.clip.width;}else {v5=v6=0;}this.x=parseInt(v3);this.y=parseInt(v4);this.h=parseInt(v5);this.w=parseInt(v6);}

function flvS8(v1,v2,v3){//v1.0
var v4=(document.layers)?v1:v1.style;var v5=flvS5();eval("v4.left='"+v2+v5+"'");eval("v4.top='"+v3+v5+"'");}

function flvS5(){//v1.0
var v1=((parseInt(navigator.appVersion)>4||navigator.userAgent.indexOf("MSIE")>-1)&&(!window.opera))?"px":"";return v1;}

function flvXAS1(){
var v1=arguments,v2=v1.length,v3='AutoScrollContainer',v4='AutoScrollContent';var v5=MM_findObj(v3),v6=MM_findObj(v4);if (!v5){return;}if (v5.XAS1!=null){clearTimeout(v5.XAS1);}var v7=(v2>0)?parseInt(v1[0]):1;if (v7){var v8=(v2>1)?parseInt(v1[1]):1,v9=(v2>2)?parseInt(v1[2]):50,v10=(v2>3)?parseInt(v1[3]):1;var v11=new flvS3(v3),v12=new flvS3(v4);var v13=v12.x,v14=v12.y,v15=0,v16=0;if (v10==1){var v17=-1*v12.h;v15=v12.x;if (v14>=v17){v16=v12.y-v8;}else {v16=v11.h;}}else {var v18=-1*v12.w;v16=v12.y;if (v13>=v18){v15=v12.x-v8;}else {v15=v11.w;}}flvS8(v6,v15,v16);v5.XAS1=setTimeout("flvXAS1("+v7+","+v8+","+v9+","+v10+")",v9);}}
//
// function to alert user that he is leaving the domain of unit143.org
//
function OffsiteWarning() {
	alert("This link will take you off-site. Unit 143 is not responsible for any content. To return to our site, simply close the opened window");
}

// Cookie Toolbox Javascript
// copyright 4th September 2002, by Stephen Chapman, Felgall Pty Ltd

// You have permission to copy and use this javascript provided that
// the content of the script is not changed in any way.
// For instructions on how to use these functions see "A Cookie Toolbox"
// in the Javascript section of our site at http://www.felgall.com/

var dbug = 0;

function nextEntry(ary) {
    if (dbug) {
		alert('nextEntry');
	}
    var j = 0;
    for (var i = 1; ary[i]; i++) {
        j = i;
    }
    return j + 1;
}
function d_A(ary) {
    var beg = nextEntry(ary) - 1;
    for (var i = beg; i > -1; i--) {
        ary[i] = null;
    }
}
function initArray() {
    if (dbug) {
		alert('initArray');
	}
    var ary = [];
    return ary;
}
function setCookie(name, value, expires) {
    if (dbug) {
		alert('setCookie');
	}
    if (!expires) {
		expires = new Date();
	}
    document.cookie = name + '=' + escape(value) + '; expires=' + expires.toGMTString() + '; path=/';
}
function getCookie(name) {
    if (dbug) {
		alert('getCookie');
	}
    var dCookie = document.cookie;
    var cName = name + "=";
    var cLen = dCookie.length;
    var cBegin = 0;
    while (cBegin < cLen) {
        var vBegin = cBegin + cName.length;
        if (dCookie.substring(cBegin, vBegin) == cName) {
            var vEnd = dCookie.indexOf(";", vBegin);
            if (vEnd == -1) {
				vEnd = cLen;
			}
            return unescape(dCookie.substring(vBegin, vEnd));
        }
        cBegin = dCookie.indexOf(" ", cBegin) + 1;
        if (cBegin === 0) {
			break;
		}
    }
    return null;
}
function delCookie(name) {
    if (dbug) {
		alert('delCookie');
	}
    document.cookie = name + '=' + '; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/';
}
function getArray(name, ary) {
    if (dbug) {
		alert('getArray');
	}
    d_A(ary);
    var ent = getCookie(name);
    if (ent) {
        i = 1;
        while (ent.indexOf('^') != '-1') {
            ary[i] = ent.substring(0, ent.indexOf('^'));
            i++;
            ent = ent.substring(ent.indexOf('^') + 1, ent.length);
        }
    }
}
function setArray(name, ary, expires) {
    if (dbug) {
		alert('setArray');
	}
    var value = '';
    for (var i = 1; ary[i]; i++) {
        value += ary[i] + '^';
    }
    setCookie(name, value, expires);
}
function delEntry(name, ary, pos, expires) {
    if (dbug) {
		alert('delEntry');
	}
    var value = '';
    getArray(name, ary);
    for (var i = 1; i < pos; i++) {
        value += ary[i] + '^';
    }
    for (var j = pos + 1; ary[j]; j++) {
        value += ary[j] + '^';
    }
    setCookie(name, value, expires);
}


function debugOn() {
    dbug = 1;
}
function debugOff() {
    dbug = 0;
}
function dumpCookies() {
    if (document.cookie == '') {
		document.write('No Cookies Found');
	} else {
        thisCookie = document.cookie.split('; ');
        for (var i = 0; i < thisCookie.length; i++) {
            document.write(thisCookie[i] + '<br \/>');
        }
    }
}
//
// gives you the size in pixels of 1em.
//
function getBrowserFontSize() {
    var measure = document.createElement('div');
    measure.style.height = '10em';
    document.body.appendChild(measure);
    var size = measure.offsetHeight/10;
    document.body.removeChild(measure);
    return size;
}
//
// function to incrementally change font size on all paragraphs <p>
//
function changeFontSize(inc){  
  var p = document.getElementsByTagName('p');
  for (var n = 0; n < p.length; n++) {
	var fsize;
    if (p[n].style.fontSize) {
      fsize = parseInt(p[n].style.fontSize.replace("px", ""));
    } 
    else {       
      fsize = getBrowserFontSize();    
	}
	if (inc == 0) fsize = getBrowserFontSize();
    p[n].style.fontSize = fsize + inc + 'px';   
  }
}
//
// function to allow more than one onload
//
function addLoadEvent(func) { 
	  var oldonload = window.onload; 
	  if (typeof window.onload != 'function') { 
	    window.onload = func; 
	  } 
	  else { 
	    window.onload = function() { 
	      if (oldonload) { 
	        oldonload(); 
	      } 
	      func(); 
	    }; 
	  } 
}
//
// function to force a page refresh
// 
function pageRefresh() {
	//location.reload(true);  //history.go(0);
}


