
// multiAccordeon plugin
jQuery.fn.Accordeon = function (_options) {
    // default options
    var _options = jQuery.extend({
        activeClass: 'active',
        opener: '.opener',
        slider: '.slide',
        slideSpeed: 400,
        animStart: false,
        animEnd: false,
        event: 'click'
    }, _options);

    return this.each(function () {
        // options

        jQuery(this).find('>li').each(function () {

            var _holder = jQuery(this);
            var _slideSpeed = _options.slideSpeed;
            var _activeClass = _options.activeClass;
            var _opener = jQuery('>' + _options.opener, _holder);
            var _slider = jQuery('>' + _options.slider, _holder);
            var _animStart = _options.animStart;
            var _animEnd = _options.animEnd;
            var _event = _options.event;

            if (_slider.length) {
                if (_holder.hasClass(_activeClass)) { _slider.show(); }
                else { _slider.hide(); }

                _opener.bind(_event, function () {
                    _holder.siblings().find('li').removeClass(_activeClass);
                    if (!_slider.is(':animated')) {
                        if (typeof _animStart === 'function') _animStart();
                        if (!_holder.hasClass(_activeClass)) {
                            _holder.siblings().removeClass(_activeClass).find(_options.slider).slideUp(_slideSpeed, function () {
                                if (typeof _animEnd === 'function') _animEnd();
                            });
                            _holder.addClass(_activeClass);
                            _slider.slideDown(_slideSpeed, function () {
                                if (typeof _animEnd === 'function') _animEnd();
                            });
                        }
                    }
                    return false;
                });
            }
        });
    });

}
// initSlidebox
function initSlidebox() {
    // Slide effect
    var _parentSlide = '.slide-block';
    var _linkSlide = 'a.open-close';
    var _slideBlock = 'div.block';
    var _openClassS = 'active';
    var _textOpenS = 'Advanced Search';
    var _textCloseS = 'Quick Search';
    var _durationSlide = 500;

    jQuery(_parentSlide).each(function () {
        if (!jQuery(this).is('.' + _openClassS)) {
            jQuery(this).find(_slideBlock).css('display', 'none');
        }
    });
    jQuery(_linkSlide, _parentSlide).click(function () {
        if (jQuery(this).parents(_parentSlide).is('.' + _openClassS)) {
            jQuery(this).parents(_parentSlide).removeClass(_openClassS);
            jQuery(this).parents(_parentSlide).find(_slideBlock).slideUp(_durationSlide);
            jQuery(this).text(_textOpenS);
        } else {
            jQuery(this).parents(_parentSlide).addClass(_openClassS);
            jQuery(this).parents(_parentSlide).find(_slideBlock).slideDown(_durationSlide);
            jQuery(this).text(_textCloseS);
        }
        return false;
    });
}
function doClick(buttonName, e) {
    if (e.which || e.keyCode) {
        if ((e.which == 13) || (e.keyCode == 13)) {
            jQuery("." + buttonName).click();
            e.returnValue = false;
            e.cancel = true;
            return false;
        }
    }
    else {
        return true;
    }
}

