/* * Global variables */ /* * Browser properties BEGIN - PLEASE DO NOT MODIFY: CODE GENERATED AUTOMATICALLY */ var browserVendor = "MSIE" ; var browserVendorDetails = "Microsoft Internet Excplorer" ; var browserEngine = "MSIE" ; var browserVersionMajor = 6 ; var browserVersionMinor = 0 ; var browserHostOS = "WIN98" ; var isBrowserSupported = true ; var hasUserBeenWarned = false ; /* * Browser properties END - PLEASE DO NOT MODIFY: CODE GENERATED AUTOMATICALLY */ // insertAdjacentHTML(), insertAdjacentText() and insertAdjacentElement() for Netscape 6/Mozilla if(typeof HTMLElement!="undefined" && !HTMLElement.prototype.insertAdjacentElement) { HTMLElement.prototype.insertAdjacentElement = function(where,parsedNode) { switch (where) { case 'beforeBegin': this.parentNode.insertBefore(parsedNode,this) break; case 'afterBegin': this.insertBefore(parsedNode,this.firstChild); break; case 'beforeEnd': this.appendChild(parsedNode); break; case 'afterEnd': if (this.nextSibling) { this.parentNode.insertBefore(parsedNode,this.nextSibling); } else { this.parentNode.appendChild(parsedNode); } break; } } HTMLElement.prototype.insertAdjacentHTML = function(where,htmlStr) { var r = this.ownerDocument.createRange(); r.setStartBefore(this); var parsedHTML = r.createContextualFragment(htmlStr); this.insertAdjacentElement(where,parsedHTML) } HTMLElement.prototype.insertAdjacentText = function(where,txtStr) { var parsedText = document.createTextNode(txtStr) this.insertAdjacentElement(where,parsedText) } } /* * Image rollover function used by aao cluster homepage */ function swap(iname,swapGfc) { document.images[iname].src = swapGfc; } /* * open a new window */ function openWin(url,str) { return openLargeWin(url,str); } /* * Used by generic popup function to generate params string */ function getArgs(width,height,center,menu){ xposition=0; yposition=0; if ((parseInt(navigator.appVersion) >= 4 ) && (center)){ if (menu==0){ xposition = (screen.width - width) - 10; yposition = (screen.height - height) - 58; } else if(menu==1){ xposition = (screen.width - width) / 2; yposition = ((screen.height - height) / 2) - 67; } } if (navigator.appName == 'Netscape'){ width = width + 25; height = height + 25; } args="width="+width+",height="+height +",toolbar="+menu+",menubar="+menu +",screenx="+ xposition+",screeny="+yposition +",left="+xposition+",top="+yposition +",resizable=1,scrollbars=1,"; return args; } /* * Generic popup function for use in fragments */ function openPopup(pageToLoad, winName, width, height, center){ args=getArgs(width,height,center,0); if ((parseInt(navigator.appVersion) >= 4 ) && (center)){ if(window.popup){ popup.close(); popup=window.open(pageToLoad,winName,args); } } popup=window.open(pageToLoad,winName,args); } /* * Opens a large popup window. */ function openLargeWin(url,windowname) { popWin = window.open(url,windowname,'width=730,height=412,innerWidth=730,innerHeight=412,top=0,left=0,screenX=0,screenY=0,scrollbars=yes,resizable=yes,menubar=yes,status=yes,address=yes,location=yes,toolbar=yes'); popWin.focus(); return false; } function fireMenuItem(menu,href,target) { var form = document.forms[menu]; var oldTarget = form.target; form.action=href; form.target=target; form.submit(); if (browserHostOS.indexOf("MAC") == -1) { form.target = oldTarget; } } function fireMenuItemGet(menu,href,target) { if (target != null && target == '_blank') { newWin = window.open(href); newWin.focus(); } else { document.location = href; } } function openAdWin(url,windowname) { popWin = window.open(url,windowname,'width=730,height=412,innerWidth=730,innerHeight=412,top=0,left=0,screenX=0,screenY=0,scrollbars=yes,resizable=yes,menubar=yes,status=yes,address=yes,location=yes,toolbar=yes'); popWin.focus(); } function openFeedbackWin(url) { fedbackWin= window.open(url,"feedbackWin",'width=450,height=550,innerWidth=450,innerHeight=550,top=0,left=0,screenX=0,screenY=0,scrollbars=yes,resizable=yes,toolbar=yes,status=yes'); fedbackWin.focus(); } function openURLFeedbackWin() { var url = "/misc/feedback?feedback_badurl=" + location.href; fedbackWin= window.open(url,"feedbackWin",'width=450,height=550,innerWidth=450,innerHeight=550,top=0,left=0,screenX=0,screenY=0,scrollbars=yes,resizable=yes,toolbar=yes,status=yes'); fedbackWin.focus(); } function openHelpWin(url) { fedbackWin= window.open(url,"help",'width=450,height=350,innerWidth=450,innerHeight=350,top=0,left=0,screenX=0,screenY=0,scrollbars=yes,resizable=yes,toolbar=yes,status=yes'); fedbackWin.focus(); } function openSearchTipsWin(url) { searchTipsWin= window.open(url,"searchTipsWin",'width=450,height=350,innerWidth=450,innerHeight=350,top=0,left=0,screenX=0,screenY=0,scrollbars=yes,resizable=yes,toolbar=yes,status=yes'); searchTipsWin.focus(); } /* * id: the MeSH subject id, truncated at after the TOC@@MESH@ character * description: the item description string */ function meshSearchSubmitForm(id, description) { var msForm = document.forms['meshSearch']; msForm.elements['restrictterm_mesh'].value = id; msForm.elements['restrictdesc_mesh'].value = description; msForm.submit(); return false; } function openEcommerceWin(url) { fedbackWin= window.open(url,"help",'width=730,height=412,innerWidth=730,innerHeight=412,top=0,left=0,screenX=0,screenY=0,scrollbars=yes,resizable=yes,toolbar=yes,status=yes'); fedbackWin.focus(); } function openEcommerceWinAndSubmit(url, form) { fedbackWin= window.open(url,"help",'width=730,height=412,innerWidth=730,innerHeight=412,top=0,left=0,screenX=0,screenY=0,scrollbars=yes,resizable=yes,toolbar=yes,status=yes'); form.submit(); fedbackWin.focus(); } function validateEcommerceBillingProvinceFields(form, userZone) { isBillingProvinceDisabled = false ; isBillingUSAProvinceDisabled = false ; if (userZone.length > 0) { if ( (userZone == 'usa') || (userZone == 'canada') ) {isBillingProvinceDisabled = true;} else {isBillingUSAProvinceDisabled = true;} } else { if (form.elements['ecomm_bill_USAStatesCanadaProvinces'].value != '') {isBillingProvinceDisabled = true ;} } form.elements['ecomm_bill_State'].disabled = isBillingProvinceDisabled ; if (isBillingProvinceDisabled) { form.elements['ecomm_bill_State'].style.backgroundColor = "#EEEEEE"; } else { form.elements['ecomm_bill_State'].style.backgroundColor = "#FFFFFF"; } form.elements['ecomm_bill_USAStatesCanadaProvinces'].disabled = isBillingUSAProvinceDisabled ; return false ; } function validateEcommerceShippingProvinceFields(form, userZone) { isShippingDisabled = false ; isShippingProvinceDisabled = false ; isShippingUSAProvinceDisabled = false ; if (userZone.length > 0) { if ( (userZone == 'usa') || (userZone == 'canada')) {isShippingProvinceDisabled = true} else {isShippingUSAProvinceDisabled = true} } else { if (form.elements['ecomm_ship_USAStatesCanadaProvinces'].value != '') {isShippingProvinceDisabled = true ;} } form.elements['ecomm_ship_State'].disabled = isShippingProvinceDisabled ; if (isShippingProvinceDisabled) { form.elements['ecomm_ship_State'].style.backgroundColor = "#EEEEEE"; } else { form.elements['ecomm_ship_State'].style.backgroundColor = "#FFFFFF"; } form.elements['ecomm_ship_USAStatesCanadaProvinces'].disabled = isShippingUSAProvinceDisabled ; return false ; } function validateEcommerceShippingFields(form) { isShippingDisabled = false ; if (form.elements['ecomm_ship_isSame'].checked == true) {isShippingDisabled = true ;} form.elements['ecomm_ship_Title'].disabled = isShippingDisabled ; form.elements['ecomm_ship_FirstName'].disabled = isShippingDisabled ; form.elements['ecomm_ship_LastName'].disabled = isShippingDisabled ; form.elements['ecomm_ship_StreetAddress'].disabled = isShippingDisabled ; form.elements['ecomm_ship_StreetAddress1'].disabled = isShippingDisabled ; form.elements['ecomm_ship_City'].disabled = isShippingDisabled ; form.elements['ecomm_ship_State'].disabled = isShippingDisabled ; form.elements['ecomm_ship_USAStatesCanadaProvinces'].disabled = isShippingDisabled ; form.elements['ecomm_ship_Country'].disabled = isShippingDisabled ; form.elements['ecomm_ship_PostalCodeZIP'].disabled = isShippingDisabled ; } function redirectMain(dest) { try { opener.location.href=dest; } catch (errorCaught) {alert('You have navigated away from the page where the shopping cart was opened. Please refresh the main browser to display the new content.')}; } function refreshMain() { try { opener.location.reload(); } catch (errorCaught) {} } function openAddAlertWin(url) { fedbackWin= window.open(url,"help",'width=650,height=412,innerWidth=730,innerHeight=412,top=0,left=0,screenX=0,screenY=0,scrollbars=yes,resizable=yes,toolbar=yes,status=yes'); fedbackWin.focus(); } function changeActionAndSubmit(formName, actionPrefix) { var form = document.forms[formName] ; if (form.elements['termsConditions1'].checked) { var oldAction = form.action ; form.action = actionPrefix + oldAction ; } form.submit(); } function changeActionAndSubmitFinal(formName, newAction) { var form = document.forms[formName] ; if (form.elements['termsConditions1'].checked) { form.action = newAction; } form.submit(); } function changeFormActionCommand(formName, commandName, commandValue, brandingURL) { var form = document.forms[formName]; form.action = brandingURL + "/ecommerce/buy"; form.target = "_top"; form.elements[commandName].value = commandValue; if(commandValue != null && commandValue != "") { form.submit(); } return false; } function submitToClose(formName, toURL) { var form = document.forms[formName]; form.action = toURL; form.submit(); return false; } function switchTermsCheckboxes(formName, id) { var form = document.forms[formName]; if (id == '1') {form.elements['termsConditions2'].checked = form.elements['termsConditions1'].checked;} else {form.elements['termsConditions1'].checked = form.elements['termsConditions2'].checked;} return false; } /* * formName = the name of the form (string) * mode = the pick mode (string): 'browseBy' or 'browseLetter' or 'find' * value = the pick value string */ function journalSubscribeSubmitForm(formName, mode, value) { var form = document.forms[formName]; form.elements['product'].value = value; if(value != null && value != "") { form.submit(); } return false; } /* * formName = the name of the form (string) * mode = the pick mode (string): 'browseBy' or 'browseLetter' or 'find' * value = the pick value string */ function journalPickerSubmitForm(formName, mode, value) { var form = document.forms[formName]; form.elements['pickMode'].value = mode; form.elements['pickValue'].value = value; if(value != null && value != "") { form.submit(); } return false; } /* * url = the url (string) for the journal picker popup */ function journalPickerOpenWindow(url) { var title = "journalPickerWindow"; var options = "width=400,height=400,innerWidth=400,innerHeight=400,top=0,left=0,screenX=0,screenY=0,scrollbars=yes,resizable=yes,toolbar=yes,status=yes"; var journalPickerWin = window.open(url, title, options); journalPickerWin.opener = self; journalPickerWin.focus(); return false; } /* * Adds a journal to opener's list of journals selected (only if it is not already present) * * acronym = the journal acronym (string) * title = the journal title (string) */ function journalPickerAddItem(acronym, title) { var docRef = self.opener.document; // Check if journal is already in the list if(docRef == null) { return false; } return searchFormAddRestriction(acronym,title,docRef) } /* * Updates the visibility of the journal results list and the "other" block. */ function journalPickerUpdateVisibility(documentRef) { var holder = documentRef.getElementById("jp_results_holder"); var other = documentRef.getElementById("jp_other"); if(journalPickerItemHasNoResults(documentRef)) { holder.style.visibility = "hidden"; if(other != null) { other.style.visibility = "visible"; } } else { holder.style.visibility = "visible"; if(other != null) { other.style.visibility = "hidden"; } } return false; } function journalPickerItemHasNoResults(documentRef) { var items = documentRef.getElementsByTagName("div"); for(var i = 0; i < items.length; i++) { var id = items.item(i).getAttribute("id"); if(id != null && id.indexOf("jp_result_") == 0) { return false; } } return true; } function openImgWin(url,windowname) { imgWin = window.open(url,windowname,'width=640,height=480,innerWidth=640,innerHeight=480,top=0,left=0,screenX=0,screenY=0,scrollbars=yes,resizable=yes,toolbar=yes,status=yes'); imgWin.focus(); } function openVideoWin(url,windowname,videoTitle) { // get same style sheets as current page var styles = document.styleSheets; var numberOfStyleSheets = styles.length; var cssLinks = ""; for (var n = 0; n < numberOfStyleSheets; n++) { cssLinks += ''; } // find the title of the article which is placed into a hidden input in a form var title = ""; var form = document.forms["titleForm"]; if (form != null) { var item = form.elements["titleInput"]; if (item != null) { title = item.value; } } // open a blank window imgWin = window.open("",windowname,'width=640,height=480,innerWidth=640,innerHeight=480,top=0,left=0,screenX=0,screenY=0,scrollbars=yes,resizable=yes,toolbar=yes,status=yes'); imgWin.focus(); // replace with the follwing html var markup = '' + '' + cssLinks + '' + '' + '' + '' + '' + '' + '' + '' + '

