function ieHover(h_list){
	if ($.browser.msie && $.browser.version < 7){
		$(h_list).live('mouseover', function(){
			$(this).addClass('hover');
		}).live('mouseout', function(){
			$(this).removeClass('hover');
		});
	}
}
/*--- accordion ---*/
jQuery.fn.acc = function(_options){
	var _options = jQuery.extend({
		speed: 400,
		active: 'active',
		list: '.children()',
		opener: 'a.opener',
		slide: 'div.slide'
	}, _options);
	return this.each(function(){
		var _list = eval('jQuery(this)' + _options.list);
		var _active = _options.active;
		var _speed = _options.speed;
		var _a = _list.index(_list.filter('.' + _active + ':eq(0)'));
		if(_a != -1) _list.removeClass(_active).eq(_a).addClass(_active);
		for(var i = 0; i < _list.length; i++){
			_list.eq(i).data('btn', _list.eq(i).find(_options.opener).eq(0));
			_list.eq(i).data('box', _list.eq(i).find(_options.slide).eq(0));
			if(_list.eq(i).data('box').length && _list.eq(i).data('btn').length){
				_list.eq(i).data('btn').data('ind', i).click(function(){
					changeEl(jQuery(this).data('ind'));
					return false;
				});
				if(i == _a){
					_list.eq(i).data('box').css('display', 'block');
					_list.eq(i).data('btn').text('less');
				}
				else{
					_list.eq(i).data('box').css('display', 'none');
					_list.eq(i).data('btn').text('more');
				}
				
			}
		}
		var anim_f = true;
		var a_h, ind_h, _k;
		function changeEl(_ind){
			if(anim_f){
				anim_f = false;
				if(_a == _ind){
					_list.eq(_a).data('btn').text('more');
					_list.eq(_a).removeClass(_active).data('box').animate({height: 0}, {
						duration: _speed,
						complete: function(){
							jQuery(this).css({display:'none', height:'auto'});
							_a = -1;
							anim_f = true;
						}
					});
				}
				else{
					_list.eq(_ind).data('btn').text('less');
					_list.eq(_ind).data('box').css('display', 'block');
					ind_h = _list.eq(_ind).data('box').outerHeight();
					_list.eq(_ind).data('box').height(0);
					if(_a != -1){
						_list.eq(_a).data('btn').text('more');
						a_h = _list.eq(_a).removeClass(_active).data('box').outerHeight();
						_k = a_h/ind_h;
					}
					_list.eq(_ind).addClass(_active).data('box').animate({height: ind_h}, {
						duration: _speed,
						step: function(t_h){
							if(_a != -1) _list.eq(_a).data('box').height(a_h - t_h*_k);
						},
						complete: function(){
							_list.eq(_ind).data('box').height('auto');
							if(_a != -1) _list.eq(_a).data('box').css({display:'none', height: 'auto'});
							_a = _ind;
							anim_f = true;
						}
					});
				}
			}
		}
	});
}

jQuery(document).ready(function(){
	jQuery('ul.accordion').acc({
		slide: 'div.slide-hold'
	});
	ieHover('#nav li', 'hover');
});
