window.cyui={};
cyui.browser={};
cyui.browser.userAgent=navigator.userAgent.toLowerCase();
cyui.browser.isOpera=(cyui.browser.userAgent.indexOf('opera')!=-1);
cyui.browser.isSafari=(cyui.browser.userAgent.indexOf('safari')!=-1);
cyui.browser.isIE=(cyui.browser.userAgent.indexOf('msie')!=-1&&!cyui.browser.isOpera);
cyui.browser.isFF=(cyui.browser.userAgent.indexOf('firefox')!=-1);
cyui.$=function(id){
	return document.getElementById(id);
};
cyui.$T=function(name, root){
	if(name.match(':')){
		var str=name.split(':');
		var elements=(root||document).getElementsByTagName(str[0]);
		if(elements.length==0) return undefined;
		var element=[];
		var l=elements.length;
		for(var i=0;i<l;i++) if(elements[i].type==str[1]) element.push(elements[i]);
		return element;
	}else{
		var element=(root||document).getElementsByTagName(name);
		if(element.length==0) element=undefined;
		return element;
	}
};
cyui.dom={};
cyui.dom._getPosition_ie=function(element,parentElement) {
	var parent = null;
	var pos = {x:0,y:0};

	var rect = element.getBoundingClientRect();
	pos.x=rect.left + Math.max(document.documentElement.scrollLeft, document.body.scrollLeft);
	pos.y=rect.top + Math.max(document.documentElement.scrollTop, document.body.scrollTop);
	rect=null;

	if (parentElement) {
		var ppos=this._getPosition_ie(parentElement);
		pos.x-=ppos.x;
		pos.y-=ppos.y;
		parentElement=null;
		ppos=null;
	}
	element=null;
	parent=null;
	return {x:isNaN(pos.x)?0:pos.x,y:isNaN(pos.y)?0:pos.y};
};
cyui.dom._getPosition_ff=function(element,parentElement) {
	var parent = null;
	var pos = {x:0,y:0};

	var rect = document.getBoxObjectFor(element);
	pos = {x:rect.x, y:rect.y};
	rect=null;

	if (element.parentNode) { parent = element.parentNode; }
	else { parent = null; }

	while (parent && parent.tagName != 'BODY' && parent.tagName != 'HTML')
	{
	   pos.x -= parent.scrollLeft;
		 pos.y -= parent.scrollTop;

	   if (parent.parentNode) { parent = parent.parentNode; }
	   else { parent = null; }
	}

	if (parentElement) {
		var ppos=this._getPosition_ff(parentElement);
		pos.x-=ppos.x;
		pos.y-=ppos.y;
		parentElement=null;
		ppos=null;
	}
	element=null;
	parent=null;
	return {x:isNaN(pos.x)?0:pos.x,y:isNaN(pos.y)?0:pos.y};
};
cyui.dom._getPosition_etc=function(element,parentElement) {
	var parent = null;
	var pos = {x:0,y:0};

	pos = {x:element.offsetLeft, y:element.offsetTop};
	parent = element.offsetParent;
	if (parent != element) {
	  while (parent) {
		 pos.x += parent.offsetLeft;
		 pos.y += parent.offsetTop;
		 parent = parent.offsetParent;
	  }
	}
	if (cyui.browser.isOpera||( cyui.browser.isSafari && element.style.position == 'absolute')) {
	  pos.x -= document.body.offsetLeft;
	  pos.y -= document.body.offsetTop;
	}

	if (parentElement) {
		var ppos=this._getPosition_etc(parentElement);
		pos.x-=ppos.x;
		pos.y-=ppos.y;
		parentElement=null;
		ppos=null;
	}
	element=null;
	parent=null;
	return {x:isNaN(pos.x)?0:pos.x,y:isNaN(pos.y)?0:pos.y};
};
cyui.dom._getPosition=null,
cyui.dom.getPos=function(element,parentElement) {
	if (!cyui.dom._getPosition) {
		if (element.getBoundingClientRect) cyui.dom._getPosition=cyui.dom._getPosition_ie;
		else if (document.getBoxObjectFor) cyui.dom._getPosition=cyui.dom._getPosition_ff;
		else cyui.dom._getPosition=cyui.dom._getPosition_etc;
	}
	return cyui.dom._getPosition(element,parentElement);
};
cyui.dom.getPadding=function(element) {
	var l=parseInt(cyui.style.get(element,'paddingLeft'),10);
	var t=parseInt(cyui.style.get(element,'paddingTop'),10);
	var r=parseInt(cyui.style.get(element,'paddingRight'),10);
	var b=parseInt(cyui.style.get(element,'paddingBottom'),10);
	return {left:isNaN(l)?0:l,top:isNaN(t)?0:t,right:isNaN(r)?0:r,bottom:isNaN(b)?0:b};
};
cyui.dom.getSize=function(element){
	return {width:element.offsetWidth,height:element.offsetHeight};
};
cyui.dom.getBorderWidth=function(element){
	var l=parseInt(cyui.style.get(element,'borderLeftWidth'),10);
	var t=parseInt(cyui.style.get(element,'borderTopWidth'),10);
	var r=parseInt(cyui.style.get(element,'borderRightWidth'),10);
	var b=parseInt(cyui.style.get(element,'borderBottomWidth'),10);
	return {left:isNaN(l)?0:l,top:isNaN(t)?0:t,right:isNaN(r)?0:r,bottom:isNaN(b)?0:b};
};
cyui.event={};
cyui.event.hnd=[];
cyui.event.Dispatcher=function(){
	var q={};
	this.addListener=function(evt, fnc, tar, args){
		if(!q[evt]) q[evt]=[];
		q[evt].push([fnc,tar,args]);
		return true;
	};
	this.removeListener=function(evt, fnc){
		if(!q[evt]) return false;
		var l=q[evt].length;
		for(var i=0;i<l;i++){
			if(q[evt][i][0]==fnc){
				q[evt].splice(i, 1);
				return true;
			}
		}
	};
	this.dispatch=function(evt){
		if(!q[evt]) return false;
		var l=q[evt].length;
		for(var i=0;i<l;i++){
			if(q[evt][i][1]&&q[evt][i][2]) q[evt][i][0].apply(q[evt][i][1], q[evt][i][2]);
			else q[evt][i][0]();
		}
		return true;
	};
};
cyui.event.remove=function(hnd){
	if (window.removeEventListener) hnd[0].removeEventListener(hnd[1], hnd[2], false);
	else if (window.detachEvent) hnd[0].detachEvent('on'+hnd[1], hnd[2]);
};
cyui.event.TweenEvent={
	TWEEN_COMPLETE:'tweenComplete'
};
cyui.event.add=function(obj, evt, fnc){
	if (window.addEventListener) obj.addEventListener(evt, fnc, false);
	else if (window.attachEvent) obj.attachEvent( 'on'+evt, fnc );
	return [obj, evt, fnc];
};
cyui.event.SliderEvent={
	SLIDE_NEXT:'slideNext',
	SLIDE_PREVIOUS:'slidePrevious',
	SLIDE_ADDED:'sliderAdded',
	BEGIN_OF_SLIDE:'beginOfSlide',
	MIDDLE_OF_SLIDE:'middleOfSlide',
	END_OF_SLIDE:'endOfSlide',
	REQURE_SLIDE:'requireSlide'
};
cyui.Select=function(_sTargetId, _sCSS){
	var _bOpened=null;
	// Constructor
	var init=function(){
		// Choose when initalize
		if(!!cyui.$(_sTargetId)){
			vInitalize();
			return true;
		}else{
			cyui.event.add(window, 'load', vInitalize);
		}
	};
	// Initalize
	var vInitalize=function(){
		if(!cyui.$(_sTargetId)){
			alert('Argument for _sTargetId is not a id of document element.');
			return false;
		}
		var elSelect=cyui.$(_sTargetId);
		var elParent=elSelect.parentNode;
		var iOffsetTop=elSelect.offsetTop;
		// Create element
		var elBase=document.createElement('SPAN');
		elParent.insertBefore(elBase, elSelect);
		elBase.className=_sCSS;
		elBase.style.position='relative';
		var elButton=null;
		if(cyui.browser.isIE){
			elButton=document.createElement('<INPUT TYPE="BUTTON">');
		}else{
			elButton=document.createElement('INPUT');
			elButton.type='BUTTON';
		}
		elBase.appendChild(elButton);
		elButton.style.textAlign='left';
		elButton.value=elSelect[elSelect.selectedIndex].firstChild.nodeValue;
		var rRect=cyui.dom.getSize(elButton);
		elSelect.style.display='none';
		var elOptions=cyui.$T('OPTION', elSelect);
		var l=elOptions.length;
		if(l>0){
			var elUL=document.createElement('UL');
			elBase.appendChild(elUL);
			elUL.style.display='none';
			_bOpened=false;
			elUL.style.position='absolute';
			elUL.style.left='0';
			elUL.style.top=(rRect.height+elButton.offsetTop)+'px';
			var elLists=[];
			for(var i=0;i<l;i++){
				elLists[i]=document.createElement('LI');
				elUL.appendChild(elLists[i]);
				elLists[i].appendChild(document.createTextNode(elOptions[i].firstChild.nodeValue));
				elLists[i].setAttribute('index', i);
				cyui.event.add(elLists[i], 'click', hndListClick);
				cyui.event.add(elLists[i], 'mouseover', hndListOver);
				cyui.event.add(elLists[i], 'mouseout', hndListOut);
			}
			cyui.event.add(elButton, 'click', vToggleSelectbox);
			cyui.event.add(document, 'click', vCloseSelectbox);
		}
	};
	var vToggleSelectbox=function(e){
		var t=cyui.$(_sTargetId).previousSibling.childNodes[1];
		t.style.display=_bOpened?'none':'block';
		_bOpened=!_bOpened;
		e=window.event?window.event:e;
		e.cancelBubble = true;
	};
	var vCloseSelectbox=function(){
		var t=cyui.$(_sTargetId).previousSibling.childNodes[1];
		t.style.display='none';
		_bOpened=false;
	};
	var hndListOver=function(e){
		e=window.event?window.event:e;
		var t=e.srcElement?e.srcElement:e.target;
		t.className=t.className+' hover';
	};
	var hndListOut=function(e){
		e=window.event?window.event:e;
		var t=e.srcElement?e.srcElement:e.target;
		t.className=t.className.replace('hover', '');
	};
	var hndListClick=function(e){
		e=window.event?window.event:e;
		var t=e.srcElement?e.srcElement:e.target;
		var b=t.parentNode.previousSibling;
		var s=cyui.$(_sTargetId);
		var i=t.getAttribute('index')
		s.selectedIndex=i;
		b.value=s[i].firstChild.nodeValue;
		if(s.onchange) s.onchange();
	};
	init();
};
cyui.$N=function(name, root){
	var element=document.getElementsByName(name);
	if(element.length==0) element=undefined;
	return element;
};
cyui.Radio=function(_sTargetName, _sImgSrc, _sCSS){
	var _imgImage=null;
	var _pImgSize=null;
	var _bInitReady=false;
	var _bImageReady=false;
	var init = function()
	{
		// Check arguments
		if(!_sTargetName||!_sImgSrc){
			alert('Any argument is not input.');
			return false;
		}else if((typeof _sTargetName!='string')||(typeof _sImgSrc!='string')||(!!_sCSS&&(typeof _sCSS!='string'))){
			alert('Any argument is not correct.');
			return false;
		}
		_imgImage=new Image();
		cyui.event.add(_imgImage, 'load', hndImageLoaded);
		_imgImage.src=_sImgSrc;
		// Choose when initalize
		if(!!cyui.$N(_sTargetName)){
			vReadyInit();
			return true;
		}else{
			cyui.event.add(window, 'load', vReadyInit);
		}
	};
	 // Init ready
	var vReadyInit=function(){
		_bInitReady=true;
		if(_bImageReady) vInitalize();
	};
	 // Image loaded handler
	var hndImageLoaded=function(){
		_bImageReady=true;
		_pImgSize={width:(_imgImage.width/2), height:_imgImage.height};
		if(_bInitReady) vInitalize();
	};
	// Initalize
	var vInitalize=function(){
		if(!cyui.$N(_sTargetName)){
			alert('Argument for _sTargetId is not a id of document element.');
			return false;
		}
		var _aRadio=cyui.$N(_sTargetName);
		var l=_aRadio.length;
		for(var i=0;i<l;i++){
			var _oLabel=document.createElement('LABEL');
			_aRadio[i].parentNode.insertBefore(_oLabel, _aRadio[i]);
			_oLabel.htmlFor=_aRadio[i].id;
			if(_sCSS) _oLabel.className=_sCSS;
			var _oButton=document.createElement('INPUT');
			_oLabel.appendChild(_oButton);
			_oButton.readOnly=-1;
			_oButton.style.backgroundImage='url("'+_imgImage.src+'")';
			_oButton.style.backgroundRepeat='no-repeat';
			_oButton.style.backgroundPosition='0 0';
			_oButton.style.backgroundColor='transparent';
			_oButton.style.width=_pImgSize.width+'px';
			_oButton.style.height=_pImgSize.height+'px';
			_oButton.style.borderWidth='0';
			_oButton.style.margin='0';
			_oButton.style.padding='0';
			_oButton.style.cursor='default';
			if(_aRadio[i].checked) _oButton.style.backgroundPosition='-'+_pImgSize.width+'px 0';
			else _oButton.style.backgroundPosition='0 0';
			if(_aRadio[i].disabled) cyui.style.set(_oButton, 'opacity', 0.25);
			else cyui.event.add(_aRadio[i], 'click', vSetSelect);
			if(cyui.browser.isOpera) cyui.event.add(_oButton, 'click', vSetSelectImg);
			if(!cyui.browser.isIE){
				_aRadio[i].style.marginRight=(10000-parseInt(_aRadio[i].offsetWidth, 10))+ 'px';
				_aRadio[i].style.visibility='hidden';
			}
			_aRadio[i].style.marginLeft='-10000px';
		}
	};
	// Set select
	var vSetSelect=function(){
		var _aRadio=cyui.$N(_sTargetName);
		var l=_aRadio.length;
		for(var i=0;i<l;i++){
			if(_aRadio[i].checked) _aRadio[i].previousSibling.firstChild.style.backgroundPosition='-'+_pImgSize.width+'px 0';
			else _aRadio[i].previousSibling.firstChild.style.backgroundPosition='0 0';
		}
	};
	// Set select image
	var vSetSelectImg=function(e){
		var _e=window.event?window.event:e;
		var _oTarget=_e.target?_e.target:_e.srcElement;
		//_oTarget.parentNode.click();
		cyui.$(_oTarget.parentNode.htmlFor).checked=true;
		vSetSelect();
	};
	init();
};
cyui.style={};
cyui.style._setOpacity_ie=function(element,value) {
	element.style.filter = 'alpha(opacity=' + (value*100) + ')';
	if (!element.currentStyle || !element.currentStyle.hasLayout) {element.style.zoom = 1;}
};
cyui.style._setOpacity_non_ie=function(element,value) {
	element.style.opacity = value;
  element.style['-moz-opacity'] = value;
  element.style['-khtml-opacity'] = value;
};
// process cross browsing
cyui.style.setOpacity = (cyui.browser.isIE)?cyui.style._setOpacity_ie:cyui.style._setOpacity_non_ie;
cyui.style.set=function(element,property,value) {
	if (property=='opacity') cyui.style.setOpacity(element,value);
	else element.style[property] = value;
};
cyui.Check=function(_sGroupId, _sImgSrc, _sCSS){
	var _imgImage=null;
	var _pImgSize=null;
	var _bInitReady=false;
	var _bImageReady=false;
	var init = function()
	{
		// Check arguments
		if(!_sGroupId||!_sImgSrc){
			alert('Any argument is not input.');
			return false;
		}else if((typeof _sGroupId!='string')||(typeof _sImgSrc!='string')||(!!_sCSS&&(typeof _sCSS!='string'))){
			alert('Any argument is not correct.');
			return false;
		}
		_imgImage=new Image();
		cyui.event.add(_imgImage, 'load', hndImageLoaded);
		_imgImage.src=_sImgSrc;
		// Choose when initalize
		if(!!cyui.$T('input:checkbox'), cyui.$(_sGroupId)){
			vReadyInit();
			return true;
		}else{
			cyui.event.add(window, 'load', vReadyInit);
		}
	};
	 // Init ready
	var vReadyInit=function(){
		_bInitReady=true;
		if(_bImageReady) vInitalize();
	};
	 // Image loaded handler
	var hndImageLoaded=function(){
		_bImageReady=true;
		_pImgSize={width:(_imgImage.width/2), height:_imgImage.height};
		if(_bInitReady) vInitalize();
	};
	// Initalize
	var vInitalize=function(){
		if(!cyui.$T('input:checkbox', cyui.$(_sGroupId))){
			alert('Argument for _sTargetId is not a id of document element.');
			return false;
		}
		var _aCheck=cyui.$T('input:checkbox', cyui.$(_sGroupId));
		var l=_aCheck.length;
		for(var i=0;i<l;i++){
			var _oLabel=document.createElement('LABEL');
			_aCheck[i].parentNode.insertBefore(_oLabel, _aCheck[i]);
			_oLabel.htmlFor=_aCheck[i].id;
			if(_sCSS) _oLabel.className=_sCSS;
			var _oButton=document.createElement('INPUT');
			_oLabel.appendChild(_oButton);
			_oButton.readOnly=-1;
			_oButton.style.backgroundImage='url("'+_imgImage.src+'")';
			_oButton.style.backgroundRepeat='no-repeat';
			_oButton.style.backgroundPosition='0 0';
			_oButton.style.backgroundColor='transparent';
			_oButton.style.width=_pImgSize.width+'px';
			_oButton.style.height=_pImgSize.height+'px';
			_oButton.style.borderWidth='0';
			_oButton.style.margin='0';
			_oButton.style.padding='0';
			_oButton.style.cursor='default';
			if(_aCheck[i].checked) _oButton.style.backgroundPosition='-'+_pImgSize.width+'px 0';
			else _oButton.style.backgroundPosition='0 0';
			if(_aCheck[i].disabled) cyui.style.set(_oButton, 'opacity', 0.25);
			else cyui.event.add(_aCheck[i], 'click', vSetSelect);
			if(cyui.browser.isOpera) cyui.event.add(_oButton, 'click', vSetSelectImg);
			if(!cyui.browser.isIE){
				_aCheck[i].style.marginRight=(10000-parseInt(_aCheck[i].offsetWidth, 10))+ 'px';
				_aCheck[i].style.visibility='hidden';
			}
			_aCheck[i].style.marginLeft='-10000px';
		}
	};
	// Set select
	var vSetSelect=function(e){
		var _e=window.event?window.event:e;
		var _oTarget=_e.target?_e.target:_e.srcElement;
		if(_oTarget.checked) _oTarget.previousSibling.firstChild.style.backgroundPosition='-'+_pImgSize.width+'px 0';
		else _oTarget.previousSibling.firstChild.style.backgroundPosition='0 0';
	};
	// Set select image
	var vSetSelectImg=function(e){
		var _e=window.event?window.event:e;
		var _oTarget=_e.target?_e.target:_e.srcElement;
		//_oTarget.parentNode.click();
		var _oRadio=cyui.$(_oTarget.parentNode.htmlFor);
		_oRadio.checked=_oRadio.checked?false:true;
		if(_oRadio.checked) _oRadio.previousSibling.firstChild.style.backgroundPosition='-'+_pImgSize.width+'px 0';
		else _oRadio.previousSibling.firstChild.style.backgroundPosition='0 0';
	};
	init();
};
cyui.css={};
cyui.css.replace=function(obj, oName, nName){
	var CSSStr=obj.className.replace(/\s+/g, ' ');
	if(CSSStr.length>0&&CSSStr.match(oName)) obj.className=oName.replace(oName, nName);
};
cyui.func={};
cyui.func.bind=function(obj, fnc, arg){
	return function(){fnc.apply(obj, arg);};
};
cyui.func.bindEvent=function(obj, fnc, arg){
	return function(e){
		e=window.event?window.event:e;
		fnc.apply(obj, [e].concat(arg));
	};
};
cyui.Tab=function(_sOnCSS, _sOffCSS, _sDisplayType, _bClickMode, _iDelayTime, _iFirstView){
	var _aoTabQueue=[];
	var _aoTab=[];
	var _iSelectedIndex=0;
	var _iTempIndex=0;
	var _iTempTimer=null;
	var _iTabCount=0;
	var _bOnLoadInit=false;
	// Constructor
	var init=function(){
		// Check arguments
		if(!_sDisplayType) _sDisplayType='block';
		if(!_bClickMode) _bClickMode=false;
		if(!_sOnCSS||!!!_sOffCSS){
			alert('Any argument is not input.');
			return false;
		}else if((typeof _sDisplayType!='string')||(typeof _bClickMode!='boolean')||(!!_iDelayTime&&(typeof _iDelayTime!='number'))||(!!_iFirstView&&(typeof _iFirstView!='number'))){
			alert('Any argument is not correct.');
			return false;
		}
		cyui.event.add(window, 'load', vInitalize);
	};
	// Initalize tab
	var vInitalize=function(){
		if(_bOnLoadInit){
			var l=_aoTabQueue.length;
			for(var i=0;i<l;i++) vInitTab(_aoTabQueue[i].index, _aoTabQueue[i].content);
		}
		if(_iTabCount){
			iFirstIdx=(_iFirstView>=0&&_iFirstView<_iTabCount)?parseInt(_iFirstView):0;
			vSetTab(null, iFirstIdx);
		}
	};
	// Add tab information
	this.add=function(sIndexId, sContentId){
		if(!sIndexId||!sContentId){
			alert('Any argument is not input.');
			return false;
		}else if((typeof sIndexId!='string')||(typeof sContentId!='string')){
			alert('Any argument is not correct.');
			return false;
		}
		if((!!cyui.$(sIndexId))||(!!cyui.$(sContentId))){
			vInitTab(sIndexId, sContentId);
			return true;
		}else{
			_aoTabQueue.push({index:sIndexId, content:sContentId});
			_bOnLoadInit=true;
		}
	};
	// Initalize tab
	var vInitTab=function(sIndexId, sContentId){
		if((!cyui.$(sIndexId))||(!cyui.$(sContentId))){
			alert('Argument for _sTargetId is not a id of document element.');
			return false;
		}
		if(_bClickMode){
			cyui.event.add(cyui.$(sIndexId), 'click', cyui.func.bindEvent(null, vSetTab, [_iTabCount]));
		}else{
			if(_iDelayTime==null){
				cyui.event.add(cyui.$(sIndexId), 'mouseover', cyui.func.bindEvent(null, vSetTab, [_iTabCount]));
			}else{
				cyui.event.add(cyui.$(sIndexId), 'mouseover', cyui.func.bindEvent(null, vSetTempTab, [_iTabCount]));
				cyui.event.add(cyui.$(sIndexId), 'mouseout', vClearTempTab);
			}
		}
		_aoTab[_iTabCount]={index:sIndexId, content:sContentId};
		_iTabCount=_iTabCount+1;
	};
	// Set tab
	var vSetTab=function(e, iIdx){
		cyui.css.replace(cyui.$(_aoTab[_iSelectedIndex].index), _sOnCSS, _sOffCSS);
		cyui.$(_aoTab[_iSelectedIndex].content).style.display='none';
		_iSelectedIndex=iIdx;
		cyui.css.replace(cyui.$(_aoTab[_iSelectedIndex].index), _sOffCSS, _sOnCSS);
		cyui.$(_aoTab[_iSelectedIndex].content).style.display=_sDisplayType;
		if(_bClickMode&&e){
			if(window.event) e.returnValue=false;
			else if(e.preventDefault) e.preventDefault();
		}
	};
	// Set temp tab
	var vSetTempTab=function(e, iIdx){
		_iTempIndex=iIdx;
		_iTempTimer=setTimeout(cyui.func.bind(null, vSetDelayTab, [iIdx]), _iDelayTime);
	};
	// Set delay tab
	var vSetDelayTab=function(iIdx){
		clearTimeout(_iTempTimer);
		_iTempTimer=null;
		if(_iTempIndex==iIdx) vSetTab(null, iIdx);
	};
	// Clear temp tab
	var vClearTempTab=function(){
		if(_iTempTimer){
			clearTimeout(_iTempTimer);
			_iTempTimer=null;
		}
		_iTempIndex=-1;
	};
	init();
};
cyui.transition={};
cyui.transition.ease={
	easeNone:function(t, b, c, d){
		return c*t/d+b;
	},
	easeInQuad:function(t, b, c, d){
		return c*(t/=d)*t+b;
	},
	easeOutQuad:function(t, b, c, d){
		return -c *(t/=d)*(t-2)+b;
	},
	easeInOutQuad:function(t, b, c, d){
		if ((t/=d/2) < 1) return c/2*t*t+b;
		return -c/2*((--t)*(t-2)-1)+b;
	},
	easeOutInQuad:function(t, b, c, d){
		if (t < d/2) return ease.easeOutQuad (t*2, b, c/2, d);
		return ease.easeInQuad((t*2)-d, b+c/2, c/2, d);
	},
	easeInCubic:function(t, b, c, d){
		return c*(t/=d)*t*t+b;
	},
	easeOutCubic:function(t, b, c, d){
		return c*((t=t/d-1)*t*t+1)+b;
	},
	easeInOutCubic:function(t, b, c, d){
		if ((t/=d/2) < 1) return c/2*t*t*t+b;
		return c/2*((t-=2)*t*t+2)+b;
	},
	easeOutInCubic:function(t, b, c, d){
		if (t < d/2) return ease.easeOutCubic (t*2, b, c/2, d);
		return ease.easeInCubic((t*2)-d, b+c/2, c/2, d);
	},
	easeInQuart:function(t, b, c, d){
		return c*(t/=d)*t*t*t+b;
	},
	easeOutQuart:function(t, b, c, d){
		return -c*((t=t/d-1)*t*t*t-1)+b;
	},
	easeInOutQuart:function(t, b, c, d){
		if ((t/=d/2) < 1) return c/2*t*t*t*t+b;
		return -c/2*((t-=2)*t*t*t-2)+b;
	},
	easeOutInQuart:function(t, b, c, d){
		if (t < d/2) return ease.easeOutQuart (t*2, b, c/2, d);
		return ease.easeInQuart((t*2)-d, b+c/2, c/2, d);
	},
	easeInQuint:function(t, b, c, d){
		return c*(t/=d)*t*t*t*t+b;
	},
	easeOutQuint:function(t, b, c, d){
		return c*((t=t/d-1)*t*t*t*t+1)+b;
	},
	easeInOutQuint:function(t, b, c, d){
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t+b;
		return c/2*((t-=2)*t*t*t*t+2)+b;
	},
	easeOutInQuint:function(t, b, c, d){
		if (t < d/2) return ease.easeOutQuint (t*2, b, c/2, d);
		return ease.easeInQuint((t*2)-d, b+c/2, c/2, d);
	},
	easeInSine:function(t, b, c, d){
		return -c*Math.cos(t/d*(Math.PI/2))+c+b;
	},
	easeOutSine:function(t, b, c, d){
		return c*Math.sin(t/d*(Math.PI/2))+b;
	},
	easeInOutSine:function(t, b, c, d){
		return -c/2*(Math.cos(Math.PI*t/d)-1)+b;
	},
	easeOutInSine:function(t, b, c, d){
		if (t < d/2) return ease.easeOutSine (t*2, b, c/2, d);
		return ease.easeInSine((t*2)-d, b+c/2, c/2, d);
	},
	easeInExpo:function(t, b, c, d){
		return (t==0) ? b : c*Math.pow(2, 10*(t/d-1))+b-c*0.001;
	},
	easeOutExpo:function(t, b, c, d){
		return (t==d) ? b+c : c*1.001*(-Math.pow(2, -10*t/d)+1)+b;
	},
	easeInOutExpo:function(t, b, c, d){
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2*Math.pow(2, 10*(t-1))+b-c*0.0005;
		return c/2*1.0005*(-Math.pow(2, -10*--t)+2)+b;
	},
	easeOutInExpo:function(t, b, c, d){
		if (t < d/2) return ease.easeOutExpo (t*2, b, c/2, d);
		return ease.easeInExpo((t*2)-d, b+c/2, c/2, d);
	},
	easeInCirc:function(t, b, c, d){
		return -c*(Math.sqrt(1-(t/=d)*t)-1)+b;
	},
	easeOutCirc:function(t, b, c, d){
		return c*Math.sqrt(1-(t=t/d-1)*t)+b;
	},
	easeInOutCirc:function(t, b, c, d){
		if ((t/=d/2) < 1) return -c/2*(Math.sqrt(1-t*t)-1)+b;
		return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b;
	},
	easeOutInCirc:function(t, b, c, d){
		if (t < d/2) return ease.easeOutCirc (t*2, b, c/2, d);
		return ease.easeInCirc((t*2)-d, b+c/2, c/2, d);
	},
	easeInElastic:function(t, b, c, d){
		var p;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		var s, a;
		if (!a || a < Math.abs(c)) { a=c; s=p/4; }
		else s = p/(2*Math.PI)*Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1))*Math.sin( (t*d-s)*(2*Math.PI)/p ))+b;
	},
	easeOutElastic:function(t, b, c, d){
		var p;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		var s, a;
		if (!a || a < Math.abs(c)) { a=c; s=p/4; }
		else s = p/(2*Math.PI)*Math.asin (c/a);
		return (a*Math.pow(2,-10*t)*Math.sin( (t*d-s)*(2*Math.PI)/p )+c+b);
	},
	easeInOutElastic:function(t, b, c, d){
		var p;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		var s;
		var a;
		if (!a || a < Math.abs(c)) { a=c; s=p/4; }
		else s = p/(2*Math.PI)*Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1))*Math.sin( (t*d-s)*(2*Math.PI)/p ))+b;
		return a*Math.pow(2,-10*(t-=1))*Math.sin( (t*d-s)*(2*Math.PI)/p )*.5+c+b;
	},
	easeOutInElastic:function(t, b, c, d){
		if (t < d/2) return ease.easeOutElastic (t*2, b, c/2, d, a, p);
		return ease.easeInElastic((t*2)-d, b+c/2, c/2, d, a, p);
	},
	easeInBack:function(t, b, c, d){
		var s;
		if (!s) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t-s)+b;
	},
	easeOutBack:function(t, b, c, d){
		var s;
		if (!s) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;
	},
	easeInOutBack:function(t, b, c, d){
		var s;
		if (!s) s = 1.70158;
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;
	},
	easeOutInBack:function(t, b, c, d){
		if (t < d/2) return ease.easeOutBack (t*2, b, c/2, d, s);
		return ease.easeInBack((t*2)-d, b+c/2, c/2, d, s);
	},
	easeInBounce:function(t, b, c, d){
		return c-ease.easeOutBounce (d-t, 0, c, d)+b;
	},
	easeOutBounce:function(t, b, c, d){
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t)+b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;
		}
	},
	easeInOutBounce:function(t, b, c, d){
		if (t < d/2) return ease.easeInBounce (t*2, 0, c, d)*.5+b;
		else return ease.easeOutBounce (t*2-d, 0, c, d)*.5+c*.5+b;
	},
	easeOutInBounce:function(t, b, c, d){
		if (t < d/2) return ease.easeOutBounce (t*2, b, c/2, d);
		return ease.easeInBounce((t*2)-d, b+c/2, c/2, d);
	}
};
cyui.transition.Tween=function(_oTarget, _sProperty, _iBegin, _iFinish, _sUnit, _iDuration, _iFrameRate, _sEaseType){
	var _iIndex=null;
	var _iFrameSecond=null;
	var _hndTimer=null;
	var _aValue=[];
	var _hndListener=[];
	var _hndEventQueue={};
	var _evtDispatcher=null;
	// Constructor
	var init=function(){
		// Check arguments
		if(_oTarget==null||_sProperty==null||_iBegin==null||_iFinish==null||_sUnit==null||!!!_iDuration||!!!_iFrameRate||!!!_sEaseType){
			alert('Any argument is not input.');
			return false;
		}else if((typeof _oTarget!='object')||(typeof _sProperty!='string')||(typeof _iBegin!='number')||(typeof _iFinish!='number')||(typeof _sUnit!='string')||(typeof _iDuration!='number')||(typeof _iFrameRate!='number')||(typeof _sEaseType!='string')){
			alert('Any argument is not correct.');
			return false;
		}
		_evtDispatcher=new cyui.event.Dispatcher();
		vInitalize();
	};
	// Initalize
	var vInitalize=function(){
		_iIndex=-1;
		_iFrameSecond=1000/_iFrameRate;
		_aValue=aGetValue(_sEaseType);
	};
	// Get values
	var aGetValue=function(sEaseType){
		var rtn=[];
		var dist=_iFinish-_iBegin;
		var l=_iFrameRate*_iDuration;
		for(var i=1; i <= l; i++) rtn.push(Math.round(cyui.transition.ease[sEaseType](i, _iBegin, dist, l)));
		return rtn;
	};
	// Get begin
	this.getProperty=function(){
		return _sProperty;
	};
	// Set begin
	this.setProperty=function(sProperty){
		if(typeof sProperty!='string') return false;
		if(_hndTimer==null&&_sProperty!=sProperty){
			_sProperty=sProperty;
			return true;
		}
	};
	// Get begin
	this.getBegin=function(){
		return _iBegin;
	};
	// Set begin
	this.setBegin=function(iBegin){
		if(typeof iBegin!='number') return false;
		if(_hndTimer==null&&_iBegin!=iBegin){
			_iBegin=iBegin;
			vInitalize();
			return true;
		}
	};
	// Get finish
	this.getFinish=function(){
		return _iFinish;
	};
	// Set finish
	this.setFinish=function(iFinish){
		if(typeof iFinish!='number') return false;
		if(_hndTimer==null&&_iFinish!=iFinish){
			_iFinish=iFinish;
			vInitalize();
			return true;
		}
	};
	// Get unit
	this.getUnit=function(){
		return _sUnit;
	};
	// Set unit
	this.setUnit=function(sUnit){
		if(typeof sUnit!='string') return false;
		_sUnit=sUnit;
		return true;
	};
	// Get position
	this.getPosition=function(){
		return _aValue[_iIndex];
	};
	// Set position
	this.setPosition=function(iIndex){
		if(typeof iIndex!='number') return false;
		if(_hndTimer==null&&_iIndex!=iIndex&&iIndex<_aValue.length) _iIndex=iIndex;
		return true;
	};
	// Tween
	var vTween=function(){
		if(_iIndex+1<_aValue.length){
			_iIndex++;
			_oTarget[_sProperty]=_aValue[_iIndex]+_sUnit;
			_hndTimer=setTimeout(vTween, _iFrameSecond);
		}else{
			clearTimeout(_hndTimer);
			_hndTimer=null;
			_evtDispatcher.dispatch(cyui.event.TweenEvent.TWEEN_COMPLETE);
		}
	};
	// Is play
	this.isPlay=function(){
		return !!_hndTimer;
	};
	// Start tween
	this.start=function(){
		if(_hndTimer==null){
			_iIndex=-1;
			_hndTimer=setTimeout(vTween, _iFrameSecond);
		}
	};
	// Stop tween
	this.stop= function(){
		if(_hndTimer!=null){
			clearTimeout(_hndTimer);
			_hndTimer=null;
		}
	};
	// Add event
	this.addListener= function(sEventType, fncCallBack, oTarget, aArgs){
		_evtDispatcher.addListener(sEventType, fncCallBack, oTarget, aArgs);
	};
	init();
};
cyui.float=function(_sTargetId, _iTop, _iDelay, _sEaseType){
	var _iPosition=null;
	var _iTimer=null;
	var _twTween=null;
	var init=function(){
		// Check parameter
		if(!_sTargetId||typeof _sTargetId!= 'string'){
			alert( 'Parameter is not input or type of parameter is wrong.' );
			return false;
		}
		if(!_iTop||typeof _iTop!='number') _iTop = 0;
		if(!_iDelay||typeof _iTop!='number') _iDelay = 0;
		if(!_sEaseType||typeof _sEaseType!='string') _sEaseType = 'easeOutCubic';
		// Choose when initalize
		if(!!cyui.$(_sTargetId)){
			vInitalize();
			return true;
		}else{
			cyui.event.add(window, 'load', vInitalize);
		}
	};
	//Initalize
	var vInitalize=function(){
		if(!cyui.$(_sTargetId)){
			alert('Argument for _sTargetId is not a id of document element.');
			return false;
		}
		_iPosition=!!document.documentElement.scrollTop?document.documentElement.scrollTop+_iTop:document.body.scrollTop+_iTop;
		_twTween=new cyui.transition.Tween(cyui.$(_sTargetId).style, 'top', _iTop, _iTop, 'px', 0.5, 48, _sEaseType);
		cyui.event.add(window, 'scroll', hndScroll);
		vSetPosition();
	};
	//Scroll handler
	var hndScroll=function(){
		_iPosition=!!document.documentElement.scrollTop?document.documentElement.scrollTop+_iTop:document.body.scrollTop+_iTop;
		if(_iTimer){
			clearTimeout(_iTimer);
			_iTimer=null;
		}
		_iTimer=setTimeout(vSetPosition, 100);
	};
	//Set position when scroll
	var vSetPosition=function(){
		var posTop=!!document.documentElement.scrollTop?document.documentElement.scrollTop+_iTop:document.body.scrollTop+_iTop;
		if(_iPosition==posTop){
			if(_twTween.isPlay()) _twTween.stop();
			_twTween.setBegin(_twTween.getPosition());
			_twTween.setFinish(posTop);
			_twTween.start();
		}
	};
	init();
};
cyui.transition.MultiTween=function(_iDuration, _iFrameRate){
	var _aoTweenData=null;
	var _iCount=null;
	var _iIndex=null;
	var _iTweenLength=null;
	var _iFrameSecond=null;
	var _hndTimer=null;
	var _aValue=[];
	var _hndListener=[];
	var _hndEventQueue={};
	var _evtDispatcher=null;
	// Constructor
	var init=function(){
		// Check arguments
		if(!_iDuration||!_iFrameRate){
			alert('Any argument is not input.');
			return false;
		}else if((typeof _iDuration!='number')||(typeof _iFrameRate!='number')){
			alert('Any argument is not correct.');
			return false;
		}
		_evtDispatcher=new cyui.event.Dispatcher();
		vInitalize();
	};
	// Initalize
	var vInitalize=function(){
		_aoTweenData=[];
		_iIndex=-1;
		_iCount=0;
		_iFrameSecond=1000/_iFrameRate;
		_iTweenLength=_iFrameRate*_iDuration;
	};
	// Get values
	var aGetValue=function(sEaseType, iBegin, iFinish){
		var rtn=[];
		var dist=iFinish-iBegin;
		for(var i=1; i <= _iTweenLength; i++) rtn.push(Math.round(cyui.transition.ease[sEaseType](i, iBegin, dist, _iTweenLength)));
		return rtn;
	};
	// Add tween
	this.add=function(oTarget, sProperty, iBegin, iFinish, sUnit, sEaseType){
		// Check arguments
		if(oTarget==null||sProperty==null||iBegin==null||iFinish==null||sUnit==null||!!!sEaseType){
			alert('Any argument is not input.');
			return false;
		}else if((typeof oTarget!='object')||(typeof sProperty!='string')||(typeof iBegin!='number')||(typeof iFinish!='number')||(typeof sUnit!='string')||(typeof sEaseType!='string')){
			alert('Any argument is not correct.');
			return false;
		}
		_aoTweenData[_iCount]=[oTarget, sProperty, iBegin, iFinish, sUnit, sEaseType, aGetValue(sEaseType, iBegin, iFinish)];
		var iIdx=_iCount;
		_iCount=_iCount+1;
		return iIdx;
	};
	// Get target
	this.getTarget=function(iIdx){
		if(!_aoTweenData[iIdx]) return false;
		return _aoTweenData[iIdx][1];
	};
	// Set target
	this.setTarget=function(iIdx, oTarget){
		if(typeof oTarget!='object') return false;
		if(_hndTimer==null&&_aoTweenData[iIdx]&&_aoTweenData[iIdx][0]!=oTarget){
			_aoTweenData[iIdx][0]=oTarget;
			return true;
		}
	};
	// Get property
	this.getProperty=function(iIdx){
		if(!_aoTweenData[iIdx]) return false;
		return _aoTweenData[iIdx][1];
	};
	// Set property
	this.setProperty=function(iIdx, sProperty){
		if(typeof sProperty!='string') return false;
		if(_hndTimer==null&&_aoTweenData[iIdx]&&_aoTweenData[iIdx][1]!=sProperty){
			_aoTweenData[iIdx][1]=sProperty;
			return true;
		}
	};
	// Get begin
	this.getBegin=function(iIdx){
		if(!_aoTweenData[iIdx]) return false;
		return _aoTweenData[iIdx][2];
	};
	// Set begin
	this.setBegin=function(iIdx, iBegin){
		if(typeof iBegin!='number') return false;
		if(_hndTimer==null&&_aoTweenData[iIdx]&&_aoTweenData[iIdx][2]!=iBegin){
			_aoTweenData[iIdx][2]=iBegin;
			_aoTweenData[iIdx][6]=aGetValue(_aoTweenData[iIdx][5], _aoTweenData[iIdx][2], _aoTweenData[iIdx][3]);
			return true;
		}
	};
	// Get finish
	this.getFinish=function(iIdx){
		if(!_aoTweenData[iIdx]) return false;
		return _aoTweenData[iIdx][3];
	};
	// Set finish
	this.setFinish=function(iIdx, iFinish){
		if(typeof iFinish!='number') return false;
		if(_hndTimer==null&&_aoTweenData[iIdx]&&_aoTweenData[iIdx][3]!=iFinish){
			_aoTweenData[iIdx][3]=iFinish;
			_aoTweenData[iIdx][6]=aGetValue(_aoTweenData[iIdx][5], _aoTweenData[iIdx][2], _aoTweenData[iIdx][3]);
			return true;
		}
	};
	// Get unit
	this.getUnit=function(iIdx){
		if(!_aoTweenData[iIdx]) return false;
		return _aoTweenData[iIdx][4];
	};
	// Set unit
	this.setUnit=function(iIdx, sUnit){
		if(typeof sUnit!='string') return false;
		_aoTweenData[iIdx][4]=sProperty;
		return true;
	};
	// Get position
	this.getPosition=function(iIdx){
		if(!_aoTweenData[iIdx]) return false;
		return _aoTweenData[iIdx][6][_iIndex];
	};
	// Set position
	this.setPosition=function(iIndex){
		if(typeof iIndex!='number') return false;
		if(_hndTimer==null&&_iIndex!=iIndex&&iIndex<_aValue.length) _iIndex=iIndex;
		return true;
	};
	// Tween
	var vTween=function(){
		var l=_aoTweenData.length;
		if(_iIndex+1<_iTweenLength){
			var aData=null;
			_iIndex++;
			for(var i=0;i<l;i++){
				aData=_aoTweenData[i];
				aData[0][aData[1]]=aData[6][_iIndex]+aData[4];
			}
			_hndTimer=setTimeout(vTween, _iFrameSecond);
		}else{
			clearTimeout(_hndTimer);
			_hndTimer=null;
			_evtDispatcher.dispatch(cyui.event.TweenEvent.TWEEN_COMPLETE);
		}
	};
	// Is play
	this.isPlay=function(){
		return !!_hndTimer;
	};
	// Start tween
	this.start=function(){
		if(_hndTimer==null){
			_iIndex=-1;
			_hndTimer=setTimeout(vTween, _iFrameSecond);
		}
	};
	// Stop tween
	this.stop= function(){
		if(_hndTimer!=null){
			clearTimeout(_hndTimer);
			_hndTimer=null;
		}
	};
	// Add event
	this.addListener= function(sEventType, fncCallBack, oTarget, aArgs){
		_evtDispatcher.addListener(sEventType, fncCallBack, oTarget, aArgs);
	};
	init();
};
cyui.Slider=function(_sTargetId, _sDirection, _sEaseType, _nAutoSlide, _bAutoReturn, _iMaxSlide){
	var _iPosition=-1;
	var _asSlideId=[];
	var _hndListener=[];
	var _oTweener=null;
	var _hndBtnListener=[];
	var _iAreaWidth=[];
	var _oTimer=null;
	var _sWidthType='offsetWidth';
	var _iTweenMark=1;
	var _sTweenProperty='up';
	var _evtDispatcher=null;
	var _bRequireData;
	var _asPrevBtnId=[];
	var _asNextBtnId=[];
	// Constructor
	var init=function(){
		// Check arguments
		if(_sDirection==null) _sDirection='up';
		if(_sEaseType==null) _sEaseType='easeInOutQuint';
		if(_nAutoSlide==null) _nAutoSlide=0;
		if(_bAutoReturn==null) _bAutoReturn=false;
		if(!_sTargetId||!_sDirection){
			alert('Any argument is not input.');
			return false;
		}else if((typeof _sTargetId!='string')||(typeof _sDirection!='string')||((_iMaxSlide!=null)&&(typeof _iMaxSlide!='number'))){
			alert('Any argument is not correct.');
			return false;
		}
		switch(_sDirection){
			default:
				alert('Direction must be "up", "down", "left", "right".');
				return false;
				break;
			case 'down':
				_iTweenMark=-1;
			case 'up':
				_sTweenProperty='top';
				_sWidthType='offsetHeight';
				break;
			case 'right':
				_iTweenMark=-1;
			case 'left':
				_sTweenProperty='left';
				_sWidthType='offsetWidth';
				break;
		}
		_evtDispatcher=new cyui.event.Dispatcher()
	};
	// Check can initalize
	var vCheckInit=function(){
		if(!cyui.$(_sTargetId)){
			alert('Argument for _sTargetId is not a id of document element.');
			return false;
		}
		if(_asSlideId.length<2){
			if(_asSlideId.length<_iMaxSlide){
				_evtDispatcher.addListener(cyui.event.SliderEvent.SLIDE_ADDED, hndInitSlideAdded);
				_evtDispatcher.dispatch(cyui.event.SliderEvent.REQURE_SLIDE);
			}else{
				return true;
			}
		}else{
			vInitalize();
			vInitButton();
		}
	};
	// Initalize
	var vInitalize=function(){
		if(_iMaxSlide && (_asSlideId.length<_iMaxSlide)) _evtDispatcher.addListener(cyui.event.SliderEvent.SLIDE_ADDED, hndSlideNextAdded);
		_iPosition=0;
		_iAreaWidth=_iTweenMark * cyui.$(_sTargetId)[_sWidthType];
		_oTweener=new cyui.transition.MultiTween(0.5, 48);
		_oTweener.add(cyui.$(_asSlideId[0]).style, _sTweenProperty, _iAreaWidth, _iAreaWidth, 'px', _sEaseType);
		_oTweener.add(cyui.$(_asSlideId[1]).style, _sTweenProperty, _iAreaWidth, _iAreaWidth, 'px', _sEaseType);
		if(cyui.browser.isIE) document.execCommand('BackgroundImageCache', false, true);
		if(_nAutoSlide && _oTimer==null) setTimeout(vAutoSlide, _nAutoSlide);
	};
	// Init slide added handler
	var hndInitSlideAdded=function(){
		if(_asSlideId.length>=_iMaxSlide){
			_evtDispatcher.removeListener(cyui.event.SliderEvent.SLIDE_ADDED, hndInitSlideAdded);
			vInitalize();
		}
	};
	// Slide next added handler
	var hndSlideNextAdded=function(){
		vSlideNext();
	};
	// Initalize button
	var vInitButton=function(){
		// Add button event listener
		var prevLen=_asPrevBtnId.length;
		var nextLen=_asNextBtnId.length;
		if(prevLen>0) for(var i=0;i<prevLen;i++) cyui.event.add(cyui.$(_asPrevBtnId[i]), 'click', vSlidePrev);
		if(nextLen>0) for(var i=0;i<nextLen;i++) cyui.event.add(cyui.$(_asNextBtnId[i]), 'click', vSlideNext);
	};
	// Slide to previous
	var vSlidePrev=function(){
		if(!_oTweener.isPlay()){
			var tmpPosition=_iPosition;
			if(_bAutoReturn){
				_iPosition=(_iPosition-1<0)?_asSlideId.length-1:_iPosition-1;
			}
			else{
				if(_iPosition-1>= 0){
					_iPosition=_iPosition-1;
					if(_iPosition==0) _evtDispatcher.dispatch(cyui.event.SliderEvent.BEGIN_OF_SLIDE);
					else _evtDispatcher.dispatch(cyui.event.SliderEvent.MIDDLE_OF_SLIDE);
				}else{
					return false;
				}
			}
			_oTweener.setTarget(0, cyui.$(_asSlideId[tmpPosition]).style);
			_oTweener.setBegin(0, 0);
			_oTweener.setFinish(0, _iAreaWidth);
			_oTweener.setTarget(1, cyui.$(_asSlideId[_iPosition]).style);
			_oTweener.setBegin(1, -_iAreaWidth);
			_oTweener.setFinish(1, 0);
			_oTweener.start();
		}
	};
	// Slide to next
	var vSlideNext=function(){
		if(!_oTweener.isPlay()){
			var tmpPosition=_iPosition;
			if(_bAutoReturn){
				_iPosition=(_iPosition+1<_asSlideId.length)?_iPosition+1:0;
			}else{
				if(_iPosition+1<_asSlideId.length){
					_iPosition=_iPosition+1;
					if(((_iPosition+1)==_asSlideId.length)&&(_iMaxSlide<=_asSlideId.length)) _evtDispatcher.dispatch(cyui.event.SliderEvent.END_OF_SLIDE);
					else _evtDispatcher.dispatch(cyui.event.SliderEvent.MIDDLE_OF_SLIDE);
				}else{
					if(_iMaxSlide>_asSlideId.length){
						_evtDispatcher.dispatch(cyui.event.SliderEvent.REQURE_SLIDE);
						return false;
					}else{
						return false;
					}
				}
			}
			_oTweener.setTarget(0, cyui.$(_asSlideId[tmpPosition]).style);
			_oTweener.setBegin(0, 0);
			_oTweener.setFinish(0, -_iAreaWidth);
			_oTweener.setTarget(1, cyui.$(_asSlideId[_iPosition]).style);
			_oTweener.setBegin(1, _iAreaWidth);
			_oTweener.setFinish(1, 0);
			_oTweener.start();
		}
	};
	// Auto slide
	var vAutoSlide=function(){
		vSlideNext();
		_oTimer=setTimeout(vAutoSlide, _nAutoSlide);
	};
	// Initalize slide
	this.init=function(){
		// Choose when initalize
		if(!!cyui.$(_sTargetId)){
			vCheckInit();
			return true;
		}else{
			cyui.event.add(window, 'load', vCheckInit);
		}
	};
	// Add slide id
	this.addSlideId=function(sSlideId){
		_asSlideId.push(sSlideId);
		_evtDispatcher.dispatch(cyui.event.SliderEvent.SLIDE_ADDED);
	};
	// Add button id
	this.addButtonId=function(sPrevBtnId, sNextBtnId){
		_asPrevBtnId.push(sPrevBtnId);
		_asNextBtnId.push(sNextBtnId);
	};
	// Add previous button id
	this.addPrevBtnId=function(sBtnId){
		_asPrevBtnId.push(sBtnId);
	};
	// Add next button id
	this.addNextBtnId=function(sBtnId){
		_asNextBtnId.push(sBtnId);
	};
	// Add event
	this.addListener= function(sEventType, fncCallBack, oTarget, aArgs){
		_evtDispatcher.addListener(sEventType, fncCallBack, oTarget, aArgs);
	};
	init();
};
cyui.browser.getClientRect=function(){
	return self.innerHeight?{width:self.innerWidth,height:self.innerHeight}:((document.documentElement && document.documentElement.clientHeight)?{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}:{width:document.body.clientWidth,height:document.body.clientHeight});
};
cyui.browser.getVersion=function(){
	var ver=navigator.appVersion;
	ver=cyui.browser.isIE?(ver.split(';')[1].split(' '))[2]:ver.split(' ')[0];
	return parseFloat(ver);
};
cyui.setWindowSize=function(iWidth, iHeight){
	// Initalize body size
	var clientRect=cyui.browser.getClientRect();
	var dist={width:iWidth-clientRect.width, height:iHeight-clientRect.height};
	if(dist.width||dist.height){
		document.body.style.width=iWidth+'px';
		document.body.style.height=iHeight+'px';
		// If window on iframe
		if(window.frameElement&&window.frameElement.tagName=='IFRAME'){
			var iframe=window.frameElement;
			iframe.style.width=iWidth+'px';
			iframe.style.height=iHeight+'px';
		}
		// Else window is single
		else{
			// For IE 7
			if(cyui.browser.isIE&&cyui.browser.getVersion()>7)
			{
				// Get now position
				var winPos=cyui.browser.getWindowPosition();
				// Init properties
				var moveX=null;
				var moveY=null;
				// If avail screen size is too small, set position of window to can resize.
				// Calculate position
				if((screen.availWidth-winPos.x)<iWidth) moveX=screen.availWidth-iWidth;
				if((screen.availHeight-winPos.y)<iHeight) moveY=screen.availHeight-winPos.y;
				// Set position
				if(moveX!=null||moveY!=null){
					if(moveX!=null) winPos.x=moveX;
					if(moveY!=null) winPos.y=moveY;
					window.moveTo(winPos.x, winPos.y);
				}
				// Resize default size
				window.resizeBy(dist.width, dist.height);
				// Get body size
				clientRect=cyui.browser.getClientRect();
				// Calculate fit width
				dist.width=iWidth-clientRect.width;
				// Move to drawable position
				if((screen.availWidth-winPos.x)<iWidth+dist.width){
					winPos.x=screen.availWidth-(iWidth*2-clientRect.width);
					window.moveTo(winPos.x, winPos.y);
				}
				// Resize fit width
				window.resizeBy(dist.width, 0);
				// Get body size again
				clientRect=cyui.browser.getClientRect();
				// Calculate fit height
				dist.height=iHeight-clientRect.height;

				// Move to drawable position
				if((screen.availHeight-winPos.y)<iHeight+dist.height){
					winPos.y=screen.availHeight-(iHeight*2-clientRect.height);
					window.moveTo(winPos.x, winPos.y);
				}
				// Resize fit height
				window.resizeBy(0, dist.height);
			}else{
				// Resize default size
				window.resizeBy(dist.width, dist.height);
				// For firefox window.innerWidth bug
				if(cyui.browser.isFF){
					clientRect=cyui.browser.getClientRect();
					dist={width:iWidth-clientRect.width, height:iHeight-clientRect.height};
					if(dist.width||dist.height) window.resizeBy( dist.width, dist.height );
				}
				// Get body size
				clientRect=cyui.browser.getClientRect();
				// Calculate fit width
				dist.width=iWidth-clientRect.width;
				// Resize fit width
				window.resizeBy(dist.width, 0);
				// Get body size again
				clientRect=cyui.browser.getClientRect();
				// Calculate fit height
				dist.height=iHeight-clientRect.height;
				// Resize fit height
				window.resizeBy(0, dist.height);
			}
		}
	}
};
cyui.resize=function(iWidth, iHeight, bIsNow){
	// If run at now
	if(bIsNow) cyui.setWindowSize(iWidth, iHeight);
	// Else run at window onloaded
	else cyui.event.add(window, 'load', function(){cyui.setWindowSize(iWidth, iHeight);});
};
cyui.Toggle=function(_sButtonId, _sTargetId, _sDisplayStyle, _sToggleClassName, _bBodyClickHide){
	var _sOnClassName=null;
	var _sOffClassName=null;
	var _bToggleOn=null;
	var _bToggleCSS=null;
	var _hndListener=[];
	// Constructor
	var init=function(){
		// Check arguments
		if(!_sButtonId||!_sTargetId){
			alert('Any argument is not input.');
			return false;
		}else if((typeof _sButtonId!='string')||(typeof _sTargetId!='string')||((_sToggleClassName!=null)&&(typeof _sToggleClassName!='string'))){
			alert('Any argument is not correct.');
			return false;
		}
		if(_sDisplayStyle==null) _sDisplayStyle='block';
		if(_bBodyClickHide==null) _bBodyClickHide=false;
		// Choose when initalize
		if(!!cyui.$(_sButtonId)&&!!cyui.$(_sTargetId)){
			vInitalize();
			return true;
		}else{
			cyui.event.add(window, 'load', vInitalize);
		}
	};
	// Initalize
	var vInitalize=function(){
		if(!cyui.$(_sButtonId)||!cyui.$(_sTargetId)){
			alert('Argument for _sTargetId is not a id of document element.');
			return false;
		}
		sDisplayNow=cyui.$(_sTargetId).style.display;
		_sDisplayStyle=sDisplayNow=='none'?_sDisplayStyle:sDisplayNow;
		_bToggleOn=sDisplayNow=='none'?false:true;
		if((_bToggleCSS=_sToggleClassName?true:false)){
			if(_bToggleOn){
				_sOnClassName=cyui.$(_sButtonId).className;
				_sOffClassName=_sToggleClassName;
			}else{
				_sOnClassName=_sToggleClassName;
				_sOffClassName=cyui.$(_sButtonId).className;
			}
		}
		cyui.event.add(cyui.$(_sButtonId), 'click', vToggle);
		if(_bBodyClickHide) cyui.event.add(document, 'click', vHide);
	};
	// Toggle layer
	var vToggle=function(e){
		_bToggleOn=!_bToggleOn;
		vShowHide(e);
	};
	// Show layer
	var vShow=function(e){
		if(_bToggleOn==false){
			_bToggleOn=true;
			vShowHide(e);
		}
	};
	// Hide layer
	var vHide=function(e){
		if(_bToggleOn==true){
			_bToggleOn=false;
			vShowHide(e);
		}
	};
	// Show hide layer/
	var vShowHide=function(e){
		if(window.event) e=window.event;
		e.cancelBubble=true;
		var sDisplay=_bToggleOn?_sDisplayStyle:'none';
		cyui.$(_sTargetId).style.display=sDisplay;
		if(_bToggleCSS) cyui.$(_sButtonId).className=_bToggleOn?_sOnClassName:_sOffClassName;
	};
	init();
};
cyui.css.get=function(selectorname) {
	var css=document.styleSheets;
	var rules,rule;
	for(var i=css.length-1;i>=0;i--) {
		try {
			if (css[i].cssRules) rules=css[i].cssRules;
			else if (css[i].rules) rules=css[i].rules;
		} catch(e) {
			continue;
		}
		for(var j=0;j<rules.length;j++) {
			rule=rules[j];
			if (rule.selectorText && rule.selectorText==selectorname) {
				return rule.style;
			}
		}
	}
	return null;
};
cyui.style.get=function(element,property) {
  var value = null;
  var dv = document.defaultView;

  if (cyui.browser.isIE && property == 'opacity') { // IE
	value=1;
	if (value = (element.style.filter || '').match(/alpha\(opacity=(.*)\)/))
	  if (value[1]) value=parseFloat(value[1]) / 100;
  }
  else if (element.style[property]) {return element.style[property];}
  else if (element.currentStyle && element.currentStyle[property]) { return element.currentStyle[property];}
  else if ( dv && dv.getComputedStyle )
  {
	 var converted = '';
	 for(var i = 0, len = property.length;i < len; ++i) {
		if (property.charAt(i) == property.charAt(i).toUpperCase()) {
		   converted = converted + '-' + property.charAt(i).toLowerCase();
		} else {
		   converted = converted + property.charAt(i);
		}
	 }
	 if (dv.getComputedStyle(element, '') && dv.getComputedStyle(element, '').getPropertyValue(converted)) {
		value = dv.getComputedStyle(element, '').getPropertyValue(converted);
	 }
  }
  element=null;
  return value;
};
cyui.Scroll=function(_sTargetId, _sScrollCSS){
	var _hndListener = [];
	var _iPosition = 0;
	var _iMouseOffset = null;
	var _iMouseY = null;
	var _elHandle = null;
	var _iRailHeight = null;
	var _iHandleHeight = null;
	var _bMouseDown = false;
	var _oOrgSize = null;
	var _iScrollWidth = null;
	// Constructor
	var init=function(){
		// Check arguments
		if(!_sTargetId||!_sScrollCSS){
			alert('Any argument is not input.');
			return false;
		}else if((typeof _sTargetId!='string')||(typeof _sScrollCSS!='string')){
			alert('Any argument is not correct.');
			return false;
		}
		// Choose when initalize
		if(!!cyui.$(_sTargetId)&&!!cyui.css.get('.'+_sScrollCSS)){
			vInitalize();
			return true;
		}else{
			cyui.event.add(window, 'load', vInitalize);
		}
	};
	// Initalize
	var vInitalize=function(){
		if(!cyui.$(_sTargetId)||!cyui.css.get('.'+_sScrollCSS)){
			alert('Argument for _sTargetId is not a id of document element.');
			return false;
		}
		var elTarget=cyui.$(_sTargetId);
		var elWrapper=document.createElement('DIV');
		// Swap element
		elTarget.parentNode.insertBefore(elWrapper, elTarget);
		elWrapper.appendChild(elTarget);
		_oOrgSize=cyui.dom.getSize(elTarget);
		var oScrollCSS=cyui.css.get('.'+_sScrollCSS);
		var aImage=oScrollCSS.backgroundImage.replace('url(', '').replace(')', '').split(',');
		var sOrgBorderWidth=cyui.dom.getBorderWidth(elTarget);
		var sOrgPadding=cyui.dom.getPadding(elTarget);
		_iScrollWidth=parseInt(oScrollCSS.width, 10);
		var oWrapSize={};
		oWrapSize.width=_oOrgSize.width-sOrgBorderWidth.left-sOrgBorderWidth.right;
		oWrapSize.height=_oOrgSize.height-sOrgBorderWidth.top-sOrgBorderWidth.bottom;
		cyui.style.set(elWrapper, 'position', 'relative');
		cyui.style.set(elWrapper, 'width', oWrapSize.width+'px');
		cyui.style.set(elWrapper, 'height', oWrapSize.height+'px');
		cyui.style.set(elWrapper, 'marginTop', cyui.style.get(elTarget, 'marginTop'));
		cyui.style.set(elWrapper, 'marginRight', cyui.style.get(elTarget, 'marginRight'));
		cyui.style.set(elWrapper, 'marginBottom', cyui.style.get(elTarget, 'marginBottom'));
		cyui.style.set(elWrapper, 'marginLeft', cyui.style.get(elTarget, 'marginLeft'));
		cyui.style.set(elWrapper, 'borderTopStyle', cyui.style.get(elTarget, 'borderTopStyle'));
		cyui.style.set(elWrapper, 'borderRightStyle', cyui.style.get(elTarget, 'borderRightStyle'));
		cyui.style.set(elWrapper, 'borderBottomStyle', cyui.style.get(elTarget, 'borderBottomStyle'));
		cyui.style.set(elWrapper, 'borderLeftStyle', cyui.style.get(elTarget, 'borderLeftStyle'));
		cyui.style.set(elWrapper, 'borderTopColor', cyui.style.get(elTarget, 'borderTopColor'));
		cyui.style.set(elWrapper, 'borderRightColor', cyui.style.get(elTarget, 'borderRightColor'));
		cyui.style.set(elWrapper, 'borderBottomColor', cyui.style.get(elTarget, 'borderBottomColor'));
		cyui.style.set(elWrapper, 'borderLeftColor', cyui.style.get(elTarget, 'borderLeftColor'));
		cyui.style.set(elWrapper, 'borderTopWidth', cyui.style.get(elTarget, 'borderTopWidth'));
		cyui.style.set(elWrapper, 'borderRightWidth', cyui.style.get(elTarget, 'borderRightWidth'));
		cyui.style.set(elWrapper, 'borderBottomWidth',cyui.style.get(elTarget, 'borderBottomWidth'));
		cyui.style.set(elWrapper, 'borderLeftWidth', cyui.style.get(elTarget, 'borderLeftWidth'));
		cyui.style.set(elWrapper, 'overflow', 'hidden');
		cyui.style.set(elTarget, 'position', 'absolute');
		cyui.style.set(elTarget, 'margin', '0');
		cyui.style.set(elTarget, 'borderWidth', '0');
		cyui.style.set(elTarget, 'width', oWrapSize.width-_iScrollWidth-sOrgPadding.left-sOrgPadding.right+'px');
		cyui.style.set(elTarget, 'height', 'auto');
		cyui.style.set(elTarget, 'overflow', 'visible');
		var elScrollBase=document.createElement('DIV');
		elWrapper.appendChild(elScrollBase);
		cyui.style.set(elScrollBase, 'position', 'absolute');
		cyui.style.set(elScrollBase, 'right', '0');
		cyui.style.set(elScrollBase, 'top', '0');
		cyui.style.set(elScrollBase, 'width', _iScrollWidth+'px');
		cyui.style.set(elScrollBase, 'height', oWrapSize.height+'px');
		var elScrollTopButton=document.createElement('DIV');
		elScrollBase.appendChild(elScrollTopButton);
		cyui.style.set(elScrollTopButton, 'height', oScrollCSS.marginTop);
		cyui.style.set(elScrollTopButton, 'backgroundImage', 'url('+aImage[0]+')');
		cyui.style.set(elScrollTopButton, 'backgroundRepeat', 'no-repeat');
		cyui.style.set(elScrollTopButton, 'backgroundPosition', '0 0');
		_iRailHeight=oWrapSize.height-parseInt(oScrollCSS.marginTop, 10)-parseInt(oScrollCSS.marginBottom, 10);
		var elScrollRail=document.createElement('DIV');
		elScrollBase.appendChild(elScrollRail);
		cyui.style.set(elScrollRail, 'height', _iRailHeight+'px');
		cyui.style.set(elScrollRail, 'position', 'relative');
		cyui.style.set(elScrollRail, 'backgroundImage', 'url('+aImage[1]+')');
		cyui.style.set(elScrollRail, 'backgroundRepeat', 'repeat-y');
		var iPosY=parseInt(oScrollCSS.marginTop, 10)+parseInt(oScrollCSS.marginBottom, 10);
		var elRailTop=document.createElement('DIV');
		elScrollRail.appendChild(elRailTop);
		cyui.style.set(elRailTop, 'width', _iScrollWidth+'px');
		cyui.style.set(elRailTop, 'height', oScrollCSS.borderTopWidth);
		cyui.style.set(elRailTop, 'position', 'absolute');
		cyui.style.set(elRailTop, 'backgroundImage', 'url('+aImage[0]+')');
		cyui.style.set(elRailTop, 'backgroundRepeat', 'no-repeat');
		cyui.style.set(elRailTop, 'backgroundPosition', '0 -'+iPosY+'px');
		iPosY+=parseInt(oScrollCSS.borderTopWidth, 10);
		var elRailBottom=document.createElement('DIV');
		elScrollRail.appendChild(elRailBottom);
		cyui.style.set(elRailBottom, 'width', _iScrollWidth+'px');
		cyui.style.set(elRailBottom, 'bottom', '0');
		cyui.style.set(elRailBottom, 'position', 'absolute');
		cyui.style.set(elRailBottom, 'backgroundImage', 'url('+aImage[0]+')');
		cyui.style.set(elRailBottom, 'backgroundRepeat', 'no-repeat');
		cyui.style.set(elRailBottom, 'backgroundPosition', '0 -'+iPosY+'px');
		_elHandle=document.createElement('DIV');
		elScrollRail.appendChild(_elHandle);
		cyui.style.set(_elHandle, 'width', _iScrollWidth+'px');
		cyui.style.set(_elHandle, 'position', 'absolute');
		iPosY+=parseInt(oScrollCSS.borderBottomWidth, 10);
		var elHandleTop=document.createElement('DIV');
		_elHandle.appendChild(elHandleTop);
		cyui.style.set(elHandleTop, 'height', oScrollCSS.paddingTop);
		cyui.style.set(elHandleTop, 'backgroundImage', 'url('+aImage[0]+')');
		cyui.style.set(elHandleTop, 'backgroundRepeat', 'no-repeat');
		cyui.style.set(elHandleTop, 'backgroundPosition', '0 -'+iPosY+'px');
		_oOrgSize=cyui.dom.getSize(elTarget);
		_iHandleHeight=parseInt(oWrapSize.height*_iRailHeight/_oOrgSize.height, 10);
		var elHandleMid=document.createElement('DIV');
		_elHandle.appendChild(elHandleMid);
		cyui.style.set(elHandleMid, 'height', (_iHandleHeight-parseInt(oScrollCSS.paddingTop, 10)-parseInt(oScrollCSS.paddingBottom, 10))+'px');
		cyui.style.set(elHandleMid, 'overflow', 'hidden');
		cyui.style.set(elHandleMid, 'backgroundImage', 'url('+aImage[1]+')');
		cyui.style.set(elHandleMid, 'backgroundRepeat', 'repeat-y');
		cyui.style.set(elHandleMid, 'backgroundPosition', '-'+_iScrollWidth+'px 0');
		iPosY+=parseInt(oScrollCSS.paddingTop, 10);
		var elHandleBottom=document.createElement('DIV');
		_elHandle.appendChild(elHandleBottom);
		cyui.style.set(elHandleBottom, 'height', oScrollCSS.paddingTop);
		cyui.style.set(elHandleBottom, 'backgroundImage', 'url('+aImage[0]+')');
		cyui.style.set(elHandleBottom, 'backgroundRepeat', 'no-repeat');
		cyui.style.set(elHandleBottom, 'backgroundPosition', '0 -'+iPosY+'px');
		var elScrollBottomButton=document.createElement('DIV');
		elScrollBase.appendChild(elScrollBottomButton);
		cyui.style.set(elScrollBottomButton, 'height', oScrollCSS.marginBottom);
		cyui.style.set(elScrollBottomButton, 'backgroundImage', 'url('+aImage[0]+')');
		cyui.style.set(elScrollBottomButton, 'backgroundRepeat', 'no-repeat');
		cyui.style.set(elScrollBottomButton, 'backgroundPosition', '0 -'+oScrollCSS.marginTop);
		// Add event handler
		cyui.event.add(elScrollTopButton, 'click', hndTopButtonClick);
		cyui.event.add(elScrollTopButton, 'mousedown', hndButtonMouseDown);
		cyui.event.add(elScrollTopButton, 'mouseup', hndButtonMouseUp);
		cyui.event.add(elScrollTopButton, 'mouseout', hndButtonMouseUp);
		cyui.event.add(elScrollBottomButton, 'click', hndBottomButtonClick);
		cyui.event.add(elScrollBottomButton, 'mousedown', hndButtonMouseDown);
		cyui.event.add(elScrollBottomButton, 'mouseup', hndButtonMouseUp);
		cyui.event.add(elScrollBottomButton, 'mouseout', hndButtonMouseUp);
		cyui.event.add(_elHandle, 'mousedown', hndMouseDown);
		var oBaseTarget=cyui.browser.isFF?window:document.body;
		cyui.event.add(oBaseTarget, 'mousemove', hndMouseMove);
		cyui.event.add(oBaseTarget, 'mousedown', hndBodyMouseDown);
		cyui.event.add(oBaseTarget, 'mouseup', hndMouseUp);
		cyui.event.add(oBaseTarget, 'mouseup', hndBodyMouseUp);
		if(cyui.browser.isFF) cyui.event.add(elTarget, 'DOMMouseScroll', hndMouseWheel);
		else cyui.event.add(elTarget, 'mousewheel', hndMouseWheel);
		_iBaseY=cyui.dom.getPos(elScrollRail).y;
	};
	// Top button click handler
	var hndTopButtonClick=function(e){
		if(_iPosition>0){
			_iPosition=_iPosition-10<0?0:_iPosition-10;
			vScrollTo(_iPosition);
		}
	};
	// Bottom button click handler
	var hndBottomButtonClick=function(e){
		if(_iPosition<(_iRailHeight-_iHandleHeight)){
			_iPosition=(_iPosition+10)>(_iRailHeight-_iHandleHeight)?_iRailHeight-_iHandleHeight:_iPosition+10;
			vScrollTo(_iPosition);
		}
	};
	// Button mouse down handler
	var hndButtonMouseDown=function(e){
		var e=window.event?window.event:e;
		var oTarget=e.srcElement?e.srcElement:e.target;
		var aBgPosition=cyui.style.get(oTarget, 'backgroundPosition').split(' ');
		aBgPosition[0]='-'+_iScrollWidth+'px';
		cyui.style.set(oTarget, 'backgroundPosition', aBgPosition[0]+' '+aBgPosition[1]);
	};
	// Button mouse up handler
	var hndButtonMouseUp=function(e){
		var e=window.event?window.event:e;
		var oTarget=e.srcElement?e.srcElement:e.target;
		var aBgPosition=cyui.style.get(oTarget, 'backgroundPosition').split(' ');
		aBgPosition[0]='0';
		cyui.style.set(oTarget, 'backgroundPosition', aBgPosition[0]+' '+aBgPosition[1]);
	};
	// Mouse down handler
	var hndMouseDown=function(e){
		var e=window.event?window.event:e;
		var oTarget=e.srcElement?e.srcElement:e.target;
		_iMouseY=e.pageY?e.pageY:document.documentElement.scrollTop+e.clientY;
		_iMouseOffset=cyui.dom.getPos(_elHandle).y-_iMouseY;
	};
	// Mouse move handler
	var hndMouseMove=function(e){
		if(_iMouseY&&_bMouseDown){
			var e=window.event?window.event:e;
			var oTarget=e.srcElement?e.srcElement:e.target;
			_iMouseY=e.pageY?e.pageY:document.documentElement.scrollTop+e.clientY;
			var posTop=_iMouseY-_iBaseY+_iMouseOffset;
			if(posTop<0) posTop = 0;
			else if(posTop>_iRailHeight-_iHandleHeight) posTop=_iRailHeight-_iHandleHeight;
			_iPosition=posTop;
			vScrollTo(_iPosition);
		}
	};
	// Mouse up handler
	var hndMouseUp=function(e){
		_iMouseY=null;
		_iMouseOffset=null;
	};
	// Body mouse down handler
	var hndBodyMouseDown=function(e){
		_bMouseDown = true;
	};
	// Body mouse up handler
	var hndBodyMouseUp=function(e){
		_bMouseDown = false;
	};
	// Mouse wheel handler
	var hndMouseWheel=function(e){
		if(window.event){
			e=window.event;
			e.returnValue=false;
		}else{
			if(e.preventDefault){
				e.preventDefault();
			}
		}
		var delta=e.detail?e.detail/3:-e.wheelDelta/120;
		var posTop=_iPosition+(10*delta);
		if(posTop<0) posTop=0;
		else if(posTop>_iRailHeight-_iHandleHeight) posTop=_iRailHeight-_iHandleHeight;
		_iPosition=posTop;
		vScrollTo(_iPosition);
	};
	// Get top position of target element to scroll
	var iGetScrollTop=function(iScrollBarTop){
		return parseInt(iScrollBarTop*_oOrgSize.height/_iRailHeight);
	};
	// Scroll to position
	var vScrollTo=function(iPosition){
		cyui.style.set(_elHandle, 'top', iPosition+'px');
		cyui.style.set(cyui.$(_sTargetId), 'top', '-'+iGetScrollTop(iPosition)+'px');
	};
	init();
};


