/*
 * Denbel object
 * @version: 1.0
 * @author: M.F.Endenburg
 * @copyright (c) Denbel Systems, 2007
 * www.denbel.nl
 */
var undefined;var Denbel={load:function(){var b=arguments,g=null,e,c,f;for(e=0;e<b.length;e++){f=b[e].split(".");g=Denbel;for(c=(f[0]=="Denbel")?1:0;c<f.length;c++){g[f[c]]=g[f[c]]||{};g=g[f[c]];}}return g;},toString:function(){return"Denbel";}};Denbel.load("lang.StringExtender");Denbel.lang.StringExtender=function(){};Denbel.lang.StringExtender.prototype={utf8Encode:function(){var b=this;b.replace(/\r\n/g,"\n");var a="";var e;for(var d=0;d<b.length;d++){e=b.charCodeAt(d);if(e<128){a+=String.fromCharCode(e);}else{if((e>127)&&(e<2048)){a+=String.fromCharCode((e>>6)|192);a+=String.fromCharCode((e&63)|128);}else{a+=String.fromCharCode((e>>12)|224);a+=String.fromCharCode(((e>>6)&63)|128);a+=String.fromCharCode((e&63)|128);}}}return a;},utf8Decode:function(){var b=this;var d="";var a=0;var e=c1=c2=0;while(a<b.length){e=b.charCodeAt(a);if(e<128){d+=String.fromCharCode(e);}else{if((e>191)&&(e<224)){c2=b.charCodeAt(a+1);d+=String.fromCharCode(((e&31)<<6)|(c2&63));a+=2;}else{c2=b.charCodeAt(a+1);c3=b.charCodeAt(a+2);d+=String.fromCharCode(((e&15)<<12)|((c2&63)<<6)|(c3&63));a+=3;}}}return d;},startsWith:function(a){return(this.substring(0,a.length)==a);},endsWith:function(a){return(this.substring((this.length-a.length))==a);}};YAHOO.lang.augmentProto(String,Denbel.lang.StringExtender);Denbel.load("lang.Date");Denbel.lang.Date={stringToDate:function(e){if(!e||e.length==0){return null;}var g=e.split(" ");var a=null;if(g[0].indexOf("-")>-1){a="-";}else{if(g[0].indexOf("/")>-1){a="/";}else{return null;}}var b=0;var c=g[0].split(a);var h=new Date();h.setFullYear(c[0]);h.setMonth(c[1]-1);h.setDate(c[2]);if(g.length>1){a=":";var f=g[1].split(a);h.setHours(f[0]);h.setMinutes(f[1]);h.setSeconds(f[2]);}return h;},format:function(h,b){try{var c=(b.getMonth()+1);c=(c.toString().length==2)?c:"0"+c;var a=b.getFullYear();var g=(b.getDate().toString().length==2)?b.getDate().toString():"0"+b.getDate().toString();var j=(b.getHours().toString().length==2)?b.getHours().toString():"0"+b.getHours().toString();var e=(b.getMinutes().toString().length==2)?b.getMinutes().toString():"0"+b.getMinutes().toString();var k=(b.getSeconds().toString().length==2)?b.getSeconds().toString():"0"+b.getSeconds().toString();return Denbel.util.replaceAll(["Y","m","d","H","i","s"],[a,c,g,j,e,k],h);}catch(f){return k;}},dateToString:function(a){return a.getFullYear().toString()+"-"+(a.getMonth()+1)+"-"+a.getDate()+" "+a.getHours()+":"+a.getMinutes()+":"+a.getSeconds();}};Denbel.load("lang.Array");Denbel.lang.Array.prototype={contains:function(a){return Denbel.util.inArray(a,this,false);},indexOf:function(a){return Denbel.util.inArray(a,this,true);},asString:function(){return"Array["+this.length+"]";}};YAHOO.lang.augmentProto(Array,Denbel.lang.Array);Denbel.load("util.inArray");Denbel.util.inArray=function(f,e,a){if(!e||!YAHOO.lang.isArray(e)||e.length==0){return null;}var d=false;var b=null;for(var c=0;c<e.length;c++){if(e[c]==f){d=true;b=c;break;}}if(a&&d){return b;}else{return d;}};Denbel.load("util.getHeight");Denbel.util.getHeight=function(a){if(!a){return null;}if(YAHOO.lang.isString(a)){a=YAHOO.util.Dom.get(a);}if(!a){return null;}return a.offsetHeight;};Denbel.load("util.replaceAll");Denbel.util.replaceAll=function(e,d,c){if(!YAHOO.lang.isString(c)){YAHOO.log("replaceAll expects the argument subject as a string","error","Denbel.util.replaceAll");return c;}if(YAHOO.lang.isArray(e)&&YAHOO.lang.isArray(d)){var a=0;if(d.length<=e.length){a=d.length;}else{a=e.length;}for(var b=0;b<a;b++){c=Denbel.util.replaceAll(e[b],d[b],c);}}else{if(YAHOO.lang.isArray(e)){for(var b=0;b<e.length;b++){c=Denbel.util.replaceAll(e[b],d,c);}}else{while(c.indexOf(e)>-1){c=c.replace(e,d);}}}return c;};Denbel.load("util.stripTags");Denbel.util.stripTags=function(a){return a.replace(/<\/?[^>]+>/gi,"");};Denbel.load("util.htmlEntities");Denbel.util.htmlEntities=function(a){return Denbel.util.replaceAll(["&",'"',">","<"],["&amp;","&quot;","&gt;","&lt;"],a);};Denbel.load("util.round");Denbel.util.round=function(b,a){if(!YAHOO.lang.isNumber(b)){b=parseFloat(b);if(!YAHOO.lang.isNumber(b)){YAHOO.log("Input number not numeric.","error","Denbel.util.round");return"NaN";}}if(!a||a==0){b=Math.round(b);}else{b=b.toFixed(a);}return b;};Denbel.load("util.Rand");Denbel.util.Rand=function(b,a){if(b==null||a==null){return(Math.random()*10000);}return Math.floor(((a-(b-1))*Math.random())+b);};Denbel.load("util.formatNumber");Denbel.util.formatNumber=function(h,f,e,c){if(!YAHOO.lang.isNumber(h)){h=parseFloat(h);if(!YAHOO.lang.isNumber(h)){YAHOO.log("Input number not numeric.","error","Denbel.util.formatNumber");return"NaN";}}if(!f){f=0;}if(!e){e=".";}if(!c){c=",";}h=h.toString();var g=h.indexOf(".");var b=0;if(g==-1){if(f>0){h+=".";for(b=0;b<f;b++){h+="0";}}}else{var a=h.substring((g+1)).length;if(a>f){h=Denbel.util.round(h,f).toString();}else{if(a<f){for(b=a;b<f;b++){h+="0";}}}}return h;};Denbel.load("util.isA");Denbel.util.isA=function(d,a){if(!YAHOO.lang.isString(a)||!YAHOO.lang.isObject(d)){YAHOO.log("isA( x, y ): invalid data type for argument","error");return false;}var b=false;try{switch(Denbel.util.BrowserDetect.browser){case"Firefox":b=((d.constructor.toString().toLowerCase()=="["+a.toLowerCase()+"]")?true:false);break;case"Explorer":if(d.tagName){var f="HTML"+d.tagName+"Element";b=((f.toLowerCase()==a.toLowerCase())?true:false);}else{b=((d.toString().toLowerCase()==a.toLowerCase())?true:false);}break;case"Safari":b=((d.toString().toLowerCase()=="[object "+a.toLowerCase()+"]")?true:false);break;default:b=false;break;}}catch(c){YAHOO.log("Error: "+c,"error");b=false;}return b;};Denbel.load("lang.Object");Denbel.lang.Object=function(){this.properties=new Array();this.propertyValues=new Array();};Denbel.lang.Object.prototype={properties:null,propertyValues:null,get:function(a){var b=Denbel.util.inArray(a,this.properties,true);if(b==null){return null;}return this.propertyValues[b];},set:function(a,d){var c=Denbel.util.inArray(a,this.properties,true);if(c){this.propertyValues[c]=d;}else{this.properties.push(a);var b=(this.properties.length-1);this.propertyValues[b]=d;}},toArray:function(){var a=new Array();var b="";var d="";for(var c=0;c<this.properties.length;c++){a[this.properties[c]]=this.propertyValues[c];}return a;},toString:function(){return"Denbel.lang.Object";}};Denbel.load("util.BrowserDetect");Denbel.util.BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS";},toString:function(){return this.browser+" "+this.version+" "+this.OS;},searchString:function(d){for(var a=0;a<d.length;a++){var b=d[a].string;var c=d[a].prop;this.versionSearchString=d[a].versionSearch||d[a].identity;if(b){if(b.indexOf(d[a].subString)!=-1){return d[a].identity;}}else{if(c){return d[a].identity;}}}},searchVersion:function(b){var a=b.indexOf(this.versionSearchString);if(a==-1){return;}return parseFloat(b.substring(a+this.versionSearchString.length+1));},dataBrowser:[{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};Denbel.util.BrowserDetect.init();YAHOO.log("Browser detected: "+Denbel.util.BrowserDetect.browser+" "+Denbel.util.BrowserDetect.version+" on "+Denbel.util.BrowserDetect.OS);
