jQuery(function(){	
	jQuery('html').addClass('js-ready');
	initBrowser();
	initNav2();
	initCustomForms();
	initValidation();
	fixTabs();
	initAccodion();
	initAccodion2();
	initAccodion3();
	initFancy();
})
jQuery(window).load(function(){
	initNav();
	initFadeGallery();
	jQuery('.widget-brightpapers h3').append('<span style="font-size:10px;vertical-align:top;">&reg;</span>');
	setTimeout(mouseSlide, 500);
})
function mouseSlide(){
	jQuery('.logo-gal').mouseGallerySlide({
		scrollElParent: 'ul',
		scrollEl: 'li'
	});
	jQuery('.sponsor-gal').mouseGallerySlide({
		scrollElParent: 'ul',
		scrollEl: 'li'
	});
};
// fadeGallery
function initFadeGallery(){
	jQuery('div.gallery').fadeGallery({
		slideElements:'ul.slider >li',
		pagerLinks:'.switcher ul li',
		pagerGener: true,
		pagerHold: '.switcher',
		autoRotation:true,
		pauseOnHover:false,
		autoHeight:true,
		switchTime: 3000
	});
}
// navigation
function initNav(){
	var ieOld = jQuery.browser.msie && jQuery.browser.version < 9;
	var menu = jQuery('.main-nav'),
		elements = menu.find('>li'),
		menuWidth = menu.outerWidth(),
		widthDropEl = 0,
		dropWidth = 0,
		maxWidth = 0,
		speed = ieOld ? 0 : 300;
		
	elements.each(function(ind){
		var element = jQuery(this),
			posLeft = element.position().left,
			drop = element.find('.drop').css({opacity: 0}),
			dropEl = drop.find('.drop-in >ul >li'),
			widthEl = element.outerWidth();
		
		if(ind > elements.length -4){
			element.addClass('drop-alignright');
		}
		
		if(!element.hasClass('drop-alignright')){
			maxWidth = menuWidth - posLeft;
			dropEl.each(function(){
				widthDropEl += (jQuery(this).outerWidth() + 3);
				if(maxWidth > widthDropEl){
					dropWidth = widthDropEl;
				}
			})
		}else{
			maxWidth = posLeft + widthEl;
			dropEl.each(function(){
				widthDropEl += (jQuery(this).outerWidth() + 3);
				if(maxWidth > widthDropEl){
					dropWidth = widthDropEl;
				}
			})
		}
		
		drop.css({width: dropWidth -2});
		drop.find('.drop-in').css({
			width: dropWidth -14
		});
		drop.find('.drop-in >ul').css({
			width: dropWidth +14,
			marginRight: -14
		});
		widthDropEl = 0;
		
		drop.css({
			top: 34,
			display: 'none'
		})
		var navHover = (jQuery('<em class="nav-hover"><em>&nbsp;</em></em>').css({
			height: element.outerHeight(),
			width: element.width() - 16,
			opacity: 0
		}));
		if(element.find('>div').length){
			element.find('>a').addClass('has-drop');
			element.append(navHover);
		}
		
		var timer, delay = 0, opDest = ieOld ? 'auto' : 1;
		element.hover(function(){
			clearTimeout(timer);
			timer = setTimeout(function(){
				drop.stop().css({display: 'block'}).animate({opacity: opDest}, {duration:speed});
				navHover.stop().css({display: 'block'}).animate({opacity: opDest}, {duration:0});
			},delay)
		},function(){
			clearTimeout(timer);
			timer = setTimeout(function(){
				drop.stop().animate({opacity: 0}, {duration:speed, complete: function(){
					drop.css({display: 'none'});
				}});
				navHover.stop().animate({opacity: 0}, {duration:speed, complete: function(){
					navHover.css({display: 'none'});
				}});
			},delay);
		})
	})
	jQuery('.main-nav li li:not(:nth-child(2))').css({background: 'none'});
}
function initNav2(){
	var animSpeed = 300;
	
	jQuery('.add-nav').each(function(){
		var set = jQuery(this);
		var link = set.children();
		link.each(function(i, obj){
			jQuery(obj).css({ position: 'relative' });
			var drop = jQuery(obj).find('.add-drop');
			if( jQuery.browser.msie ){
				jQuery(obj).hover(
					function(){
						drop
							.css({ display: 'block' })
					},
					function(){
						drop
							.css({ display: 'none' })
					}
				)
			}
			else {
				jQuery(obj).hover(
					function(){
						drop
							.css({ display: 'block', opacity: 0 })
							.animate({ opacity: 1 }, {
								queue: false, duration: animSpeed
							})
					},
					function(){
						drop
							.animate({ opacity: 0 }, {
								queue: false, duration: animSpeed, complete: function(){
									drop.removeAttr('style');
								}
							})
					}
				)
			}
		})
	})
}
function initBrowser() {
    var cssFix = function(){
        var u = navigator.userAgent.toLowerCase(),
        addClass = function(el,val){
        if(!el.className) {
            el.className = val;
        } else {
            var newCl = el.className;
            newCl+=(" "+val);
            el.className = newCl;
        }
    },
    is = function(t){return (u.indexOf(t)!=-1)};
    addClass(document.getElementsByTagName('html')[0],[
        (!(/opera|webtv/i.test(u))&&/msie (\d)/.test(u))?('ie ie'+RegExp.$1)
        :is('firefox/2')?'gecko ff2'
        :is('firefox/3')?'gecko ff3'
        :is('gecko/')?'gecko'
        :is('chrome/')?'chrome'
        :is('opera/9')?'opera opera9':/opera (\d)/.test(u)?'opera opera'+RegExp.$1
        :is('konqueror')?'konqueror'
        :is('applewebkit/525')?'webkit safari3'
        :is('applewebkit/')?'webkit safari'
        :is('mozilla/')?'gecko':'',
        (is('x11')||is('linux'))?' linux'
        :is('mac')?' mac'
        :is('win')?' win':''
    ].join(" "));
}();
}

var mobi = ['opera', 'iemobile', 'webos', 'android', 'ipad', 'safari'];
var midp = ['blackberry', 'symbian'];
var ua = navigator.userAgent.toLowerCase();
var desktop = '<!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="css/ie.css" media="screen"/><![endif]-->';
if ((ua.indexOf('midp') != -1) || (ua.indexOf('mobi') != -1) || ((ua.indexOf('ppc') != -1) && (ua.indexOf('mac') == -1)) || (ua.indexOf('webos') != -1)) {
	document.write('<link rel="stylesheet" href="css/allmobile.css" type="text/css" media="all"/>');
	if (ua.indexOf('midp') != -1) {
		for (var i = 0; i < midp.length; i++) {
			if (ua.indexOf(midp[i]) != -1) {
				document.write('<link rel="stylesheet" href="css/' + midp[i] + '.css" type="text/css"/>');
			}
		}
	}
	else {
		if ((ua.indexOf('mobi') != -1) || (ua.indexOf('ppc') != -1) || (ua.indexOf('webos') != -1)) {
			for (var i = 0; i < mobi.length; i++) {
				if (ua.indexOf(mobi[i]) != -1) {
					document.write('<link rel="stylesheet" href="css/' + mobi[i] + '.css" type="text/css"/>');
					break;
				}
			}
		}
	}
}
else {
	document.write(desktop);
}

