/***
* MooTools Copyright:copyright (c) 2007 Valerio Proietti, <http://mad4milk.net>
* This script is used to fix for mootools v1.11 . It's Free for use
* Use :
<script type="text/JavaScript" src="/path/to/mootools.v1.11.js"></script>
<script type="text/JavaScript" src=""/path/to/mootools.v1.11-fix_by_loa.js"></script>
<!-- this js must put at the line after the mootols.js , and please don't set any code between them -->

*/
var MooToolsFixByLoa = {
version: '1.11'
,date: '2010-01-15'
};

Element.extend({
	setStyle:function(property, value){
		switch(property){
			case 'opacity': return this.setOpacity(parseFloat(value));
			case 'float': property = (window.ie) ? 'styleFloat' : 'cssFloat';
	//fix on ie Add by loa(locke_ad@yahoo.com.tw) 2007-11-05
	case 'width':
	case 'height':if (window.ie)if (value.toInt()<1)value=1;break;
	//fix end
		}
		property = property.camelCase();
		switch($type(value)){
			case 'number': if (!['zIndex', 'zoom'].contains(property)) value += 'px'; break;
			case 'array': value = 'rgb(' + value.join(',') + ')';
		}
		this.style[property] = value;
		return this;
	}
	,del: function(){//remove is keyword in firefox and ie8 (mod by loa 2010-01-15)
		if ( this.parentNode )	return this.parentNode.removeChild(this);
	}

});
if( !Event.KEY_DOWN )Event = $extend(Event, {
KEY_BACKSPACE: 8,KEY_TAB:       9,
KEY_RETURN:   13,KEY_ESC:      27,
KEY_LEFT:     37,KEY_UP:       38,
KEY_RIGHT:    39,KEY_DOWN:     40,
KEY_DELETE:   46,KEY_HOME:     36,
KEY_END:      35,KEY_PAGEUP:   33,
KEY_PAGEDOWN: 34});

/*fix on ie Add by loa(locke_ad@yahoo.com.tw) 2007-11-05*/
if (window.ie){
var Accordion = Fx.Accordion.extend({
step: function(){
	var time = $time();
	if (!(time < this.time + this.options.duration)){
		this.hideElement.setStyle('display','none');
	}
	return this.parent();
},
display: function(index){
		var hidH = window.ie ? 1:0;
		this.elements.each(function(el, i){
			if ( window.ie ){
				if ( el.offsetHeight < hidH)	el.setStyle('height',hidH);
			}
			var hide = (i != index) || (this.options.alwaysHide && (el.offsetHeight > hidH));
			if ( hide )this.hideElement = el;
			else el.setStyle('display','');
		}, this);
/*
		return this.parent(index);
*/
		index = ($type(index) == 'element') ? this.elements.indexOf(index) : index;
		if ((this.timer && this.options.wait) || (index === this.previous && !this.options.alwaysHide)) return this;
		this.previous = index;
		var obj = {};

		this.elements.each(function(el, i){
			obj[i] = {};
			var hide = (i != index) || (this.options.alwaysHide && (el.offsetHeight > hidH));
			this.fireEvent(hide ? 'onBackground' : 'onActive', [this.togglers[i], el]);
			for (var fx in this.effects) obj[i][fx] = hide ? (fx=='height'? hidH :0) : el[this.effects[fx]];
		}, this);
		return this.start(obj);
	}
});
Fx.Accordion = Accordion;
}
/*fix end*/

/*fix Garbage.trash on ie 7 Add by loa(locke_ad@yahoo.com.tw) 2009-09-09*/
Garbage.trash = function(elements){
		for (var i = 0, j = elements.length, el; i < j; i++){
			if (!(el = elements[i]) || !el.$tmp) continue;
			if (el.$events) el.fireEvent('trash').removeEvents();
			for (var p in el.$tmp) el.$tmp[p] = null;
			for (var d in Element.prototype) {
				try{
				el[d] = null;
				}catch(e){};
			}
			Garbage.elements[Garbage.elements.indexOf(el)] = null;
			el.htmlElement = el.$tmp = el = null;
		}
		Garbage.elements.remove(null);
	}
/*fix end*/

