﻿var active;
if (!active) active = {};
active.forwards = 1; // const
active.backwards = 2; // const
active.linearTransition = 1; // const
active.sinusoidalTransition = 2; // const
if (!active.effect) active.effect = {};
/*
***************************************************************
*active.effect.Registry
***************************************************************
*/
active.effect.Registry = function(){
	this.elements = new Array();
	_AnimatedElement = function (element){
		this.element = element;
		this.currentEffect = -1;
		this.effectArray = new Array();
	};
	this.AnimatedElement = _AnimatedElement;
};
Object.Ext(active.effect.Registry.prototype,{
	getRegisteredEffect : function(element, effect){
		var eleIdx = this.getIndexOfElement(element);
		if (eleIdx == -1){
			this.elements[this.elements.length] = new this.AnimatedElement(element);
			eleIdx = this.elements.length - 1;
		}
		var foundEffectArrayIdx = -1;
		for (var i = 0; i < this.elements[eleIdx].effectArray.length; i++){
			if (this.elements[eleIdx].effectArray[i]){
				if (this.effectsAreTheSame(this.elements[eleIdx].effectArray[i], effect)){
					foundEffectArrayIdx = i;
					if (this.elements[eleIdx].effectArray[i].isRunning == true) {
						this.elements[eleIdx].effectArray[i].cancel();
					}
					this.elements[eleIdx].currentEffect = i;
					if (this.elements[eleIdx].effectArray[i].options && (this.elements[eleIdx].effectArray[i].options.toggle != null)) {
						if (this.elements[eleIdx].effectArray[i].options.toggle == true)
							this.elements[eleIdx].effectArray[i].doToggle();
					} else {
						this.elements[eleIdx].effectArray[i] = effect;
					}
					break;
				}
			}
		}
		if (foundEffectArrayIdx == -1){
			var currEffectIdx = this.elements[eleIdx].effectArray.length;
			this.elements[eleIdx].effectArray[currEffectIdx] = effect;
			this.elements[eleIdx].currentEffect = currEffectIdx;
		}
		var idx = this.elements[eleIdx].currentEffect;
		return this.elements[eleIdx].effectArray[idx];
	},
	getIndexOfElement : function(element){
		var registryIndex = -1;
		for (var i = 0; i < this.elements.length; i++){
			if (this.elements[i]) {
				if (this.elements[i].element == element)
					registryIndex = i;
			}
		}
		return registryIndex;
	},
	effectsAreTheSame : function(effectA, effectB){
		if (effectA.name != effectB.name) 
			return false;
		if(effectA.effectsArray != null){
			for (var i = 0; i < effectA.effectsArray.length; i++){
				if(!e.optionsAreIdentical(effectA.effectsArray[i].effect.options, effectB.effectsArray[i].effect.options))
					return false;
			}
		}
		else{
			if(!e.optionsAreIdentical(effectA.options, effectB.options))
				return false;
		}
		return true;
	}
});
var Registry = new active.effect.Registry;
/*
***************************************************************
*active.effect.Animator
***************************************************************
*/
active.effect.Animator = function(options){
	this.name = 'Animator';
	this.element = null;
	this.timer = null;
	this.direction = active.forwards;
	this.startMilliseconds = 0;
	this.repeat = 'none';
	this.isRunning = false;
	this.options = {
		duration: 500,
		toggle: false,
		transition: active.linearTransition,
		interval: 33 // ca. 30 fps
	};
	this.setOptions(options);
};
Object.Ext(active.effect.Animator.prototype,{
	setOptions : function(options){
		if (!options)
			return;
		for (var prop in options)
			this.options[prop] = options[prop];
	},
	start : function(withoutTimer){
		if (arguments.length == 0)
			withoutTimer = false;
		var self = this;
		if (this.options.setup){
			try{
				this.options.setup(this.element, this);
			}
			catch (zhj) {alert(zhj.description);}
		}
		this.prepareStart();
		var currDate = new Date();
		this.startMilliseconds = currDate.getTime();
		if (withoutTimer == false) {
			this.timer = setInterval(function() { self.drawEffect(); }, this.options.interval);
		}
		this.isRunning = true;
	},
	stop : function(){
		if (this.timer) {
			clearInterval(this.timer);
			this.timer = null;
		}
		this.startMilliseconds = 0;
		if (this.options.finish){
			try{
				this.options.finish(this.element, this);
			}
			catch (zhj) {alert(zhj.description);}
		}
		this.isRunning = false;
	},
	cancel : function(){
		if (this.timer) {
			clearInterval(this.timer);
			this.timer = null;
		}
		this.isRunning = false;
	},
	drawEffect : function(){
		var isRunning = true;
		var position = this.getElapsedMilliseconds() / this.options.duration;
		if (this.getElapsedMilliseconds() > this.options.duration) {
			position = 1.0;
		} else {
			if (this.options.transition == active.sinusoidalTransition){
				position = (-Math.cos(position*Math.PI)/2) + 0.5;
			}
			else if (this.options.transition == active.linearTransition){
				// default: linear
			}
			else{
				alert('unknown transition');
			}
			
		}
		this.animate(position);
		if (this.getElapsedMilliseconds() > this.options.duration) {
			this.stop();
			isRunning = false;
		}
		return isRunning;
	},
	getElapsedMilliseconds : function(){
		if (this.startMilliseconds > 0) {
			var currDate = new Date();
			return (currDate.getTime() - this.startMilliseconds);
		} else {
			return 0;
		}
	},
	doToggle : function(){
		if (this.options.toggle == true) {
			if (this.direction == active.forwards) {
				this.direction = active.backwards;
			} else if (this.direction == active.backwards) {
				this.direction = active.forwards;
			}
		}
	},
	prepareStart : function(){
	},
	animate : function(position){
	}
});
/*
***************************************************************
*active.effect.Move
***************************************************************
*/
active.effect.Move = function(element, fromPos, toPos, options){
	this.dynamicFromPos = false;
	if (arguments.length == 3){
		options = toPos;
		toPos = fromPos;
		fromPos = e.getPosition(element);
		this.dynamicFromPos = true;
	}
	active.effect.Animator.call(this, options);
	this.name = 'Move';
	this.element = $(element);
	if (fromPos.units != toPos.units)
		alert('active.effect.Move: Conflicting units (' + fromPos.units + ', ' + toPos.units + ')');
	this.units = fromPos.units;
	this.startX = fromPos.x;
	this.stopX = toPos.x;
	this.startY = fromPos.y;
	this.stopY = toPos.y;
	this.rangeMoveX = this.startX - this.stopX;
	this.rangeMoveY= this.startY - this.stopY;
};
active.effect.Move.prototype = new active.effect.Animator();
Object.Ext(active.effect.Move.prototype,{
	constructor : active.effect.Move,
	animate : function(position){
		var left = 0;
		var top = 0;
		if (this.direction == active.forwards) {
			left = this.startX - (this.rangeMoveX * position);
			top = this.startY - (this.rangeMoveY * position);
		} else if (this.direction == active.backwards) {
			left = this.rangeMoveX * position + this.stopX;
			top = this.rangeMoveY * position + this.stopY;
		}
		this.element.style.left = left + this.units;
		this.element.style.top = top + this.units;
	},
	prepareStart : function() {
		if (this.dynamicFromPos == true){
			var fromPos = e.getPosition(this.element);
			this.startX = fromPos.x;
			this.startY = fromPos.y;
			
			this.rangeMoveX = this.startX - this.stopX;
			this.rangeMoveY= this.startY - this.stopY;
		}
	}
});
/*
***************************************************************
*active.effect.MoveSlide
***************************************************************
*/
active.effect.MoveSlide = function(element, fromPos, toPos, horizontal, options){
	this.dynamicFromPos = false;
	if (arguments.length == 4){
		options = horizontal;
		horizontal = toPos;
		toPos = fromPos;
		fromPos = e.getPosition(element);
		this.dynamicFromPos = true;
	}
	active.effect.Animator.call(this, options);
	this.name = 'MoveSlide';
	this.element = $(element);
	this.horizontal = horizontal;
	this.firstChildElement = e.getFirstChildElement(element);
	this.overflow = e.getStyle(this.element, 'overflow');
	this.originalChildRect = e.getDimensionsClosed(this.firstChildElement, this.element);
	if (fromPos.units != toPos.units)
		alert('active.effect.MoveSlide: Conflicting units (' + fromPos.units + ', ' + toPos.units + ')');
	this.units = fromPos.units;
	var originalRect = e.getDimensionsClosed(element);
	this.startHeight = originalRect.height;
	this.startX = Number(fromPos.x);
	this.stopX = Number(toPos.x);
	this.startY = Number(fromPos.y);
	this.stopY = Number(toPos.y);
	this.rangeMoveX = this.startX - this.stopX;
	this.rangeMoveY = this.startY - this.stopY;
	this.enforceVisible = e.isVisible(this.element);
};
active.effect.MoveSlide.prototype = new active.effect.Animator();
Object.Ext(active.effect.MoveSlide.prototype,{
	constructor : active.effect.MoveSlide,
	animate : function(position){
		if(this.horizontal){
			var xStart      = (this.direction == active.forwards) ? this.startX : this.stopX;
			var xStop       = (this.direction == active.forwards) ? this.stopX : this.startX;
			var eltWidth    = xStart + position * (xStop - xStart);
			if(eltWidth<0) eltWidth = 0;
			if(this.overflow != 'scroll' || eltWidth > this.originalChildRect.width)
				this.firstChildElement.style.left = eltWidth - this.originalChildRect.width + this.units;
			this.element.style.width = eltWidth + this.units;
		}
		else{
			var yStart      = (this.direction == active.forwards) ? this.startY : this.stopY;
			var yStop       = (this.direction == active.forwards) ? this.stopY : this.startY;
			var eltHeight   = yStart + position * (yStop - yStart);
			if(eltHeight<0) eltHeight = 0;
			if(this.overflow != 'scroll' || eltHeight > this.originalChildRect.height)
				this.firstChildElement.style.top = eltHeight - this.originalChildRect.height + this.units;
			this.element.style.height = eltHeight + this.units;
		}
		if(this.enforceVisible){
			e.enforceVisible(this.element);
			this.enforceVisible = false;
		}
	},
	prepareStart : function() {
		if (this.dynamicFromPos == true){
			var fromPos = e.getPosition(this.element);
			this.startX = fromPos.x;
			this.startY = fromPos.y;
			this.rangeMoveX = this.startX - this.stopX;
			this.rangeMoveY= this.startY - this.stopY;
		}
	}
});
/*
***************************************************************
*active.effect.Size
***************************************************************
*/
active.effect.Size = function(element, fromRect, toRect, options){
	this.dynamicFromRect = false;
	if (arguments.length == 3){
		options = toRect;
		toRect = fromRect;
		fromRect = e.getDimensionsClosed(element);
		this.dynamicFromRect = true;
	}
	active.effect.Animator.call(this, options);
	this.name = 'Size';
	this.element = $(element);
	if (fromRect.units != toRect.units)
		alert('active.effect.Size: Conflicting units (' + fromRect.units + ', ' + toRect.units + ')');	
	this.units = fromRect.units;
	var originalRect = e.getDimensionsClosed(element);
	this.originalWidth = originalRect.width;
	this.startWidth = fromRect.width;
	this.startHeight = fromRect.height;
	this.stopWidth = toRect.width;
	this.stopHeight = toRect.height;
	this.childImages = new Array();
	if(this.options.scaleContent)
		e.fetchChildImages(element, this.childImages);
	this.fontFactor = 1.0;
	if(this.element.style && this.element.style.fontSize){
		if(/em\s*$/.test(this.element.style.fontSize))
			this.fontFactor = parseFloat(this.element.style.fontSize);
	}
	if (e.isPercentValue(this.startWidth)){
		var startWidthPercent = e.getPercentValue(this.startWidth);
		this.startWidth = originalRect.width * (startWidthPercent / 100);
	}

	if (e.isPercentValue(this.startHeight)){
		var startHeightPercent = e.getPercentValue(this.startHeight);
		this.startHeight = originalRect.height * (startHeightPercent / 100);
	}
	if (e.isPercentValue(this.stopWidth)){
		var stopWidthPercent = e.getPercentValue(this.stopWidth);
		var originalRect = e.getDimensionsClosed(element);
		this.stopWidth = originalRect.width * (stopWidthPercent / 100);
	}
	if (e.isPercentValue(this.stopHeight)){
		var stopHeightPercent = e.getPercentValue(this.stopHeight);
		var originalRect = e.getDimensionsClosed(element);
		this.stopHeight = originalRect.height * (stopHeightPercent / 100);
	}
	this.widthRange = this.startWidth - this.stopWidth;
	this.heightRange = this.startHeight - this.stopHeight;
	this.enforceVisible = e.isVisible(this.element);
};
active.effect.Size.prototype = new active.effect.Animator();
Object.Ext(active.effect.Size.prototype,{
	constructor : active.effect.Size,
	animate : function(position){
		var width = 0;
		var height = 0;
		var fontSize = 0;
		if (this.direction == active.forwards) {
			width = this.startWidth - (this.widthRange * position);
			height = this.startHeight - (this.heightRange * position);
			fontSize = this.fontFactor*(this.startWidth + position*(this.stopWidth - this.startWidth))/this.originalWidth;
		} else if (this.direction == active.backwards) {
			width = this.widthRange * position + this.stopWidth;
			height = this.heightRange * position + this.stopHeight;
			fontSize = this.fontFactor*(this.stopWidth + position*(this.startWidth - this.stopWidth))/this.originalWidth;
		}
		try{
		if (this.options.scaleContent == true)
			this.element.style.fontSize = fontSize + 'em';
		this.element.style.width = width + this.units;
		this.element.style.height = height + this.units;
		}
		catch(zhj){
			alert(zhj.description)
		}
		if(this.options.scaleContent){
			var propFactor = (this.direction == active.forwards) ? (this.startWidth + position*(this.stopWidth - this.startWidth))/this.originalWidth : (this.stopWidth + position*(this.startWidth - this.stopWidth))/this.originalWidth;
			var This=this;
			$A(this.childImages).each(function(img){
				img[0].style.width = propFactor * img[1] + This.units;
				img[0].style.height = propFactor * img[2] + This.units;
			});
			This=null;
		}
		if(this.enforceVisible){
			e.enforceVisible(this.element);
			this.enforceVisible = false;
		}
	},
	prepareStart : function() {
		if (this.dynamicFromRect == true){
			var fromRect = e.getDimensions(element);
			this.startWidth = fromRect.width;
			this.startHeight = fromRect.height;
			this.widthRange = this.startWidth - this.stopWidth;
			this.heightRange = this.startHeight - this.stopHeight;
		}
	}
});
/*
***************************************************************
*active.effect.Opacity
***************************************************************
*/
active.effect.Opacity = function(element, startOpacity, stopOpacity, options){
	this.dynamicStartOpacity = false;
	if (arguments.length == 3){
		options = stopOpacity;
		stopOpacity = startOpacity;
		startOpacity = e.getOpacity(element);
		this.dynamicStartOpacity = true;
	}
	active.effect.Animator.call(this, options);
	this.name = 'Opacity';
	this.element = $(element);
    if(browser.name=="ie" && (!this.element.hasLayout))
	  e.setStyle(this.element, 'zoom', '1');
	this.startOpacity = startOpacity;
	this.stopOpacity = stopOpacity;
	this.opacityRange = this.startOpacity - this.stopOpacity;
	this.enforceVisible = e.isVisible(this.element);
};
active.effect.Opacity.prototype = new active.effect.Animator();
Object.Ext(active.effect.Opacity.prototype,{
	constructor : active.effect.Opacity,
	animate : function(position){
		var opacity = 0;
		if (this.direction == active.forwards) {
			opacity = this.startOpacity - (this.opacityRange * position);
		} else if (this.direction == active.backwards) {
			opacity = this.opacityRange * position + this.stopOpacity;
		}
		this.element.style.opacity = opacity;
		this.element.style.filter = "alpha(opacity=" + Math.floor(opacity * 100) + ")";
		if(this.enforceVisible){
			e.enforceVisible(this.element);
			this.enforceVisible = false;
		}
	},
	prepareStart : function() {
		if (this.dynamicStartOpacity == true){
			this.startOpacity = e.getOpacity(element);
			this.opacityRange = this.startOpacity - this.stopOpacity;
		}
	}
});
/*
***************************************************************
*active.effect.Color
***************************************************************
*/
active.effect.Color = function(element, startColor, stopColor, options){
	this.dynamicStartColor = false;
	if (arguments.length == 3){
		options = stopColor;
		stopColor = startColor;
		startColor = e.getColor(element);
		this.dynamicStartColor = true;
	}
	active.effect.Animator.call(this, options);
	this.name = 'Color';
	this.element = $(element);
	this.startColor = startColor;
	this.stopColor = stopColor;
	this.startRedColor = e.hexToInt(startColor.substr(1,2));
	this.startGreenColor = e.hexToInt(startColor.substr(3,2));
	this.startBlueColor = e.hexToInt(startColor.substr(5,2));
	this.stopRedColor = e.hexToInt(stopColor.substr(1,2));
	this.stopGreenColor = e.hexToInt(stopColor.substr(3,2));
	this.stopBlueColor = e.hexToInt(stopColor.substr(5,2));
	this.redColorRange = this.startRedColor - this.stopRedColor;
	this.greenColorRange = this.startGreenColor - this.stopGreenColor;
	this.blueColorRange = this.startBlueColor - this.stopBlueColor;
};
active.effect.Color.prototype = new active.effect.Animator();
Object.Ext(active.effect.Color.prototype,{
	constructor : active.effect.Color,
	animate : function(position){
		var redColor = 0;
		var greenColor = 0;
		var blueColor = 0;
		if (this.direction == active.forwards) {
			redColor = (this.startRedColor - (this.redColorRange * position)).toInt();
			greenColor = (this.startGreenColor - (this.greenColorRange * position)).toInt();
			blueColor = (this.startBlueColor - (this.blueColorRange * position)).toInt();
		} else if (this.direction == active.backwards) {
			redColor = (this.redColorRange * position).toInt() + this.stopRedColor;
			greenColor = (this.greenColorRange * position).toInt() + this.stopGreenColor;
			blueColor = (this.blueColorRange * position).toInt() + this.stopBlueColor;
		}
		e.setStyle(this.element,"background-color",e.ColorChange(redColor, greenColor, blueColor));
	},
	prepareStart : function(){
		if (this.dynamicStartColor == true){
			this.startColor = e.getColor(element);
			this.startRedColor = e.hexToInt(startColor.substr(1,2));
			this.startGreenColor = e.hexToInt(startColor.substr(3,2));
			this.startBlueColor = e.hexToInt(startColor.substr(5,2));
			this.redColorRange = this.startRedColor - this.stopRedColor;
			this.greenColorRange = this.startGreenColor - this.stopGreenColor;
			this.blueColorRange = this.startBlueColor - this.stopBlueColor;
		}
	}
});
/*
***************************************************************
*active.effect.Cluster
***************************************************************
*/
active.effect.Cluster = function(options){
	active.effect.Animator.call(this, options);
	this.name = 'Cluster';
	this.effectsArray = new Array();
	this.currIdx = -1;
	_ClusteredEffect = function(effect, kind){
		this.effect = effect;
		this.kind = kind; // "parallel" or "queue"
		this.isRunning = false;
	};
	this.ClusteredEffect = _ClusteredEffect;
};
active.effect.Cluster.prototype = new active.effect.Animator();
Object.Ext(active.effect.Cluster.prototype,{
	constructor : active.effect.Cluster,
	drawEffect : function(){
		var isRunning = true;
		var allEffectsDidRun = false;
		if (this.currIdx == -1)
			this.initNextEffectsRunning();
		var baseEffectIsStillRunning = false;
		var evalNextEffectsRunning = false
		for (var i = 0; i < this.effectsArray.length; i++){
			if (this.effectsArray[i].isRunning == true){
				baseEffectIsStillRunning = this.effectsArray[i].effect.drawEffect();
				if (baseEffectIsStillRunning == false && i == this.currIdx){
					evalNextEffectsRunning = true;
				}
			}
		}
		if (evalNextEffectsRunning == true){
			allEffectsDidRun = this.initNextEffectsRunning();
		}
		if (allEffectsDidRun == true) {
			this.stop();
			isRunning = false;
			for (var i = 0; i < this.effectsArray.length; i++){
				this.effectsArray[i].isRunning = false;
			}
			this.currIdx = -1;
		}
		return isRunning;
	},
	initNextEffectsRunning : function(){
		var allEffectsDidRun = false;
		this.currIdx++;
		if (this.currIdx > (this.effectsArray.length - 1)){
			allEffectsDidRun = true;
		}
		else {
			for (var i = this.currIdx; i < this.effectsArray.length; i++){
				if ((i > this.currIdx) && this.effectsArray[i].kind == "queue")
					break;	
				this.effectsArray[i].effect.start(true);
				this.effectsArray[i].isRunning = true;
				this.currIdx = i;
			};
		}
		return allEffectsDidRun;
	},
	doToggle : function(){
		if (this.options.toggle == true) {
			if (this.direction == active.forwards) {
				this.direction = active.backwards;
			} else if (this.direction == active.backwards){
				this.direction = active.forwards;
			}
		}
		for (var i = 0; i < this.effectsArray.length; i++){
			if (this.effectsArray[i].effect.options && (this.effectsArray[i].effect.options.toggle != null)) {
				if (this.effectsArray[i].effect.options.toggle == true){
					this.effectsArray[i].effect.doToggle();
				}
			}
		}
	},
	cancel : function(){
		for (var i = 0; i < this.effectsArray.length; i++){
			this.effectsArray[i].effect.cancel();
		}
		if (this.timer) {
			clearInterval(this.timer);
			this.timer = null;
		}
		this.isRunning = false;
	},
	addNextEffect : function(effect){
		this.effectsArray[this.effectsArray.length] = new this.ClusteredEffect(effect, "queue");
		if (this.effectsArray.length == 1) {
			this.element = effect.element;
		}
	},
	addParallelEffect : function(effect){
		this.effectsArray[this.effectsArray.length] = new this.ClusteredEffect(effect, "parallel");
		if (this.effectsArray.length == 1) {
			this.element = effect.element;
		}
	}
});
if (!active.move){active.move=new Object();}
/*
*******************************************************************
*Name:active move div object
*Func:active.move.layer
*WritenBy:HongJun Zhang
*CopyRight:www.ic98.com
*******************************************************************
*/
active.move.layer=function(){};
active.move.layer.prototype={
	para:{
		inscreen:true,//是否在可视屏幕内移动
		bytype:"id",//是根据什么方式来确定哪些元素可移动；id:元素ID;class:元素样式名称
		types:[],//确定移动元素方式的名称
		onmove:[],//触发移动事件的元素，与types对应(不允许相同class名)
		moveit:false,//内部参数
		obj:null,//内部参数
		x:0,//内部参数
		y:0,//内部参数
		xx:0,//内部参数
		yy:0//内部参数
	},
	move:function(){
		if (this.para.moveit) {
		try{event=document.Event();}catch(zhj){}
		var myscreen=z.screen();
		var top = (event.clientY || event.pageY);
		var left = (event.clientX || event.pageX);
		var width=e.getWidth(this.para.obj);
		var height=e.getHeight(this.para.obj);
		top = this.para.yy + top - this.para.y;
		left = this.para.xx + left - this.para.x;
		height=(z.bodytop()+myscreen.aHeight-height-(myscreen.aHeight-body.clientHeight));
		if (this.para.inscreen){
			if (left<=5 || top<=(z.bodytop()+5) || (left+width)>=(myscreen.aWidth-30) || top>=height-5) {
			return false;
			}
		}
		 this.para.obj.style.top = top+"px";
		 this.para.obj.style.left = left+"px";
		 }
		 height=width=left=top=null;
		 return false;
	},
	up:function(){
		this.para.moveit=false;
	},
	down:function(){
		 var obj = document.This(),findelement=false;
		 if (this.para.bytype.Lcase()=="class"){
			 var cssName=obj.className;
			 var parentcssName=this.para.types[this.para.onmove.indexOf(cssName)];
			 if (parentcssName!=cssName){
				 while(obj.className!=parentcssName && obj.tagName.Ucase != "HTML"){
					 obj=obj.parentNode;
				 }
			 }
			 if (obj.className==parentcssName){findelement=true;}
			 parentcssName=cssName=null;
		 }
		 else{
			 if (this.para.bytype.Lcase()=="id"){
				 var parentID=this.para.types[this.para.onmove.indexOf(obj.id)];
				 obj=$(parentID);
				 if(!isNull(obj)){findelement=true;}
				 parentID=null;
			 }
			 else{}
		 }
		 if (findelement) {
			this.para.obj=obj;
			try{event=document.Event();}catch(zhj){}
			this.para.yy = parseInt(this.para.obj.style.top+0);
			this.para.y = (this.para.yy==0)?-z.bodytop():(event.clientY || event.pageY);
			this.para.y = (event.clientY || event.pageY);
			this.para.xx = parseInt(this.para.obj.style.left+0);
			this.para.x = (this.para.xx==0)?-z.bodyleft():(event.clientX || event.pageX);
			this.para.x = (event.clientX || event.pageX);
			this.para.moveit=true;
		 }
		 return false;
	},
	atta:function(){
		if (!this.para.types.length){
			return;
		}
		if (!this.para.onmove.length){
			this.para.onmove=this.para.types;
		}
		for (var i=0; i<this.para.onmove.length; i++){
			if (this.para.bytype.Lcase()=="id"){
				//e.atta(this.para.onmove[i],"mousemove",this.move.bind(this));
				e.atta(this.para.onmove[i],"mousedown",this.down.bind(this));
			}
			else{
				var This=this;
				if (this.para.bytype.Lcase()=="class"){
					$A(e.Style(this.para.onmove[i],document)).each(
						function(element){
							e.atta(element,"mousedown",This.down.bind(This));
							//e.atta(element,"mousemove",This.move.bind(This));
						}
					);
				}
				else{
					//
				}
				This=null;
			}
			
		}
		e.atta(document,"mousemove",this.move.bind(this));
		e.atta(document,"mouseup",this.up.bind(this));
	},
	start:function(){
		if (!this.para.types.length){
			return;
		}
		if (this.para.onmove.length>0 && this.para.types.length!=this.para.onmove.length){
			return;
		}
		if (this.para.bytype.Lcase()!="id" && this.para.bytype.Lcase()!="class"){
			return;
		}
		this.atta();
	},
	init:function(){
		var arg=arguments[0];
		if (isNull(arg) || !isObject(arg)){
			return;
		}
		Object.Ext(this.para,arg);
	}
};
