if(typeof(obipswb)=="undefined"||obipswb==null){obipswb=function(){}}obipswb.findType=function(a){if(a=="text"){return"string"}else{if(a=="integer"||a=="real"){return"decimal"}else{if(a=="timeStamp"){return"dateTime"}}}return a};obipswb.AddExpression=function(a,d,b){var c=XUICreateElement(saw.xml.kSawxNamespace,"expr");XUISetXsiType(c,saw.xml.kXsdNamespace,obipswb.findType(b));XUISetElementText(c,d);if(a!=null){a.appendChild(c)}return c};obipswb.AddNullExpression=function(a){var b=XUICreateElement(saw.xml.kSawxNamespace,"expr");XUISetXsiType(b,saw.xml.kSawxNamespace,"null");if(a!=null){a.appendChild(b)}return b};obipswb.FixInput=function(e,a){var d=null;var c=null;switch(a){case"real":if(e==""){return e}e=e.replace(g_LocaleInfo.sDecimalPoint,".");d=e.match(/^\s*([+\-]?[0-9]*(?:\.[0-9]*)?(?:[Ee][+\-]?[0-9]+)?)\s*$/);if(d!=null&&d[1].match(/^\s*\.?\s*$/)==null){e=d[1]}else{throw kmsgWBInvalidInput+e}break;case"integer":if(e==""){return e}d=e.match(/^\s*([+\-]?[0-9]+(?:[Ee][+\-]?[0-9]+)?)\s*$/);if(d!=null){e=d[1]}else{throw kmsgWBInvalidInput+e}break;case"date":case"timeStamp":case"time":var c=new DateTimeParser();var b=null;if(a=="date"){b=c.parseDate(e);e=(b==null)?e:b.asXsiDate()}else{if(a=="timeStamp"){b=c.parseDateTime(e);e=(b==null)?e:b.asXsiDateTime()}else{if(a=="time"){b=c.parseTime(e);e=(b==null)?e:b.asXsiTime()}}}break;default:}return e};obipswb.DateTimePickerField=function(b,e,a,c,d){this.floatingWindowManager=e;this.date=null;this.input=b;b.pickerField=this;this.dateType=a;this.table=c;this.bInsert=d;if(b.value){this.date=WBDateTimeConvertDate(a,b.value)}};obipswb.DateTimeConvertDate=function(a,k){var e=null;var j=null;var i=new DateTimeParser();var l="(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London";if(a=="datePicker"){e=i.parseDate(k)}else{if(a=="dateTimePicker"){e=i.parseDateTime(k)}else{if(a=="timePicker"){e=i.parseTime(k)}}}if(e){var g=valueOrNull(e.year,0);var f=valueOrNull(e.month,0);if(f>0){--f}var h=valueOrNull(e.day,0);var d=valueOrNull(e.hour,0);var c=valueOrNull(e.minute,0);var b=valueOrNull(e.second,0);j=new obips.DateTime.DateTime(g,f,h,d,c,b,l)}return j};obipswb.valueOrNull=function(b,a){if(b){return b}else{return a}};obipswb.DateTimePickerField.globalFloatingWindowManager=null;obipswb.DateTimePickerField.prototype.launchPicker=function(){var c=true;var e=true;if(this.dateType=="datePicker"){e=false}else{if(this.dateType=="timePicker"){c=false}}var b=new obips.Callback(this,this.acceptValueFromPicker);var d=new obips.DateTimePicker.Model(b,this.date,c,e,this.floatingWindowManager.resourceManager);var a=new obips.DateTimePicker.Viewer(d,this.floatingWindowManager)};obipswb.DateTimePickerField.prototype.acceptValueFromPicker=function(c){this.date=c.chosenDateTime;var b;var a;if(this.dateType=="datePicker"){b=this.date.toLocaleDateString();a=this.date.getXSDDate()}else{if(this.dateType=="timePicker"){b=this.date.toLocaleTime24String();a=this.date.getXSDTime()}else{b=this.date.toLocaleString();a=this.date.getXSDDateTime()}}this.value=b;this.dateValue=a;this.input.value=this.value;this.xmlValue=a;if(this.bInsert==false){WBInputChange(this.input,this.table)}};obipswb.DateTimePickerField.launchDateTimePicker=function(a,f,k,d){if(WBDateTimePickerField.globalFloatingWindowManager==null){var h=obips.ResourceManager.getSingleton();WBDateTimePickerField.globalFloatingWindowManager=obips.FloatingWindow.Manager.getSingleton()}var j=saw.getEventTarget(a);var b=null;if(j){var c=j.parentNode;if(c.tagName!="TD"){c=j.parentNode.parentNode}var g=c.getElementsByTagName("INPUT");if(g.length>0){b=g[0]}}var e=b;var i=null;if(e&&e.pickerField){i=e.pickerField}else{i=new WBDateTimePickerField(e,WBDateTimePickerField.globalFloatingWindowManager,f,k,d)}i.launchPicker()};