/* 접속중인 내 일촌 버튼관련 */
function chgIcoText(id1) {
	var obj = document.getElementById(id1);
	var obja = document.getElementById('link-onedeg');
	var objlist = document.getElementById('list-onedeg');
	var icoClass = obj.className;

	if (icoClass=='icon-open')
	{
		obj.innerHTML = '리스트 펼치기';
		obj.className = 'icon-close';
		obja.title = '미니라이프에 접속중인 내 일촌 리스트를 봅니다.';
		objlist.style.display = 'none';
	} else if (icoClass=='icon-close')
	 {
		obj.innerHTML = '리스트 접기';
		obj.className = 'icon-open';
		obja.title = '미니라이프에 접속중인 내 일촌 리스트를 닫습니다.';
		objlist.style.display = 'inline';
	}
}

/* swf삽입 */
var skiui={}
skiui.ua=navigator.userAgent.toLowerCase();
skiui.isIE=skiui.ua.indexOf('msie')!=-1;
skiui.isWin=skiui.ua.indexOf('win')!=-1;
skiui.isOpera=skiui.ua.indexOf('opera')!=-1;
skiui.ver=null;
skiui.getVer=function(){
	if(skiui.ver!=null) return skiui.ver;
	var axo;
	var e;
	try{
		axo=new ActiveXObject('ShockwaveFlash.ShockwaveFlash.7');
		skiui.ver=axo.GetVariable('$version');
	}catch(e){
	}
	if(!skiui.ver){
		try{
			axo=new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
			skiui.ver='WIN 6,0,21,0';
			alo.AllowScriptAccess='always';
			skiui.ver=axo.GetVariable('$version');
		}catch(e){
		}
	}
	if(!skiui.ver){
		try{
			axo=new ActiveXObject('ShockwaveFlash.ShockwaveFlash.3');
			skiui.ver=axo.GetVariable('$version');
		}catch(e){
		}
	}
	if(!skiui.ver){
		try{
			axo=new ActiveXObject('ShockwaveFlash.ShockwaveFlash.3');
			skiui.ver='WIN 2,0,0,11';
		}catch(e){
			skiui.ver=-1;
		}
	}
};
skiui.getSwfVer=function(){
		var flVer=-1;
	if(navigator.plugins!=null&&navigator.plugins.length>0){
		if(navigator.plugins['Shockwave Flash 2.0']||navigator.plugins['Shockwave Flash']){
			var swVer2=navigator.plugins['Shockwave Flash 2.0']?' 2.0': '';
			var flDesc=navigator.plugins['Shockwave Flash'+swVer2].description;
			var descArr=flDesc.split(' ');
			var tempArrMajor=descArr[2].split('.');
			var verMajor=tempArrMajor[0];
			var verMinor=tempArrMajor[1];
			var verRev=descArr[3];
			if(verRev=='') verRev=descArr[4];
			if(verRev[0]=='d') verRev=verRev.substring(1);
			else if(verRev[0]=='r'){
				verRev=verRev.substring(1);
				if(verRev.indexOf('d')>0) verRev=verRev.substring(0, verRev.indexOf('d'));
			}
			flVer=verMajor+'.'+verMinor+'.'+verRev;
		}
	}else if(skiui.ua.indexOf('webtv/2.6')!=-1) flVer=4;
	else if(skiui.ua.indexOf('webtv/2.5')!=-1) flVer=3;
	else if(skiui.ua.indexOf('webtv')!=-1) flVer=2;
	else if(skiui.isIE&&skiui.isWin&&!skiui.isOpera) flVer=getVer();
	return flVer;
};
skiui.detectFlVer=function(reqMajorVer, reqMinorVer, reqRev){
	var verStr=skiui.getSwfVer();
	var tmpArr;
	var tmpStr;
	var verArr;
	if(verStr==-1) return false;
	else if(verStr!=0){
		if(skiui.isIE&&skiui.isWin&&!skiui.isOpera){
			tmpArr=verStr.split(' ');
			tmpStr=tmpArr[1];
			verArr=tmpStr.split(',');
		}else verArr=verStr.split('.');
		var verMajor=verArr[0];
		var verMinor=verArr[1];
		var verRev=verArr[2];
		if(verMajor>parseFloat(reqMajorVer)) return true;
		else if(verMajor==parseFloat(reqMajorVer)){
			if(verMinor>parseFloat(reqMinorVer)) return true;
			else if(verMinor==parseFloat(reqMinorVer)) if(verRev>=parseFloat(reqRev)) return true;
		}
		return false;
	}
};
skiui.getHTML=function(ieAttrs, params, ffAttrs, reqVer){
	var str='';
	if(skiui.isIE&&skiui.isWin&&!skiui.isOpera){
		str+='<object ';
		for(var p in ieAttrs) str+=p+'="'+ieAttrs[p]+'" ';
		str+='>';
		for(var p in params) str+='<param name="'+p+'" value="'+params[p]+'" />';
		str+='</object>';
	}else{
		var ver=reqVer.split(',');
		if(skiui.detectFlVer(ver[0], ver[1], ver[2])){
			str+='<object ';
			if(/Firefox\/3/.test(navigator.userAgent)){
				str+='style="outline:none;"';
			}
			for(var p in ffAttrs) str+=p+'="'+ffAttrs[p]+'" ';
			str+='></object>';
		}else{
				str+='<div style="text-align:center;"><h1>Require flash player version '+reqVer+'</h1><p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p></div>';
		}
	}
	return str;
};
skiui.getArgs=function(src, id, width, height, wmode, flashvars, option){
	var ret={};
	ret.ieAttrs={};
	ret.params={};
	ret.ffAttrs={};
	if(option==null) option={};
	if(option['quality']==null) option['quality']='high';
	if(option['align']==null) option['align']='middle';
	if(option['play']==null) option['play']='true';
	if(option['loop']==null) option['loop']='true';
	if(option['scale']==null) option['scale']='noscale';
	if(option['devicefont']==null) option['devicefont']='false';
	if(option['bgcolor']==null) option['bgcolor']='#ffffff';
	if(option['menu']==null) option['menu']='true';
	if(option['allowFullScreen']==null) option['allowFullScreen']='false';
	if(option['allowScriptAccess']==null) option['allowScriptAccess']='always';
	if(option['version']==null) option['version']='10,0,0,0';
	ret.ieAttrs['codebase']='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+option['version'];
	ret.ieAttrs['id']=ret.ffAttrs['id']=id;
	ret.ieAttrs['classid']='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
	ret.ffAttrs['type']='application/x-shockwave-flash';
	ret.ffAttrs['pluginspage']='http://www.macromedia.com/go/getflashplayer';
	ret.ffAttrs['data']=ret.params['movie']=src;
	ret.ffAttrs['width']=ret.ieAttrs['width']=width;
	ret.ffAttrs['height']=ret.ieAttrs['height']=height;
	ret.ffAttrs['wmode']=ret.params['wmode']=wmode;
	ret.ffAttrs['flashvars']=ret.params['flashvars']=flashvars;
	for(var p in option){
		switch (p){
			case "classid":
				break;
			case "onafterupdate":
			case "onbeforeupdate":
			case "onblur":
			case "oncellchange":
			case "onclick":
			case "ondblclick":
			case "ondrag":
			case "ondragend":
			case "ondragenter":
			case "ondragleave":
			case "ondragover":
			case "ondrop":
			case "onfinish":
			case "onfocus":
			case "onhelp":
			case "onmousedown":
			case "onmouseup":
			case "onmouseover":
			case "onmousemove":
			case "onmouseout":
			case "onkeypress":
			case "onkeydown":
			case "onkeyup":
			case "onload":
			case "onlosecapture":
			case "onpropertychange":
			case "onreadystatechange":
			case "onrowsdelete":
			case "onrowenter":
			case "onrowexit":
			case "onrowsinserted":
			case "onstart":
			case "onscroll":
			case "onbeforeeditfocus":
			case "onactivate":
			case "onbeforedeactivate":
			case "ondeactivate":
			case "type":
				ret.ieAttrs[p]=option[p];
				break;
			case "align":
			case "vspace":
			case "hspace":
			case "class":
			case "title":
			case "accesskey":
			case "tabindex":
				ret.ffAttrs[p]=ret.ieAttrs[p]=option[p];
				break;
			case "version":
				ret.ver=option[p];
			case "codebase":
				ret.ieAttrs[p]=option[p]+option['version'];
				break;
			default:
				ret.ffAttrs[p]=ret.params[p]=option[p];
		}
	}
	return ret;
};
skiui.addFlash=function(src, id, width, height, wmode, flashvars, option){
	if(width==null) width='100%';
	if(height==null) height='100%';
	if(wmode==null) wmode='window';
	else{
		wmode=wmode.toLowerCase();
		if(wmode!='window'&&wmode!='opaque'&&wmode!='transparent') wmode='window';
	}
	var ret=skiui.getArgs(src, id, width, height, wmode, flashvars, option);
	document.write(skiui.getHTML(ret.ieAttrs, ret.params, ret.ffAttrs, ret.ver));
};
skiui.getEmbed=function(src, id, width, height, wmode, flashvars, option){
	if(width==null) width='100%';
	if(height==null) height='100%';
	if(wmode==null) wmode='window';
	else{
		wmode=wmode.toLowerCase();
		if(wmode!='window'&&wmode!='opaque'&&wmode!='transparent') wmode='window';
	}
	var ret=skiui.getArgs(src, id, width, height, wmode, flashvars, option);
	return skiui.getHTML(ret.ieAttrs, ret.params, ret.ffAttrs, ret.ver);
};