// slideshow plugin
jQuery.fn.fadeGallery = function(_options){
	var _options = jQuery.extend({
		slideElements:'div.slides > div.slide',
		pagerGener: true,
		pagerHold: false,
		pagerLinks:'ul.nav-list li',
		btnNext:'a.btn-next',
		btnPrev:'a.btn-prev',
		btnPlayPause:'a.play-pause',
		btnPlay:'a.play',
		btnPause:'a.pause',
		pausedClass:'paused',
		disabledClass: 'disabled',
		playClass:'playing',
		activeClass:'active',
		currentNum:false,
		allNum:false,
		startSlide:null,
		noCircle:false,
		caption:'ul.caption > li',
		pauseOnHover:true,
		autoRotation:false,
		autoHeight:true,
		onChange:false,
		switchTime:3000,
		duration:650,
		event:'click'
	},_options);

	return this.each(function(){
		// gallery options
		var _this = jQuery(this);
		var _slides = jQuery(_options.slideElements, _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 _autoRotation = _options.autoRotation;
		var _activeClass = _options.activeClass;
		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 _pagerGener = _options.pagerGener;
		var _pagerHold = jQuery(_options.pagerHold,_this);
		var _caption = jQuery(_options.caption,_this);
		var _paging = '';
		if(_pagerGener){
			for(var i=0; i< _slides.length; i++){
				_paging += '<li><a href="#">'+(i+1)+'</a></li>';
			}
			_pagerHold.html('<ul>'+_paging+'</ul>');
		}
		var _pagerLinks = jQuery(_options.pagerLinks, _this);
		// gallery init
		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();
		_caption.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) {
						_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;
			});
		}
		// gallery animation
		function prevSlide() {
			_prevIndex = _currentIndex;
			if(_currentIndex > 0) _currentIndex--;
			else {
				if(_noCycle) return;
				else _currentIndex = _slideCount-1;
			}
			switchSlide();
		}
		function nextSlide() {
			_prevIndex = _currentIndex;
			if(_currentIndex < _slideCount-1) _currentIndex++;
			else {
				if(_noCycle) return;
				else _currentIndex = 0;
			}
			switchSlide();
		}
		function refreshStatus() {
			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, _currentIndex);
			}
		}
		function switchSlide() {
			_slides.eq(_prevIndex).fadeOut(_duration);
			_slides.eq(_currentIndex).fadeIn(_duration);
			_caption.eq(_prevIndex).fadeOut();
			_caption.eq(_currentIndex).fadeIn();
			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();
			});
		}
		function loadHeight(){
			if(_autoHeight) _slides.eq(_currentIndex).parent().css({height:_slides.eq(_currentIndex).outerHeight(true)});
		}
		
		loadHeight();
		refreshStatus();
		autoSlide();
	});
};

jQuery.fn.mouseGallerySlide = function(_options){
	// defaults options	
	var _options = jQuery.extend({
		scrollElParent: 'ul',
		scrollEl: 'li'
	},_options);

	return this.each(function(){
		var _this = jQuery(this);

		var _gWidth = _this.outerWidth();
		var _scrollElParent = jQuery(_options.scrollElParent,_this);
		var _scrollEl = jQuery(_options.scrollEl,_this);
		var _liWidth = _scrollEl.outerWidth(true);
		var _liSum = _scrollEl.length * _liWidth;
		
		var _sec = (_liSum - _gWidth) * 30;
		
		var _maxMargin = _liSum;
		var _posHolder = _this.offset();
		var _width = _this.outerWidth();
		var _height = _this.outerHeight();
		
		var _chapter = _gWidth/12;
		var _speed = 0
		var _direction = 2;
		var _timerOut = false;
		
		var _cloneList = _scrollEl.clone();
		_scrollElParent.append(_cloneList);
		_scrollElParent
		
		jQuery(document).resize(function(){
			_posHolder = _this.offset();
		});

		jQuery(document).mousemove(function(e){
			if (e.pageX > _posHolder.left && e.pageX < (_posHolder.left + _width) && e.pageY > _posHolder.top && e.pageY < (_posHolder.top + _height)) 
				{mouseOverMove(e);}
			else {
				_scrollElParent.stop();
				_speed = -1;
			};
		});
		
		function mouseOverMove(e) {
			var newSpeed = 0;
			for (var i=0; i <= 12; i++) {
				if ((_chapter*i) > (e.pageX - _posHolder.left)) {
					switch(i){
						case 1: newSpeed = 2;break
						case 2:	newSpeed = 2;break
						case 3: newSpeed = 1;break
						case 4: newSpeed = 1;break
						case 12: newSpeed = 2;break
						case 11: newSpeed = 2;break
						case 10: newSpeed = 1;break
						case 9: newSpeed = 1;break
						default:newSpeed = 0;
					}					
					if (i < 5) _direction = 1;
					else if (i > 8) _direction = 3;
					break;
				}
			}
			if(_speed != newSpeed) {
				_speed = newSpeed;
				animateEl();
			}
		}
		function animateEl() {
			if (_timerOut) clearTimeout(_timerOut);
			_scrollElParent.stop();
			var _curMargin = parseInt(_scrollElParent.css('marginLeft'));
			
			if (_direction == 1) {
				var k = -_curMargin/_maxMargin;
				_scrollElParent.stop()
					.animate(
						{marginLeft:0},
						{easing:'linear',duration:(_sec/_speed)*k, complete:function(){
							_scrollElParent.css({'marginLeft':-(_maxMargin)});
							_timerOut = setTimeout(function(){animateEl()},15)
						}}
					);
			}
			if (_direction == 3) {
				var k = (_maxMargin + _curMargin)/_maxMargin;
				_scrollElParent.stop()
					.animate(
						{marginLeft:-_maxMargin},
						{easing:'linear',duration:(_sec/_speed)*k, complete:function(){
							_scrollElParent.css({'marginLeft':0});
							_timerOut = setTimeout(function(){animateEl()},15)
						}}
					);
			}
		}
	});
}


