/**
 * doijs package
 * 
 * @author donna iwan setiawan
 * @version 0.1 
 * copyright - (c) 2007 - 2008 donna iwan setiawan
 * license - GPL version 3 or any later version <http://www.gnu.org/licenses/gpl-3.0.txt>
 */
doi.dom={debug:function(el,prefix,level){var o='';if(!level && level !=0){level=1;}if(!prefix){prefix='object';}level=this.parseInt(level);if(this.isObject(el)&& level > 0){for(var i in el){o+=this.debug(el[i],prefix+'.'+i,level-1);}}else{o+=prefix+'='+el+"\n";}return o;},getBodyScroll:function(){var t=0;var l=0;var w=0;var h=0;if(document.documentElement && document.documentElement.scrollTop){t=document.documentElement.scrollTop;l=document.documentElement.scrollLeft;w=document.documentElement.scrollWidth;h=document.documentElement.scrollHeight;}else{t=document.body.scrollTop;l=document.body.scrollLeft;w=document.body.scrollWidth;h=document.body.scrollHeight;}return {scrollLeft:l,scrollTop:t,scrollWidth:w,scrollHeight:h};},getClientDimension:function(){var dim={width:0,height:0};if(self.innerWidth){dim.width=self.innerWidth;dim.height=self.innerHeight;}else if(document.documentElement && document.documentElement.clientWidth){dim.width=document.documentElement.clientWidth;dim.height=document.documentElement.clientHeight;}else if(document.body){dim.width=document.body.clientWidth;dim.height=document.body.clientHeight;}return dim;},getClientSize:function(){return this.getClientDimension();},getElement:function(element){if(this.isElement(element)){return element;}else if(this.isString(element)){return doi.dom.getElementById(element);}return false;},getElementById:function(id){if(document.all){return document.all(id);}else if(document.getElementById){return document.getElementById(id);}return null;},getElementsByName:function(name){if(!doi.browser ||(doi.browser && doi.browser.getName()=='Explorer')){var allTags=document.getElementsByTagName('*');var elements=[];for(var i=0;i < allTags.length;i++){if((allTags[i].name && allTags[i].name==name)||(allTags[i].getAttribute('name')==name)){elements[elements.length]=allTags[i];}}return elements;}else{if(document.getElementsByName){return document.getElementsByName(name);}}return false;},getElementsByTagName:function(tagName){if(document.getElementsByTagName){return document.getElementsByTagName(tagName);}return false;},getScreenDimension:function(){if(document.body.scrollHeight > document.body.offsetHeight){return {width:document.body.scrollWidth,height:document.body.scrollHeight};}else{return {width:document.body.offsetWidth,height:document.body.offsetHeight};}},getScreenSize:function(){return this.getScreenDimension();},getStyle:function(element,property){if(!this.isElement(element)){return false;}if(!property && !property.split){return false;}var att=property.split(';');var calculatedStyle={};for(var i=0;i < att.length;i++){if(!att[i].replace || att[i]==''){continue;}var ieProp=att[i].replace(/\-(\w{1})/g,function(){return arguments[1].toUpperCase()});if(element.currentStyle){calculatedStyle[att[i]]=element.currentStyle[ieProp];}else if(window.getComputedStyle){calculatedStyle[att[i]]=window.getComputedStyle(element,null)[att[i]];}}var j=0;for(var k in calculatedStyle){j++;}if(j <=0){return false;}else if(j==1){return calculatedStyle[att[0]];}else{return calculatedStyle;}return false;},getPos:function(el){if(!this.isElement(el)){return {x:0,y:0};}var x=0;var y=0;if(el.offsetParent){while(el){x+=el.offsetLeft || 0;y+=el.offsetTop || 0;el=el.offsetParent;}}return {x:x+doi.body.offsetLeft,y:y+doi.body.offsetTop};},isBoolean:function(b){return this._isSomething(b,'boolean');},isElement:function(element){return(element && element.tagName);},isFunction:function(f){return this._isSomething(f,'function');},isNumber:function(n){return this._isSomething(n,'number');},isObject:function(object){return this._isSomething(object,'object');},_isSomething:function(something,type){return(typeof something==type);},isString:function(string){return this._isSomething(string,'string');},isUndefined:function(something){return(something==undefined);},parseAttribute:function(att){var attribute={};if(att && att.split){var splt=att.split(';');var l=splt.length;for(var i=0;i < l;i++){var tmp=splt[i].split(':');if(tmp[0] !=''){tmp[0]=tmp[0].replace(/\-(\w{1})/g,function(){return arguments[1].toUpperCase()});attribute[tmp[0]]=tmp[1];}}}return attribute;},parseInt:function(value){value=parseInt(value);if(isNaN(value)){value=0;}return value;},stopEvent:function(ev){this.stopPropagation(ev);},stopPropagation:function(ev){if(!ev){var ev=window.event;}ev.cancelBubble=true;if(ev.stopPropagation){ev.stopPropagation();}}};
