/*----------------------------------------------------------------------------- | | | widget.js | | | | Think Computer Corporation | | ThinkLink Tag Widget JavaScript Library | | | | Copyright (C) 2009-2014 Think Computer Corporation. All Rights Reserved. | | | -----------------------------------------------------------------------------*/ var shared = 'https://www.thinklink.com/shared/'; var handler = shared + 'javascript/handler.js'; function ID(id) { return document.getElementById(id) } function showID(id) { if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById(id).style.display = 'block'; } else { if (document.layers) { // Netscape 4 document.id.display = 'block'; } else { // IE 4 document.all.id.style.display = 'block'; } } } function hideID(id) { if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById(id).style.display = 'none'; } else { if (document.layers) { // Netscape 4 document.id.display = 'none'; } else { // IE 4 document.all.id.style.display = 'none'; } } } function hideIDs(prefix, count, start) { for (var i = start; i < start + count; i++) { hideID(prefix + i); } } function showTR(id) { if (document.getElementById) { // DOM3 = IE5, NS6; IE7 doesn't know what a table row is. document.getElementById(id).style.display = (navigator.appName == "Microsoft Internet Explorer" ? 'block' : 'table-row'); } else { if (document.layers) { // Netscape 4 document.id.display = 'table-row'; } else { // IE 4 document.all.id.style.display = 'table-row'; } } } function hideTR(id) { if (document.getElementById) { // DOM3 = IE5, NS6 if (document.getElementById(id)) document.getElementById(id).style.display = 'none'; } else { if (document.layers) { // Netscape 4 if (document.id) document.id.display = 'none'; } else { // IE 4 if (document.all.id) document.all.id.style.display = 'none'; } } } // Tags function digestOrganization(box, field) { if (document.forms['tags'].elements[field].value) document.forms['tags'].elements[field].value = ''; } function tagTypeChange(box, index) { if (box.options[box.selectedIndex].text == 'Text') { hideID('choices' + index); hideID('tag' + index); showID('size' + index); } else if (box.options[box.selectedIndex].text == 'Pick One' || box.options[box.selectedIndex].text == 'Pick Several') { hideID('size' + index); hideID('tag' + index); showID('choices' + index); } else if (box.options[box.selectedIndex].text == 'ThinkLink Data') { hideID('size' + index); hideID('choices' + index); showID('tag' + index); } else { hideID('choices' + index); hideID('size' + index); } } function showTagRow(index) { hideID('exclude' + index); showID('type' + index); hideID('showTagRow' + index); showID('hideTagRow' + index); } function hideTagRow(index) { hideID('type' + index); showID('exclude' + index); hideID('hideTagRow' + index); showID('showTagRow' + index); } function preventSubmit(e) { e = e || event; return (e.keyCode || event.which || event.charCode || 0) !== 13; } function selectTag(data, li, input, autoPost) { var display = data.value.replace('\\', ''); // Check for duplicates if (ID('tags[0]') != undefined) { var numberTags = ID('numberTags').value; for (i = 0; i < numberTags; i++) { if (ID('tags[' + i + ']').value == data.tagid) { alert('This item has already been tagged with ' + display + '.'); return; } } } var o = '
| '; o += '' + display.replace(' ', ' ') + ' | '; o += '