function extractIt(){var WindowContent='';var TempArray;var TempArray2;var theFrame="parent.MapFrame";if((useExternalWindow)||(!useTextFrame)){theFrame="opener";if(parent.MapFrame!=null){theFrame="opener.parent.MapFrame";}};WindowContent+=('<form name="ExtractChooser" onsubmit="return false;">');WindowContent+=('<strong>Select Layer to Extract/Download:</strong><br />');WindowContent+=('<select name="ExtractChooser" onchange="'+theFrame+'.Extract_Layer(document.ExtractChooser.ExtractChooser.value);window.close();">');WindowContent+=('<option value = "[none]-0">Select Layer to Extract/Download</option>');var Temp_Counter=0;if(parent.MapFrame.USGS_OGC_Loaded){var CenterAdjust=Math.abs(eRight-eLeft);var CurrentMapScale=HaversineScale((eLeft+CenterAdjust),eBottom,(eLeft+CenterAdjust),eTop,mHeight,ScaleToolDPI);for(var i=Category_Order.length-1;i>=0;i--){if(Category_Layer_Order[i].length>0){TempArray=Category_Layer_Order[i].split(',');TempArray2=Category_Layer_Visibility[i].split(',');for(var j=TempArray.length-1;j>=0;j--){if(Check_Layer_Extent_and_Scale(TempArray[j],eLeft,eBottom,eRight,eTop,CurrentMapScale)){if(TempArray2[j]=='true'&&SRC_Layer_Download_URL[TempArray[j]].length>0){WindowContent+=('<option value="OGC-'+TempArray[j]+'">'+SRC_Layer_Name[TempArray[j]]+'</option>');Temp_Counter++;}}}}}};if(layerCount>0&&!Display_Only_OGC){for(var k=0;k<layerCount;k++){if((!hideLayersFromList)||((hideLayersFromList)&&(!noListLayer[k]))){if((listAllLayers)||((mapScaleFactor>=LayerMinScale[k])&&(mapScaleFactor<=LayerMaxScale[k]))){if(LayerVisible[k]==1){WindowContent+=('<option value="LAYER-'+k+'">'+Get_Display_LayerName(LayerName[k])+'</option>');};Temp_Counter++;}}}};if(Temp_Counter==0){WindowContent+=('<option value="NONE-0">No Layers available for download in the current scale.</option>');};WindowContent+=('</select><br /><small>Only layers that have download information available and are visible in the current extent are listed here.</small>');WindowContent+=('</form>');Create_Pop_Up_Window('USGS Map Interface Extract/Download','',WindowContent,'ExtractWindow','width=500,height=375,scrollbars=yes,resizable=yes');};function Extract_Layer(Layer2Extract){TempArray=Layer2Extract.split("-");var TempURL='';if(TempArray[0]=="OGC"){if(SRC_Layer_Download_URL[TempArray[1]].length>0){TempURL='';eval('TempURL = '+SRC_Layer_Download_URL[TempArray[1]]);if(TempURL.length>0){window.open(TempURL);}else{alert('Error building extraction request.');}}else{alert('Extract not yet available for '+SRC_Layer_Name[TempArray[1]]);}}else if(TempArray[0]=="LAYER"){if(parent.MapFrame.LayerIsFeature[TempArray[1]]){if(parent.MapFrame.aimsExtractPresent){parent.MapFrame.xLayers[0]=parseInt(TempArray[1]);parent.MapFrame.extractTheLayers();}else{alert('Feature Layer Extract not available');}}else{if(LayerName[TempArray[1]]=="NED Shaded Relief"){window.open("http://extract.cr.usgs.gov/Website/zipship/waiting.jsp?areaList="+eTop+","+eBottom+","+eRight+","+eLeft+"&prodList=NED");}else if(LayerName[TempArray[1]]=="National Land Cover"||LayerName[TempArray[1]]=="NLCD Trans"){window.open("http://extract.cr.usgs.gov/Website/zipship/waiting.jsp?areaList="+eTop+","+eBottom+","+eRight+","+eLeft+"&prodList=NLCD");}else{alert('Raster Extract not yet available for '+LayerName[TempArray[1]]);}}}else if(TempArray[0]=="NONE"){}else{alert('Bad Layer Definition Error when trying to Extract/Download Data.');}}