/* rounded 짝수로 */
function setOnetimeHeight(el, padding) {
	var objHeight = el.offsetHeight - padding;
	el.style.height = ( objHeight % 2 ? objHeight + 1 + 'px' : objHeight );
}

/* IE6 SP1 이후 background 깜빡거림관련 */
try {
    document.execCommand("BackgroundImageCache", false, true);
} catch(ignored) {}

/* 버튼 hover */
function buttonHover(e) {
    var event = e || window.event;
    var t = event.target || event.srcElement;
    tc = t.className;
	t.className = tc + "-over";
}

function buttonOut(target,cn) {
    target.className = cn;
}

function toggleLayer(id) {
	try {
	var obj = document.getElementById(id);
	obj.style.display = (obj.style.display == "none") ? "block" : "none";
	} catch (e) {

	}
	return true;
}

/* 일촌목록토글 */
function minilifeOnedeg () {
	var wrap = document.getElementById("test");
	var arw = wrap.getElementsByTagName("span")[0];
	var btn = wrap.getElementsByTagName("button")[0];
	var ul = wrap.getElementsByTagName("ul")[0];

	if (arw.className == "arw")
	{
		ul.style.display = "block";
		btn.setAttribute("title","일촌목록닫기");
		arw.className = "arw arw-open";
	} else if (arw.className == "arw arw-open")
	{
		ul.style.display = "none";
		btn.setAttribute("title","일촌목록열기");
		arw.className = "arw";
	}
}

/* 아바타 edit 버튼 */

var timer=null;
function editOver(){
   if(timer){
	  clearTimeout(timer);
   }
   showEdit();
}
function editOut(){
   timer=setTimeout(hideEdit, 100);
}
function showEdit(){
	var avatarEditButton = document.getElementById('avatarEdit');
	avatarEditButton.style.display='inline';
   //레이어 보이기
}
function hideEdit(){
	var avatarEditButton = document.getElementById('avatarEdit');
	avatarEditButton.style.display='none';
   //레이어 감추기
}