<html xmlns:MMString="http://www.macromedia.com/schemes/data/string/">
<head>
<!-- Copyright 2000-2007 Adobe Systems Incorporated.  All rights reserved. -->
<title><MMString:LoadString id="insertbar/formsFileField" /></title>
<script type="text/javascript" SRC="../../Shared/MM/Scripts/CMN/docInfo.js"></script>
<script type="text/javascript" SRC="../../Shared/Common/Scripts/dwscripts.js"></script>
<script type="text/javascript">

function isDOMRequired() { 
	// Return false, indicating that this object is available in code view.
	return false;
}

function objectTag() {
  var uniqueId = dwscripts.getUniqueId("fileField");
  var inputTag = '<label for="' + uniqueId + '">File:</label>\
				<input type="file" name="' + uniqueId + '" id="' + uniqueId + '">';
				
  var dom = dw.getDocumentDOM();
  dom.insertHTML(inputTag, false, false);	
  
  if (dw.getFocus(true) == "document") {
	  var theNode = dw.getDocumentDOM().getSelectedNode();

	  if (selectionInsideTag('form')){
	    if (theNode.nodeType == Node.TEXT_NODE) {
	      theNode = theNode.parentNode;
	    }
	    while (theNode.nodeType == Node.ELEMENT_NODE) {
	      if (theNode.tagName.toUpperCase() == 'FORM') {
	        theNode.setAttribute('enctype','multipart/form-data');
	        break;
	      }
	      theNode = theNode.parentNode;
	    }
	  }
  }
  	
	// Adjusting Selection from Label tag to Input tag
	var newObj = dom.getElementById(uniqueId);	
	var offsets = dom.nodeToOffsets(newObj);	
	dom.setSelection(offsets[0], offsets[1]);
	
	return ''; 
}

</script>
</head>

<body>
</body>

</html>
