/* * copyright by primetribe.de * */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=1;		this.endfn=function(){};		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.endAttributes[j]=[];			for(var i=0,len=atts.length;i<len;i++){				this.endAttributes[j][i]=[];				this.endAttributes[j][i][0]=atts[i][0];				if(atts[i][0]=='height' && atts[i][1]=='max'){					//$(el).setStyle('height', 'auto');					this.endAttributes[j][i][1]=this.changeValue(fullHeight(el));				}else{					this.endAttributes[j][i][1]=this.changeValue(atts[i][1]);				}			}		})		return this;	}).method('start', function(endfn){		this.endfn = endfn;		window.clearInterval(this.interval);		var thisObj = this;		this.counter = 0;		this.each(function(el, j){			this.startAttributes[j]=[];			this.morphtypes[j]=[];			for(var i=0,len=thisObj.endAttributes[j].length;i<len;i++){				this.startAttributes[j][i]=[];				this.startAttributes[j][i][0]=thisObj.endAttributes[j][i][0]=this.clearCamel(thisObj.endAttributes[j][i][0]);				this.startAttributes[j][i][1]=this.changeValue(designLib.getStyle(el, thisObj.endAttributes[j][i][0]));				this.startAttributes[j][i][0].indexOf("opacity")!=-1				?this.morphtypes[j][i]="opacity"				:this.morphtypes[j][i]=this.identify(this.endAttributes[j][i][1]);			}		})		this.interval = window.setInterval(function(){thisObj.change()}, 1);		return this;	}).method('identify', function(value){		if(value.indexOf("rgb")!=-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);					$(el).setStyle(this.endAttributes[j][i][0], newStyle);				}			})		}else{			window.clearInterval(this.interval);			if(typeof this.endfn=="function")				this.endfn();		}	}).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('toggle', function(){		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);	}).method('opacity', function(j, i){		return	(this.endAttributes[j][i][1]-this.startAttributes[j][i][1])*Math.sin(this.counter/this.fx*(Math.PI/2))+this.startAttributes[j][i][1];	})	window.morph = function(){		return new _morph(arguments);		}})();function fullHeight(elem){	if($(elem).getStyle('display')!='none')		return elem.offsetHeight+'px' || getHeight(elem);	var old = resetCSS(elem, {		display:'',		visibility:'hidden',		position:'absolute'	});	var h = elem.clientHeight+'px' || getHeight(elem);	restoreCSS(elem, old);	return h;}function getHeight(elem){	return $(elem).getStyle('height');}function resetCSS(elem, prop){	var old = {};	for(var i in prop){		old[i] = elem.style[i];		elem.style[i]=prop[i];	}	return old;}function restoreCSS(elem, prop){	for(var i in prop){		elem.style[i]=prop[i];	}}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){			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){		if($(elem).getStyle('display')!='none')			return elem.offsetHeight+'px' || getHeight(elem);				var old = resetCSS(elem, {			display:'',			visibility:'hidden',			position:'absolute'		});		var h = elem.clientHeight+'px' || getHeight(elem);		restoreCSS(elem, old);		return h;	},	fullWidth:function(elem){		if($(elem).getStyle('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;	}}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;	}}self.Drag = {		obj : null,		init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper){			o.onmousedown	= Drag.start;									o.hmode			= bSwapHorzRef ? false : true ;			o.vmode			= bSwapVertRef ? false : true ;			o.root = oRoot && oRoot != null ? oRoot : o ;			if (o.hmode  && isNaN(parseInt(o.root.style.left  ))) o.root.style.left   = "0px";			if (o.vmode  && isNaN(parseInt(o.root.style.top   ))) o.root.style.top    = "0px";			if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right  = "0px";			if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";			o.minX	= typeof minX != 'undefined' ? minX : null;			o.minY	= typeof minY != 'undefined' ? minY : null;			o.maxX	= typeof maxX != 'undefined' ? maxX : null;			o.maxY	= typeof maxY != 'undefined' ? maxY : null;			o.xMapper = fXMapper ? fXMapper : null;			o.yMapper = fYMapper ? fYMapper : null;			o.root.onDragStart	= new Function();			o.root.onDragEnd	= new Function();			o.root.onDrag		= new Function();					},		start : function(e){			var o = Drag.obj = this;			e = Drag.fixE(e);			var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);			var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );			o.root.onDragStart(x, y);			o.lastMouseX	= e.clientX;			o.lastMouseY	= e.clientY;			if (o.hmode) {				if (o.minX != null)	o.minMouseX	= e.clientX - x + o.minX;				if (o.maxX != null)	o.maxMouseX	= o.minMouseX + o.maxX - o.minX;			} else {				if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;				if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;			}			if (o.vmode) {				if (o.minY != null)	o.minMouseY	= e.clientY - y + o.minY;				if (o.maxY != null)	o.maxMouseY	= o.minMouseY + o.maxY - o.minY;			} else {				if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;				if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;			}			document.onmousemove	= Drag.drag;			document.onmouseup		= Drag.end;			return false;		},		drag : function(e){			e = Drag.fixE(e);			var o = Drag.obj;			var ey	= e.clientY;			var ex	= e.clientX;			var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);			var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );			var nx, ny;			if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);			if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);			if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);			if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);			nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));			ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));			if (o.xMapper)		nx = o.xMapper(y)			else if (o.yMapper)	ny = o.yMapper(x)			Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";			Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";			Drag.obj.lastMouseX	= ex;			Drag.obj.lastMouseY	= ey;			Drag.obj.root.onDrag(nx, ny);			return false;		},		end : function(){			document.onmousemove = null;			document.onmouseup   = null;			Drag.obj.root.onDragEnd(	parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), 										parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));			Drag.obj = null;		},		fixE : function(e){			if (typeof e == 'undefined') e = window.event;			if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;			if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;			return e;		}	};self.bigItUp={	init:function(o, bilderListe){		var _piclist = bilderListe || piclist;			delete imgMorph;		var thisObj = this;		var bigPic = new Image();				var div = $('div').get();		div.className = "prload";		$(div).setStyle('position', 'absolute');				$(div).setStyle('width', o.offsetWidth+"px");		$(div).setStyle('height', o.offsetHeight+"px");						if(typeof o !="undefined"){			$(div).setStyle('left', self.designLib.pageX(o)+"px");			$(div).setStyle('top', self.designLib.pageY(o)+"px");		}else{			$(div).setStyle('left', "100px");			$(div).setStyle('top', "100px");		}				var img = $('img').get();		$(img).setStyle('width', '100%');		$(img).setStyle('height', '100%');		img.className = "bigitdown";				var des = $('span').get();		des.className = "lbdes";				var pvimg = $('img').get();				var fn = function(req){			div.innerHTML=req;			div.firstChild.style.visibility="hidden";			$(div).append(img);						var center = $('div').get();			center.className = "aCenter";			center.align = "center";						var c = div.firstChild.childNodes[1].childNodes[2].firstChild;			if(typeof _piclist!="undefined" && _piclist.length!=1){								var nr2 = bigPic.src.lastIndexOf("/");				var pic = bigPic.src.substr(nr2+1, bigPic.src.length);				for(var i = 0; i<_piclist.length;i++){										if(pic == bigItUp.getname(_piclist[i].url)){						act = i;					}				}				var prev = $('a').get();				prev.href ="#";				$(prev).append('<< ');				$(prev).addEvent('click', function(){					if(act==0){						act=_piclist.length-1;					}else{						act--;					}					var picnew = bigPic.src.substr(0, nr2+1);					bigPic.src = picnew+bigItUp.getname(_piclist[act].url);					pvimg.src = "http://www.centa-star.de/dev/asset/img/logos/lil_logo_ani.gif";					des.innerHTML = _piclist[act].text;				});				$(center).append(prev);				pvimg.width='14';				pvimg.src = "http://www.centa-star.de/dev/asset/img/logos/lil_logo.gif";				$(center).append(pvimg);				var next = $('a').get();				next.href ="#";				$(next).append(' >>');				$(next).addEvent('click', function(){					if(_piclist.length-1==act){						act=0;					}else{						act++;					}					var picnew = bigPic.src.substr(0, nr2+1);					bigPic.src = picnew+bigItUp.getname(_piclist[act].url);					pvimg.src = "http://www.centa-star.de/dev/asset/img/logos/lil_logo_ani.gif";					des.innerHTML = _piclist[act].text;				});				$(center).append(next);								$(c).append(center);			}			if(typeof act=="undefined"){				act=0;			}			des.innerHTML = _piclist[act].text;			$(c).append(des);					}		var end = function(){			if(bigPic.src!=img.src)				img.src = bigPic.src;			//$(img).setStyle('width', '');			$(img).setStyle('height', '');			$(div).setStyle('height', '');			$(div.firstChild).setStyle("visibility","visible");			//$(div).setStyle('width', '');		}				REQUEST.send('http://www.centa-star.de/dev/prototype/frame_js.php', 'GET', '', 'text', function(req){			fn(req);			//alert(o.style.filter); 			if(typeof o.style.filter!="undefined" && o.style.filter!=""){								var iesrc = o.style.filter.split("'");								bigPic.src = bigItUp.getname(iesrc[3]);			}else{				bigPic.src = bigItUp.getname(o.src);			}		});					bigPic.onload=function(){			if(this.width>=img.width ){				img.src = this.src;				if(typeof imgMorph=='undefined'){					$(div).setStyle('height', self.designLib.fullHeight(o));					$(div).setStyle('width', self.designLib.fullWidth(o));				}							}else{				resizeImage();			}		}		if(typeof o.style.filter!="undefined" && o.style.filter!=""){			var iesrc = o.style.filter.split("'");			bigPic.src = bigItUp.getname(iesrc[3]);		}else{			bigPic.src = bigItUp.getname(o.src);		}				var lb = document.getElementById('lightbox');		lb.style.cursor = 'progress';		lb.style.display='block';				img.onload=function(){			resizeImage();			pvimg.src = "http://www.centa-star.de/dev/asset/img/logos/lil_logo.gif";		}				var lb = document.getElementById('lightbox');		$(lb).empty();		$(lb).append(div);				var resizeImage = function(){						lb.style.cursor = 'auto';			var h = bigPic.height+"px";			var w = bigPic.width+"px";						//div.firstChild.style.left=parseInt(w)/2-85+"px";			if(typeof imgMorph=='undefined'){				$(div).setStyle('height', self.designLib.fullHeight(o));								$(div).setStyle('width', self.designLib.fullWidth(o));												if(typeof div.firstChild != "undefined" && div.firstChild!=null){					div.firstChild.style.left=parseInt(w)/2-85+"px";				}				imgMorph = morph(div).setStyles([['left', Math.round(parseInt(self.designLib.fullWidth(lb))/2-parseInt(w)/2)+'px'],['top','100px'], ['width',w], ['height',h]]).start(function(){end()});			}else{				morph(div.firstChild).setStyles([['left',parseInt(w)/2-85+'px']]).start(function(){});				imgMorph = morph(div).setStyles([['width',w], ['left',parseInt(self.designLib.fullWidth(lb))/2-parseInt(w)/2+'px']]).start(function(){end()});				//$(div).setStyle('left', parseInt(self.designLib.fullWidth(lb))/2-parseInt(w)/2+'px');				//end();			}		}	},	getname:function(name){		if(typeof name =="undefined")			return false;		var nr = name.lastIndexOf(".");		var endung = name.slice(nr);		return name.substr(0, nr)+"_big"+endung;			}}