$(document).ready(function(){	initSlider();	$('.link-popup').simplebox();	initFooterDrop();});function initFooterDrop(){	$('#footer ul.nav > li:has(ul)').each(function(){		var hold = $(this);		var ul = hold.find('ul');		var clone = ul.clone();		var _time;				ul.css({display: 'block'});		clone.addClass('drop').css({			width: ul.width(),			left: hold.offset().left,			top: hold.offset().top - ul.outerHeight() - 1		});		ul.css({display: 'none'});				$('body').append(clone);				hold.hover(function(){			if(_time) clearTimeout(_time);			clone.css({display: 'block'});			hold.addClass('hover');		}, function(){			_time = setTimeout(function(){				clone.css({display: 'none'});				hold.removeClass('hover');			}, 30);		});		clone.hover(function(){			if(_time) clearTimeout(_time);			clone.css({display: 'block'});			hold.addClass('hover');		}, function(){			_time = setTimeout(function(){				clone.css({display: 'none'});				hold.removeClass('hover');			}, 30);		});	});}function initSlider(){	$('div.gallery').each(function(){		var hold = $(this);		var gal1 = hold.find('div.gallery-holder').gallery({			duration: 500,			listOfSlides: 'ul > li',			slideElement:3		});		var _time;		var next = hold.find('a.btn-next');		var prev = hold.find('a.btn-prev');				var slider = $( "#slider" ).slider({			value:1,			min: 1,			animate: true,			max: (gal1.count+1)/3,			slide: function(event, ui) {				gal1.active = (ui.value-1)*3;				gal1.scrollElement(gal1);			}		});		next.click(function(){			gal1.toPrepare(gal1, true);			slider.slider( "value" , [(gal1.active)/3+1] );			return false;		});		prev.click(function(){			gal1.toPrepare(gal1, false);			slider.slider( "value" , [(gal1.active)/3+1] );			return false;		});		function runTimer(){			_time = setInterval(function(){				next.trigger('click');			}, 5000);		}		runTimer();		hold.hover(function(){			if(_time) clearTimeout(_time);		}, function(){			runTimer();		});	});}$.fn.gallery = function(options) { return new Gallery(this.get(0), options); };		function Gallery(context, options) { this.init(context, options); };		Gallery.prototype = {		options:{},		init: function (context, options){			this.options = $.extend({				infinite: false,								//true = infinite gallery				duration: 700,									//duration of effect it 1000 = 1sec				slideElement: 1,								//number of elements for a slide				autoRotation: false,							//false = option is disabled; 1000 = 1sec				effect: false,									//false = slide; true = fade				listOfSlides: 'ul > li',						//elements galleries				switcher: false,								//false = option is disabled; 'ul > li' = elements switcher				disableBtn: false,								//false = option is disabled; 'hidden' = class adds an buttons "prev" and "next"				nextBtn: 'a.link-next, a.btn-next, a.next',		//button "next"				prevBtn: 'a.link-prev, a.btn-prev, a.prev',		//button "prev"				circle: true,									//true = cyclic gallery; false = not cyclic gallery				direction: false,								//false = horizontal; true = vertical				event: 'click',									//event for the buttons and switcher				IE: false,										//forced off effect it "fade" in IE				autoHeight: false,								//auto height on fade				easing: 'swing'			}, options || {});			var _el = $(context).find(this.options.listOfSlides);			if (this.options.effect) this.list = _el;			else this.list = _el.parent();			this.switcher = $(context).find(this.options.switcher);			this.nextBtn = $(context).find(this.options.nextBtn);			this.prevBtn = $(context).find(this.options.prevBtn);			this.count = _el.index(_el.filter(':last'));						if (this.options.switcher) this.active = this.switcher.index(this.switcher.filter('.active:eq(0)'));			else this.active = _el.index(_el.filter('.active:eq(0)'));			if (this.active < 0) this.active = 0;			this.last = this.active;						this.woh = _el.outerWidth(true);			if (!this.options.direction) this.installDirections(this.list.parent().width());			else {				this.woh = _el.outerHeight(true);				this.installDirections(this.list.parent().height());			}						if (!this.options.effect) {				this.rew = this.count - this.wrapHolderW + 1;				this.list.css({position: 'relative'}).css(this.dirAnimate());			}			else {				this.rew = this.count;				this.list.css({opacity: 0}).removeClass('active').eq(this.active).addClass('active').css({opacity: 1}).css('opacity', 'auto');				this.switcher.removeClass('active').eq(this.active).addClass('active');				if(this.options.autoHeight) this.list.parent().css({height: this.list.eq(this.active).outerHeight()});			}			this.flag = true;			if (this.options.infinite){				this.count++;				this.active += this.count;				this.list.append(_el.clone());				this.list.append(_el.clone());				this.list.css(this.dirAnimate());			}						this.initEvent(this, this.nextBtn, true);			this.initEvent(this, this.prevBtn, false);			if (this.options.disableBtn) this.initDisableBtn();			if (this.options.autoRotation) this.runTimer(this);			if (this.options.switcher) this.initEventSwitcher(this, this.switcher);		},		dirAnimate: function(){			if (!this.options.direction) return {left: -(this.woh * this.active)};			else return {top: -(this.woh * this.active)};		},		initDisableBtn: function(){			this.prevBtn.removeClass('prev-'+this.options.disableBtn);			this.nextBtn.removeClass('next-'+this.options.disableBtn);			if (this.active == 0 || this.count+1 == this.wrapHolderW) this.prevBtn.addClass('prev-'+this.options.disableBtn);			if (this.active == 0 && this.count+1 == 1 || this.count+1 <= this.wrapHolderW) this.nextBtn.addClass('next-'+this.options.disableBtn);			if (this.active == this.rew) this.nextBtn.addClass('next-'+this.options.disableBtn);		},		installDirections: function(temp){			this.wrapHolderW = Math.ceil(temp / this.woh);			if (((this.wrapHolderW - 1) * this.woh + this.woh / 2) > temp) this.wrapHolderW--;		},		fadeElement: function(){			if ($.browser.msie && this.options.IE){				this.list.eq(this.last).css({opacity:0});				this.list.removeClass('active').eq(this.active).addClass('active').css({opacity:'auto'});			}			else{				this.list.eq(this.last).animate({opacity:0}, {queue:false, easing: this.options.easing, duration: this.options.duration});				this.list.removeClass('active').eq(this.active).addClass('active').animate({					opacity:1				}, {queue:false, duration: this.options.duration, complete: function(){					$(this).css('opacity','auto');				}});			}			if(this.options.autoHeight) this.list.parent().animate({height: this.list.eq(this.active).outerHeight()}, {queue:false, duration: this.options.duration});			if (this.options.switcher) this.switcher.removeClass('active').eq(this.active).addClass('active');			this.last = this.active;		},		scrollElement: function($this){			if (!$this.options.infinite) $this.list.animate($this.dirAnimate(), {queue:false, easing: $this.options.easing, duration: $this.options.duration});			else $this.list.animate($this.dirAnimate(), $this.options.duration, $this.options.easing, function(){ $this.flag = true });			if ($this.options.switcher) $this.switcher.removeClass('active').eq($this.active / $this.options.slideElement).addClass('active');		},		runTimer: function($this){			if($this._t) clearTimeout($this._t);			$this._t = setInterval(function(){				if ($this.options.infinite) $this.flag = false;				$this.toPrepare($this, true);			}, this.options.autoRotation);		},		initEventSwitcher: function($this, el){			el.bind($this.options.event, function(){				$this.active = $this.switcher.index($(this)) * $this.options.slideElement;				if($this._t) clearTimeout($this._t);				if ($this.options.disableBtn) $this.initDisableBtn();				if (!$this.options.effect) $this.scrollElement($this);				else $this.fadeElement();				if ($this.options.autoRotation) $this.runTimer($this);				return false;			});		},		initEvent: function($this, addEventEl, dir){			addEventEl.bind($this.options.event, function(){				if ($this.flag){					if ($this.options.infinite) $this.flag = false;					if($this._t) clearTimeout($this._t);					$this.toPrepare($this, dir);					if ($this.options.autoRotation) $this.runTimer($this);				}				return false;			});		},		toPrepare: function($this, side){			if (!$this.options.infinite){				if (($this.active == $this.rew) && $this.options.circle && side) $this.active = -$this.options.slideElement;				if (($this.active == 0) && $this.options.circle && !side) $this.active = $this.rew + $this.options.slideElement;				for (var i = 0; i < $this.options.slideElement; i++){					if (side) { if ($this.active + 1 <= $this.rew) $this.active++; }					else { if ($this.active - 1 >= 0) $this.active--; }				};			}			else{				if ($this.active >= $this.count + $this.count && side) $this.active -= $this.count;				if ($this.active <= $this.count-1 && !side) $this.active += $this.count;				$this.list.css($this.dirAnimate());				if (side) $this.active += $this.options.slideElement;				else $this.active -= $this.options.slideElement;			}			if (this.options.disableBtn) this.initDisableBtn();			if (!$this.options.effect) $this.scrollElement($this);			else $this.fadeElement();		},		stop: function(){			if (this._t) clearTimeout(this._t);		},		play: function(){			if (this._t) clearTimeout(this._t);			if (this.options.autoRotation) this.runTimer(this);		}	}		$.fn.simplebox = function(options) { return new Simplebox(this, options); };		function Simplebox(context, options) { this.init(context, options); };		Simplebox.prototype = {		options:{},		init: function (context, options){			this.options = $.extend({				duration: 300,				linkClose: 'a.close, a.btn-close',				divFader: 'fader',				faderColor: 'black',				overlayClick: true,				opacity: 0.7			}, options || {});			this.btn = $(context);			this.select = $('body').find('select');			this.initFader();			if(typeof options=='string')this.condition(options);			else this.btnEvent(this,this.btn);		},		btnEvent: function($this, el){			el.click(function(){				if ($(this).attr('href')) $this.condition($(this).attr('href'));				else $this.condition($(this).attr('title'));				return false;			});		},		calcWinWidth: function(){			this.winWidth = $('body').width();			if ($(document).width() > this.winWidth) this.winWidth = $(document).width();		},		condition: function(obj){			if(this.popup){				var _this = this;				this.popup.fadeOut(this.options.duration, function(){					_this.popup.css({left: '-9999px'}).show();					_this.fader.unbind('click');					_this.btnClose.unbind('click');					$(window).unbind('resize');					_this.toPrepare(obj);				});			}			else this.toPrepare(obj);		},		toPrepare: function(obj){			this.popup = $(obj);			this.btnClose = this.popup.find(this.options.linkClose);						if ($.browser.msie) this.select.css({visibility: 'hidden'});			this.calcWinWidth();			this.winHeight = $(window).height();			this.winScroll = $(window).scrollTop();						this.popupTop = this.winScroll + (this.winHeight/2) - this.popup.outerHeight(true)/2;			if (this.popupTop < 0) this.popupTop = 0;						this.popup.css({				top: this.popupTop,				left: this.winWidth/2 - this.popup.outerWidth(true)/2			}).hide();			this.fader.css({				width: this.winWidth,				height: $(document).height()			});			this.initAnimate(this);			this.initCloseEvent(this, this.btnClose);			if(this.options.overlayClick) this.initCloseEvent(this, this.fader);		},		initCloseEvent: function($this, el){			el.click(function(){				$this.popup.fadeOut($this.options.duration, function(){					$this.popup.css({left: '-9999px'}).show();					if ($.browser.msie) $this.select.css({visibility: 'visible'});					$this.fader.unbind('click');					$this.btnClose.unbind('click');					$(window).unbind('resize');					$this.popup = false;					$this.fader.fadeOut($this.options.duration);				});				return false;			});		},		initAnimate:function ($this){			$this.fader.fadeIn($this.options.duration, function(){				$this.popup.fadeIn($this.options.duration);			});			$(window).resize(function(){				$this.calcWinWidth();				$this.popup.animate({					left: $this.winWidth/2 - $this.popup.outerWidth(true)/2				}, {queue:false, duration: $this.options.duration});				$this.fader.css({width: $this.winWidth});			});		},		initFader: function(){			if ($('div.'+this.options.divFader).length > 0) this.fader = $('div.'+this.options.divFader);			else{				this.fader = $('<div class="'+this.options.divFader+'"></div>');				$('body').append(this.fader);				this.fader.css({					position: 'absolute',					zIndex: 999,					left:0,					top:0,					background: this.options.faderColor,					opacity: this.options.opacity				}).hide();			}		}	}var ieHover={lazyMode:true,init:function(){this.setDefaults();return this},setDefaults:function(){this.fixActive=/MSIE 6/.test(navigator.userAgent);if(this.fixActive){this.hoverEvents=[];this.hoverQueue=[];this.activators={onhover:{on:"onmouseenter",off:"onmouseleave"},onactive:{on:"onmousedown",off:"onmouseup"}};window.attachEvent("onload",this.bind(this.domReady,this));window.attachEvent("onunload",this.bind(this.unhookHoverEvents,this))}},domReady:function(){this.pageReady=true;if(this.lazyMode){this.processStylesheets()}if(this.hoverQueue.length){for(var a=0;a<this.hoverQueue.length;a++){this.doFix(this.hoverQueue[a].s,this.hoverQueue[a].c)}}},processStylesheets:function(){var c=document.styleSheets,a=c.length;for(var b=0;b<a;b++){this.parseStylesheet(c[b])}},parseStylesheet:function(f){if(f.imports){try{var b=f.imports,a=b.length;for(var d=0;d<a;d++){this.parseStylesheet(f.imports[d])}}catch(g){}}try{var h=(this.currentSheet=f).rules,a=h.length;for(var c=0;c<a;c++){this.parseCSSRule(h[c])}}catch(g){}},parseCSSRule:function(f){var g=f.selectorText,b=f.style.cssText;if(!/(^|\s)(([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):(hover|active)/i.test(g)||!b){return}var h=g.replace(/[^:]+:([a-z-]+).*/i,"on$1");var j=g.replace(/(\.([a-z0-9_-]+):[a-z]+)|(:[a-z]+)/gi,".$2"+h);var e=(/\.([a-z0-9_-]*on(hover|active))/i).exec(j)[1];var c=g.replace(/:(hover|active).*$/,"");var a=this.parseSelector(c);if(!a.length){return}this.currentSheet.addRule(j,b);for(var d=0;d<a.length;d++){this.addHoverElement(a[d],e,this.activators[h])}},fix:function(a,b){if(this.fixActive){if(this.pageReady){this.doFix(a,b)}else{this.hoverQueue.push({s:a,c:b})}}},doFix:function(a,c){if(this.fixActive&&typeof a==="string"){var d=this.parseSelector(a);for(var b=0;b<d.length;b++){this.addHoverElement(d[b],c||"hover",this.activators.onhover)}}},addHoverElement:function(c,b,a){if(!c.hovers){c.hovers={}}if(c.hovers[b]){return}c.hovers[b]=true;this.hookHoverEvent(c,a.on,function(){c.className+=" "+b});this.hookHoverEvent(c,a.off,function(){c.className=c.className.replace(new RegExp("\\s+"+b,"g"),"")})},hookHoverEvent:function(c,b,a){c.attachEvent(b,a);this.hoverEvents[this.hoverEvents.length]={node:c,type:b,handler:a}},unhookHoverEvents:function(){for(var b,a=0;a<this.hoverEvents.length;a++){b=this.hoverEvents[a];b.node.detachEvent(b.type,b.handler)}},parseSelector:(function(){var d=/^([^#.>`]*)(#|\.|\>|\`)(.+)$/;function e(g,f){var k=g.split(/\s*\,\s*/);var j=[];for(var h=0;h<k.length;h++){j=j.concat(b(k[h],f))}return j}function b(r,p,n){r=r.replace(" ","`");var m=r.match(d);var l,o,g,q,j,h;var k=[];if(m==null){m=[r,r]}if(m[1]==""){m[1]="*"}if(n==null){n="`"}if(p==null){p=document}switch(m[2]){case"#":q=m[3].match(d);if(q==null){q=[null,m[3]]}l=document.getElementById(q[1]);if(l==null||(m[1]!="*"&&!a(l,m[1]))){return k}if(q.length==2){k.push(l);return k}return b(q[3],l,q[2]);case".":if(n!=">"){o=c(p,m[1])}else{o=p.childNodes}for(j=0,h=o.length;j<h;j++){l=o[j];if(l.nodeType!=1){continue}q=m[3].match(d);if(q!=null){if(l.className==null||l.className.match("(\\s|^)"+q[1]+"(\\s|$)")==null){continue}g=b(q[3],l,q[2]);k=k.concat(g)}else{if(l.className!=null&&l.className.match("(\\s|^)"+m[3]+"(\\s|$)")!=null){k.push(l)}}}return k;case">":if(n!=">"){o=c(p,m[1])}else{o=p.childNodes}for(j=0,h=o.length;j<h;j++){l=o[j];if(l.nodeType!=1){continue}if(!a(l,m[1])){continue}g=b(m[3],l,">");k=k.concat(g)}return k;case"`":o=c(p,m[1]);for(j=0,h=o.length;j<h;j++){l=o[j];g=b(m[3],l,"`");k=k.concat(g)}return k;default:if(n!=">"){o=c(p,m[1])}else{o=p.childNodes}for(j=0,h=o.length;j<h;j++){l=o[j];if(l.nodeType!=1){continue}if(!a(l,m[1])){continue}k.push(l)}return k}}function c(g,f){if(f=="*"&&g.all!=null){return g.all}return g.getElementsByTagName(f)}function a(g,f){if(f=="*"){return true}return g.nodeName.toLowerCase().replace("html:","")==f.toLowerCase()}return e}()),bind:function(c,b,a){return function(){return c.apply(b,a||arguments)}}}.init();