//init accordions
function initAccordion() {
    jQuery('.accordion').each(function () {
        var _acc = jQuery(this);
        var _openers = jQuery(".opener", _acc);
        jQuery('.accordion').Accordeon({
            header: '.opener',
            active: _openers.index(_openers.filter('.selected')),
            icons: false
        })
    })

}
function initGallery(context, options) { this.init(context, options) }
(function ($) {
    initGallery.prototype = {
        autoRotation: false,
        disableBtn: false,
        list: 'ul.g1',
        switcher: false,
        prev: false,
        next: false,
        effect: false,
        event: 'click',
        onStart: function () { },
        onChange: function () { },
        stopOnHover: true,
        activeSlide: 0,

        init: function (context, options) {
            for (var i in options) this[i] = options[i];
            this.holder = $(context);
            if (this.holder == undefined) return;

            this.list = this.holder.find(this.list);
            this.animation = true, this.active = 0;
            this.prevActive = this.active, this.wait;
            this.count = this.list.children().length,
			this.w = this.list.children().eq(0).outerWidth();
            this.holdW = this.list.parent().width();
            this.visEl = Math.ceil(this.holdW / this.w);

            if (this.count <= this.visEl) this.animation = false;

            if (this.effect == 'fade') this.list.children().css('opacity', 0).eq(this.active).css('opacity', 1).addClass('active');
            else if (this.effect == 'slide') this.list.css('marginLeft', -this.w * this.active);

            this.initControls(this);

            this.toggleState.listItem(this);
            if (this.switcher) this.toggleState.switchItem(this);

            this.onStart(this.list, this.active);

            if (this.autoRotation && this.animation) this.runTimer(this);
        },
        initControls: function (_this) {
            if (_this.prev && _this.next) {
                _this.prev = _this.holder.find(_this.prev).attr('rel', 'prev').click(function (e) {
                    _this.refreshState(e);
                    return false;
                });
                _this.next = _this.holder.find(_this.next).attr('rel', 'next').click(function (e) {
                    _this.refreshState(e);
                    return false;
                });
            }
            if (_this.switcher) {
                _this.switcher = _this.holder.find(_this.switcher);
                _this.toggleState.switchItem(_this);
                _this.switcher.bind(_this.event, function () {
                    var ind = _this.switcher.index($(this))
                    _this.refreshState(ind);
                    return false;
                });
            }
            if (this.disableBtn) this.disabledConrtol();
        },
        toggleState: {
            listItem: function (_this) {
                _this.list.children().eq(_this.prevActive).removeClass('active');
                _this.list.children().eq(_this.active).addClass('active');
            },
            switchItem: function (_this) {
                _this.switcher.eq(_this.prevActive).removeClass('active');
                _this.switcher.eq(_this.active).addClass('active');
            }
        },
        disabledConrtol: function () {
            if (this.active == 0) {
                this.prev.parent().addClass('disabled');
                this.next.parent().removeClass('disabled');
            }
            else if (this.active == this.count - 1 && this.active + this.visEl == this.count) {
                this.prev.parent().removeClass('disabled');
                this.next.parent().addClass('disabled');
                this.autoRotation = false;
            }
            else {
                this.prev.parent().removeClass('disabled');
                this.next.parent().removeClass('disabled');
            }
        },
        runTimer: function (_this) {
            this.wait = setTimeout(function () { _this.refreshState('next') }, this.autoRotation)
        },
        stop: function () {
            if (this.wait) clearTimeout(this.wait)
        },
        play: function () {
            if (this.wait) clearTimeout(this.wait);
            if (this.autoRotation) this.runTimer(this);
        },
        changeSlide: {
            fade: function (_this) {
                _this.list.children().eq(_this.prevActive).animate({ opacity: 0 }, { queue: false, duration: 700 });
                _this.list.children().eq(_this.active).animate({ opacity: 1 }, { queue: false, duration: 700, complete: function () {
                    _this.play();
                    _this.onChange(_this.list, _this.active);
                } 
                });
            },
            slide: function (_this) {
                if (_this.active + _this.visEl > _this.count) _this.active = 0;
                _this.list.animate({ marginLeft: -_this.w * _this.active }, { queue: false, duration: 700, complete: function () {
                    _this.play();
                    _this.onChange(_this.list, _this.active);
                } 
                });
            }
        },
        refreshState: function (e) {
            if (this.animation) {
                this.prevActive = this.active;
                if (typeof e == 'string' && e == 'next') this.active++;
                else if (typeof e == 'number') this.active = e;
                else {
                    if (e.target.rel == 'next') this.active++;
                    else if (e.target.rel == 'prev') this.active--;
                }
                if (this.wait) clearTimeout(this.wait);
                if (this.active == this.count) this.active = 0;
                else if (this.active == -1) this.active = this.count - 1;

                this.toggleState.listItem(this);
                if (this.switcher) this.toggleState.switchItem(this);

                if (this.disableBtn) this.disabledConrtol();

                if (this.effect == 'fade') this.changeSlide.fade(this);
                else if (this.effect == 'slide') this.changeSlide.slide(this);
            }
        }
    }
})(jQuery);


