
var glossary=new Glossary();function g(entryName,elem)
{var region=YAHOO.util.Dom.getRegion(elem);glossary.show({'name':entryName},region.left,region.bottom+2,293);}
(function()
{CPN.ProcessSelector=function(tableId,processType)
{this.table=$(tableId);this.processType=processType;if(processType==CPN.ProcessSelector.PRODUCTION)
this.filters=this.productionFilters;else if(processType==CPN.ProcessSelector.RAPID_PROTOTYPING)
this.filters=this.rapidPrototypingFilters;for(var x in this.filters)
{YAHOO.util.Event.addListener(x,'change',this.onFilterChange,$(x),this);}
for(var i=0;i<this.envFields.length;i++)
{var elem=$(this.envFields[i]);if(elem){YAHOO.util.Event.addListener(elem,'click',this.onEnvelopeClick,elem,this);YAHOO.util.Event.addListener(elem,'change',this.onEnvelopeChange,elem,this);}}};CPN.ProcessSelector.PRODUCTION=1;CPN.ProcessSelector.RAPID_PROTOTYPING=2;var proto=CPN.ProcessSelector.prototype;proto.WS_COMPATIBILITY='ws/process/compatibility.php';proto.productionFilters={'shape':{label:'Shape'},'production_quantity':{label:'Quantity'},'lead_time':{label:'Lead Time'},'material_type':{label:'Material Type'},'tolerance':{label:'Tolerance'},'surface_finish':{label:'Surface Finish'},'thickness':{label:'Wall Thickness'},'envelope':{label:'Size'}};proto.rapidPrototypingFilters={'material_type':{label:'Material Type'},'envelope':{label:'Size'},'build_speed':{label:'Build Speed'},'min_layer_thickness':{label:'Min Layer Thickness'},'min_feature_size':{label:'Min Feature Size'},'accuracy':{label:'Accuracy'},'surface_finish':{label:'Surface Finish'}};proto.envFields=['env_length','env_width','env_height'];proto.columns=[];proto.setField=function(fieldName,value)
{$(fieldName).value=value;this.onFilterChange(fieldName);},proto.onFilterChange=function(e,elem)
{elem=YAHOO.lang.isString(e)?$(e):elem;if(elem.value=='')
{this.removeColumn(elem.id);return;}
var params={'t':this.processType,'f':elem.id,'v':elem.value},paramsString=$H(params).toQueryString(),callback={success:this.processResponse,argument:[this,elem.id]};var transaction=YAHOO.util.Connect.asyncRequest('GET',this.WS_COMPATIBILITY+'?'+paramsString,callback,null);};proto.onEnvelopeClick=function(e)
{var elem=Event.element(e);v=elem.value;if(v=='L'||v=='W'||v=='H')
{elem.value='';}};proto.onEnvelopeChange=function(e)
{var field='envelope';var l=$F(this.envFields[0]),w=$F(this.envFields[1]),h=$F(this.envFields[2]);$(field).value=l+','+w+','+h;if((l==''||l=='L')&&(w==''||w=='W')&&(h==''||h=='H'))
{var c=this.findColumn(field);if(c!=-1)
{this.removeColumn(field);}}
else
{this.onFilterChange(field);}};proto.processResponse=function(transport)
{var self=this.argument[0],fieldName=this.argument[1],response;try
{eval('response = '+transport.responseText);}
catch(e)
{}
var filter=self.filters[fieldName],i=self.findColumn(fieldName);if(i==-1)
{i=self.addColumn(fieldName,filter.label);}
self.setCompatibility(i,response.compatibility);};proto.addColumn=function(fieldName,label)
{var rows=this.table.rows,numRows=rows.length;this.columns.push(fieldName);cell=document.createElement('th');cell.innerHTML=label;rows[0].appendChild(cell);var ie=document.all&&!window.opera;for(var i=1;i<numRows;i++)
{var cell=document.createElement('td');cell.innerHTML='&nbsp;';rows[i].appendChild(cell);if(ie&&$(rows[i]).hasClassName('parentProcess'))
{$(rows[i]).removeClassName('parentProcess');$(rows[i]).addClassName('parentProcess');}}
return rows[0].cells.length-1;};proto.removeColumn=function(fieldName)
{var col=this.findColumn(fieldName),rows=this.table.rows;if(col==-1)
return;this.columns.splice(col-1,1);for(var i=0,numRows=rows.length;i<numRows;i++)
{$(rows[i].cells[col]).remove();}};proto.findColumn=function(fieldName)
{var numCols=this.columns.length;for(var i=0;i<numCols;i++)
{if(this.columns[i]==fieldName)
{return i+1;}}
return-1;};proto.setCompatibility=function(columnIndex,compatibility)
{var rows=this.table.rows,colors=['#ff6666','#ffff66','#66ff66'],prefix='process_';for(var i=0,numRows=rows.length;i<numRows;i++)
{var row=rows[i];if(row.id.startsWith(prefix))
{var processId=rows[i].id.substring(prefix.length),c=compatibility[processId];c=(c!==null&&c!==undefined)?colors[c]:'#fff';row.cells[columnIndex].style.backgroundColor=c;}}};proto.compareProcesses=function()
{var checkboxes=Form.getInputs('processForm','checkbox'),numCheckboxes=checkboxes.length,processes=[];for(var i=0;i<checkboxes.length;i++)
{if(checkboxes[i].checked)
processes.push(checkboxes[i].value);}
if(processes.length<=0)
{alert("Please select 1 or more processes to compare.");return;}
var params='p='+processes[0];for(var i=1;i<processes.length;i++)
{params+=','+processes[i];}
if(this.processType==CPN.ProcessSelector.RAPID_PROTOTYPING)
window.location="rapid-process-compare?"+params;else
window.location="process-compare?"+params;};})();(function()
{CPN.ProcessComparison=function(tableId,processIds)
{this.table=$(tableId);this.processIds=processIds;};var proto=CPN.ProcessComparison.prototype;proto.addColumn=function()
{this.processIds.push($F('newProcess'));var params='p='+this.processIds[0];for(var i=1;i<this.processIds.length;i++)
{params+=','+this.processIds[i];}
if(window.location.href.indexOf('rapid')==-1)
window.location="process-compare?"+params;else
window.location="rapid-process-compare?"+params;};proto.removeColumn=function(processId)
{var rows=this.table.rows;var col=-1;for(var i=0,numProcesses=this.processIds.length;i<numProcesses;i++)
{if(this.processIds[i]==processId)
{col=i;}}
if(col==-1)
return;this.processIds.splice(col,1);var colWidth=$(rows[i].cells[col]).getWidth();this.table.setStyle({width:(this.table.getWidth()-colWidth)+'px'});this.table.down('colgroup').down('col',col+1).remove();col++;for(var i=0,numRows=rows.length;i<numRows;i++)
{$(rows[i].cells[col]).remove();}};})();