Function.prototype.method=function(name, fn){	this.prototype[name]=fn;	return this; };(function(){	function _morph(elems){		var thisObj = this;		this.elements=[];		this.startAttributes=[];		this.endAttributes=[];		this.morphtypes=[];		this.counter=0;		this.fx=20;		for(var i=0, len=elems.length;i<len;i++){			var element=elems[i];			if(typeof element==='string')				element = document.getElementById(element);				this.elements.push(element);		}	}	_morph.method('each',function(fn){		for(var i=0,len=this.elements.length;i<len; i++){			fn.call(this, this.elements[i], i);		}	}).method('setStyles', function(atts){		this.each(function(el, j){			this.startAttributes[j]=[];			this.morphtypes[j]=[];			for(var i=0,len=atts.length;i<len;i++){				this.startAttributes[j][i]=[];				this.startAttributes[j][i][0]=atts[i][0];				////morphtype				atts[i][0].indexOf("opacity")!=-1				?this.morphtypes[j][i]="opacity"				:this.morphtypes[j][i]=this.identify(atts[i][1]);				if(typeof console!='undefined')					console.log(this.morphtypes[j][i]);												if(atts[i][0]=='height' && atts[i][1]=='max'){					this.startAttributes[j][i][1]=this.changeValue(self.DOOMLIB.getFullHeight(el));				}else{					this.startAttributes[j][i][1]=this.changeValue(atts[i][1]);				}			}		})		return this;	}).method('start', function(onMorphEnd, gesch, onMorphEnd2){		this.fx = gesch || this.fx;		this._onMorphEnd = onMorphEnd;		this._onMorphEnd2 = onMorphEnd2;						window.clearInterval(this.interval);		var thisObj = this;		this.counter = 0;		this.each(function(el, j){			this.endAttributes[j]=[];			for(var i=0,len=thisObj.startAttributes[j].length;i<len;i++){				this.endAttributes[j][i]=[];				this.endAttributes[j][i][0]=thisObj.startAttributes[j][i][0]=this.clearCamel(thisObj.startAttributes[j][i][0]);								if(thisObj.startAttributes[j][i][0]=='opacity')					var aktStyle = this.changeValue(self.DOOMLIB.getStyle(el, thisObj.startAttributes[j][i][0]))*100;				else					var aktStyle = this.changeValue(self.DOOMLIB.getStyle(el, thisObj.startAttributes[j][i][0]));								if(aktStyle==''){					aktStyle = self.DOOMLIB.getComStyle(el, thisObj.startAttributes[j][i][0]);				}				//alert(aktStyle);				this.endAttributes[j][i][1]=aktStyle;			}		})		//this.interval = window.setInterval(function(){thisObj.change()}, 1);		return this;	}).method('identify', function(value){		if(value.indexOf("rgb")!=-1||value.indexOf("#")!=-1||value.indexOf(",")!=-1)return "hex";		if(value.indexOf("px")!=-1||value.indexOf("%")!=-1)return "eese";		return "linear";	}).method('changeValue', function(value){		if(value.indexOf("rgb")!=-1||value.indexOf("#")!=-1)return hexToRgb(value);		if(value.indexOf("px")!=-1||value.indexOf("%")!=-1)return value;		return value;	}).method('clearCamel', function(att){		attarr = att.split("-");		for(var i=1;i<attarr.length;i++){			attarr[i] = attarr[i].toLowerCase().replace(/\b([a-z])/gi,function(c){return c.toUpperCase()});		}		return attarr.join('');	}).method('change', function(){				if(this.counter<this.fx){			this.counter++;			this.each(function(el, j){				for(var i=0,len=this.startAttributes[j].length;i<len;i++){					var newStyle = this[this.morphtypes[j][i]](j, i);					if(this.endAttributes[j][i][0]!='opacity'){						$(el).setStyle(this.endAttributes[j][i][0], newStyle);					}else{						$(el).setOpacity(newStyle);					}				}			})		}else{			window.clearInterval(this.interval);						if(typeof this._onMorphEnd=="function") this._onMorphEnd();		}	}).method('linear', function(j, i){			return (parseInt(this.endAttributes[j][i][1])-parseInt(this.startAttributes[j][i][1]))/this.fx*this.counter+parseInt(this.startAttributes[j][i][1])+"px";	}).method('eese', function(j, i){			return	(parseInt(this.endAttributes[j][i][1])-parseInt(this.startAttributes[j][i][1]))*Math.sin(this.counter/this.fx*(Math.PI/2))+parseInt(this.startAttributes[j][i][1])+"px";	}).method('hex', function(j, i){		var r=(this.endAttributes[j][i][1][0]-this.startAttributes[j][i][1][0])*this.counter/this.fx+this.startAttributes[j][i][1][0];		var g=(this.endAttributes[j][i][1][1]-this.startAttributes[j][i][1][1])*this.counter/this.fx+this.startAttributes[j][i][1][1];		var b=(this.endAttributes[j][i][1][2]-this.startAttributes[j][i][1][2])*this.counter/this.fx+this.startAttributes[j][i][1][2];		return "rgb("+r+"%, "+g+"%, "+b+"%)";	}).method('opacity', function(j, i){		return	parseInt(this.startAttributes[j][i][1])+(this.endAttributes[j][i][1]-this.startAttributes[j][i][1])*this.counter/this.fx;	}).method('toggle', function(){			this._onMorphEnd3 = this._onMorphEnd2;		this._onMorphEnd2 = this._onMorphEnd;		this._onMorphEnd = this._onMorphEnd3;							window.clearInterval(this.interval);		var thisObj = this;		var temparr = this.endAttributes;		this.counter = 0;		this.endAttributes = this.startAttributes;		this.startAttributes= temparr;		this.interval = window.setInterval(function(){thisObj.change()}, 10);	})	window.morph = function(){		return new _morph(arguments);		}})();function getHeight(elem){	return self.DOOMLIB.getStyle(elem, 'height');}self.designLib={	pageX:function(elem){		return elem.offsetParent ? elem.offsetLeft+designLib.pageX(elem.offsetParent):elem.offsetLeft;	},	pageY:function(elem){		return elem.offsetParent ? elem.offsetTop+designLib.pageY(elem.offsetParent):elem.offsetTop;	},	getStyle:function(elem, name){		if(elem.style[name])return elem.style[name];		else if(elem.currentStyle) return elem.currentStyle[name];		else if(document.defaultView&&document.defaultView.getComputedStyle){			alert(typeof name.replace);			name = name.replace(/[A-Z]/g,"-$1");			name = name.toLowerCase();			var s = document.defaultView.getComputedStyle(elem,"");			return s && s.getPropertyValue(name);		}else{						return null;		}	},	fullHeight:function(elem){		var old = resetCSS(elem, {			height:'',			display:'',			visibility:'hidden',			position:'absolute'		});		if(self.DOOMLIB.getStyle(elem, 'display')!='none'){			var h = elem.offsetHeight+'px' || getHeight(elem);			restoreCSS(elem, old);			return h;		}				var h = elem.clientHeight+'px' || getHeight(elem);		restoreCSS(elem, old);		return h;	},	fullWidth:function(elem){		if(self.DOOMLIB.getStyle(elem, 'display')!='none')			return elem.offsetWidth+'px' || getWidth(elem);		var old = resetCSS(elem, {			display:'',			visibility:'hidden',			position:'absolute'		});		var h = elem.clientWidth+'px' || getWidth(elem);		restoreCSS(elem, old);		return h;	},	px2pc:function(elem){		var popx = parseInt(self.designLib.fullWidth(elem.parentNode));		var opx = parseInt(self.designLib.fullWidth(elem));		return Math.floor(100*opx/popx);	}}function hexToRgb(color){	if(color.indexOf("rgb")>-1){		color = color.replace(/rgb\((.+)\).*/gi,"$1");		color = color.split(",");				for(i in color){			color[i]=Math.round(parseInt(color[i])*100/255);		}		return color//"rgb("+color[0]+"%, "+color[1]+"%, "+color[2]+"%)";	}else if(color.indexOf("#")>-1){		color = color.toUpperCase();		var a = dec(color.substring(1, 2));		var b = dec(color.substring(2, 3));				var c = dec(color.substring(3, 4));		var d = dec(color.substring(4, 5));						var e = dec(color.substring(5, 6));		var f = dec(color.substring(6, 7));						var x = (a * 16) + b;		var y = (c * 16) + d;		var z = (e * 16) + f;				return hexToRgb("rgb("+x+","+y+","+z+")");	}else if(color.indexOf("transparent")>-1){		return hexToRgb("rgb(100%,100%,100%)");	}	function dec(Hex){		if(Hex == "A")			Value = 10;		else if(Hex == "B")			Value = 11;		else if(Hex == "C")			Value = 12;		else if(Hex == "D")			Value = 13;		else if(Hex == "E")			Value = 14;		else if(Hex == "F")			Value = 15;		else			Value = eval(Hex);		return Value;	}}
