var isNav,isIE;var coll="";var styleObj="";var nameExistsMsg="The Name you entered already exists, please enter a valid name";var mustBeANmuberMsg="The Number of columns field must be a number";var emptyNameFieldMsg="The Name field cannot be empty";var emptyResTypeFieldMsg="The Resource Type field cannot be empty";var questionTextMsg="Question text cannot be empty";var filterTextMsg="Answer text cannot be empty";var emptyColumnFieldMsg="The Number of columns field cannot be empty";var numOfQueryPageColumns=10;var dbNameLength=500;var dbDescriptionLength=1000;var dbImageLength=120;var dbDataSheetLength=120;if(parseInt(navigator.appVersion)>=4){if(navigator.appName=="Netscape"){isNav=true}else{isIE=true;coll="all.";styleObj=".style"}}function resetContent(b,a){alert(a);b.value="";b.focus()}function notEmptyString(a){if(a.length<1){return false}return true}function getFTFromValue(b){idx=b.indexOf("_");var a;if(idx>-1){a=new String(b.substring(0,idx))}else{a=new String(b)}return a}function containsValue(b,c){var a=b.options.length;for(i=0;i<a;i++){if(b.options[i].value.indexOf("_")==-1){if(b.options[i].value==c){return i}}}return -1}function createMoveAndAddElements(e,g,h,f){var b=e.options.length-1;var a=f.length;var c=b-g;for(i=0;i<a;i++){e.options[e.options.length]=new Option("","",false,false)}var d=e.options.length-1;for(i=0;i<=c;i++){e.options[d].text=e.options[b].text;e.options[d].value=e.options[b].value;b--;d--}for(i=0;i<a;i++){e.options[g].text=h[f[i]].text;e.options[g].value=h[f[i]].value;g++}}function createAndAddElements(e,g,f,d){var c=d.selectedIndex;e.options[e.options.length]=new Option(d[c].text,d[c].value,false,false);var a=f.length;for(var b=0;b<a;b++){e.options[e.options.length]=new Option(g[f[b]].text,g[f[b]].value,false,false)}}function unassignFeatures(l,a,d){var f=new Array();var k=-1;if(d.selectedIndex!=-1){k=d.options[d.selectedIndex].value}len=l.options.length;var h=0;var g=0;var b=false;var e=false;while(h<len){if(l.options[h].selected){b=true;if(l.options[h].value.indexOf("_")==-1&&h<(len-1)){l.options[h].selected=false;h++;var c=getFTFromValue(l.options[h].value);while(h<len&&l.options[h].value.indexOf("_")>-1){if(c==k){a[a.options.length]=new Option(l.options[h].text,l.options[h].value,false,false)}l.options[h].selected=false;h++}}else{var c=getFTFromValue(l.options[h].value);if(c==k){a[a.options.length]=new Option(l.options[h].text,l.options[h].value,false,false)}l.options[h].selected=false;h++}}else{f[f.length]=new Option(l.options[h].text,l.options[h].value,false,false);h++}}rebuildList(l,f);if(!b){alert("Please select an item to assign or unassign.")}}function rebuildList(c,b){var a=c.options.length-1;while(a>=0){c.options[a--].selected=false}var a=c.options.length-1;while(a>=0){c.options[a--]=null}c.options.length=0;for(a=0;a<b.length;a++){c.options[a]=b[a];c.options[a].selected=false}}function assignFeatures(e,d,c){if(c.length<1){return}var a=c.options[c.selectedIndex].value;var f=new Array();getSelectedArray(d,f);var b=containsValue(e,a);if(b>-1){createMoveAndAddElements(e,b+1,d,f)}else{createAndAddElements(e,d,f,c)}deleteElements(f,d)}function buildAssignedFeatureList(d,b){i=d.options.length;var c="";var f=true;for(j=0;j<i;j++){var g=d.options[j].value.indexOf("_");if(g>-1){var a=d.options[j].value.length;var e=new String(d.options[j].value.substring(g+1,a));if(!f){c=c+","+e}else{f=false;c=e}d.options[j].selected=false}}b.value=c}function getSelectedArray(c,d){var a=c.options.length;var b=0;for(i=0;i<a;i++){isSelected=c.options[i].selected;if(isSelected){d[b++]=i;c.options[i].selected=false}}}function buildSelectedList(d,b){var a=d.options.length;var e=true;var c="";for(i=0;i<a;i++){isSelected=d.options[i].selected;if(isSelected){if(!e){c=c+","+d.options[i].value}else{e=false;c=d.options[i].value}}}b.value=c}function addToList(e,g,f){var c=0;var a=f.length;var b="";var d="";while(c<a){b=g.options[f[c]].text;d=g.options[f[c]].value;e.options[e.options.length]=new Option(b,d,false,false);c++}}function makeAssignments(a,c){var b=new Array();getSelectedArray(c,b);addToList(a,c,b);deleteElements(b,c)}function buildListSeqValues(c,a){i=c.options.length;var b="";var d=true;for(j=0;j<i;j++){if(!d){b=b+","+c.options[j].value}else{d=false;b=c.options[j].value}c.options[j].selected=false}a.value=b}function onlyOneSelected(b){var a=0;for(i=0;i<b.options.length;i++){isSelected=b.options[i].selected;if(isSelected){selIndex=i;a++;if(a>1){return false}}}return true}function moveItem(d,a){i=d.selectedIndex;if(i==-1){alert("You did not select an item to move. Please select one item and click the Move Up or Move Down button.");return}if(onlyOneSelected(d)){if(a&&selIndex==0){return}else{if(!a&&selIndex==d.length-1){return}}var f=d.options[selIndex].text;var c=d.options[selIndex].value;j=selIndex-1;if(!a){j=selIndex+1}var b=d.options[j].text;var e=d.options[j].value;d.options[selIndex].text=b;d.options[selIndex].value=e;d.options[j].text=f;d.options[j].value=c;d.options[selIndex].selected=false;d.options[j].selected=true}else{alert("Only one item can be selected to move up or move down.")}}function deleteSelectedItems(d,e){var c=d.options.length;for(var b=0;b<c;b++){var a=d.options[b].selected;if(a){if(confirm(e)){deleteItems(d);return true}else{return false}}}return false}function deleteSelectedItems1(d,e){var c=d.options.length;for(var b=0;b<c;b++){var a=d.options[b].selected;if(a){if(confirm(e)){deleteItems(d);return 1}return 0}}return -1}function deleteItems(d){var c=d.options.length;var e=new Array();var a=0;for(var b=0;b<c;b++){isSelected=d.options[b].selected;if(isSelected){e[a++]=b;d.options[b].selected=false}}deleteElements(e,d)}function deleteSelectedFromList(c){var e=false;var b=c.options.length;var d=new Array();var a=0;for(i=0;i<b;i++){isSelected=c.options[i].selected;if(isSelected){if(!e){e=true;if(!confirm("Do you want to delete all selected items?")){return false}}d[a++]=i;c.options[i].selected=false}}deleteElements(d,c);return true}function deleteFromList(e,c){var g=false;var d=e.options.length;var f=new Array();var b=0;var a=c.length;for(i=0;i<d;i++){isSelected=e.options[i].selected;if(isSelected){if(!g){g=true;if(!confirm("Do you want to delete all selected items?")){return}}f[b]=i;c[a+b++]=e.options[i].value;e.options[i].selected=false}}deleteElements(f,e)}function deleteFromListWithMsg(e,c,g){var h=false;var d=e.options.length;var f=new Array();var b=0;var a=c.length;for(i=0;i<d;i++){isSelected=e.options[i].selected;if(isSelected){if(!h){h=true;if(!confirm(g)){return}}f[b]=i;c[a+b++]=e.options[i].value;e.options[i].selected=false}}deleteElements(f,e)}function getSelectedListItems(c){var e=false;var b=c.options.length;var a=0;var d=new Array();for(i=0;i<b;i++){isSelected=c.options[i].selected;if(isSelected){if(!e){e=true;if(!confirm("Do you want to delete all selected items?")){break}}d[a++]=i;c.options[i].selected=false}}return d}function deleteElements(b,c){var a=b.length;while(a>0){c.options[b[a-1]]=null;a--}}function buildSelectValueList(c,a){var b="";if(c.options.length>0){b+=c.options[0].value;for(j=1;j<c.options.length;j++){b=b+a+c.options[j].value}}return b}function buildValueList(c,a){var b="";if(c.length>0){b=b+c[0]}for(i=1;i<c.length;i++){b=b+a+c[i]}return b}function isInteger(a){var b=new String(a);var c=b.indexOf("e");if(c>=0&&c<b.length-1){return false}c=b.indexOf("E");if(c>=0&&c<b.length-1){return false}c=b.indexOf(".");if(c>=0){return false}if(isNaN(a)){return false}var c=parseInt(a);return !isNaN(c)}function isFloat(a){if(isNaN(a)){return false}var b=parseFloat(a);return !isNaN(b)}function initQueryPageColumns(e,d,c){for(var b=0;b<c;b++){if(e.options.length>0){e.options[0]=null}}for(var a=0;a<numOfQueryPageColumns;a++){e[a]=new Option(a+1,a+1,false,false);if(d==a+1){e[a].selected=true}else{e[a].selected=false}}}function showPricingError(a){alert(a)}function removeLeadingAndTrailingBlanks(a){a.value=trim(a.value)}function trim(a){while(a.substring(0,1)==" "){a=a.substring(1,a.length)}while(a.substring(a.length-1,a.length)==" "){a=a.substring(0,a.length-1)}return a}function containsSubstring(b,a){if(b==null){return false}if(b.indexOf(a,0)==-1){return false}return true}function validateNameLength(a){return validateLength(a,dbNameLength)}function validateDescriptionLength(a){return validateLength(a,dbDescriptionLength)}function validateProductDescriptionLength(a){return validateLength(a,480)}function validateImageLength(a){return validateLength(a,dbImageLength)}function validateDataSheetLength(a){return validateLength(a,dbDataSheetLength)}function validateLength(b,a){if(b.length<=a){return true}else{return false}}function validateFloat(a){if(a>9999999999){return false}return true}function validateInteger(a){if(!isInteger(a)||(a>9999999999)){return false}return true}function containsElement(c,d){var b=c.options.length;for(var a=0;a<b;a++){if(c.options[a].text.toLowerCase()==d.toLowerCase()){return true}}return false}function getSelectedElements(e,d,f){var a=e.options.length;var b=0;var c;for(i=0;i<a;i++){isSelected=e.options[i].selected;if(isSelected){c=new Object();c.value=e.options[i].value;c.text=e.options[i].text;d[b]=c;f[b++]=i}}}function initializeListToNull(b){var a=b.options.length-1;while(a>=0){b.options[a--]=null}}function isWebpageFile(a){if(a==""){return false}var b=a.split(".");var c=b[b.length-1];c=c.toLowerCase();if(c==""||c=="jsp"||c=="jspf"||c=="html"||c=="htm"||c=="js"){return true}else{return false}}function getProtocol(){return window.location.protocol.replace(/:/g,"")}function matchLinkToProtocol(a){a=a.replace(/http[s]?/,getProtocol());if(a.indexOf(":8080")==-1&&a.indexOf(":8083")==-1){if(a.indexOf(":80")!=-1){a=a.replace(":80","")}}return a};