$(document).ready(function () {

    initSlideshow();

}); 
// slideshow init
function initSlideshow(){
	jQuery('.slider-holder').fadeGallery({
		slideElements:'.slider > li',
		pagerLinks:'.swicher a',
		activeClass:'active',
		autoRotation:true,
		switchTime:10000
	});
}
// slideshow plugin
jQuery.fn.fadeGallery = function(_options){
	var _options = jQuery.extend({
		slideElements:'div.slideset > div',
		pagerLinks:'div.pager a',
		btnNext:'a.next',
		btnPrev:'a.prev',
		btnPlayPause:'a.play-pause',
		btnPlay:'a.play',
		btnPause:'a.pause',
		pausedClass:'paused',
		disabledClass: 'disabled',
		playClass:'playing',
		activeClass:'active',
		loadingClass:'ajax-loading',
		loadedClass:'slide-loaded',
		dynamicImageLoad:false,
		dynamicImageLoadAttr:'alt',
		currentNum:false,
		allNum:false,
		startSlide:null,
		noCircle:false,
		pauseOnHover:true,
		autoRotation:false,
		autoHeight:false,
		onBeforeFade:false,
		onAfterFade:false,
		onChange:false,
		disableWhileAnimating:false,
		switchTime:3000,
		duration:650,
		event:'click'
	},_options);

	return this.each(function(){
		// gallery options
		if(this.slideshowInit) return; else this.slideshowInit;
		var _this = jQuery(this);
		var _slides = jQuery(_options.slideElements, _this);
		var _pagerLinks = jQuery(_options.pagerLinks, _this);
		var _btnPrev = jQuery(_options.btnPrev, _this);
		var _btnNext = jQuery(_options.btnNext, _this);
		var _btnPlayPause = jQuery(_options.btnPlayPause, _this);
		var _btnPause = jQuery(_options.btnPause, _this);
		var _btnPlay = jQuery(_options.btnPlay, _this);
		var _pauseOnHover = _options.pauseOnHover;
		var _dynamicImageLoad = _options.dynamicImageLoad;
		var _dynamicImageLoadAttr = _options.dynamicImageLoadAttr;
		var _autoRotation = _options.autoRotation;
		var _activeClass = _options.activeClass;
		var _loadingClass = _options.loadingClass;
		var _loadedClass = _options.loadedClass;
		var _disabledClass = _options.disabledClass;
		var _pausedClass = _options.pausedClass;
		var _playClass = _options.playClass;
		var _autoHeight = _options.autoHeight;
		var _duration = _options.duration;
		var _switchTime = _options.switchTime;
		var _controlEvent = _options.event;
		var _currentNum = (_options.currentNum ? jQuery(_options.currentNum, _this) : false);
		var _allNum = (_options.allNum ? jQuery(_options.allNum, _this) : false);
		var _startSlide = _options.startSlide;
		var _noCycle = _options.noCircle;
		var _onChange = _options.onChange;
		var _onBeforeFade = _options.onBeforeFade;
		var _onAfterFade = _options.onAfterFade;
		var _disableWhileAnimating = _options.disableWhileAnimating;

		// gallery init
		var _anim = false;
		var _hover = false;
		var _prevIndex = 0;
		var _currentIndex = 0;
		var _slideCount = _slides.length;
		var _timer;
		if(_slideCount < 2) return;
		
		

		_prevIndex = _slides.index(_slides.filter('.'+_activeClass));
		if(_prevIndex < 0) _prevIndex = _currentIndex = 0;
		else _currentIndex = _prevIndex;
		if(_startSlide != null) {
			if(_startSlide == 'random') _prevIndex = _currentIndex = Math.floor(Math.random()*_slideCount);
			else _prevIndex = _currentIndex = parseInt(_startSlide);
		}
		_slides.hide().eq(_currentIndex).show();
		if(_autoRotation) _this.removeClass(_pausedClass).addClass(_playClass);
		else _this.removeClass(_playClass).addClass(_pausedClass);

		// gallery control
		if(_btnPrev.length) {
			_btnPrev.bind(_controlEvent,function(){
				prevSlide();
				return false;
			});
		}
		if(_btnNext.length) {
			_btnNext.bind(_controlEvent,function(){
				nextSlide();
				return false;
			});
		}
		if(_pagerLinks.length) {
			_pagerLinks.each(function(_ind){
				jQuery(this).bind(_controlEvent,function(){
					if(_currentIndex != _ind) {
						if(_disableWhileAnimating && _anim) return;
						_prevIndex = _currentIndex;
						_currentIndex = _ind;
						switchSlide();
					}
					return false;
				});
			});
		}

		// play pause section
		if(_btnPlayPause.length) {
			_btnPlayPause.bind(_controlEvent,function(){
				if(_this.hasClass(_pausedClass)) {
					_this.removeClass(_pausedClass).addClass(_playClass);
					_autoRotation = true;
					autoSlide();
				} else {
					_autoRotation = false;
					if(_timer) clearTimeout(_timer);
					_this.removeClass(_playClass).addClass(_pausedClass);
				}
				return false;
			});
		}
		if(_btnPlay.length) {
			_btnPlay.bind(_controlEvent,function(){
				_this.removeClass(_pausedClass).addClass(_playClass);
				_autoRotation = true;
				autoSlide();
				return false;
			});
		}
		if(_btnPause.length) {
			_btnPause.bind(_controlEvent,function(){
				_autoRotation = false;
				if(_timer) clearTimeout(_timer);
				_this.removeClass(_playClass).addClass(_pausedClass);
				return false;
			});
		}

		// dynamic image loading (swap from ATTRIBUTE)
		function loadSlide(slide) {
			if(!slide.hasClass(_loadingClass) && !slide.hasClass(_loadedClass)) {
				var images = slide.find(_dynamicImageLoad) // pass selector here
				var imagesCount = images.length;
				if(imagesCount) {
					slide.addClass(_loadingClass);
					images.each(function(){
						var img = this;
						img.onload = function(){
							img.loaded = true;
							img.onload = null;
							setTimeout(reCalc,_duration);
						}
						img.setAttribute('src', img.getAttribute(_dynamicImageLoadAttr));
						img.setAttribute(_dynamicImageLoadAttr,'');
					}).css({opacity:0});

					function reCalc() {
						var cnt = 0;
						images.each(function(){
							if(this.loaded) cnt++;
						});
						if(cnt == imagesCount) {
							slide.removeClass(_loadingClass);
							images.animate({opacity:1},{duration:_duration,complete:function(){
								if(jQuery.browser.msie && jQuery.browser.version < 9) jQuery(this).css({opacity:'auto'})
							}});
							slide.addClass(_loadedClass)
						}
					}
				}
			}
		}

		// gallery animation
		function prevSlide() {
			if(_disableWhileAnimating && _anim) return;
			_prevIndex = _currentIndex;
			if(_currentIndex > 0) _currentIndex--;
			else {
				if(_noCycle) return;
				else _currentIndex = _slideCount-1;
			}
			switchSlide();
		}
		function nextSlide() {
			if(_disableWhileAnimating && _anim) return;
			_prevIndex = _currentIndex;
			if(_currentIndex < _slideCount-1) _currentIndex++;
			else {
				if(_noCycle) return;
				else _currentIndex = 0;
			}
			switchSlide();
		}
		function refreshStatus() {
			if(_dynamicImageLoad) loadSlide(_slides.eq(_currentIndex));
			if(_pagerLinks.length) _pagerLinks.removeClass(_activeClass).eq(_currentIndex).addClass(_activeClass);
			if(_currentNum) _currentNum.text(_currentIndex+1);
			if(_allNum) _allNum.text(_slideCount);
			_slides.eq(_prevIndex).removeClass(_activeClass);
			_slides.eq(_currentIndex).addClass(_activeClass);
			if(_noCycle) {
				if(_btnPrev.length) {
					if(_currentIndex == 0) _btnPrev.addClass(_disabledClass);
					else _btnPrev.removeClass(_disabledClass);
				}
				if(_btnNext.length) {
					if(_currentIndex == _slideCount-1) _btnNext.addClass(_disabledClass);
					else _btnNext.removeClass(_disabledClass);
				}
			}
			if(typeof _onChange === 'function') {
				_onChange(_this, _slides, _prevIndex, _currentIndex);
			}
		}
		function switchSlide() {
			_anim = true;
			if(typeof _onBeforeFade === 'function') _onBeforeFade(_this, _slides, _prevIndex, _currentIndex);
			_slides.eq(_prevIndex).fadeOut(_duration,function(){
				_anim = false;
			});
			_slides.eq(_currentIndex).fadeIn(_duration,function(){
				if(typeof _onAfterFade === 'function') _onAfterFade(_this, _slides, _prevIndex, _currentIndex);
			});
			if(_autoHeight) _slides.eq(_currentIndex).parent().animate({height:_slides.eq(_currentIndex).outerHeight(true)},{duration:_duration,queue:false});
			refreshStatus();
			autoSlide();
		}

		// autoslide function
		function autoSlide() {
			if(!_autoRotation || _hover) return;
			if(_timer) clearTimeout(_timer);
			_timer = setTimeout(nextSlide,_switchTime+_duration);
		}
		if(_pauseOnHover) {
			_this.hover(function(){
				_hover = true;
				if(_timer) clearTimeout(_timer);
			},function(){
				_hover = false;
				autoSlide();
			});
		}
		refreshStatus();
		autoSlide();
	});
}