'; imgWin.document.open('text/html','replace'); imgWin.document.write(markup); imgWin.document.close(); } /* * Called from the serach form * to delete an item from the picker list. */ function searchFormWithinItemDelete(jid) { var jpickerList= document.getElementById("jpickerList"); var item = document.getElementById("restrictBlock_" + jid); // Check if the item is present if(item == null) { return false; } jpickerList.removeChild(item); return searchFormWithinUpdateVisibility(document); } /* * Returns the number true if restricitions exist */ function searchFormHasNoResults(docRef) { var items = docRef.getElementsByTagName("div"); for(var i = 0; i < items.length; i++) { var id = items.item(i).getAttribute("id"); if(id != null && id.indexOf("restrictBlock_") == 0) { return false; } } return true; } function searchFormWithinUpdateVisibility(docRef) { if(searchFormHasNoResults(docRef)) { searchFormWithinMode(false, docRef); } else { searchFormWithinMode(true, docRef); } return false; } /* * Called from the serach form * to change the within mode. */ function searchFormWithinMode(mode, docRef) { var jpickerWithin = docRef.getElementById("jpickerWithin"); var searchDefaultWithin = docRef.getElementById("searchDefaultWithin"); if (mode) { searchDefaultWithin.style.display = "none"; jpickerWithin.style.display = "block"; } else { searchDefaultWithin.style.display = "block"; jpickerWithin.style.display = "none"; } } function searchFormAddRestriction(jid,title,docRef) { var jpickerList= docRef.getElementById("jpickerList"); var item = docRef.getElementById("restrictBlock_" + jid); // Check if the item is present if(item != null) { return false; } // Add a new restriction var html = searchFormCreateRestriction(jid,title); jpickerList.insertAdjacentHTML("beforeEnd",html); searchFormWithinMode(true,docRef); return false; } /* * Creates the HTML for the chosen journal */ function searchFormCreateRestriction(jid,title) { var html = "
"; html = html + ""; html = html + ""; html = html + ""; html = html + ""; html = html + " - "+ title +""; html = html + " (delete)"; html = html + "
"; return html; } function doAllPeriodicalSearch() { var items = document.getElementsByTagName("div"); var jpickerList= document.getElementById("jpickerList"); for(var i = 0; i < items.length; i++) { var item = items.item(i); var id = item.getAttribute("id"); if(id != null && id.indexOf("restrictBlock_") == 0) { jpickerList.removeChild(item); } } searchFormWithinMode(false, document); return false; } function doSaveSearch(uri_) { var form = document.forms["resultForm"]; var saveSearchWindow = window.open('about:blank','savedWin','width=600,height=350,innerWidth=450,innerHeight=350,top=0,left=0,screenX=0,screenY=0,scrollbars=yes,resizable=yes,toolbar=yes,status=yes'); var oldTarget = form.target; var oldAction = form.action; form.action = uri_; form.target = 'savedWin'; form.submit(); if (browserHostOS.indexOf("MAC") == -1) { form.target = oldTarget; form.action = oldAction; } saveSearchWindow.focus(); } function doEditSearch(uri_) { var form = document.forms["resultForm"]; form.action = uri_; form.submit(); return false; } var njumps = 0; function doViewMultiplAbstracts(uri_) { // Only do the comand if something is checked. var form = document.forms["resultForm"]; var items = form.elements; for(var i = 0; i < items.length; i++) { var item = items.item(i) id = item.getAttribute("name"); if(id == "article_id" && item.checked) { form.action = uri_; form.submit(); return false; } } njumps = 0; return false; } function doJump() { njumps++; } function backToResultList() { var nj = -njumps - 1; njumps = 0; history.go(nj); } function doComboBoxFire(form_,field_,trigger_) { var form = document.forms[form_]; var orginal = form.elements[field_]; var newVal = trigger_.value; if (orginal.value != newVal) { orginal.value = newVal; form.submit(); } return false; } function doSortComboBoxFire(form_,field_,trigger_) { var form = document.forms[form_]; var orginal = form.elements[field_]; var newVal = trigger_.value; if (orginal.value != newVal) { orginal.value = newVal; form.elements["search_reqfirst"].value = 1; form.submit(); } return false; } function doSearchPage(start_) { var form = document.forms["resultForm"]; form.elements["search_reqfirst"].value = start_; form.submit(); return false; } function doSingleSearch(mode_) { var form = document.forms["resultForm"]; if (mode_ == "medline") { form.elements["search_mode"].value = "medline"; } else { form.elements["search_mode"].value = "journal"; form.elements["search_medline"].value = "no"; } form.elements["search_reqfirst"].value = "1"; form.submit(); return false; } function openArticle(uri_,target_) { var form = document.forms["resultForm"]; var oldTarget = form.target; var oldAction = form.action; form.action = uri_; form.target = target_; form.submit(); if (browserHostOS.indexOf("MAC") == -1) { form.target = oldTarget; // Note: These lines interfered with MAC IE5 form.action = oldAction; } return false; } function doAddTOCAlert(uri_) { //var form = document.forms["resultForm"]; //form.action = uri_; //form.submit(); var windowOptions = "width=650,height=450,innerWidth=600,innerHeight=400,top=0,left=50,screenX=0,screenY=0,scrollbars=yes,resizable=yes,toolbar=yes,status=yes"; addtocwin = window.open(uri_,"AddTOCAlert",windowOptions); return false; } function doVolumeList(uri_) { var form = document.forms["resultForm"]; form.action = uri_; form.submit(); return false; } function doIssueMove(uri_,key_) { var form = document.forms["resultForm"]; form.elements["issue_key"].value = key_; form.action = uri_; form.submit(); return false; } function checkTermsAndFields(formname,fieldname) { var form=eval('document.'+formname); var field=eval('document.'+formname+'.'+fieldname); if (field.checked != true) { window.alert('Please read and agree to the registered user agreement before proceeding.'); return false; } form.submit(); } /* * formName = the name of the form (string) * action = where the for is to be submitted */ function genericSubmitForm(formName, action) { var form = document.forms[formName]; form.action=action; form.submit(); return false; } /* * checkBrowserCompliance - check the brower compliance. * Phoenix site is optimized for IE 5.0, Netscape 6.2 and higher */ function checkBrowserCompliance() { var UserAgent = navigator.userAgent; var browserName = navigator.appName; var MSIEVersion; var NetscapeVersion; if (browserName == "Microsoft Internet Explorer"){ var MSIEVersion = UserAgent.substring(30,33); } if ( (browserName == "Microsoft Internet Explorer") && (MSIEVersion < 5.0)){ browserCompliantMessage() } if (browserName == "Netscape") { var NetscapeVersion = getNSBrowserVersion(UserAgent); } if ((browserName == "Netscape") && (NetscapeVersion < 7.0)){ browserCompliantMessage() } if ( (browserName != "Netscape") && (browserName != "Microsoft Internet Explorer") ){ browserCompliantMessage() } } /* * getNSBrowserVersion - check the netscape browser version * This routine will fail if a new version of Netscape comes out with a * totally different UserAgent structure. * */ function getNSBrowserVersion(UserAgent) { var ver=UserAgent.indexOf('Netscape/') var ver6=UserAgent.indexOf('Netscape6/') if (ver > 0){ nsversion = UserAgent.substring(ver+9,ver+12); }else if (ver6 > 0){ nsversion = UserAgent.substring(ver6+10,ver6+14); } else{ // At this stage we consider that the browser is of version 5 or a lower version nsversion = 0 } return nsversion; } /* * browserCompliantMessage * Show the pop-up window for Browser Compliance. * */ function browserCompliantMessage() { // var url = "/webfiles/browserCompliance.html"; var url = "/misc/browsersupport"; var windowOptions = "width=500,height=450,innerWidth=450,innerHeight=400,top=0,left=50,screenX=0,screenY=0,scrollbars=yes,resizable=yes,toolbar=yes,status=yes"; browserCompatbilityWin= window.open(url,"BrowserCompliance",windowOptions); } function ecommerceCompliantMessage() { var url = "/misc/ecommercesupport"; var windowOptions = "width=500,height=450,innerWidth=450,innerHeight=400,top=0,left=50,screenX=0,screenY=0,scrollbars=yes,resizable=yes,toolbar=yes,status=yes"; browserCompatbilityWin= window.open(url,"EcommerceCompliance",windowOptions); } /* * id: The author in the form lastname_initials * description: the author display string */ function authorSearchSubmitForm(formName, id, description) { var msForm = document.forms[formName]; msForm.elements['restrictterm_author'].value = id; msForm.elements['restrictdesc_author'].value = description; msForm.submit(); return false; } /* * uri: the uri to submit the form to * */ function doLogout(uri) { var form = document.forms['loginForm']; form.elements['login'].value = ""; form.elements['logout'].value = "true"; if ((i = uri.indexOf('user/register')) > -1) { form.action=uri.substring(0,i); } form.submit(); return false; } //openEcommerceWin('/ecommerce/buy?command=addPPV&article=PIIS0895706103009695'); function addSubs(baseurl,entrypoint) { var url = baseurl + '/ecommerce/buy?command=addSubscription'; var list = ''; var form = document.forms["subscribe1"]; var items = form.elements; for(var i = 0; i < items.length; i++) { var item = items.item(i) type = item.getAttribute("type"); if(type == "checkbox" && item.checked) { list = list + '&product=' + item.getAttribute("name"); } } if (list == '') alert ('Please select journal title(s) to subscribe'); else { openEcommerceWin(url+list+"&entrypoint="+entrypoint); } } /* * uri: the uri to submit the form to * */ function openSearchArticle(uri) { var form = document.forms['resultsListTop']; form.action = uri; form.submit(); return false; } function registerNow(formName, uri) { var form = document.forms[formName]; blankField(form, 'login'); blankField(form, 'password'); blankField(form, 'username'); return genericSubmitForm(formName, uri); } function blankField(form, fieldName) { if (form != null) { var field = form.elements[fieldName]; if (field != null) { field.value = ''; } } } function redirect(url) { if (document.images) { location.replace(url); } else { location.href = url; } } function verisignPopUp(url) { sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=725,height=450'); self.name = "mainWin"; } function limitAmountOfTextInFeedbackTextArea(field, maxlimit) { if (field.value.length > maxlimit) { field.value = field.value.substring(0, maxlimit); alert("The maximum number of characters that can be entered in this field is " + maxlimit); } // alert(field.value); }