/*
	Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/


window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","dojox.form.Uploader"],["require","dojox.form.uploader.Base"],["require","dijit.form.Button"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dojox.form.Uploader"]){_4._hasResource["dojox.form.Uploader"]=true;_4.provide("dojox.form.Uploader");_4.experimental("dojox.form.Uploader");_4.require("dojox.form.uploader.Base");_4.require("dijit.form.Button");_4.declare("dojox.form.Uploader",[_6.form.uploader.Base],{uploadOnSelect:false,tabIndex:0,multiple:false,label:"Upload...",url:"",name:"uploadedfile",flashFieldName:"",uploadType:"form",_nameIndex:0,widgetsInTemplate:true,templateString:"<div class=\"dojoxFileInput\"><div dojoType=\"dijit.form.Button\" dojoAttachPoint=\"button\">${label}</div></div>",postMixInProperties:function(){this._inputs=[];this._getButtonStyle(this.srcNodeRef);this.inherited(arguments);},postCreate:function(){var _7=false;var _8=this.domNode.parentNode;var _9=this._getNodePosition(this.domNode);if(!this.btnSize.w||!this.btnSize.h){_4.body().appendChild(this.domNode);this._getButtonStyle(this.domNode);_7=true;}this._setButtonStyle();if(_7){_4.place(this.domNode,_9.node,_9.pos);}this.inherited(arguments);},onChange:function(_a){},onBegin:function(_b){},onProgress:function(_c){},onComplete:function(_d){this.reset();},onCancel:function(){},onAbort:function(){},onError:function(_e){},upload:function(_f){},submit:function(_10){},reset:function(){this._disconnectButton();_4.forEach(this._inputs,_4.destroy,_4);this._inputs=[];this._nameIndex=0;this._createInput();},getFileList:function(){var _11=[];if(this.supports("multiple")){_4.forEach(this.inputNode.files,function(f,i){_11.push({index:i,name:f.name,size:f.size,type:f.type});},this);}else{_4.forEach(this._inputs,function(n,i){_11.push({index:i,name:n.value.substring(n.value.lastIndexOf("\\")+1),size:0,type:n.value.substring(n.value.lastIndexOf(".")+1)});},this);}return _11;},_getValueAttr:function(){return this.getFileList();},_setValueAttr:function(_12){console.error("Uploader value is read only");},_getDisabledAttr:function(){return this._disabled;},_setDisabledAttr:function(_13){if(this._disabled==_13){return;}this.button.set("disabled",_13);_4.style(this.inputNode,"display",_13?"none":"block");},_getNodePosition:function(_14){if(_14.previousSibling){return {node:_14.previousSibling,pos:"after"};}return {node:_14.nextSibling,pos:"before"};},_getButtonStyle:function(_15){if(!_15){this.btnSize={w:200,h:25};}else{this.btnSize=_4.marginBox(_15);}},_setButtonStyle:function(){var _16=true;if(!this.domNode.parentNode||!this.domNode.parentNode.tagName){document.body.appendChild(this.domNode);_16=false;}_4.style(this.domNode,{width:this.btnSize.w+"px",height:(this.btnSize.h+4)+"px",overflow:"hidden",position:"relative"});this.inputNodeFontSize=Math.max(2,Math.max(Math.ceil(this.btnSize.w/60),Math.ceil(this.btnSize.h/15)));this._createInput();_4.style(this.button.domNode,{margin:"0px",display:"block",verticalAlign:"top"});_4.style(this.button.domNode.firstChild,{margin:"0px",display:"block"});if(!_16){document.body.removeChild(this.domNode);}},_createInput:function(){if(this._inputs.length){_4.style(this.inputNode,{top:"500px"});this._disconnectButton();this._nameIndex++;}var _17;if(this.supports("multiple")){_17=this.name+"s[]";}else{_17=this.name+(this.multiple?this._nameIndex:"");}this.inputNode=_4.create("input",{type:"file",name:_17,className:"dojoxInputNode"},this.domNode,"first");if(this.supports("multiple")&&this.multiple){_4.attr(this.inputNode,"multiple",true);}this._inputs.push(this.inputNode);_4.style(this.inputNode,{fontSize:this.inputNodeFontSize+"em"});var _18=_4.marginBox(this.inputNode);_4.style(this.inputNode,{position:"absolute",top:"-2px",left:"-"+(_18.w-this.btnSize.w-2)+"px",opacity:0});this._connectButton();},_connectButton:function(){this._cons=[];var cs=_4.hitch(this,function(nm){this._cons.push(_4.connect(this.inputNode,nm,this,function(evt){this.button._cssMouseEvent({type:nm});}));});cs("mouseover");cs("mouseout");cs("mousedown");this._cons.push(_4.connect(this.inputNode,"change",this,function(evt){this.onChange(this.getFileList(evt));if(!this.supports("multiple")&&this.multiple){this._createInput();}}));this.button.set("tabIndex",-1);if(this.tabIndex>-1){this.inputNode.tabIndex=this.tabIndex;var _19=_4.style(this.button.domNode.firstChild,"border");this._cons.push(_4.connect(this.inputNode,"focus",this,function(){_4.style(this.button.domNode.firstChild,"border","1px dashed #ccc");}));this._cons.push(_4.connect(this.inputNode,"blur",this,function(){_4.style(this.button.domNode.firstChild,"border",_19);}));}},_disconnectButton:function(){_4.forEach(this._cons,_4.disconnect,_4);}});(function(){_6.form.UploaderOrg=_6.form.Uploader;var _1a=[_6.form.UploaderOrg];_6.form.addUploaderPlugin=function(_1b){_1a.push(_1b);_4.declare("dojox.form.Uploader",_1a,{});};})();}}};});