function InitGallery() {
    var _speed = 1,
_duration = 10000;
    var _hold = $('.side-box');
    var _list = _hold.find('ul.slider2>li');
    var _prev = _hold.find('a.prev');
    var _next = _hold.find('a.next');
    var _a = _list.index(_list.filter('.active:eq(0)'));
    if (_a == -1) { _a = 0; _list.eq(_a).addClass('active') }
    var _i, _old = _a, _t, _t1;
    /*--------CREATING THUMBNAILS----------*/
    var _num = $('.swicher2').empty();
    _list.each(function (i) {
        $('<li><a href="#">' + (i + 1) + '</a></li>').appendTo(_num);
    });
    /*-------------------------------------------------*/
    _num.find('li:first').addClass('first');
    _num.find('li:last').addClass('last');
    var _thumb = _num.find('li');
    _thumb.eq(_a).addClass('active');
    if ($.browser.msie && $.browser.version < 7) {
        _list.hide().eq(_a).show();
    } else { _list.hide().css({ opacity: 0 }).eq(_a).show().css({ opacity: 1 }); }
    Run(_a);
    function Run(_a) {
        _t = setTimeout(function () {
            _a++; if (_a >= _list.length) { _a = 0 }
            ChangeFade(_a);
        }, _duration);
    };
    function ChangeFade(_new) {
        if ($.browser.msie && $.browser.version < 7) {
            _list.eq(_old).removeClass('active').hide();
            _list.eq(_new).addClass('active').show();
        } else {
            _list.eq(_old).removeClass('active').animate({ opacity: 0 }, { queue: false, duration: _speed, complete: function () { $(this).hide(); } });
            _list.eq(_new).addClass('active').show().animate({ opacity: 1 }, { queue: false, duration: _speed });
        }
        _thumb.eq(_old).removeClass('active');
        _thumb.eq(_new).addClass('active');
        _old = _new; _a = _new;
        if (_t) clearTimeout(_t);
        if (_t1) clearTimeout(_t1);
        Run(_new);
    };
    _thumb.click(function () {
        if (_list.is(':animated')) {
            _t1 = setTimeout(function () {
                _i = _thumb.index($(this));
                ChangeFade(_i);
                _a = _i;
            }, _speed);
        } else {
            _i = _thumb.index($(this));
            ChangeFade(_i);
            _a = _i;
        }; return false;
    });
    _next.click(function () {
        if (_list.is(':animated')) {
            _t1 = setTimeout(function () {
                _a++; if (_a == _list.length) { _a = 0 }
                ChangeFade(_a);
            }, _speed);
        } else {
            _a++; if (_a == _list.length) { _a = 0 }
            ChangeFade(_a);
        }; return false;
    });
    _prev.click(function () {
        if (_list.is(':animated')) {
            _t1 = setTimeout(function () {
                _a--; if (_a == -1) { _a = _list.length - 1 }
                ChangeFade(_a);
            }, _speed);
        } else {
            _a--; if (_a == -1) { _a = _list.length - 1 }
            ChangeFade(_a);
        }; return false;
    });
};
function InitSlide() {
    var _hold = $('div.wrap-gallery');
    var _slide = _hold.find('ul.gallery');
    var _list = _slide.find('>li');
    var _prev = $('a.prev');
    var _next = $('a.next');
    var _d = _list.eq(0).outerWidth(true);
    var _x = 0;
    var _wh = _hold.width();
    var _ws = _list.length * _d;
    var _i = 1;
    _list.eq(_i).addClass('active');
    _next.click(function () {
        _i = _i + 1;
        if (_x < _ws - _wh) {
            _x = _x + _d;
        } else {
            _x = 0;
        }
        _slide.animate({ marginLeft: -_x }, { queue: false, duration: 500 });
        return false;
    });
    _prev.click(function () {
        _i = _i - 1;
        if (_x > 0) {
            _x = _x - _d;
        } else {
            _x = _ws - _wh;
        }
        _slide.animate({ marginLeft: -_x }, { queue: false, duration: 500 });
        return false;
    });
};

