//crunchinatorvariable_compressed
function fSelectionLength(oSelect){var iLength=0;with(oSelect){for(var i=0;i<options.length;i++)if(options[i].selected)iLength++;}return iLength;}function fParseData(sData,iMaxLength){fDebugPoint('fParseData','parsing string as array max length '+iMaxLength);var aLines=new Array();var aData=new Array();aLines=sData.split('\n');for(var i=0;i<aLines.length;i++){aData[i]=new Array();var sSnippet=aLines[i].split(',');if(sSnippet!='')aData[i]=sSnippet;}if(aData.length<2){aData[1]=new Array();aData[1]=aData[0];}if(iMaxLength!=null)aData=aData.slice(0,iMaxLength);return aData;}function fCacheList(oList){fDebugPoint('fCacheList','Caching list '+oList.name);var aOptions=new Array();aOptions[0]=new Array();aOptions[1]=new Array();aOptions[2]=new Array();var oBaseObj=oList.options?oList.options:oList;var iMaxLen=oBaseObj.length?oBaseObj.length:1;for(var i=0;i<iMaxLen;i++){var oItem=iMaxLen==1?oBaseObj:oBaseObj[i];aOptions[0][i]=oItem.value;aOptions[1][i]=oItem.getAttribute('selected');aOptions[2][i]=oItem.getAttribute('checked');}return aOptions;}function fRestoreList(oList,aCache,bHighlightNew){var oBaseObj=oList.options?oList.options:oList;var iMaxLen=oBaseObj.length?oBaseObj.length:1;var aNewItems=new Array();for(var i=0;i<iMaxLen;i++){var oItem=iMaxLen==1?oBaseObj:oBaseObj[i];if(aCache[0].indexOf(oItem.value)<0){aNewItems[aNewItems.length]=i;if(!bHighlightNew)continue;oItem.setAttribute('selected',true);oItem.setAttribute('checked',true);}else{if((oList.outerHTML)&&(oList.getAttribute('tagName')=='SELECT'))if((oList.getAttribute('multiple')==false)&&(bHighlightNew))continue;var iObjectIndex=aCache[0].indexOf(oItem.value);oItem.setAttribute('selected',aCache[1][iObjectIndex]);oItem.setAttribute('checked',aCache[2][iObjectIndex]);}}return aNewItems;}function fPopulateCheckedList(aData,oTable,sName,bChecked){var bCreatedBoxes=false;for(var i=0;i<aData[0].length;i++){bCreatedBoxes=true;with(oTable.insertRow(-1)){with(insertCell(-1)){var oNewCheckbox=document.createElement('<input type="checkbox" name='+sName+'>');oNewCheckbox.value=aData[1][i];appendChild(oNewCheckbox);if(bChecked)oNewCheckbox.setAttribute('checked',true);width='30';align='center';}with(insertCell(-1))innerHTML=aData[0][i];}}return bCreatedBoxes;}function fClearCheckedList(oCheckedList){if(oCheckedList.length){while(oCheckedList.length>0){var oRow=fParentElement(oCheckedList[oCheckedList.length-1],'TR');oRow.parentElement.removeChild(oRow);}}else{var oRow=fParentElement(oCheckedList,'TR');oRow.parentElement.removeChild(oRow);}}function fRefreshCheckedList(sData,oCheckedList,bHighlightNew){fDebugPoint('fRefreshCheckedList','Refreshing list '+oCheckedList);var oForm=oCheckedList.form;var oTable=fParentElement(oCheckedList.length?oCheckedList[0]:oCheckedList,'TABLE');var sName=oCheckedList.length?oCheckedList[0].name:oCheckedList.name;var aCache=new Array();aCache=fCacheList(oCheckedList);fClearCheckedList(oCheckedList);var aData=new Array();aData=fParseData(sData);fPopulateCheckedList(aData,oTable,sName);if(oCheckedList.outerHTML)oCheckedList=oForm.elements(sName);return fRestoreList(oCheckedList,aCache,bHighlightNew);}function fPopulateList(aArray,oList){fDebugPoint('fPopulateList','populating list');var bCreatedOptions=false;var iListLen=oList.options?oList.options.length:0;var iArrayLength=fMaxLength(aArray);for(var i=0;i<iArrayLength;i++){bCreatedOptions=true;oList.options[i+iListLen]=new Option(aArray[0][i]);oList.options[i+iListLen].value=aArray[1][i];}return bCreatedOptions;}function fClearList(oList){fDebugPoint('fClearList','Clearing list '+oList.name);with(oList.options)while(length>0)remove(0);}function fRefreshList(sData,oList,bHighlightNew){fDebugPoint('fRefreshList','Refreshing list '+oList.name);var aCache=new Array();aCache=fCacheList(oList);fClearList(oList);var aData=new Array();aData=fParseData(sData);fPopulateList(aData,oList);return fRestoreList(oList,aCache,bHighlightNew);}function fSetRadioGroup(oGroup,sValue,sMatch){fDebugPoint('fSetRadioGroup','setting radiogroup '+oGroup+' for value '+sValue);for(var i=0;i<oGroup.length;i++)with(oGroup[i])checked=value==sValue?true:false;}function fSetList(oList,sValue,sCaption){fDebugPoint('fSetList','Setting list '+oList.id+' for value '+sValue+' and caption '+sCaption);with(oList){if(!options)return;for(var i=0;i<options.length;i++){with(options[i]){var bValueMatch=((sValue==null)||(value==sValue))?true:false;var bCaptionMatch=((sCaption==null)||(caption==sCaption))?true:false;selected=((bValueMatch)&&(bCaptionMatch))?true:false;}}}}function fReplaceItem(sCaption,sValue,iIndex,oObj){DebugPoint('fReplaceItem','Replacing item '+iIndex+' in list '+oObj.id+' with value '+sValue+' and caption '+sCaption);oObj.options[iIndex].text=sCaption;oObj.option[iIndex].value=sValue;}function fRemoveItem(iIndex,oObj){fDebugPoint('fRemoveItem','Removing item '+iIndex+' from list '+oObj.id);if((!oObj.options)||(!oObj.options.length))return '';if(iIndex<0)iIndex=oObj.selectedIndex;if((iIndex>oObj.options.length)||(iIndex<0))return '';var sRemovedText=oObj.options[iIndex].text;for(var i=iIndex;i<oObj.options.length-1;i++){oObj.options[i].text=oObj.options[i+1].text;oObj.options[i].value=oObj.options[i+1].value;}oObj.options[oObj.options.length-1]=null;return sRemovedText;}function fAddItem(sCaption,sValue,oObj){fDebugPoint('fAddItem','adding value '+sValue+' caption '+sCaption+' to list '+oObj.id);if((sCaption=='')&&(sValue==''))return;for(var i=0;i<oObj.options.length;i++){if(oObj.options[i].text==sCaption)return;}var iNextItem=oObj.options.length;oObj.options[iNextItem]=new Option(sCaption);oObj.options[iNextItem].value=sValue;}function fMoveItems(oFromObj,oToObj){fDebugPoint('fMoveItems','moving items from '+oFromObj.id+' to '+oToObj.id);for(var i=0;i<oFromObj.options.length;i++){if(oFromObj.options[i].selected){var iNextitem=toObj.options.length;oToObj.options[iNextitem]=new Option(oFromObj.options[i].text);oToObj.options[iNextitem].value=oFromObj.options[i].value;oToObj.options[iNextitem].selected=true;oFromObj.options[i].selected=false;fRemoveItem(i,oFromObj);}}}function fMoveAll(oFromObj,oToObj){fDebugPoint('fMoveAll','moving all items in '+oFromObj.id+' to '+oToObj.id);for(var i=0;i<oFromObj.options.length;i++){iNextitem=oToObj.options.length;oToObj.options[iNextitem]=new Option(oFromObj.options[i].text);oToObj.options[iNextitem].value=oFromObj.options[i].value;}for(i=oFromObj.options.length-1;i>=0;i--)fRemoveItem(i,oFromObj);}function fMoveInCheckedList(oTable,oSelectedRow,oList,iDir){fDebugPoint('fMoveInList','moving selected item in list '+oTable.id+' in direction '+iDir);if(oSelectedRow==null)return;var aCache=new Array();aCache=fCacheList(oList);var iRow=oSelectedRow.rowIndex;var iDestination=iRow+iDir;if(oTable==null)return;if((iDestination<0)||(iDestination>oTable.rows.length-1))return;oTable.moveRow(iRow,iDestination);fRestoreList(oList,aCache,false);}function fMoveInList(oList,iDir){fDebugPoint('fMoveInList','moving selected item in list '+oList.id+' in direction '+iDir);var oTempObj=new Object();oTempObj.pos=oList.selectedIndex;oTempObj.newPos=oTempObj.pos+iDir;if((oTempObj.newPos<0)||(oTempObj.newPos>=oList.options.length))return;oTempObj.value=oList.options[oTempObj.pos].value;oTempObj.text=oList.options[oTempObj.pos].text;oList.options[oTempObj.pos].value=oList.options[oTempObj.newPos].value;oList.options[oTempObj.pos].text=oList.options[oTempObj.newPos].text;oList.options[oTempObj.newPos].value=oTempObj.value;oList.options[oTempObj.newPos].text=oTempObj.text;oList.selectedIndex=oTempObj.newPos;}fRegister('selection.js v.1004032306');
