/* 
 * wrapScroll
 * Copyright 2007 youmos <youmos.com@gmail.com>
 * http://youmos.com/project/wrapresize
 * 
 * The wrapResize is licensed under a 
 * Creative Commons Attribution-NonCommercial-ShareAlike License.
 *
 * http://creativecommons.org/licenses/by-nc-sa/3.0/
 *
 * It is provided "as is" and without warranty of any kind. If you wish to continue to use it,
 * free for personal or non-commercial use, $30 for commercial use,
 * or transform and build your script upon this work to distribute.
 * The permission is valid for all future versions of wrapResize.
*/
/*--- wrapresize.js ---*/
var wrapResize=function(){this.initialize.apply(this,arguments);};wrapResize.prototype={Version:'0.5.0',Interval:1000,_obj:null,_api:null,initialize:function(){this._api=[];this._pre=[];this.attach(window,'load',this.bind(this.prepare,arguments));},prepare:function(e,f,p){if(this._obj=(typeof e=='object')?e:document.getElementById(e)){this.addevent(f,p);this.callback();}},addevent:function(f,p){return((typeof f=='function')&&(this._api.length!=this._api.push({'f':f,'p':p})));},callback:function(){var r=this.event.update(this);setTimeout(this.bind(this.callback),(r)?100:this.Interval);},bind:function(method,arg){var _this=this;var _arg=(arg)?arg:[];return function(){method.apply(_this,_arg);}},attach:function(e,name,func,cap){if(e.addEventListener){e.addEventListener(name,func,cap);}else if(e.attachEvent){e.attachEvent('on'+name,func);}},addEvent:function(f,p){this.addevent(f,p);}};wrapResize.prototype.event={update:function(t){var height=this.height(t._obj);var width=this.width(t._obj);var cur=[height,width];t._check=(t._pre.join()!=cur.join())?0:(t._check==0)?1:2;if((t._pre=cur)&&(t._check==1)){for(var i=0;i<t._api.length;i++){if((!t._api[i].p)||eval(t._api[i].p)){t._api[i].f.apply(t._api[i].f,cur);}}}return(t._check==0);},height:function(o){if(o!=window){return o.offsetHeight||document.body.scrollHeight||document.documentElement.scrollHeight;}else{return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;}},width:function(o){if(o!=window){return o.offsetWidth||document.body.scrollWidth||document.documentElement.scrollWidth;}else{return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;}}};
