function doSearchLiteracy(rl,ra,series) { if (rl=="" && ra=="") { alert('Please select a Reading level or Reading Age '); return false; } /*if (rl!="" && ra!="") { alert('Please select EITHER a Reading level or Reading Age '); return false; }*/ //document.location = "/primary31/site/libraries/Search+results+dev+2?open&template=domPrimary&rl=" + rl + "&ra=" + unescape(ra) + "&series=" + series; document.location = "/primary31/site/libraries/Search+results?open&template=domPrimary&div=Literacy&rl=" + rl + "&ra=" + unescape(ra) + "&series=" + series + "&literacysearch=yes"; } function doSearchTest(str) { if(str == "Search" || str == "") { alert("Please enter a search term."); } else { document.location = "/primary31/site/libraries/Search+results?open&template=domPrimary&query=" + escape( str ); } } function doSearch(s,rl,ra) { var str = trim(s.value); var regExp1 = /[&+]/; var regExp2 = /[()\[\]"=<>!]|(\bfield\b)/; var regExp3 = /'(\w|\s)*'/g; if ( regExp1.test( str )) { alrt = "Please use AND as the operator."; return alert( alrt ); } if ( regExp3.test( str )) { alrt = "Please use \" as the operator for phrase searching."; return alert( alrt ); } if (str == "") { alert("Please be sure to enter something to search for."); s.focus(); } else { document.location = "/primary31/site/libraries/Search+results?open&template=domPrimary&query=" + escape( str ) + "&rl=" + rl + "&ra=" + ra + "&start=1&count=10"; } } // returns the element value from modules array function getHmElement(eName,b,eMod) { elementName= eName + b + eMod; for (var a=0;a,\[,\]]/; var str = s.value; var tstr = t.value; if ( regExp1.test( str ) || regExp2.test( str ) ) { alrt = "Please note that you can not include:"; alrt += "\n\nThe reserved word 'field'\nthe characters [, ], (, ), < or >"; alrt += "\n\nin your search query!\n\nIf you are confident that you know"; alrt += "\nwhat you are doing, then you can\nmanually produce the URL required."; s.focus(); return alert( alrt ); } if ( str == "" ) { alert("Please be sure to enter something to search for."); s.focus(); } else { document.location = "/" + document.forms[0].Path.value + "/index?open&type=Search&query=(FIELD+" + tstr + "+contains+"+ escape( str ) + ")&start=1&count=100"; } } // close popup window function closeWindow() { window.close() } // print the page function printWindow() { window.print() } function inStr(beginning, word1, word2) { check1 = new String(word2); returnInStr = word1.indexOf(word2, (beginning - 1)) + 1; return returnInStr; } function mid(inputMid, pos, l) { pos = pos - 1; if ((pos < inputMid.length) && ((pos + l) <= inputMid.length)) { returnMid = inputMid.substring(pos, pos + l); } else { returnMid = ""; } return returnMid; } function replaceSubstring (inputString, badString, goodString, caseSensitive) { fixedReplace = ""; UI = inputString; UB = badString; if ((caseSensitive != 1) && (caseSensitive != true)) { UI = inputString.toUpperCase(); UB = badString.toUpperCase(); } badEnd = -1; badLoc = UI.indexOf(UB); if (badLoc != -1) { for (x=1; (badLoc != -1); x++) { fixedReplace = fixedReplace + inputString.substring((badEnd + 1), badLoc) + goodString badEnd = badLoc + UB.length - 1; badLoc = UI.indexOf(UB, (badLoc + 1)); } fixedReplace = fixedReplace + inputString.substring((badEnd + 1), inputString.length); } else { fixedReplace = inputString; } return fixedReplace; } // similar to the StrLeft function function getFront(mainStr, searchStr ){ foundOffset = mainStr.indexOf(searchStr) if ( foundOffset == -1 ) { return null; } return mainStr.substring(0, foundOffset ); } // similar to the StrRight function function getEnd(mainStr, searchStr ){ foundOffset = mainStr.indexOf(searchStr) if ( foundOffset == -1 ) { return null; } return mainStr.substring( foundOffset + searchStr.length, mainStr.length); } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i0&&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 1; i-- ) { c = s.charAt(10 - i); checkDigit += (c - 0) * i; result += c; } checkDigit = (11 - (checkDigit % 11)) % 11; result += checkDigit == 10 ? 'X' : (checkDigit + ""); return ( result ); } function convISBN10toISBN13(str) { var c; var checkDigit = 0; var result = ""; c = '9'; result += c; checkDigit += (c - 0) * 1; c = '7'; result += c; checkDigit += (c - 0) * 3; c = '8'; result += c; checkDigit += (c - 0) * 1; for ( i = 0; i < 9; i++ ) { // > c = str.charAt(i); if ( i % 2 == 0 ) checkDigit += (c - 0) * 3; else checkDigit += (c - 0) * 1; result += c; } checkDigit = (10 - (checkDigit % 10)) % 10; result += (checkDigit + ""); return ( result ); } function preEditISBN(str) { var len = str.length; var c; var s; if ( (str.substring(0,4) == 'ISBN') || (str.substring(0,4) == 'isbn') ) { str = str.substring(4, len); len = str.length; } s = ""; for ( i = 0; i < len; i++ ) { // > c = str.charAt(i); if ( (c == '-') || (c == ' ') ) continue; s += c; } str = s; return ( str ); } var xmlhttp var emailExists = false; function loadXMLEmail(url) { // code for Mozilla, etc. if (window.XMLHttpRequest && navigator.userAgent.toLowerCase().indexOf("msie 7")==-1) { xmlhttp=new XMLHttpRequest() //xmlhttp.onreadystatechange=state_Change xmlhttp.onload = function () { eval(xmlhttp.responseText); if (isRegistered==1) { emailExists = true;} } xmlhttp.open("GET",url,false) xmlhttp.send(null) } // code for IE else if (window.ActiveXObject) { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP") if (xmlhttp) { xmlhttp.onreadystatechange= function () { if (xmlhttp.readyState==4) { // if "OK" if (xmlhttp.status==200) { eval(xmlhttp.responseText); if (isRegistered==1) { emailExists = true;} } else { alert("Problem retrieving XML data:" + xmlhttp.statusText) } } } xmlhttp.open("GET",url,false) xmlhttp.send() } } } function logInMain() { var which = document.forms['LoginMain']; var regEmailPattern = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/; if (! regEmailPattern.test( which.EmailAddress.value )) { alert("Please enter a valid email address"); return false; } var thisXMLurl = "/site/primei3beta.nsf/checkReg.js?readform&email=" + which.EmailAddress.value; loadXMLEmail(thisXMLurl); if (emailExists) { // set cookie detailsCookie = "|" detailsCookie += "|" detailsCookie += "|" detailsCookie += "|" detailsCookie += "|" detailsCookie += "|" detailsCookie += "|" detailsCookie += "|" detailsCookie += "|" detailsCookie += "|" detailsCookie += "|" detailsCookie += "|" detailsCookie += which.EmailAddress.value + "|" detailsCookie += "|" var cookieExpires = new Date(); cookieExpires.setTime(cookieExpires.getTime() + (10 * 365 * 24 * 1 * 60 * 60 * 1000 )); setCookie('MacmillanDetailsNew', detailsCookie, cookieExpires, '/'); setCookie('MacTClub', '1', cookieExpires, '/'); window.location.reload(); } else { alert('We\'re unable to find a registration for ' + which.EmailAddress.value +'.\n\nPlease register by following the link on the home page.'); return false; } }