/** * Display the form hint for the given field type. * Returns true if the hint was found and displayed else false. */ function showFormHint(type, evt, panelName, extra) { var event = evt || window.event; $("resourceMessage").innerHTML=""; //Challenge if (type == "ChallengeSummary") { $("resourceMessage").insert("(compulsory) - Enter a new Key Challenge summary. This will form the Key Challenge title displayed in lists."); } else if (type == "ChallengeTheme") { $("resourceMessage").insert("(compulsory) - Select at least one Theme associated to this Key Challenge. These are used to help cluster Key Challenges around Themes and also provide recommendations based on Theme matching. You can enter more than one."); } else if (type == "ChallengeDesc") { $("resourceMessage").insert("(optional) - Enter a longer description of the Key Challenge"); } else if (type == "ChallengeTag") { $("resourceMessage").insert("(optional) - Tags associated to this Key Challenge. You can enter more than one in a comma separated list."); } else if (type == "ChallengeTagAdded") { $("resourceMessage").insert("This is a list of tags you have added to this Key Challenge. Tick the tags in the list if you wish to delete them."); } else if (type == "ChallengeReason") { $("resourceMessage").insert("Describe why you think this Key Challenge is relevant to: "+extra); } else if (type == "Challenges") { $("resourceMessage").insert("Select the Key Challenges that you wish to relate to: "+extra); // Issues } else if (type == "IssueSummary") { $("resourceMessage").insert("(compulsory) - Enter a new Issue summary. This will form the Issue title displayed in lists."); } else if (type == "IssueDesc") { $("resourceMessage").insert("(optional) - Enter a longer description of the Issue"); } else if (type == "IssueChallenges") { $("resourceMessage").insert("(optional) - Select one or more Key Challenges that this Issue relates to."); } else if (type == "IssueTheme") { $("resourceMessage").insert("(compulsory) - Select at least one Theme associated to this Issue. These are used to help cluster Issues around Themes and also provide recommendations based on Theme matching. You can enter more than one."); } else if (type == "IssueTag") { $("resourceMessage").insert("(optional) - Tags associated to this Issue. You can enter more than one in a comma separated list"); } else if (type == "IssueTagAdded") { $("resourceMessage").insert("This is a list of tags you have added to this Issue. Tick the tags in the list if you wish to delete them."); } else if (type == "IssueReason") { $("resourceMessage").insert("(optional) - Describe why you think this Issue is relevant to: "+extra); } else if (type == "IssueOtherChallenge") { $("resourceMessage").insert("(optional) - Select any other Key Challenges that you want to relate to this Issue"); } else if (type == "IssueResource") { $("resourceMessage").insert("(optional) - Add any Publications, website, or images etc.. that form part of or support this Issue. You can enter more than one."); // Solutions } else if (type == "SolutionSummary") { $("resourceMessage").insert("(compulsory) - Enter a new Idea summary. This will form the item title."); } else if (type == "SolutionTheme") { $("resourceMessage").insert("(compulsory) - Select at least one Theme associated to this Idean. These are used to help cluster Ideas around Themes and also provide recommendations based on Theme matching. You can enter more than one."); } else if (type == "SolutionPro") { $("resourceMessage").insert("Enter a piece of supporting evidence for the above Idea. Add a summary of the evidence, and then if desired a fuller description and/or a url for a website that contributes to/is the evidence."); } else if (type == "SolutionCon") { $("resourceMessage").insert("Enter a piece of opposing evidence for the above Idea. Add a summary of the evidence, and then if desired a fuller description and/or a url for a website that contributes to/is the evidence."); } else if (type == "SolutionDesc") { $("resourceMessage").insert("(optional) - Enter a longer description of the Idea"); } else if (type == "SolutionTag") { $("resourceMessage").insert("(optional) - Tags associated to this Idea. You can enter more than one in a comma separated list."); } else if (type == "SolutionTagAdded") { $("resourceMessage").insert("This is a list of tags you have added to this Idea. Tick the tags in the list if you wish to delete them."); } else if (type == "SolutionReason") { $("resourceMessage").insert("(optional) - Describe why you think this Idea is relevant to: "+extra); // Claims } else if (type == "ClaimSummary") { $("resourceMessage").insert("(compulsory) - Enter a new Fact summary. This will be the Fact title displayed in lists."); } else if (type == "ClaimTheme") { $("resourceMessage").insert("(compulsory) - Select at least one Theme associated to this Fact. These are used to help cluster Facts around Themes and also provide recommendations based on Theme matching. You can enter more than one."); } else if (type == "ClaimDesc") { $("resourceMessage").insert("(optional) - Enter a longer description of the Fact"); } else if (type == "ClaimReason") { $("resourceMessage").insert("(optional) - Describe why you think this Fact is relevant to: "+extra); } else if (type == "ClaimTag") { $("resourceMessage").insert("(optional) - Tags associated to this Fact. You can enter more than one in a comma separated list."); } else if (type == "ClaimTagAdded") { $("resourceMessage").insert("This is a list of tags you have added to this Fact. Tick the tags in the list if you wish to delete them."); // Evidence } else if (type == "EvidenceSummary") { $("resourceMessage").insert("(compulsory) - Enter a summary of the Argument. This will be the Argument title displayed in lists."); } else if (type == "EvidenceDesc") { $("resourceMessage").insert("(optional) - Enter a longer description of the Argument"); } else if (type == "EvidenceWebsites") { $("resourceMessage").insert("(optional) - Add any Publications, website, or images etc.. that form part of or support this Argument. You can enter more than one."); } else if (type == "EvidenceTheme") { $("resourceMessage").insert("(compulsory) - Select at least one Theme associated with this evidence. These are used to help cluster Arguments around Themes and also provide recommendations based on Theme matching. You can enter more than one."); } else if (type == "EvidenceType") { $("resourceMessage").insert("(compulsory) - Select what sort of Argument you wish to submit - the default is Argument, but if you can be more specific that would be helpful."); } else if (type == "EvidenceTag") { $("resourceMessage").insert("(optional) - Tags associated to this Argument. You can enter more than one in a comma separated list."); } else if (type == "EvidenceTagAdded") { $("resourceMessage").insert("This is a list of tags you have added to this Argument. Tick the tags in the list if you wish to delete them."); } else if (type == "EvidenceReason") { $("resourceMessage").insert("(optional) - Describe why you think this Argument is relevant to: "+extra); } else if (type == "EvidenceProjects") { $("resourceMessage").insert("(optional) - Add any Projects assoicated with this Argument. You can enter more than one."); } else if (type == "EvidenceOrganizations") { $("resourceMessage").insert("(optional) - Add any Organizations assoicated with this Argument. You can enter more than one."); // Resource } else if (type == "Resources") { $("resourceMessage").insert("(optional) - Enter any web resources supporting your Argument"); } else if (type == "RemoteEvidenceResources") { $("resourceMessage").insert("(optional) - Enter any web Resources supporting your Argument. The url of the site you are currently on should have been automatically entered for you, as well as any selected text."); } else if (type == "OrgResources") { $("resourceMessage").insert("(optional) - Please add the website for this organization or project and any other supporting web resources you feel will be useful to people viewing this item. You can enter more than one."); } else if (type == "ResourceClip") { $("resourceMessage").insert("This is the text you have selected on the website"); } else if (type == "ResourceType") { $("resourceMessage").insert("(compulsory) - Select what sort of Resource you wish to submit - the default is Web Resource, which covers website and any urls which are not Publications."); } else if (type == "ResourceTheme") { $("resourceMessage").insert("(compulsory) - Select at least one Theme associated with this Resource. These are used to help cluster Resources around Themes and also provide recommendations based on Theme matching. You can enter more than one."); } else if (type == "ResourceTitle") { $("resourceMessage").insert("(compulsory) - Enter a title for the Resource. If you do not complete the title, the url will be used, which may not be ideal. Bear in mind, that this title will be used in all listings of this Resource

You can use the arrow button at the end of the URL field to try and fetch the title from the website page automatically if you wish."); } else if (type == "ResourceURL") { $("resourceMessage").insert("(compulsory) - Enter the url of the Resource"); } else if (type == "ResourceDOI") { $("resourceMessage").insert("(optional) - Enter the digital object identifier (DOI) for the Publication you are adding, if known."); } else if (type == "ResourceTag") { $("resourceMessage").insert("(optional) - Tags associated to this Resource. You can enter more than one in a comma separated list."); } else if (type == "ResourceTagAdded") { $("resourceMessage").insert("This is a list of tags you have added to this Resource. Tick the tags in the list if you wish to delete them."); } else if (type == "ResourceReason") { $("resourceMessage").insert("(optional) - Describe why you think this Resource is relevant to: "+extra); } else if (type == "ResourceProjects") { $("resourceMessage").insert("(optional) - Add any Projects linked to this Resource. You can enter more than one."+extra); } else if (type == "ResourceOrganizations") { $("resourceMessage").insert("(optional) - Add any Organizations linked to this Resource. You can enter more than one."+extra); // organization / project } else if (type == "OrgType") { $("resourceMessage").insert("(compulsory) - Select if you are entering information about an Organization or Project"); } else if (type == "OrgTown") { $("resourceMessage").insert("(optional) - Town or City where the Organization or Project is primarily based. For the Organizations/Projects to appear on the Map you must enter at least the city/town and the country."); } else if (type == "OrgCountry") { $("resourceMessage").insert("(optional) - Geographical country where the Organization or Project is primarily based."); } else if (type == "OrgTheme") { $("resourceMessage").insert("(compulsory) - Select at least one Theme of interest to your Organizations/Projects. These are used to help cluster Organization and Project and also provide recommendations based on Theme matching. You can enter more than one."); } else if (type == "OrgName") { $("resourceMessage").insert("(compulsory) - The Organization or Project name."); } else if (type == "OrgPartner") { $("resourceMessage").insert("(optional) - Organizations or Projects with which your Organization or Project has a major partnership with in the community. You can enter more than one."); } else if (type == "OrgDesc") { $("resourceMessage").insert("(optional) - A longer description about the Organization or Project"); } else if (type == "OrgWebsites") { $("resourceMessage").insert("(optional) - Please add the website for this Organization or Project and any other supporting Resources you feel will be useful to people viewing this item. You can enter more than one."); } else if (type == "OrgDates") { $("resourceMessage").insert("(optional) - Date formats allowed e.g.: \'14 May 2008\' or \'14-05-2008\'"); } else if (type == "OrgChallenges") { $("resourceMessage").insert("(optional) - Select any Key Challenges you feel you would like to associate with this Organizations or Projects"); } else if (type == "OrgProjects") { $("resourceMessage").insert("(optional) - Add any Projects which this Organization direclty manages. You can enter more than one."); } else if (type == "OrgTag") { $("resourceMessage").insert("(optional) - Tags associated to this Organization/Project You can enter more than one in a comma separated list."); } else if (type == "OrgTagAdded") { $("resourceMessage").insert("This is a list of tags you have added to this Organization/Project Tick the tags in the list if you wish to delete them."); } else if (type == "OrgReason") { $("resourceMessage").insert("(optional) - Describe why you think this Organization/Project is relevant to: "+extra); } else if (type == "OrgProject") { $("resourceMessage").insert("(optional) - Add any associated Projects. You can enter more than one."); } else if (type == "OrgOrg") { $("resourceMessage").insert("(optional) - Add any associated Organizations. You can enter more than one."); // Comments } else if (type == "CommentTag") { $("resourceMessage").insert("(optional) - Tags associated to this Open Comment You can enter more than one in a comma separated list."); } else if (type == "CommentTagsAdded") { $("resourceMessage").insert("This is a list of tags you have added to this Open Comment. Tick the tags in the list if you wish to delete them."); } else if (type == "CommentDesc") { $("resourceMessage").insert("(compulsory) - Enter your Open Comment text here. This can be as long as you like but cannot be empty. If using the Formatter, some text is still required, i.e. it can not just be a picture or a movie. The Comment title is created using up to the first 100 characters entered here."); // REMOTE FORMS } else if (type == "RemoteEvidenceSolution") { $("resourceMessage").insert("Enter your supporting Argument for the Idea. Add a summary of the Argument, and then if desired a fuller description."); } else if (type == "RemoteEvidenceClaim") { $("resourceMessage").insert("Enter your supporting Argument for the Fact. Add a summary of the Argument, and then if desired a fuller description."); } else if (type == "RemoteEvidenceDesc") { $("resourceMessage").insert("Enter a longer description of the Argument (optional)"); } else if (type == "RemoteEvidenceType") { $("resourceMessage").insert("Select what sort of Argument you wish to submit - the default is Argument, but if you can be more specific that would be helpful."); // QUICK FORMS } else if (type == "ThemeQuickP") { $("resourceMessage").insert("Select one or more Themes to associate to the Issue, Idea, Argument and any Resources you are adding. These are used to help cluster data and also provide recommendations based on Theme matching. You can enter more than one."); } else if (type == "ThemeQuickR") { $("resourceMessage").insert("Select one or more Themes to associate to the Issue, Fact, Argument and any Resources you are adding. These are used to help cluster data and also provide recommendations based on Theme matching. You can enter more than one."); } else if (type == "TagQuickP") { $("resourceMessage").insert("Type in one or more tags to be associated with the Issue, Idea, Argument and any Resources you are adding - comma separated (optional)"); } else if (type == "TagQuickR") { $("resourceMessage").insert("Type in one or more tags to be associated with the Issue, Fact, Argument and any Resources you are adding - comma separated (optional)"); } else if (type == "IssueQuick") { $("resourceMessage").insert("Enter a new Issue summary. This will form the item title."); } else if (type == "SolutionQuick") { $("resourceMessage").insert("Enter a new Idea summary. This will form the item title."); } else if (type == "ClaimQuick") { $("resourceMessage").insert("Enter a new Fact summary. This will form the item title."); } else if (type == "EvidenceQuickP") { $("resourceMessage").insert("Enter your Argument for the Idea. Add a summary of the Argument, and then if desired a fuller description."); } else if (type == "EvidenceQuickR") { $("resourceMessage").insert("Enter your Argument for the Fact. Add a summary of the Argument, and then if desired a fuller description."); } else if (type == "EvidenceTypeQuick") { $("resourceMessage").insert("Select what sort of Argument you wish to submit - the default is Argument, but if you can be more specific that would be helpful."); } else if (type == "OrgQuickP") { $("resourceMessage").insert("Select an Organization or Project to associated with the Issue, Idea and Argument you are entering. If it is not listed, please add it. (optional)"); } else if (type == "OrgQuickR") { $("resourceMessage").insert("Select an Organization or Project to associated with the Issue, Fact and Argument you are entering. If it is not listed, please add it. (optional)"); // OTHER } else if (type == "CompendiumTheme") { $("resourceMessage").insert("(compulsory) - Select at least one Theme to associate with all the data that is being imported. You can enter more than one."); } else if (type == "BibtexTheme") { $("resourceMessage").insert("(compulsory) - Select at least one Theme to associate with all the publications that are being imported. You can enter more than one."); } else { return false; } showHint(event, panelName, 10, -10); return true; } /** * Display the quick form navigation hint for the given field type. * Returns true if the hint was found and displayed else false. */ function showQuickFormNavHint(type, evt, panelName, extra) { var event = evt || window.event; $("resourceMessage").innerHTML=""; if (type == "IssueQuickForm") { $('resourceMessage').insert("Click to view the Issue section of the form"); } else if (type == "SolutionQuickForm") { $('resourceMessage').insert("Click to view the Idea section of the form"); } else if (type == "ClaimQuickForm") { $('resourceMessage').insert("Click to view the Fact section of the form"); } else if (type == "EvidenceQuickForm") { $('resourceMessage').insert("Click to view the Argument section of the form"); } else if (type == "ResourceQuickForm") { $('resourceMessage').insert("Click to view the Resources section of the form"); } else if (type == "ThemeQuickForm") { $('resourceMessage').insert("Click to view the Themes and Tags section of the form"); } else { return false; } showHint(event, panelName, 10, -10); return true; } /** * Remove the given multiple for the given type at the given index */ function removeMultiple(key, i) { var answer = confirm("Are you sure you want to remove this item? This action cannot be undone!"); if(answer){ if ($(key+'form') && $(key+'field'+i)) { if( $(key+'form').childElements()[0].nodeName.toUpperCase() != "HR"){ $(key+'field'+i).remove(); try { $(key+'hr'+ i).remove(); } catch (err) { // do nowt } if($(key+'form').childElements()[0] && $(key+'form').childElements()[0].nodeName.toUpperCase() == "HR"){ $(key+'form').childElements()[0].remove(); } } } } return; } /** * Add another resource block */ function addResource(noResources) { if($('resourceform').childElements().length != 0){ $('resourceform').insert('
'); } var newitem = '
'; newitem += ''; newitem += ''; newitem += '
'; newitem += ''; newitem += '
'; newitem += '
Select Existing Resource
'; newitem += '
'; newitem += '
'; newitem += ''; newitem += '
'; newitem += '
'; newitem += '
'; newitem += '
'; newitem += ''; newitem += '
'; newitem += '
'; newitem += ''; newitem += '
'; newitem += ''; newitem += 'remove
'; newitem += '
'; newitem += '
'; $('resourceform').insert(newitem); noResources++; return noResources; } function addResourceEvents(targetname) { for (var i=0; i < noResources; i++) { if ($('resourceremovebutton-'+i)) { Event.observe($('resourceremovebutton-'+i),"click", function(){ validateResourceNext(targetname); }); Event.stopObserving('resourceremovebutton-'+i,'keyup'); Event.observe($('resourceremovebutton-'+i),"keyup", function(){ validateResourceNext(targetname); }); } if ($('resourceurl-'+i)) { Event.stopObserving('resourceurl-'+i,'input'); Event.stopObserving('resourceurl-'+i,'change'); Event.stopObserving('resourceurl-'+i,'keyup'); Event.observe($('resourceurl-'+i),"input", function(){ validateResourceNext(targetname); }); Event.observe($('resourceurl-'+i),"change", function(){ validateResourceNext(targetname); }); Event.observe($('resourceurl-'+i),"keyup", function(){ validateResourceNext(targetname); }); } if ($('resourcetitle-'+i)) { Event.stopObserving('resourcetitle-'+i,'input'); Event.stopObserving('resourcetitle-'+i,'change'); Event.stopObserving('resourcetitle-'+i,'keyup'); Event.observe($('resourcetitle-'+i),"input", function(){ validateResourceNext(targetname); }); Event.observe($('resourcetitle-'+i),"change", function(){ validateResourceNext(targetname); }); Event.observe($('resourcetitle-'+i),"keyup", function(){ validateResourceNext(targetname); }); } } } function validateResourceNext(targetname) { var allBlank = true; for (var i=0; i < noResources; i++) { if ($('resourceurl-'+i)) { if ( $('resourceurl-'+i).value.trim() != '' && $('resourceurl-'+i).value.trim() != 'http://' && $('resourcetitle-'+i).value.trim() != '') { allBlank = false; } } } if ($(targetname)) { if (!allBlank) { $(targetname).removeAttribute('disabled'); } else { $(targetname).setAttribute('disabled', 'true'); } } } function validateSimpleNext(obj, targetname) { if (obj.value.trim() != '') { $(targetname).removeAttribute('disabled'); } else { $(targetname).setAttribute('disabled', 'true'); } } function openResourceSelector(num) { loadDialog('selector', URL_ROOT+"ui/popups/selector.php?num="+num+"&handler=addSelectedResource&filternodetypes="+encodeURIComponent(RESOURCE_TYPES_STR), 420, 730); } /** * Add another related item block */ function addSeeAlso(noRelated) { if($('relatedform')) { if ($('relatedform').childElements().length != 0){ $('relatedform').insert('
'); } var newitem = '
'; newitem += ''; newitem += ''; newitem += '
'; newitem += ''; newitem += 'Select Existing Resource'; newitem += '
'; newitem += '
'; $('relatedform').insert(newitem); noRelated++; } return noRelated; } function openRelatedItemSelector(num) { loadDialog('selector', URL_ROOT+"ui/popups/selector.php?num="+num+"&handler=addSelectedRelatedItem&filternodetypes="+encodeURIComponent(BASE_TYPES_STR)+","+encodeURIComponent(EVIDENCE_TYPES_STR)+","+encodeURIComponent(RESOURCE_TYPES_STR), 420, 730); } //add another theme field function addTheme(noThemes) { if($('themeform').childElements().length != 0){ $('themeform').insert('
'); } var newitem = '
'; newitem += '
'; newitem += '
remove
'; newitem += '
'; $('themeform').insert(newitem); noThemes++; return noThemes; } //add another url field function addURL(noURLs){ if($('urlform').childElements().length != 0){ $('urlform').insert('
'); } var newitem = '
'; newitem += ''; newitem += ''; newitem += ''; newitem += ''; newitem += ''; newitem += '
'; $('urlform').insert(newitem); noURLs++; return noURLs; } // add a Project function addProject(noProjects, nodename, nodeid){ // Add the new item into the current box if ($('projectfield'+noProjects)) { $('projectfield'+noProjects).innerHTML = ""; } let newitem = ''; newitem += ''; newitem += 'remove'; $('projectfield'+noProjects).insert(newitem); // Add the new selector section noProjects++; let newselector = '
'; newselector += '
Add Existing Project
'; newselector += '
'; $('projectform').insert(newselector); return noProjects; } // remove a Project function removeProject(removeProjectNo){ let removed = false; if($('projectform').childElements().length != 1){ var parent = document.getElementById('projectform'); var child = document.getElementById('projectfield'+removeProjectNo); if (child) { parent.removeChild(child); } removed = true; } return removed; } // add an Organization function addOrganization(noOrganisations, nodename, nodeid){ // Add the new item into the current box if ($('orgfield'+noOrganisations)) { $('orgfield'+noOrganisations).innerHTML = ""; } let newitem = ''; newitem += ''; newitem += 'remove'; $('orgfield'+noOrganisations).insert(newitem); // Add the new selector section noOrganisations++; let newselector = '
'; newselector += '
Add Existing Organization
'; newselector += '
'; $('orgform').insert(newselector); return noOrganisations; } // remove an Organization function removeOrganization(removeOrgNo){ let removed = false; if($('orgform').childElements().length != 1){ var parent = document.getElementById('orgform'); var child = document.getElementById('orgfield'+removeOrgNo); if (child) { parent.removeChild(child); } removed = true; } return removed; } // add an Evidence item function addEvidence(noEvidence, nodename, nodeid){ // Add the new item into the current box if ($('evidencefield'+noEvidence)) { $('evidencefield'+noEvidence).innerHTML = ""; } let newitem = ''; newitem += ''; newitem += 'remove'; $('evidencefield'+noEvidence).insert(newitem); // Add the new selector section noEvidence++; let newselector = '
'; newselector += '
Add Existing Argument
'; newselector += '
'; $('evidenceform').insert(newselector); return noEvidence; } // remove an Evidence item function removeEvidence(removeEvidenceNo){ let removed = false; if($('evidenceform').childElements().length != 1){ var parent = document.getElementById('evidenceform'); var child = document.getElementById('evidencefield'+removeEvidenceNo); if (child) { parent.removeChild(child); } removed = true; } return removed; } //add a partner organization function addPartner(noPartners) { if($('partnerform').childElements().length != 0){ $('partnerform').insert('
'); } var newitem = '
'; newitem += ''; newitem += 'remove'; newitem += '
'; $('partnerform').insert(newitem); noPartners++; return noPartners; } function toggleChallenges() { if ( $("groupsdiv").style.display == "flex") { $("groupsdiv").style.display = "none"; $("groupsimg").innerHTML = 'Show '; } else { $("groupsdiv").style.display = "flex"; $("groupsimg").innerHTML = 'Hide '; } } function typeChangedResource(num) { var type = $('resource'+num+'menu').value; if (type == "Publication") { $('identifierdiv-'+num).style.display = ""; } else { $('identifierdiv-'+num).style.display = "none"; } } function typeChangedProject() { if ($('datediv')) { $('datediv').style.display = ""; } if ($('projectdiv')) { $('projectdiv').style.display = "none"; } } function typeChangedOrg() { if ($('startdate')) { $('startdate').value=""; } if ($('enddate')) { $('enddate').value=""; } if ($('datediv')) { $('datediv').style.display = "none"; } if ($('projectdiv')) { $('projectdiv').style.display = "block"; } } /** * Fetch the website title and description from the website page for the url passed. */ function autoCompleteWebsiteDetails() { var urlvalue = $('url').value; if (urlvalue == "" || urlvalue == "http://") { alert("You must enter a url first"); return; } var reqUrl = SERVICE_ROOT + "&method=autocompleteurldetails&url="+encodeURIComponent(urlvalue); new Ajax.Request(reqUrl, { method:'get', onSuccess: function(transport){ var json = transport.responseText.evalJSON(); if(json.error){ //alert(json.error[0].message); return; } $('title').value = json.url[0].title; } }); } /** * Fetch the website title and description from the website page for the url passed. */ function autoCompleteWebsiteDetailsMulti(num) { var urlvalue = $('resourceurl-'+num).value; if (urlvalue == "" || urlvalue == "http://") { alert("You must enter a url first"); return; } var reqUrl = SERVICE_ROOT + "&method=autocompleteurldetails&url="+encodeURIComponent(urlvalue); new Ajax.Request(reqUrl, { method:'get', onSuccess: function(transport){ var json = transport.responseText.evalJSON(); if(json.error){ //alert(json.error[0].message); return; } $('resourcetitle-'+num).value = json.url[0].title; } }); } /** * Hide all other steps apart from stepshow. */ function switchSteps(stepcount, stepshow) { for (var count=1; count<= stepcount; count++) { $('stepdiv'+count).style.display = "none"; } $('stepdiv'+stepshow).style.display = "block"; }