////////////////////////////////////////////// 
//        SoundOutTheBox pickadate          // 
//  Copyright © SoundOutTheBox 2012-2013    // 
//           License-CC-BY-NC-ND            // 
////////////////////////////////////////////// 
(function(e){e.widget("mui.pickadate",{options:{publicVariables:{Name:{value:"no name",type:"StringData",dynamic:!1},Left:{value:0,type:"IntegerData",dynamic:!1},Top:{value:0,type:"IntegerData",dynamic:!1},Width:{value:540,type:"IntegerData",dynamic:!1},Height:{value:364,type:"IntegerData",dynamic:!1},DateText:{value:"",type:"StringData",dynamic:!0},Date:{value:"",type:"StringData",dynamic:!0},Day:{value:0,type:"IntegerData",dynamic:!0},Month:{value:0,type:"IntegerData",dynamic:!0},Year:{value:0,
type:"IntegerData",dynamic:!0},Visible:{value:["no","yes"],type:"EnumData",defaultvalue:"yes",write:!0,dynamic:!0}},privateVariables:{pageNumber:0,motifType:0,userScreen:0,myPickadateField:null,myPickadate:null},config:{main:"pickadate.js",description:"pickadate is a date selector.",author:"SoundOutTheBox",version:"1.0.0.0.Final",dependencies:["./css/pickadateInlineFixed.css","./js/jPickadate.js"],widgetID:"9e69976c6e9b9a946b369c96686b716d97686b666c6d6469696a986370619e6b",widgetPackages:["6e6e6871996b689271349f96689f6a686e6369337066669f709798669f307069"]}},_create:function(){},
_init:function(){},_destroy:function(){},_setOption:function(){e.Widget.prototype._setOption.apply(this,arguments)},_render:function(){var b=this.options.publicVariables,a=this.options.privateVariables,d=this.element,h=b.Top.value,f=b.Height.value,c=b.Left.value,i=b.Width.value,g=a.myPickadateField;console.log("_render()  object="+b.Name.value);d.disableSelection();d.css({position:"absolute",left:c+"px",top:h+"px",width:i+"px",height:f+"px",backgroundColor:"white",zIndex:10});d.addClass("dynamicObject");
e(d).attr("id",this.options.publicVariables.Name.value);g=e('<fieldset class="picker-holder--inline-fixed" style="background-color:white; color:black"/>');g.appendTo(d);a.myPickadate=e('<input type="text" class="pickadate pickadate__input" style="width:500px;" />');a.myPickadate.appendTo(g);urlDependency=UTIL.getDirectoryByScriptFileName("jPickadate.js")+"jPickadate.js";WEBPANEL.addFile(urlDependency,function(b){a.myPickadate.pickadate({onSelect:function(){var a=this.getDate("yyyy"),c=this.getDate("mm"),
d=this.getDate("dd");a===""&&(a=0);c===""&&(c=0);d===""&&(d=0);b.internalSetDateText(this.getDate(),a,c,d,!0)}})},this);this.setVisible(b.Visible.value)},readFromXML:function(b){var a=this.options.publicVariables,b=e(b);a.Name.value=UTIL.getStringAttr(b,"Name",a.Name.value);a.DateText.value=UTIL.getStringAttr(b,"DateText",a.DateText.value);a.Date.value=UTIL.getStringAttr(b,"Date",a.Date.value);a.Day.value=UTIL.getIntAttr(b,"Day",a.Day.value);a.Month.value=UTIL.getIntAttr(b,"Month",a.Month.value);
a.Year.value=UTIL.getIntAttr(b,"Year",a.Year.value);a.Visible.value=UTIL.getStringAttr(b,"Visible",a.Visible.value);UTIL.readPositionFromXML(b,a)},internalSetDateText:function(b,a,d,e,f){var c=this.options.publicVariables;if(b!==c.DateText.value)c.DateText.value=b,c.Date.value=e+"/"+d+"/"+a,c.Year.value=a,c.Month.value=d,c.Day.value=e,f&&(this._trigger("propertyChange",null,Object({name:this.options.publicVariables.Name.value+".DateText",property:"DateText",value:c.DateText.value})),this._trigger("propertyChange",
null,Object({name:this.options.publicVariables.Name.value+".Date",property:"Date",value:c.Date.value})),this._trigger("propertyChange",null,Object({name:this.options.publicVariables.Name.value+".Year",property:"Year",value:c.Year.value})),this._trigger("propertyChange",null,Object({name:this.options.publicVariables.Name.value+".Month",property:"Month",value:c.Month.value})),this._trigger("propertyChange",null,Object({name:this.options.publicVariables.Name.value+".Day",property:"Day",value:c.Day.value})))},
setVisible:function(b){var a=this.options.publicVariables,d=this.element;if(b!==a.Visible.value)a.Visible.value=b;a.Visible.value!=="no"?UTIL.setOpacity(d,1):UTIL.setOpacity(d,0)},onPropertyChange:function(b,a){switch(b){case "Visible":this.setVisible(a)}},onReleaseCapture:function(){}})})(jQuery);