function initTabs()
{
	var sets = document.getElementsByTagName("ul");
	for (var i = 0; i < sets.length; i++)
	{
		if (sets[i].className.indexOf("tabset") != -1)
		{
			var tabs = [];
			var links = sets[i].getElementsByTagName("a");
			for (var j = 0; j < links.length; j++)
			{
				if (links[j].className.indexOf("tab") != -1)
				{
					tabs.push(links[j]);
					links[j].tabs = tabs;
					var c = document.getElementById(links[j].href.substr(links[j].href.indexOf("#") + 1));

					if (c) if (links[j].parentNode.className.indexOf("active") != -1) c.style.display = "block";
					else c.style.display = "none";

					links[j].onclick = function ()
					{
						var c = document.getElementById(this.href.substr(this.href.indexOf("#") + 1));
						if (c)
						{
							for (var i = 0; i < this.tabs.length; i++)
							{
								var tab = document.getElementById(this.tabs[i].href.substr(this.tabs[i].href.indexOf("#") + 1));
								if (tab)
								{
									tab.style.display = "none";
								}
								this.tabs[i].parentNode.className = this.tabs[i].parentNode.className.replace("active", "");
							}
							this.parentNode.className += " active";
							c.style.display = "block";
							return false;
						}
					}
				}
			}
		}
	}
}