//New 20.04
function initAccodion(){
	jQuery('.aside-nav').each(function(){
		var set = jQuery(this);
		var opener = set.find('>li > a');
		var _active = opener.parent('li').index(opener.parent('li').filter('.active:eq(0)'));
		var timer, curr;
		opener.each(function(i){
			if(i != _active) opener.eq(i).parent('li').find('ul').hide();
			else opener.eq(i).parent('li').find('ul').show();
		});
		opener.bind('mouseenter', function(){
			if(timer) clearTimeout(timer);
			if(jQuery(this).next().length){
				curr = opener.index(this);
				opener.each(function(i){
					if(i != curr) opener.eq(i).parent('li').find('ul').stop(false, true).hide();
					else opener.eq(i).parent('li').find('ul').stop(false, true).fadeIn(500);
				});
			}
		})
		set.bind('mouseleave', function(){
			timer = setTimeout(function(){
				opener.each(function(i){
					if(i != _active) opener.eq(i).parent('li').find('ul').stop(false, true).hide();
					else opener.eq(i).parent('li').find('ul').stop(false, true).fadeIn(500);
				});
			}, 500);
		});
	});
}
// FAQs
function initAccodion2(){
	jQuery('#accordion-faq h4:first a').css({"color" : "#F69218"});
	jQuery('#accordion-faq .answer:first').show();
	jQuery('#accordion-faq h4 a').click(function(){
		jQuery('.answer').hide();
		jQuery('#accordion-faq h4 a').css({"color" : "#21376e"});
		jQuery(this).parents().next("div.answer").fadeIn("fast");
		jQuery(this).css({"color" : "#F69218"});
	});
}
// Our Teams
function initAccodion3(){
	jQuery('#accordion-team .read-more').click(function(){
		jQuery('.team-content').hide();
		jQuery('.read-more').fadeIn("fast");
		jQuery(this).parents().next("div.team-content").fadeIn("fast");
		jQuery(this).hide();
	});
}
function initValidation(){
	var _errorClass = 'error';
	var _errorClassForm = 'error-form';
	var _regEmail = /([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+/;
	var _regPhone = /([0-9_\.\-])+/;
	jQuery('#page .contact-form form').each(function(){
		var _form = jQuery(this);
		var errorBox = jQuery('.error-msg', _form);
		jQuery('input[type=text], input[type=password] , textarea', _form).focus(function(){
			jQuery(this).parents('div.row').eq(0).removeClass(_errorClass);
		});
		jQuery('select', _form).change(function(){
			jQuery(this).parents('div.row').eq(0).removeClass(_errorClass);
		});
		function checkFields() {
			var _flag = false;
			errorBox.empty();
			_form.removeClass(_errorClassForm);
			_form.find('.'+_errorClass).removeClass(_errorClass);
			// fields validation
			_form.find('input.request').each(function(){
				if( jQuery(this).val() == '' ) addError(jQuery(this));
			});
			_form.find('textarea.request').each(function(){
				if( jQuery(this).val() == '' ) addError(jQuery(this));
			});
			_form.find('.request-email').each(function(){
				if(!_regEmail.test(jQuery(this).val()) || jQuery(this).val() == '' || jQuery(this).val() == jQuery(this).attr('alt')) addError(jQuery(this));
			});
			_form.find('.request-phone').each(function(){
				if(!_regPhone.test(jQuery(this).val()) || jQuery(this).val() == '' || jQuery(this).val() == jQuery(this).attr('alt')) addError(jQuery(this));
			});
			_form.find('select.request').each(function(){
				if( jQuery(this).val() == '' || jQuery(this).val() == jQuery(this).find('option').eq(0).text() ) addError(jQuery(this));
			});
			// error class adding
			function addError(_obj) {
				_obj.parents('div.row').eq(0).addClass(_errorClass);
				var _txt = _obj.parents('div.row').eq(0).find('label').clone(true);
				_txt.find('span').remove();
				errorBox.append('<p><span>*</span> ' + _txt.text() + ' required</p>');
				_flag=true;
			}
			return _flag;
		}
		
		// catch form submit event
		/*_form.bind('submit', function(){
			if(checkFields()) {
				_form.addClass(_errorClassForm);
				return false;
			}
		});*/
	});
}
var timerRefresh;
function resizeFancy(){
	timerRefresh = setInterval(function(){
		if(!window.busyFlag) {
			jQuery.fancybox.resize();
		}
	}, 100);
}
function initFancy(){
	var _body = jQuery('body');
	var _loadClass = 'fbload';

	jQuery('a.open-popup, a[href="http://www.accolo.com/wp-content/themes/accolo/iframe/popupform.html"]').fancybox({
		overlayColor: '#ffffff',
		overlayOpacity: 0.75,
		titleShow: false,
		padding: 0,
		transitionIn : 'show',
		transitionOut : 'fade',
		centerOnScroll: false,
		width: 507,
		height: 485,
		type :'iframe',
		hideOnOverlayClick: false,
		onClosed: function(){
			if(timerRefresh) clearInterval(timerRefresh);
		},
		onStart: function() {
			window.busyFlag = true;
			_body.addClass(_loadClass);
		},
		onComplete: function() {
			window.parent.scroll(0,0);	// Scroll to top
			resizeFancy();
			var lb = jQuery('#fancybox-wrap');
			var lbTop = parseInt(lb.css('top'));
			var lbHeight = lb.innerHeight(true);
			setTimeout(function(){
				//lb.css({top:-lbHeight});
				lb.css({top:20});
				_body.removeClass(_loadClass);
				/*
				lb.stop().animate({top:20},{duration:800,complete:function(){
					//window.busyFlag = false;
				}})
				*/
			},100);
		}
	});
	
	jQuery('a.open-popup-rw').fancybox({
		overlayColor: '#ffffff',
		overlayOpacity: 0.9,
		titleShow: false,
		padding: 0,
		transitionIn : 'show',
		transitionOut : 'fade',
		centerOnScroll: false,
		width: 970,
		height: 720,
		type :'iframe',
		hideOnOverlayClick: false,
		onClosed: function(){
			if(timerRefresh) clearInterval(timerRefresh);
		},
		onStart: function() {
			window.busyFlag = true;
			_body.addClass(_loadClass);
		},
		onComplete: function() {
			window.parent.scroll(0,0);	// Scroll to top
			resizeFancy();
			var lb = jQuery('#fancybox-wrap');
			var lbTop = parseInt(lb.css('top'));
			var lbHeight = lb.innerHeight(true);
			setTimeout(function(){
				//lb.css({top:-lbHeight});
				lb.css({top:20});
				_body.removeClass(_loadClass);
				/*
				lb.stop().animate({top:20},{duration:800,complete:function(){
					//window.busyFlag = false;
				}})
				*/
			},100);
		}
	});

	// add css
	var ss = document.createElement('style');
	var def = '.fbload #fancybox-wrap {margin-top: -9999px !important}';
	ss.setAttribute("type", "text/css");
	if (ss.styleSheet) {
		ss.styleSheet.cssText = def;
	} else {
		var tn = document.createTextNode(def);
		ss.appendChild(tn);
	}
	document.body.appendChild(ss);
}
function fixTabs(){
	var hideTimer;
	jQuery('.fixed-tabs').each(function(){
		var set = jQuery('>ul', jQuery(this));
		var item = jQuery('>li', set);
		var opener = item.find('.btn-opener');
		var itemPosition = [];
		var waitAnim = true, _parent;
		var curr, prevIdx;
		var animSpeed = 500;
		item.each(function(i){
			var _r = -jQuery(this).width() + jQuery(this).find('.btn-opener').outerWidth(true);
			// jQuery(this).data('zIndex', i+50)
			jQuery(this).css({ right: _r, zIndex: i+50 });
		});
		
		item.bind('mouseenter', function(){
			if(hideTimer) clearTimeout(hideTimer);
			if(curr) prevIdx = curr;
			curr = item.index(this);
			waitAnim = false;
			item.each(function(){
				if(prevIdx) item.eq(prevIdx).removeClass('active').stop().animate({ right: -item.eq(prevIdx).width() + item.eq(prevIdx).find('.btn-opener').outerWidth(true) }, { duration: animSpeed });
				item.eq(curr).addClass('active').stop().css({ zIndex: 999 }).animate({ right: 0 }, { duration: animSpeed, complete: function(){
					waitAnim = true;
				}});
			});
		}).bind('mouseleave', function(){
			item.each(function(i){
				jQuery(this).stop().css({ zIndex: i+50 }).animate({ right: -jQuery(this).width() + jQuery(this).find('.btn-opener').outerWidth(true) }, { duration: animSpeed, complete: function(){
					jQuery(this).removeClass('active')
				}});
			});
		});
		jQuery(window).load(function(){
			setTimeout(function(){
				item.each(function(){
					if(jQuery(this).hasClass('active')) jQuery(this).removeClass('active');
				});
			}, 10);
		});
	})
}


function initCustomForms(){
	jQuery('select:not(.rcr_select)').customSelect();
	jQuery('input:radio').customRadio();
	jQuery('input:checkbox').customCheckbox();
}
// custom forms plugin
(function(jQuery){
	// custom checkboxes module
	jQuery.fn.customCheckbox = function(_options){
		var _options = jQuery.extend({
			checkboxStructure: '<div></div>',
			checkboxDisabled: 'disabled',
			checkboxDefault: 'checkboxArea',
			checkboxChecked: 'checkboxAreaChecked'
		}, _options);
		return this.each(function(){
			var checkbox = jQuery(this);
			if(!checkbox.hasClass('outtaHere') && checkbox.is(':checkbox')){
				var replaced = jQuery(_options.checkboxStructure);
				this._replaced = replaced;
				if(checkbox.is(':disabled')) replaced.addClass(_options.checkboxDisabled);
				else if(checkbox.is(':checked')) replaced.addClass(_options.checkboxChecked);
				else replaced.addClass(_options.checkboxDefault);

				replaced.click(function(){
					if(checkbox.is(':checked')) checkbox.removeAttr('checked');
					else checkbox.attr('checked', 'checked');
					changeCheckbox(checkbox);
				});
				checkbox.click(function(){
					changeCheckbox(checkbox);
				});
				replaced.insertBefore(checkbox);
				checkbox.addClass('outtaHere');
			}
		});
		function changeCheckbox(_this){
			_this.change();
			if(_this.is(':checked')) _this.get(0)._replaced.removeClass().addClass(_options.checkboxChecked);
			else _this.get(0)._replaced.removeClass().addClass(_options.checkboxDefault);
		}
	}

	// custom radios module
	jQuery.fn.customRadio = function(_options){
		var _options = jQuery.extend({
			radioStructure: '<div></div>',
			radioDisabled: 'disabled',
			radioDefault: 'radioArea',
			radioChecked: 'radioAreaChecked'
		}, _options);
		return this.each(function(){
			var radio = jQuery(this);
			if(!radio.hasClass('outtaHere') && radio.is(':radio')){
				var replaced = jQuery(_options.radioStructure);
				this._replaced = replaced;
				if(radio.is(':disabled')) replaced.addClass(_options.radioDisabled);
				else if(radio.is(':checked')) replaced.addClass(_options.radioChecked);
				else replaced.addClass(_options.radioDefault);
				replaced.click(function(){
					if(jQuery(this).hasClass(_options.radioDefault)){
						radio.attr('checked', 'checked');
						changeRadio(radio.get(0));
					}
				});
				radio.click(function(){
					changeRadio(this);
				});
				replaced.insertBefore(radio);
				radio.addClass('outtaHere');
			}
		});
		function changeRadio(_this){
			jQuery(_this).change();
			jQuery('input:radio[name='+jQuery(_this).attr("name")+']').not(_this).each(function(){
				if(this._replaced && !jQuery(this).is(':disabled')) this._replaced.removeClass().addClass(_options.radioDefault);
			});
			_this._replaced.removeClass().addClass(_options.radioChecked);
		}
	}

	// custom selects module
	jQuery.fn.customSelect = function(_options) {
		var _options = jQuery.extend({
			selectStructure: '<div class="selectArea"><span class="left"></span><span class="center"></span><a href="#" class="selectButton"></a><div class="disabled"></div></div>',
			hideOnMouseOut: false,
			copyClass: true,
			selectText: '.center',
			selectBtn: '.selectButton',
			selectDisabled: '.disabled',
			optStructure: '<div class="optionsDivVisible"><div class="select-top"></div><div class="select-center"><ul></ul></div><div class="select-bottom"></div>',
			optList: 'ul'
		}, _options);
		return this.each(function() {
			var select = jQuery(this);
			if(!select.hasClass('outtaHere')) {
				if(select.is(':visible')) {
					var hideOnMouseOut = _options.hideOnMouseOut;
					var copyClass = _options.copyClass;
					var replaced = jQuery(_options.selectStructure);
					var selectText = replaced.find(_options.selectText);
					var selectBtn = replaced.find(_options.selectBtn);
					var selectDisabled = replaced.find(_options.selectDisabled).hide();
					var optHolder = jQuery(_options.optStructure);
					var optList = optHolder.find(_options.optList);
					if(copyClass) optHolder.addClass('drop-'+select.attr('class'));

					if(select.attr('disabled')) selectDisabled.show();
					select.find('option').each(function(){
						var selOpt = jQuery(this);
						var _opt = jQuery('<li><a href="#">' + selOpt.html() + '</a></li>');
						if(selOpt.attr('selected')) {
							selectText.html(selOpt.html());
							_opt.addClass('selected');
						}
						_opt.children('a').click(function() {
							optList.find('li').removeClass('selected');
							select.find('option').removeAttr('selected');
							jQuery(this).parent().addClass('selected');
							selOpt.attr('selected', 'selected');
							selectText.html(selOpt.html());
							select.change();
							optHolder.css({left:-9999,top:-9999});
							return false;
						});
						optList.append(_opt);
						if(selOpt.attr('title') == 'default'){
							_opt.hide();
						}
						
					});
					replaced.width(select.outerWidth());
					replaced.insertBefore(select);
					optHolder.css({
						width: select.outerWidth(),
						position: 'absolute',
						left:-9999,
						top:-9999
					});
					jQuery(document.body).append(optHolder);

					var optTimer;
					replaced.hover(function() {
						if(optTimer) clearTimeout(optTimer);
					}, function() {
						if(hideOnMouseOut) {
							optTimer = setTimeout(function() {
								optHolder.css({left:-9999,top:-9999});
							}, 200);
						}
					});
					optHolder.hover(
					function(){
						if(optTimer) clearTimeout(optTimer);
					},
					function() {
						if(hideOnMouseOut) {
							optTimer = setTimeout(function() {
								optHolder.css({left:-9999,top:-9999});
								
							}, 200);
							selectBtn.removeClass('hover-btn');
						}
					});
					selectBtn.hover(
						function(){
							jQuery(this).addClass('hover-btn');
						},
						function(){
							jQuery(this).removeClass('hover-btn');
						}
					)
					selectBtn.click(function() {
						if(optHolder.css('left') == '-9999px') {
							if(_activeDrop) _activeDrop.css({left:-9999,top:-9999});
							optHolder.children('ul').css({height:'auto', overflow:'hidden'});
							optHolder.css({
								top: replaced.offset().top + replaced.outerHeight(),
								left: replaced.offset().left,
								display: 'block'
							});
							if(optHolder.children('ul').height() > 200) optHolder.children('ul').css({height:200, overflow:'auto'});
							_activeDrop = optHolder;
						}
						else{
							optHolder.css({left:-9999,top:-9999});
						}
						return false;
					});
					replaced.addClass(select.attr('class'));
					select.addClass('outtaHere');
					//If need scroll auto-height
					//if (optList.height() > 144 ) optList.parent().addClass('scrollable');
				}
			}
		});
	}

	// event handler on DOM ready
	var _activeDrop;
	jQuery(function(){
		jQuery('body').click(hideOptionsClick)
		jQuery(window).resize(hideOptions)
	});
	function hideOptions() {
		if(_activeDrop && _activeDrop.length) {
			_activeDrop.css({left:-9999,top:-9999});
			_activeDrop = null;
		}
	}
	function hideOptionsClick(e) {
		if(_activeDrop && _activeDrop.length) {
			var f = false;
			jQuery(e.target).parents().each(function(){
				if(this == _activeDrop.get(0)) f=true;
			});
			if(!f) {
				_activeDrop.css({left:-9999,top:-9999});
				_activeDrop = null;
			}
		}
	}
})(jQuery);



/*
 * FancyBox - jQuery Plugin
 * Simple and fancy lightbox alternative
 *
 * Examples and documentation at: http://fancybox.net
 * 
 * Copyright (c) 2008 - 2010 Janis Skarnelis
 * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
 * 
 * Version: 1.3.4 (11/11/2010)
 * Requires: jQuery v1.3+
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */

;(function($){var tmp,loading,overlay,wrap,outer,content,close,title,nav_left,nav_right,selectedIndex=0,selectedOpts={},selectedArray=[],currentIndex=0,currentOpts={},currentArray=[],ajaxLoader=null,imgPreloader=new Image(),imgRegExp=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,swfRegExp=/[^\.]\.(swf)\s*$/i,loadingTimer,loadingFrame=1,titleHeight=0,titleStr='',start_pos,final_pos,busy=false,fx=jQuery.extend(jQuery('<div/>')[0],{prop:0}),isIE6=jQuery.browser.msie&&jQuery.browser.version<7&&!window.XMLHttpRequest,_abort=function(){loading.hide();imgPreloader.onerror=imgPreloader.onload=null;if(ajaxLoader){ajaxLoader.abort()}tmp.empty()},_error=function(){if(false===selectedOpts.onError(selectedArray,selectedIndex,selectedOpts)){loading.hide();busy=false;return}selectedOpts.titleShow=false;selectedOpts.width='auto';selectedOpts.height='auto';tmp.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');_process_inline()},_start=function(){var obj=selectedArray[selectedIndex],href,type,title,str,emb,ret;_abort();selectedOpts=jQuery.extend({},jQuery.fn.fancybox.defaults,(typeof jQuery(obj).data('fancybox')=='undefined'?selectedOpts:jQuery(obj).data('fancybox')));ret=selectedOpts.onStart(selectedArray,selectedIndex,selectedOpts);if(ret===false){busy=false;return}else if(typeof ret=='object'){selectedOpts=jQuery.extend(selectedOpts,ret)}title=selectedOpts.title||(obj.nodeName?jQuery(obj).attr('title'):obj.title)||'';if(obj.nodeName&&!selectedOpts.orig){selectedOpts.orig=jQuery(obj).children("img:first").length?jQuery(obj).children("img:first"):jQuery(obj)}if(title===''&&selectedOpts.orig&&selectedOpts.titleFromAlt){title=selectedOpts.orig.attr('alt')}href=selectedOpts.href||(obj.nodeName?jQuery(obj).attr('href'):obj.href)||null;if((/^(?:javascript)/i).test(href)||href=='#'){href=null}if(selectedOpts.type){type=selectedOpts.type;if(!href){href=selectedOpts.content}}else if(selectedOpts.content){type='html'}else if(href){if(href.match(imgRegExp)){type='image'}else if(href.match(swfRegExp)){type='swf'}else if(jQuery(obj).hasClass("iframe")){type='iframe'}else if(href.indexOf("#")===0){type='inline'}else{type='ajax'}}if(!type){_error();return}if(type=='inline'){obj=href.substr(href.indexOf("#"));type=jQuery(obj).length>0?'inline':'ajax'}selectedOpts.type=type;selectedOpts.href=href;selectedOpts.title=title;if(selectedOpts.autoDimensions){if(selectedOpts.type=='html'||selectedOpts.type=='inline'||selectedOpts.type=='ajax'){selectedOpts.width='auto';selectedOpts.height='auto'}else{selectedOpts.autoDimensions=false}}if(selectedOpts.modal){selectedOpts.overlayShow=true;selectedOpts.hideOnOverlayClick=false;selectedOpts.hideOnContentClick=false;selectedOpts.enableEscapeButton=false;selectedOpts.showCloseButton=false}selectedOpts.padding=parseInt(selectedOpts.padding,10);selectedOpts.margin=parseInt(selectedOpts.margin,10);tmp.css('padding',(selectedOpts.padding+selectedOpts.margin));jQuery('.fancybox-inline-tmp').unbind('fancybox-cancel').bind('fancybox-change',function(){jQuery(this).replaceWith(content.children())});switch(type){case'html':tmp.html(selectedOpts.content);_process_inline();break;case'inline':if(jQuery(obj).parent().is('#fancybox-content')===true){busy=false;return}jQuery('<div class="fancybox-inline-tmp" />').hide().insertBefore(jQuery(obj)).bind('fancybox-cleanup',function(){jQuery(this).replaceWith(content.children())}).bind('fancybox-cancel',function(){jQuery(this).replaceWith(tmp.children())});jQuery(obj).appendTo(tmp);_process_inline();break;case'image':busy=false;jQuery.fancybox.showActivity();imgPreloader=new Image();imgPreloader.onerror=function(){_error()};imgPreloader.onload=function(){busy=true;imgPreloader.onerror=imgPreloader.onload=null;_process_image()};imgPreloader.src=href;break;case'swf':selectedOpts.scrolling='no';str='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+selectedOpts.width+'" height="'+selectedOpts.height+'"><param name="movie" value="'+href+'"></param>';emb='';jQuery.each(selectedOpts.swf,function(name,val){str+='<param name="'+name+'" value="'+val+'"></param>';emb+=' '+name+'="'+val+'"'});str+='<embed src="'+href+'" type="application/x-shockwave-flash" width="'+selectedOpts.width+'" height="'+selectedOpts.height+'"'+emb+'></embed></object>';tmp.html(str);_process_inline();break;case'ajax':busy=false;jQuery.fancybox.showActivity();selectedOpts.ajax.win=selectedOpts.ajax.success;ajaxLoader=jQuery.ajax(jQuery.extend({},selectedOpts.ajax,{url:href,data:selectedOpts.ajax.data||{},error:function(XMLHttpRequest,textStatus,errorThrown){if(XMLHttpRequest.status>0){_error()}},success:function(data,textStatus,XMLHttpRequest){var o=typeof XMLHttpRequest=='object'?XMLHttpRequest:ajaxLoader;if(o.status==200){if(typeof selectedOpts.ajax.win=='function'){ret=selectedOpts.ajax.win(href,data,textStatus,XMLHttpRequest);if(ret===false){loading.hide();return}else if(typeof ret=='string'||typeof ret=='object'){data=ret}}tmp.html(data);_process_inline()}}}));break;case'iframe':_show();break}},_process_inline=function(){var w=selectedOpts.width,h=selectedOpts.height;if(w.toString().indexOf('%')>-1){w=parseInt((jQuery(window).width()-(selectedOpts.margin*2))*parseFloat(w)/100,10)+'px'}else{w=w=='auto'?'auto':w+'px'}if(h.toString().indexOf('%')>-1){h=parseInt((jQuery(window).height()-(selectedOpts.margin*2))*parseFloat(h)/100,10)+'px'}else{h=h=='auto'?'auto':h+'px'}tmp.wrapInner('<div style="width:'+w+';height:'+h+';overflow: '+(selectedOpts.scrolling=='auto'?'auto':(selectedOpts.scrolling=='yes'?'scroll':'hidden'))+';position:relative;"></div>');selectedOpts.width=tmp.width();selectedOpts.height=tmp.height();_show()},_process_image=function(){selectedOpts.width=imgPreloader.width;selectedOpts.height=imgPreloader.height;jQuery("<img />").attr({'id':'fancybox-img','src':imgPreloader.src,'alt':selectedOpts.title}).appendTo(tmp);_show()},_show=function(){var pos,equal;loading.hide();if(wrap.is(":visible")&&false===currentOpts.onCleanup(currentArray,currentIndex,currentOpts)){jQuery.event.trigger('fancybox-cancel');busy=false;return}busy=true;jQuery(content.add(overlay)).unbind();jQuery(window).unbind("resize.fb scroll.fb");jQuery(document).unbind('keydown.fb');if(wrap.is(":visible")&&currentOpts.titlePosition!=='outside'){wrap.css('height',wrap.height())}currentArray=selectedArray;currentIndex=selectedIndex;currentOpts=selectedOpts;if(currentOpts.overlayShow){overlay.css({'background-color':currentOpts.overlayColor,'opacity':currentOpts.overlayOpacity,'cursor':currentOpts.hideOnOverlayClick?'pointer':'auto','height':jQuery(document).height()});if(jQuery(window).width()>jQuery(document).width())overlay.css('width',jQuery(window).width());else overlay.css('width',jQuery(document).width());if(!overlay.is(':visible')){if(isIE6){jQuery('select:not(#fancybox-tmp select)').filter(function(){return this.style.visibility!=='hidden'}).css({'visibility':'hidden'}).one('fancybox-cleanup',function(){this.style.visibility='inherit'})}overlay.show()}}else{overlay.hide()}final_pos=_get_zoom_to();_process_title();if(wrap.is(":visible")){jQuery(close.add(nav_left).add(nav_right)).hide();pos=wrap.position(),start_pos={top:pos.top,left:pos.left,width:wrap.width(),height:wrap.height()};equal=(start_pos.width==final_pos.width&&start_pos.height==final_pos.height);content.fadeTo(currentOpts.changeFade,0.3,function(){var finish_resizing=function(){content.html(tmp.contents()).fadeTo(currentOpts.changeFade,1,_finish)};jQuery.event.trigger('fancybox-change');content.empty().removeAttr('filter').css({'border-width':currentOpts.padding,'width':final_pos.width-currentOpts.padding*2,'height':selectedOpts.autoDimensions?'auto':final_pos.height-titleHeight-currentOpts.padding*2});if(equal){finish_resizing()}else{fx.prop=0;jQuery(fx).animate({prop:1},{duration:currentOpts.changeSpeed,easing:currentOpts.easingChange,step:_draw,complete:finish_resizing})}});return}wrap.removeAttr("style");content.css('border-width',currentOpts.padding);if(currentOpts.transitionIn=='elastic'){start_pos=_get_zoom_from();content.html(tmp.contents());wrap.show();if(currentOpts.opacity){final_pos.opacity=0}fx.prop=0;jQuery(fx).animate({prop:1},{duration:currentOpts.speedIn,easing:currentOpts.easingIn,step:_draw,complete:_finish});return}if(currentOpts.titlePosition=='inside'&&titleHeight>0){title.show()}content.css({'width':final_pos.width-currentOpts.padding*2,'height':selectedOpts.autoDimensions?'auto':final_pos.height-titleHeight-currentOpts.padding*2}).html(tmp.contents());wrap.css(final_pos).fadeIn(currentOpts.transitionIn=='none'?0:currentOpts.speedIn,_finish)},_format_title=function(title){if(title&&title.length){if(currentOpts.titlePosition=='float'){return'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+title+'</td><td id="fancybox-title-float-right"></td></tr></table>'}return'<div id="fancybox-title-'+currentOpts.titlePosition+'">'+title+'</div>'}return false},_process_title=function(){titleStr=currentOpts.title||'';titleHeight=0;title.empty().removeAttr('style').removeClass();if(currentOpts.titleShow===false){title.hide();return}titleStr=jQuery.isFunction(currentOpts.titleFormat)?currentOpts.titleFormat(titleStr,currentArray,currentIndex,currentOpts):_format_title(titleStr);if(!titleStr||titleStr===''){title.hide();return}title.addClass('fancybox-title-'+currentOpts.titlePosition).html(titleStr).appendTo('body').show();switch(currentOpts.titlePosition){case'inside':title.css({'width':final_pos.width-(currentOpts.padding*2),'marginLeft':currentOpts.padding,'marginRight':currentOpts.padding});titleHeight=title.outerHeight(true);title.appendTo(outer);final_pos.height+=titleHeight;break;case'over':title.css({'marginLeft':currentOpts.padding,'width':final_pos.width-(currentOpts.padding*2),'bottom':currentOpts.padding}).appendTo(outer);break;case'float':title.css('left',parseInt((title.width()-final_pos.width-40)/2,10)*-1).appendTo(wrap);break;default:title.css({'width':final_pos.width-(currentOpts.padding*2),'paddingLeft':currentOpts.padding,'paddingRight':currentOpts.padding}).appendTo(wrap);break}title.hide()},_set_navigation=function(){if(currentOpts.enableEscapeButton||currentOpts.enableKeyboardNav){jQuery(document).bind('keydown.fb',function(e){if(e.keyCode==27&&currentOpts.enableEscapeButton){e.preventDefault();jQuery.fancybox.close()}else if((e.keyCode==37||e.keyCode==39)&&currentOpts.enableKeyboardNav&&e.target.tagName!=='INPUT'&&e.target.tagName!=='TEXTAREA'&&e.target.tagName!=='SELECT'){e.preventDefault();jQuery.fancybox[e.keyCode==37?'prev':'next']()}})}if(!currentOpts.showNavArrows){nav_left.hide();nav_right.hide();return}if((currentOpts.cyclic&&currentArray.length>1)||currentIndex!==0){nav_left.show()}if((currentOpts.cyclic&&currentArray.length>1)||currentIndex!=(currentArray.length-1)){nav_right.show()}},_finish=function(){if(!jQuery.support.opacity){content.get(0).style.removeAttribute('filter');wrap.get(0).style.removeAttribute('filter')}if(selectedOpts.autoDimensions){content.css('height','auto')}wrap.css('height','auto');if(titleStr&&titleStr.length){title.show()}if(currentOpts.showCloseButton){close.show()}_set_navigation();if(currentOpts.hideOnContentClick){content.bind('click',jQuery.fancybox.close)}if(currentOpts.hideOnOverlayClick){overlay.bind('click',jQuery.fancybox.close)}jQuery(window).bind("resize.fb",jQuery.fancybox.resize);if(currentOpts.centerOnScroll){jQuery(window).bind("scroll.fb",jQuery.fancybox.center)}if(currentOpts.type=='iframe'){jQuery('<iframe id="fancybox-frame" name="fancybox-frame'+new Date().getTime()+'" frameborder="0" hspace="0" '+(jQuery.browser.msie?'allowtransparency="true""':'')+' scrolling="'+selectedOpts.scrolling+'" src="'+currentOpts.href+'"></iframe>').appendTo(content)}wrap.show();busy=false;jQuery.fancybox.center();currentOpts.onComplete(currentArray,currentIndex,currentOpts);_preload_images()},_preload_images=function(){var href,objNext;if((currentArray.length-1)>currentIndex){href=currentArray[currentIndex+1].href;if(typeof href!=='undefined'&&href.match(imgRegExp)){objNext=new Image();objNext.src=href}}if(currentIndex>0){href=currentArray[currentIndex-1].href;if(typeof href!=='undefined'&&href.match(imgRegExp)){objNext=new Image();objNext.src=href}}},_draw=function(pos){var dim={width:parseInt(start_pos.width+(final_pos.width-start_pos.width)*pos,10),height:parseInt(start_pos.height+(final_pos.height-start_pos.height)*pos,10),top:parseInt(start_pos.top+(final_pos.top-start_pos.top)*pos,10),left:parseInt(start_pos.left+(final_pos.left-start_pos.left)*pos,10)};if(typeof final_pos.opacity!=='undefined'){dim.opacity=pos<0.5?0.5:pos}wrap.css(dim);content.css({'width':dim.width-currentOpts.padding*2,'height':dim.height-(titleHeight*pos)-currentOpts.padding*2})},_get_viewport=function(){return[jQuery(window).width()-(currentOpts.margin*2),jQuery(window).height()-(currentOpts.margin*2),jQuery(document).scrollLeft()+currentOpts.margin,jQuery(document).scrollTop()+currentOpts.margin]},_get_zoom_to=function(){var view=_get_viewport(),to={},resize=currentOpts.autoScale,double_padding=currentOpts.padding*2,ratio;if(currentOpts.width.toString().indexOf('%')>-1){to.width=parseInt((view[0]*parseFloat(currentOpts.width))/100,10)}else{to.width=currentOpts.width+double_padding}if(currentOpts.height.toString().indexOf('%')>-1){to.height=parseInt((view[1]*parseFloat(currentOpts.height))/100,10)}else{to.height=currentOpts.height+double_padding}if(resize&&(to.width>view[0]||to.height>view[1])){if(selectedOpts.type=='image'||selectedOpts.type=='swf'){ratio=(currentOpts.width)/(currentOpts.height);if((to.width)>view[0]){to.width=view[0];to.height=parseInt(((to.width-double_padding)/ratio)+double_padding,10)}if((to.height)>view[1]){to.height=view[1];to.width=parseInt(((to.height-double_padding)*ratio)+double_padding,10)}}else{to.width=Math.min(to.width,view[0]);to.height=Math.min(to.height,view[1])}}to.top=parseInt(Math.max(view[3]-20,view[3]+((view[1]-to.height-40)*0.5)),10);to.left=parseInt(Math.max(view[2]-20,view[2]+((view[0]-to.width-40)*0.5)),10);return to},_get_obj_pos=function(obj){var pos=obj.offset();pos.top+=parseInt(obj.css('paddingTop'),10)||0;pos.left+=parseInt(obj.css('paddingLeft'),10)||0;pos.top+=parseInt(obj.css('border-top-width'),10)||0;pos.left+=parseInt(obj.css('border-left-width'),10)||0;pos.width=obj.width();pos.height=obj.height();return pos},_get_zoom_from=function(){var orig=selectedOpts.orig?jQuery(selectedOpts.orig):false,from={},pos,view;if(orig&&orig.length){pos=_get_obj_pos(orig);from={width:pos.width+(currentOpts.padding*2),height:pos.height+(currentOpts.padding*2),top:pos.top-currentOpts.padding-20,left:pos.left-currentOpts.padding-20}}else{view=_get_viewport();from={width:currentOpts.padding*2,height:currentOpts.padding*2,top:parseInt(view[3]+view[1]*0.5,10),left:parseInt(view[2]+view[0]*0.5,10)}}return from},_animate_loading=function(){if(!loading.is(':visible')){clearInterval(loadingTimer);return}jQuery('div',loading).css('top',(loadingFrame*-40)+'px');loadingFrame=(loadingFrame+1)%12};jQuery.fn.fancybox=function(options){if(!jQuery(this).length){return this}jQuery(this).data('fancybox',jQuery.extend({},options,(jQuery.metadata?jQuery(this).metadata():{}))).unbind('click.fb').bind('click.fb',function(e){e.preventDefault();if(busy){return}busy=true;jQuery(this).blur();selectedArray=[];selectedIndex=0;var rel=jQuery(this).attr('rel')||'';if(!rel||rel==''||rel==='nofollow'){selectedArray.push(this)}else{selectedArray=jQuery("a[rel="+rel+"], area[rel="+rel+"]");selectedIndex=selectedArray.index(this)}_start();return});return this};jQuery.fancybox=function(obj){var opts;if(busy){return}busy=true;opts=typeof arguments[1]!=='undefined'?arguments[1]:{};selectedArray=[];selectedIndex=parseInt(opts.index,10)||0;if(jQuery.isArray(obj)){for(var i=0,j=obj.length;i<j;i++){if(typeof obj[i]=='object'){jQuery(obj[i]).data('fancybox',jQuery.extend({},opts,obj[i]))}else{obj[i]=jQuery({}).data('fancybox',jQuery.extend({content:obj[i]},opts))}}selectedArray=jQuery.merge(selectedArray,obj)}else{if(typeof obj=='object'){jQuery(obj).data('fancybox',jQuery.extend({},opts,obj))}else{obj=jQuery({}).data('fancybox',jQuery.extend({content:obj},opts))}selectedArray.push(obj)}if(selectedIndex>selectedArray.length||selectedIndex<0){selectedIndex=0}_start()};jQuery.fancybox.showActivity=function(){clearInterval(loadingTimer);loading.show();loadingTimer=setInterval(_animate_loading,66)};jQuery.fancybox.hideActivity=function(){loading.hide()};jQuery.fancybox.next=function(){return jQuery.fancybox.pos(currentIndex+1)};jQuery.fancybox.prev=function(){return jQuery.fancybox.pos(currentIndex-1)};jQuery.fancybox.pos=function(pos){if(busy){return}pos=parseInt(pos);selectedArray=currentArray;if(pos>-1&&pos<currentArray.length){selectedIndex=pos;_start()}else if(currentOpts.cyclic&&currentArray.length>1){selectedIndex=pos>=currentArray.length?0:currentArray.length-1;_start()}return};jQuery.fancybox.cancel=function(){if(busy){return}busy=true;jQuery.event.trigger('fancybox-cancel');_abort();selectedOpts.onCancel(selectedArray,selectedIndex,selectedOpts);busy=false};jQuery.fancybox.close=function(){if(busy||wrap.is(':hidden')){return}busy=true;if(currentOpts&&false===currentOpts.onCleanup(currentArray,currentIndex,currentOpts)){busy=false;return}_abort();jQuery(close.add(nav_left).add(nav_right)).hide();jQuery(content.add(overlay)).unbind();jQuery(window).unbind("resize.fb scroll.fb");jQuery(document).unbind('keydown.fb');content.find('iframe').attr('src',isIE6&&/^https/i.test(window.location.href||'')?'javascript:void(false)':'about:blank');if(currentOpts.titlePosition!=='inside'){title.empty()}wrap.stop();function _cleanup(){overlay.fadeOut('fast');title.empty().hide();wrap.hide();jQuery.event.trigger('fancybox-cleanup');content.empty();currentOpts.onClosed(currentArray,currentIndex,currentOpts);currentArray=selectedOpts=[];currentIndex=selectedIndex=0;currentOpts=selectedOpts={};busy=false}if(currentOpts.transitionOut=='elastic'){start_pos=_get_zoom_from();var pos=wrap.position();final_pos={top:pos.top,left:pos.left,width:wrap.width(),height:wrap.height()};if(currentOpts.opacity){final_pos.opacity=1}title.empty().hide();fx.prop=1;jQuery(fx).animate({prop:0},{duration:currentOpts.speedOut,easing:currentOpts.easingOut,step:_draw,complete:_cleanup})}else{wrap.fadeOut(currentOpts.transitionOut=='none'?0:currentOpts.speedOut,_cleanup)}};jQuery.fancybox.resize=function(){if(overlay.is(':visible')){overlay.css('height',jQuery(document).height());if(jQuery(window).width()>jQuery(document).width())overlay.css('width',jQuery(window).width());else overlay.css('width',jQuery(document).width())}jQuery.fancybox.center(true)};jQuery.fancybox.center=function(){var view,align;if(busy){return}align=arguments[0]===true?1:0;view=_get_viewport();if(!align&&(wrap.width()>view[0]||wrap.height()>view[1])){return}wrap.stop().animate({'top':parseInt(Math.max(view[3]-20,view[3]+((view[1]-content.height()-40)*0.5)-currentOpts.padding)),'left':parseInt(Math.max(view[2]-20,view[2]+((view[0]-content.width()-40)*0.5)-currentOpts.padding))},typeof arguments[0]=='number'?arguments[0]:200)};jQuery.fancybox.init=function(){if(jQuery("#fancybox-wrap").length){return}jQuery('body').append(tmp=jQuery('<div id="fancybox-tmp"></div>'),loading=jQuery('<div id="fancybox-loading"><div></div></div>'),overlay=jQuery('<div id="fancybox-overlay"></div>'),wrap=jQuery('<div id="fancybox-wrap"></div>'));outer=jQuery('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(wrap);outer.append(content=jQuery('<div id="fancybox-content"></div>'),close=jQuery('<a id="fancybox-close"></a>'),title=jQuery('<div id="fancybox-title"></div>'),nav_left=jQuery('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),nav_right=jQuery('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));close.click(jQuery.fancybox.close);loading.click(jQuery.fancybox.cancel);nav_left.click(function(e){e.preventDefault();jQuery.fancybox.prev()});nav_right.click(function(e){e.preventDefault();jQuery.fancybox.next()});if(jQuery.fn.mousewheel){wrap.bind('mousewheel.fb',function(e,delta){if(busy){e.preventDefault()}else if(jQuery(e.target).get(0).clientHeight==0||jQuery(e.target).get(0).scrollHeight===jQuery(e.target).get(0).clientHeight){e.preventDefault();jQuery.fancybox[delta>0?'prev':'next']()}})}if(!jQuery.support.opacity){wrap.addClass('fancybox-ie')}if(isIE6){loading.addClass('fancybox-ie6');wrap.addClass('fancybox-ie6');jQuery('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||'')?'javascript:void(false)':'about:blank')+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(outer)}};jQuery.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:'auto',width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:'transparent'},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:'#777',titleShow:true,titlePosition:'float',titleFormat:null,titleFromAlt:false,transitionIn:'fade',transitionOut:'fade',speedIn:300,speedOut:300,changeSpeed:300,changeFade:'fast',easingIn:'swing',easingOut:'swing',showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};jQuery(document).ready(function(){jQuery.fancybox.init()})})(jQuery);




/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
* Licensed under the MIT License (LICENSE.txt).
*
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
* Thanks to: Seamus Leahy for adding deltaX and deltaY
*
* Version: 3.0.4
*
* Requires: 1.2.2+
*/

(function(d){function g(a){var b=a||window.event,i=[].slice.call(arguments,1),c=0,h=0,e=0;a=d.event.fix(b);a.type="mousewheel";if(a.wheelDelta)c=a.wheelDelta/120;if(a.detail)c=-a.detail/3;e=c;if(b.axis!==undefined&&b.axis===b.HORIZONTAL_AXIS){e=0;h=-1*c}if(b.wheelDeltaY!==undefined)e=b.wheelDeltaY/120;if(b.wheelDeltaX!==undefined)h=-1*b.wheelDeltaX/120;i.unshift(a,c,h,e);return d.event.handle.apply(this,i)}var f=["DOMMouseScroll","mousewheel"];d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=
f.length;a;)this.addEventListener(f[--a],g,false);else this.onmousewheel=g},teardown:function(){if(this.removeEventListener)for(var a=f.length;a;)this.removeEventListener(f[--a],g,false);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);




/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('h.i[\'1a\']=h.i[\'z\'];h.O(h.i,{y:\'D\',z:9(x,t,b,c,d){6 h.i[h.i.y](x,t,b,c,d)},17:9(x,t,b,c,d){6 c*(t/=d)*t+b},D:9(x,t,b,c,d){6-c*(t/=d)*(t-2)+b},13:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t+b;6-c/2*((--t)*(t-2)-1)+b},X:9(x,t,b,c,d){6 c*(t/=d)*t*t+b},U:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t+1)+b},R:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t+b;6 c/2*((t-=2)*t*t+2)+b},N:9(x,t,b,c,d){6 c*(t/=d)*t*t*t+b},M:9(x,t,b,c,d){6-c*((t=t/d-1)*t*t*t-1)+b},L:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t+b;6-c/2*((t-=2)*t*t*t-2)+b},K:9(x,t,b,c,d){6 c*(t/=d)*t*t*t*t+b},J:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t*t*t+1)+b},I:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t*t+b;6 c/2*((t-=2)*t*t*t*t+2)+b},G:9(x,t,b,c,d){6-c*8.C(t/d*(8.g/2))+c+b},15:9(x,t,b,c,d){6 c*8.n(t/d*(8.g/2))+b},12:9(x,t,b,c,d){6-c/2*(8.C(8.g*t/d)-1)+b},Z:9(x,t,b,c,d){6(t==0)?b:c*8.j(2,10*(t/d-1))+b},Y:9(x,t,b,c,d){6(t==d)?b+c:c*(-8.j(2,-10*t/d)+1)+b},W:9(x,t,b,c,d){e(t==0)6 b;e(t==d)6 b+c;e((t/=d/2)<1)6 c/2*8.j(2,10*(t-1))+b;6 c/2*(-8.j(2,-10*--t)+2)+b},V:9(x,t,b,c,d){6-c*(8.o(1-(t/=d)*t)-1)+b},S:9(x,t,b,c,d){6 c*8.o(1-(t=t/d-1)*t)+b},Q:9(x,t,b,c,d){e((t/=d/2)<1)6-c/2*(8.o(1-t*t)-1)+b;6 c/2*(8.o(1-(t-=2)*t)+1)+b},P:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6-(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b},H:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6 a*8.j(2,-10*t)*8.n((t*d-s)*(2*8.g)/p)+c+b},T:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d/2)==2)6 b+c;e(!p)p=d*(.3*1.5);e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);e(t<1)6-.5*(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b;6 a*8.j(2,-10*(t-=1))*8.n((t*d-s)*(2*8.g)/p)*.5+c+b},F:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*(t/=d)*t*((s+1)*t-s)+b},E:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},16:9(x,t,b,c,d,s){e(s==u)s=1.l;e((t/=d/2)<1)6 c/2*(t*t*(((s*=(1.B))+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.B))+1)*t+s)+2)+b},A:9(x,t,b,c,d){6 c-h.i.v(x,d-t,0,c,d)+b},v:9(x,t,b,c,d){e((t/=d)<(1/2.k)){6 c*(7.q*t*t)+b}m e(t<(2/2.k)){6 c*(7.q*(t-=(1.5/2.k))*t+.k)+b}m e(t<(2.5/2.k)){6 c*(7.q*(t-=(2.14/2.k))*t+.11)+b}m{6 c*(7.q*(t-=(2.18/2.k))*t+.19)+b}},1b:9(x,t,b,c,d){e(t<d/2)6 h.i.A(x,t*2,0,c,d)*.5+b;6 h.i.v(x,t*2-d,0,c,d)*.5+c*.5+b}});',62,74,'||||||return||Math|function|||||if|var|PI|jQuery|easing|pow|75|70158|else|sin|sqrt||5625|asin|||undefined|easeOutBounce|abs||def|swing|easeInBounce|525|cos|easeOutQuad|easeOutBack|easeInBack|easeInSine|easeOutElastic|easeInOutQuint|easeOutQuint|easeInQuint|easeInOutQuart|easeOutQuart|easeInQuart|extend|easeInElastic|easeInOutCirc|easeInOutCubic|easeOutCirc|easeInOutElastic|easeOutCubic|easeInCirc|easeInOutExpo|easeInCubic|easeOutExpo|easeInExpo||9375|easeInOutSine|easeInOutQuad|25|easeOutSine|easeInOutBack|easeInQuad|625|984375|jswing|easeInOutBounce'.split('|'),0,{}))

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2001 Robert Penner
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
 */

 

