function setCookie(name, value, expire) {
    document.cookie = name + "=" + escape(value) + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
    return true;
}

function getCookie(Name) {
          var search = Name + "="
          if (document.cookie.length > 0) { // if there are any cookies
                    offset = document.cookie.indexOf(search)
                    if (offset != -1) { // if cookie exists
                              offset += search.length
                              // set index of beginning of value
                              end = document.cookie.indexOf(";", offset)
                              // set index of end of cookie value
                              if (end == -1)
                                        end = document.cookie.length
                              return unescape(document.cookie.substring(offset, end))
                    }
          }
          return null;
}

function j(s) { 
   //open(s,'','resizable=1,scrollbars=1,status=yes,toolbar=no,location=no,menu=no','fullscreen,scrollbars' );
   //open(s,'','resizable=1,scrollbars=1,status=yes,toolbar=yes,location=no,','fullscreen,scrollbars' );
   open(s,'','resizable=1,scrollbars=1,status=yes,titlebar=yes,toolbar=yes,menubar=yes,location=no,','fullscreen,scrollbars' );
}

function k(s) { 
   //open(s,'','resizable=1,scrollbars=1,status=yes,toolbar=no,location=no,menu=no','fullscreen,scrollbars' );
   //open(s,'','resizable=1,scrollbars=1,status=yes,toolbar=yes,location=no,','fullscreen,scrollbars' );
   open(s,'','resizable=1,scrollbars=1,status=yes,titlebar=yes,toolbar=no,menubar=no,location=no,','fullscreen,scrollbars' );
}

function k2(s) { 
   var n = 'newwindow';
   var w = (screen.width * (0.80));
   var l = (screen.width * (0.19));
   var h = (screen.height - 20);
   var winProperty = 'resizable=1,scrollbars=1,titlebar=yes,menubar=yes,toolbar=yes,location=no'
                   + ',width='+w+',top=20,left='+l;
   var newWin = open(s,n,winProperty);
   //open(s,'','resizable=1,scrollbars=1,status=yes,titlebar=yes,toolbar=yes,menubar=yes,location=no,width='+w+',top=20,left='+l);                         
}

function openPopup(s, n, width, height, top, left) {
   var winProperty = 'resizable=yes,scrollbars=no,dependent=1,titlebar=no,menubar=no,toolbar=no,location=no'
                   + ',width='+width+',height='+height+',top='+top+',left='+left;
   var newWin = open(s,n,winProperty);
   newWin.focus();
}
function centerPopup(s, n, width, height) {
   var winl = (screen.width - width) / 2;
   var wint = (screen.height - height) / 2;
   openPopup(s, n, width, height, wint, winl);
}

function popupPage(s, n, width, height, top, left) {
   var count = getCookie(n);
   if (count == null) {
       var today   = new Date();
       var expires = new Date();
       expires.setTime(today.getTime() + 60*60*24*7*1000);
       count = 1;
       setCookie(n, count, expires);
       openPopup(s, n, width, height, top, left);
   }
}

function JumpToIt(list) {
	var listValue = list.options[list.selectedIndex].value;
	var newPage = listValue+"Category.html";
	if (listValue == "" || listValue == "computerbooks3.html") {
		newPage = "computerbooks3.html";
	}
	//if (newPage == "Books.html") newPage = "computerbooks3.html";
    if (newPage != "None")
        window.location.href=newPage
}

function JumpToPage(list) {
    var newPage = list.options[list.selectedIndex].value;
    if (newPage != "None")
        window.location.href=newPage
}

function JumpToBookHome() {
   if (document.referrer.indexOf("boat") == -1 || document.referrer.indexOf("maththinking") == -1) {
       window.top.location.replace("http://www.maththinking.com/boat/booksIndex.html");
   }
}

function JumpToBookHome2() {
   if (document.referrer.indexOf("boat") == -1 || document.referrer.indexOf("maththinking") == -1) {
       window.top.location.replace("http://www.maththinking.com/boat/computerbooks.html");
   }
}

function JumpToHome() {
   if (window.parent == window.self) {
       window.top.location.replace("index.html");
   }
}

function JumpTo(url) {
   if (window.parent == window.self) {
       window.top.location.replace(url);
   }
}

function showImage(imageName, imageFile) {
	document.images[imageName].src = imageFile;
}

var right_msg="How do you do?";

function checkFields() {
   if (document.search.keywords.value == "" || document.search.keywords.value == " " || 
       document.search.keywords.value == "  " || document.search.keywords.value == "   " || 
       document.search.keywords.value == "     ") {
       alert("Please enter search keywords");
       document.search.keywords.focus();
       //return false;
   } else {
       document.search.submit();
   }
   //return true;
}

var message="";
function clickIE() {
	if (document.all) {
		(message);
		return false;
	}
}
function clickNS(e) {
	if (document.layers||(document.getElementById&&!document.all)) {
        if (e.which==2||e.which==3) {
			(message);
			return false;
		}
	}
}
if (document.layers) {
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown=clickNS;
} else {
	document.onmouseup=clickNS;
	document.oncontextmenu=clickIE;
}
document.oncontextmenu=new Function("return false");