if (window.addEventListener) {
    window.addEventListener("load", initTabs, false);
}
else if (window.attachEvent && !window.opera)
    window.attachEvent("onload", initTabs);

function InitGalary(){
	var _speed = 1200,
		_duration = 2000;	
	var _hold = $('div.slider-holder');
	var _list=_hold.find('ul.slider>li');
	var _t, _t1;
	var _a = _list.index(_list.filter('.active:eq(0)'));
	if(_a == -1) {_a = 0;_thumb.eq(_a).addClass('active');}
		_old=_a;
	_list.css({opacity:0}).hide().eq(_a).show().css({opacity:1});
	var _thumb = $('.swicher ul li');
	
	_thumb.each(function(_i,_this){
		$(this).click(function(){
			ChangeFade(_i);
			return false;
		});
	});
	Run(_a);
	function Run(_a){
		_t = setTimeout(function(){
			_a++; if (_a == _list.length){_a=0}
			ChangeFade(_a);
		}, _duration);
	};
	function ChangeFade(_new){
		_list.eq(_old).removeClass('active').animate({opacity:0}, {queue:false, duration:_speed, complete:function(){$(this).hide();}});
		_list.eq(_new).addClass('active').show().animate({opacity:1}, {queue:false, duration:_speed});
		_thumb.eq(_old).removeClass('active');
		_thumb.eq(_new).addClass('active');
		_old=_new;_a=_new;
		if(_t) clearTimeout(_t);
		if(_t1) clearTimeout(_t1);
		Run(_new);
	};
};

