function checkIfPopUpShouldAppear(c){var d=findEmbededHtmlElement("input","checkbox","cbHideProcCapbPopUp");var b=findEmbededHtmlElement("input","hidden","hiddenMainProcess");var a=b.value.toLowerCase();if(a=="casting"||a=="plastics"){if(!d.checked){procCapbHeader_onclick()}}}function SelectOverlap_onclick(){var a=findEmbededHtmlElement("input","hidden","OverlapSelected");if(a==null){alert("Browse for a 2d file and click on 'Preview'!");return false}else{if(a.value=="empty"){alert("You must first select a shape that you would like to use as a search input.");return false}}return true}function Overlap_Selected(o){var r=findEmbededHtmlElement("input","hidden","OverlapSelected");r.value=o;var l=findEmbededHtmlElement("div","","highlighter");var q=findEmbededHtmlElement("img","","imgoverlap");var k=findEmbededHtmlElement("input","hidden","ixdExtents");var n=k.value.split("*");var f=n[0];var j=n[o+1];f=f.split(" ")[1];var p=parseFloat(f.split("x")[0]);var d=parseFloat(f.split("x")[1]);var c=parseFloat(j.split(",")[1]);var a=parseFloat(j.split(",")[2]);var b=parseFloat(j.split(",")[3]);var h=parseFloat(j.split(",")[4]);var m,e;var g=p-d;if(g>0){e=400/p;m=d*e}else{e=400/d;m=400}b=b*e;h=h*e;c=c*e;a=m-a*e-h;if(c+b>420){return}l.style.top=a+"px";l.style.left=c+"px";l.style.width=b+"px";l.style.height=h+"px"}function search_onclick(){try{var s=findEmbededHtmlElement("div","","ctvSetAside_rtvEdit");var z=findEmbededHtmlElement("div","","ctvNAICS_rtvEdit");var h=findEmbededHtmlElement("div","","ctvClassificationCodes_rtvEdit");var d=findEmbededHtmlElement("input","","expandedDiv");var o=findEmbededHtmlElement("input","","hiddenMainProcess");var g=findEmbededHtmlElement("input","","txtSearch");var b=findEmbededHtmlElement("input","","txtCompName");var w=findEmbededHtmlElement("input","","ProductCategoryValid");var r=findEmbededHtmlElement("input","","customSearchVal");var k=findEmbededHtmlElement("select","","ddlChooseCountry");var l=findEmbededHtmlElement("select","","ddlChooseState");var c=findEmbededHtmlElement("select","","ddlDiameter");var t=findEmbededHtmlElement("select","","ddlLength");var q=findEmbededHtmlElement("select","","ddlCubeVolume");var e=findEmbededHtmlElement("select","","ddlTolerance");var f=findEmbededHtmlElement("select","","ddlSurfaceFinish");if(d!=null){var x=findEmbededHtmlElement("input","","searchInputDiv");if(x!=null&&x.value=="doodleDiv"&&d.value==""){d.value=x.value;var u=findEmbededHtmlElement("input","","ixdStr");var y=findEmbededHtmlElement("input","hidden","ixdStrMemory");if(u!=null&&y!=null){u.value=y.value}var a=window.frames[0];a.doOnLoad()}if(d.value=="doodleDiv"){var n=findEmbededHtmlElement("input","","frontCoords");n.value=window.frames[0].getEntities();if((n.value=="")){alert("You must provide a search input.");return false}else{return true}}else{if(d.value=="uploadDiv"){var j=findEmbededHtmlElement("input","","File1");var v=findEmbededHtmlElement("input","","backgroundUpload");var p=findEmbededHtmlElement("input","","messageInput");if(v.value==""&&j.value==""){if((p.value=="3d"||p.value=="image")&&j.value==""){alert("Pick the "+p.value+" file that you want to use as search input!");return false}if(p.value=="2d"){return SelectOverlap_onclick()}}else{return true}}else{if(o!=null&&o.value!=""){return true}}}}if(r!=null&&r.value!=""){return true}if(g!=null&&g.value!=""&&g.value!="Type here to Search"){return true}if(b!=null&&b.value!=""&&b.value!="Enter Company/Team Name"){return true}if(w!=null&&w.value=="true"){return true}if((k!=null)&&(k.selectedIndex!=0)){return true}if((l!=null)&&(l.selectedIndex!=0)){return true}if(s){for(i=0;i<s.getElementsByTagName("input").length;i++){if((s.getElementsByTagName("input")[i]).checked){return true}}}if(z){for(i=0;i<z.getElementsByTagName("input").length;i++){if((z.getElementsByTagName("input")[i]).checked){return true}}}if(h){for(i=0;i<h.getElementsByTagName("input").length;i++){if((h.getElementsByTagName("input")[i]).checked){return true}}}if(c){if(c.selectedIndex!=0){return true}}if(t){if(t.selectedIndex!=0){return true}}if(q){if(q.selectedIndex!=0){return true}}if(e){if(e.selectedIndex!=0){return true}}if(f){if(f.selectedIndex!=0){return true}}alert("You must provide a search input.");return false}catch(m){alert("exception: "+m.description);return false}return true}function closePopUp_onclick(c){try{var b=findEmbededHtmlElement("input","","expandedDiv");b.value="";closePopUpOnly_onclick(c)}catch(a){}return false}function closePopUpOnly_onclick(d){var a=findEmbededHtmlElement("div","",d);var b=findEmbededHtmlElement("input","hidden","hiddenCastingOpen");HideOrShowTheControl(a,0);if(d=="procCapbDiv"){b.value="false"}var c=findEmbededHtmlElement("input","","expandedDiv");showDaPopUp(c.value)}function setTheBackgroundBackToBefore(){var c=findEmbededHtmlElement("input","","background");if(c!=null){c.value=""}var d=findEmbededHtmlElement("input","","ixdStr");var b=findEmbededHtmlElement("input","hidden","ixdStrMemory");if(d!=null&&b!=null){d.value=b.value}var a=findEmbededHtmlElement("iframe","","Iframe1");var e=window.frames[0];e.doOnLoad()}function viewSearchInput_onclick(){var a=findEmbededHtmlElement("input","","searchInputDiv");Header_onclick(a.value,"input","viewInput");setTheBackgroundBackToBefore()}function editSearchInput_onclick(){var a=findEmbededHtmlElement("input","","searchInputDiv");Header_onclick(a.value,"input","editInput");setTheBackgroundBackToBefore()}function hideAllShapeDivs(){var b=findEmbededHtmlElement("div","","doodleDiv");var c=findEmbededHtmlElement("div","","uploadDiv");var a=findEmbededHtmlElement("div","","cadDiv");HideOrShowTheControl(b,0);HideOrShowTheControl(c,0);HideOrShowTheControl(a,0)}function generateUploadInstructionTable(f){var a="<label style='background-color:Orange; color:White; font-size:smaller; font-family:avenir; font-weight:600;'>&nbsp;SEARCH&nbsp;</label>";var d="";var c=".";if(f=="2d"){d=" your 2D drawing file (dxf, dwg)"}else{if(f=="3d"){d=" your 3D model file (stl, stp/step, iges/igs, dwf)";c=" or just click the "+a+" button right away."}else{if(f=="image"){d=" your image file (png, jpg, jpeg)";c=" or just click the "+a+" button."}}}var e=1;var b='<table style="background-color: #dedede;" class="ControlWidth"><tr>     <td>     </td>     <td nowrap="nowrap" align="left">'+e+++". Browse to"+d+' using the <b>Browse</b> button.     </td></tr><tr>    <td>    </td>    <td align="left">'+e+++'. Click <b>Preview</b> to see the file and select the region to use as search input (if necessary)'+c+"    </td></tr>";return b}function Header_onclick(l,h,k){var n="";var a=findEmbededHtmlElement("input","","messageInput");if(h!=null){a.value=h;n=h}else{if(a!=null){n=a.value}}var d=findEmbededHtmlElement("input","","expandedDiv");d.value=l;hideAllShapeDivs();showDaPopUp(l);var e=findEmbededHtmlElement("div","","divUploadInstructionDetails");var b=findEmbededHtmlElement("div","","divUploadHeading");var m=findEmbededHtmlElement("div","","divDoodleHeading");if(k==null){if(n=="doodle"){}else{SetInnerHTML(e,generateUploadInstructionTable(n));if(n=="2d"){SetInnerHTML(b,'<label class="instructionHeading">Upload 2D Drawing</label>')}else{if(n=="3d"){SetInnerHTML(b,'<label class="instructionHeading">Upload 3D Model</label>')}else{if(n=="image"){SetInnerHTML(b,'<label class="instructionHeading">Upload Image/Picture</label>')}}}}}else{var c=findEmbededHtmlElement("div","","divDoodleInstructionDetails");var f=findEmbededHtmlElement("div","","divDoodle2ndStepInstruction");var g=findEmbededHtmlElement("div","","divUploadBrowseArea");var j=findEmbededHtmlElement("div","","divHighlightDrawing");if(k=="viewInput"){HideOrShowTheControl(j,0);HideOrShowTheControl(g,0);HideOrShowTheControl(c,0);HideOrShowTheControl(e,0);SetInnerHTML(b,'<label class="instructionHeading">View Your Search Input</label>');SetInnerHTML(m,'<label class="instructionHeading">View Your Search Input</label>')}else{if(k=="editInput"){HideOrShowTheControl(j,1);HideOrShowTheControl(e,1);HideOrShowTheControl(g,1);HideOrShowTheControl(c,1);SetInnerHTML(b,'<label class="instructionHeading">Edit Your Search Input</label>');SetInnerHTML(m,'<label class="instructionHeading">Edit Your Search Input</label>');SetInnerHTML(f,"1. Use the tools to edit the image/drawing.")}}}return false}function SetInnerHTML(b,a){if(b!=null){b.innerHTML=a}}function HideOrShowTheControl(b,a){if(b!=null){if(a==1){Element.extend(b).show()}else{if(a==0){Element.extend(b).hide()}}}}function findPos(a){var b=curtop=curBottom=0;if(a.offsetParent){b=a.offsetLeft;curtop=a.offsetTop;curBottom=a.offsetTop+a.offsetHeight;while(a=a.offsetParent){b+=a.offsetLeft;curtop+=a.offsetTop}}alert("left="+b+"     top="+curtop);alert("bottom="+curBottom);return[b,curtop]}function findBottom(b){var a=0;if(b.offsetParent){a=b.offsetTop+b.offsetHeight}return a}function showDaPopUp(c){if(c!=""&&c!=""){var a=findEmbededHtmlElement("div","",c);var b=findEmbededHtmlElement("div","","showPopUpHere");a.style.position="absolute";a.style.left=b.style.left;a.style.top=b.style.top;a.style.zIndex="30";a.style.backgroundColor="#f2f2f2";a.style.borderWidth="thin";a.style.borderColor="gray";a.style.borderStyle="ridge";if(c=="procCapbDiv"){a.style.left+=300;a.style.top+=185}HideOrShowTheControl(a,1)}}function arrangePanelAccordingly(b,c){var d=findEmbededHtmlElement("div","",b);var a=findEmbededHtmlElement("div","",c);a.style.top=findBottom(d)}function showAllPanelInProperArrangement(){var d=0;var b=new Array();showDaPopUp("searchHeadingz");b[d++]="searchHeadingz";var e=findEmbededHtmlElement("input","","inputText");if(e.value!=""){}var c=findEmbededHtmlElement("input","","inputShape");if(c.value!=""){showDaPopUp(c.value);b[d++]=c.value}var a=findEmbededHtmlElement("input","","inputProcCapb");if(a.value!=""){showDaPopUp("procCapbDiv");b[d++]="procCapbDiv"}showDaPopUp("searchFooterz");b[d++]="searchFooterz";for(i=0;i+1<b.length;i++){arrangePanelAccordingly(b[i],b[i+1])}}function procCapbHeader_onclick(){var c=findEmbededHtmlElement("input","hidden","hiddenCastingOpen");var b=findEmbededHtmlElement("input","hidden","hiddenMainProcess");var a=b.value.toLowerCase();if(a=="casting"||a=="plastics"){if(c.value=="false"){showDaPopUp("procCapbDiv");c.value="true"}}else{closePopUp_onclick("procCapbDiv","inputProcCapb")}}function showLoadingIcon(){var a=findEmbededHtmlElementExecute("div","","slowScreenSplash",window.parent.document);if(a!=null){a.style.visibility="visible"}}function hideLoadingIcon(){var a=findEmbededHtmlElementExecute("div","","slowScreenSplash",window.parent.document);if(a!=null){a.style.visibility="hidden"}};