function InitSlide(){
	var _hold = $('div.wrap-gallery');
	var _slide = _hold.find('ul.gallery');
	var _list=_slide.find('>li');
	var _prev = $('a.prev');
	var _next = $('a.next');
	var _d = _list.eq(0).outerWidth(true);
	var _x=0;	
	
	var _wh = _hold.width();
	var _ws = _list.length*_d;
	var _i = 1;
	_list.eq(_i).addClass('active');
	
	_next.click(function(){
		_i = _i+1;
		if (_x < _ws- _wh){
			_x = _x + _d;
		}else{
			_x = 0; 
		}
		_slide.animate({marginLeft: -_x}, {queue:false, duration:500});		
		return false;
	});
	
	_prev.click(function(){
		_i = _i-1;
		if (_x > 0){
			_x = _x - _d;
		}else{_x=_ws-_wh;
		}
		_slide.animate({marginLeft: -_x}, {queue:false, duration:500});
		return false;
	});
};
function InitGallery(){
	var _speed = 1,
		_duration = 10000;
	var _hold = $('.side-box');
	var _list =_hold.find('ul.slider2>li');
	var _prev = _hold.find('a.prev');
	var _next = _hold.find('a.next');
	var _a = _list.index(_list.filter('.active:eq(0)'));
	if(_a == -1) {_a = 0;_list.eq(_a).addClass('active')}
	var _i, _old = _a, _t, _t1;
/*--------CREATING THUMBNAILS----------*/
	var _num = $('.swicher2').empty();
	_list.each(function(i){
		$('<li><a href="#">'+(i+1)+'</a></li>').appendTo(_num);
	});
/*-------------------------------------------------*/
	_num.find('li:first').addClass('first');
	_num.find('li:last').addClass('last');
	var _thumb = _num.find('li');
	_thumb.eq(_a).addClass('active');
	if (jQuery.browser.msie && jQuery.browser.version < 7){		_list.hide().eq(_a).show();
	} else{		_list.hide().css({opacity:0}).eq(_a).show().css({opacity:1});	}
	Run(_a);
	function Run(_a){	
		_t = setTimeout(function(){
			_a++; if (_a >= _list.length){_a=0}
			ChangeFade(_a);
		}, _duration);
	};
	function ChangeFade(_new){
		if(jQuery.browser.msie && jQuery.browser.version < 7){
			_list.eq(_old).removeClass('active').hide();
			_list.eq(_new).addClass('active').show();
		}else{
			_list.eq(_old).removeClass('active').animate({opacity:0}, {queue:false, duration:_speed, complete:function(){$(this).hide();}});
			_list.eq(_new).addClass('active').show().animate({opacity:1}, {queue:false, duration:_speed});
		}
		_thumb.eq(_old).removeClass('active');
		_thumb.eq(_new).addClass('active');
		_old=_new;_a=_new;
		if(_t) clearTimeout(_t);
		if(_t1) clearTimeout(_t1);
		Run(_new);
	};
	_thumb.click(function(){
		if (_list.is(':animated')){
			_t1 = setTimeout(function(){
				_i = _thumb.index($(this));
				ChangeFade(_i);
				_a = _i;
			}, _speed);
		}else{
			_i = _thumb.index($(this));
			ChangeFade(_i);
			_a = _i;
		};return false;
	});
	_next.click(function(){
		if (_list.is(':animated')){
			_t1 = setTimeout(function(){
				_a++; if (_a == _list.length){_a=0}
				ChangeFade(_a);
			}, _speed);	
		}else{
			_a++; if (_a == _list.length){_a=0}
			ChangeFade(_a);
		};return false;
	});
	_prev.click(function(){
		if (_list.is(':animated')){
			_t1 = setTimeout(function(){
				_a--; if (_a == -1){_a=_list.length-1}
				ChangeFade(_a);
			}, _speed);
		}else{
			_a--; if (_a == -1){_a=_list.length-1}
			ChangeFade(_a);
		};return false;
	});
};

function find_an_expert() {
    
    var question = $("#meet_expert_q").val();
    $('form').attr({ 'action': 'http://experts.kumc.edu/', 'method': 'get', 'target': '_blank' })
	.append($('<input/>').attr({ 'type': 'hidden', 'name': 'q', 'value': question }))
	.submit();
}

