/*
 * Slides, A Slideshow Plugin for jQuery
 * By: Nathan Searles, http://nathansearles.com
 * Updated: March 7th, 2011
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 */
(function($){$.fn.slides=function(g){g=$.extend({},$.fn.slides.option,g);return this.each(function(){$('.'+g.container,$(this)).children().wrapAll('<div class="slides_control"/>');var d=$(this),control=$('.slides_control',d),total=control.children().size(),width=control.children().outerWidth(),height=control.children().outerHeight(),start=g.start-1,effect=g.effect.indexOf(',')<0?g.effect:g.effect.replace(' ','').split(',')[0],paginationEffect=g.effect.indexOf(',')<0?effect:g.effect.replace(' ','').split(',')[1],next=0,prev=0,number=0,current=0,loaded,active,clicked,position,direction,imageParent,pauseTimeout,playInterval;function animate(a,b,c){if(!active&&loaded){active=true;g.animationStart(current+1);switch(a){case'next':prev=current;next=current+1;next=total===next?0:next;position=width*2;a=-width*2;current=next;break;case'prev':prev=current;next=current-1;next=next===-1?total-1:next;position=0;a=0;current=next;break;case'pagination':next=parseInt(c,10);prev=$('.'+g.paginationClass+' li.current a',d).attr('href').match('[^#/]+$');if(next>prev){position=width*2;a=-width*2}else{position=0;a=0}current=next;break}if(b==='fade'){if(g.crossfade){control.children(':eq('+next+')',d).css({zIndex:10}).fadeIn(g.fadeSpeed,g.fadeEasing,function(){if(g.autoHeight){control.animate({height:control.children(':eq('+next+')',d).outerHeight()},g.autoHeightSpeed,function(){control.children(':eq('+prev+')',d).css({display:'none',zIndex:0});control.children(':eq('+next+')',d).css({zIndex:0});g.animationComplete(next+1);active=false})}else{control.children(':eq('+prev+')',d).css({display:'none',zIndex:0});control.children(':eq('+next+')',d).css({zIndex:0});g.animationComplete(next+1);active=false}})}else{control.children(':eq('+prev+')',d).fadeOut(g.fadeSpeed,g.fadeEasing,function(){if(g.autoHeight){control.animate({height:control.children(':eq('+next+')',d).outerHeight()},g.autoHeightSpeed,function(){control.children(':eq('+next+')',d).fadeIn(g.fadeSpeed,g.fadeEasing)})}else{control.children(':eq('+next+')',d).fadeIn(g.fadeSpeed,g.fadeEasing,function(){if($.browser.msie){$(this).get(0).style.removeAttribute('filter')}})}g.animationComplete(next+1);active=false})}}else{control.children(':eq('+next+')').css({left:position,display:'block'});if(g.autoHeight){control.animate({left:a,height:control.children(':eq('+next+')').outerHeight()},g.slideSpeed,g.slideEasing,function(){control.css({left:-width});control.children(':eq('+next+')').css({left:width,zIndex:5});control.children(':eq('+prev+')').css({left:width,display:'none',zIndex:0});g.animationComplete(next+1);active=false})}else{control.animate({left:a},g.slideSpeed,g.slideEasing,function(){control.css({left:-width});control.children(':eq('+next+')').css({left:width,zIndex:5});control.children(':eq('+prev+')').css({left:width,display:'none',zIndex:0});g.animationComplete(next+1);active=false})}}if(g.pagination){$('.'+g.paginationClass+' li.current',d).removeClass('current');$('.'+g.paginationClass+' li:eq('+next+')',d).addClass('current')}}}function stop(){clearInterval(d.data('interval'))}function pause(){if(g.pause){clearTimeout(d.data('pause'));clearInterval(d.data('interval'));pauseTimeout=setTimeout(function(){clearTimeout(d.data('pause'));playInterval=setInterval(function(){animate("next",effect)},g.play);d.data('interval',playInterval)},g.pause);d.data('pause',pauseTimeout)}else{stop()}}if(total<2){return}if(start<0){start=0}if(start>total){start=total-1}if(g.start){current=start}if(g.randomize){control.randomize()}$('.'+g.container,d).css({overflow:'hidden',position:'relative'});control.children().css({position:'absolute',top:0,left:control.children().outerWidth(),zIndex:0,display:'none'});control.css({position:'relative',width:(width*3),height:height,left:-width});$('.'+g.container,d).css({display:'block'});if(g.autoHeight){control.children().css({height:'auto'});control.animate({height:control.children(':eq('+start+')').outerHeight()},g.autoHeightSpeed)}if(g.preload&&control.find('img').length){$('.'+g.container,d).css({background:'url('+g.preloadImage+') no-repeat 50% 50%'});var f=control.find('img:eq('+start+')').attr('src')+'?'+(new Date()).getTime();if($('img',d).parent().attr('class')!='slides_control'){imageParent=control.children(':eq(0)')[0].tagName.toLowerCase()}else{imageParent=control.find('img:eq('+start+')')}control.find('img:eq('+start+')').attr('src',f).load(function(){control.find(imageParent+':eq('+start+')').fadeIn(g.fadeSpeed,g.fadeEasing,function(){$(this).css({zIndex:5});$('.'+g.container,d).css({background:''});loaded=true;g.slidesLoaded()})})}else{control.children(':eq('+start+')').fadeIn(g.fadeSpeed,g.fadeEasing,function(){loaded=true;g.slidesLoaded()})}if(g.bigTarget){control.children().css({cursor:'pointer'});control.children().click(function(){animate('next',effect);return false})}if(g.hoverPause&&g.play){control.bind('mouseover',function(){stop()});control.bind('mouseleave',function(){pause()})}if(g.generateNextPrev){$('.'+g.container,d).after('<a href="#" class="'+g.prev+'">Prev</a>');$('.'+g.prev,d).after('<a href="#" class="'+g.next+'">Next</a>')}$('.'+g.next,d).click(function(e){e.preventDefault();if(g.play){pause()}animate('next',effect)});$('.'+g.prev,d).click(function(e){e.preventDefault();if(g.play){pause()}animate('prev',effect)});if(g.generatePagination){d.append('<ul class='+g.paginationClass+'></ul>');control.children().each(function(){$('.'+g.paginationClass,d).append('<li><a href="#'+number+'">'+(number+1)+'</a></li>');number++})}else{$('.'+g.paginationClass+' li a',d).each(function(){$(this).attr('href','#'+number);number++})}$('.'+g.paginationClass+' li:eq('+start+')',d).addClass('current');$('.'+g.paginationClass+' li a',d).click(function(){if(g.play){pause()}clicked=$(this).attr('href').match('[^#/]+$');if(current!=clicked){animate('pagination',paginationEffect,clicked)}return false});$('a.link',d).click(function(){if(g.play){pause()}clicked=$(this).attr('href').match('[^#/]+$')-1;if(current!=clicked){animate('pagination',paginationEffect,clicked)}return false});if(g.play){playInterval=setInterval(function(){animate('next',effect)},g.play);d.data('interval',playInterval)}})};$.fn.slides.option={preload:false,preloadImage:'/img/loading.gif',container:'slides_container',generateNextPrev:false,next:'next',prev:'prev',pagination:true,generatePagination:true,paginationClass:'pagination',fadeSpeed:350,fadeEasing:'',slideSpeed:350,slideEasing:'',start:1,effect:'slide',crossfade:false,randomize:false,play:0,pause:0,hoverPause:false,autoHeight:false,autoHeightSpeed:350,bigTarget:false,animationStart:function(){},animationComplete:function(){},slidesLoaded:function(){}};$.fn.randomize=function(c){function randomizeOrder(){return(Math.round(Math.random())-0.5)}return($(this).each(function(){var $this=$(this);var $children=$this.children();var a=$children.length;if(a>1){$children.hide();var b=[];for(i=0;i<a;i++){b[b.length]=i}b=b.sort(randomizeOrder);$.each(b,function(j,k){var $child=$children.eq(k);var $clone=$child.clone(true);$clone.show().appendTo($this);if(c!==undefined){c($child,$clone)}$child.remove()})}}))}})(jQuery);


/* Image Preloader  */
jQuery(function(){
	var $imgContainerClass = '.portfolio .post';
	var $images = jQuery($imgContainerClass+' a img.image_shadow');
	var $max = $images.length;
	jQuery('.image_shadow_container a.preloader').each(function(){
		jQuery('<span class="image_shadow_container_img" />').prependTo(jQuery(this));
	});
	$images.remove();
	if ($max > 0){
		LoadImage(0, $max);
	}
	function LoadImage(index, $max){
		if (index < $max){
			jQuery('<span id="img'+(index+1)+'" class="p_img_container" />').each(function(){
				jQuery(this).prependTo(jQuery('.post .image_shadow_container a.preloader .image_shadow_container_img').eq(index));
			});
			var $img = new Image();
			var $curr = jQuery('#img'+(index+1));
			jQuery($img).load(function(){
				jQuery(this).css({display: 'none', opacity: 0});
				jQuery($curr).append(this);
				jQuery(this).css({display: 'block'}).animate({opacity: 1}, 300, function(){
					jQuery(this).parent().css({backgroundImage: 'none'});
					if (index == ($max-1)){
					} else {
						LoadImage(index+1, $max);
					}
				});
			}).error(function(){
				jQuery($curr).remove();
				LoadImage(index+1, $max);
			}).attr({
				src: jQuery($images[index]).attr('src'), 
				title: jQuery($images[index]).attr('title'), 
				alt: jQuery($images[index]).attr('alt')
			}).addClass(jQuery($images[index]).attr('class'));
		}
	}
});

/*
 * Architector Slider v1.1 - jQuery Image Slider
 * 
 * (c) Copyright Steven "cmsmasters" Masters
 * http://cmsmastrs.net/
 * For sale on ThemeForest.net
 */

(function($) {
	$.fn.architectorSlider = function(options){
		var defaults = {
			sliderWidth: 600,
			sliderHeight: 300,
			pauseTime: 5000,
			animationSpeed: 500,
			effect: '',
			easing: '',
			descriptionOpacity: 0.8,
			numberNav: true,
			numberNavThumb: true,
			numberNavHide: false,
			thumbnailWidth: 70,
			thumbnailHeight: 50,
			timeLine: true,
			blocksize: {height: '', width: ''},
			customblocksize: {
				cubeinlinearhor: {height: 100, width: 100},
				cubeinlinearver: {height: 100, width: 100},
				cubeindiagonal: {height: 100, width: 100},
				cubeinrandom: {height: 100, width: 100},
				stripemovehor: {width: 40},
				stripemovever: {height: 20},
				stripefadehor: {width: 40},
				stripefadever: {height: 20},
				stripechangehor: {width: 40},
				stripechangever: {height: 20},
				stripehalfhor: {width: 40},
				stripehalfver: {height: 20},
				stripehalfotherhor: {width: 40},
				stripehalfotherver: {height: 20}
			},
			callback: function(){ }
		};
		
		var options = $.extend(defaults, options);
		
		// -------------------- Declaring variables ---------------------
		var slider = $(this);
		var li = slider.find('li');
		
		var pos, random_no, timer, image_timer, arr, index, block, w, h, k, t, m, i, j, src, parent, im, effect, easing, numberNav, override = false, in_animation = false;
		var current = li.eq(0).toggleClass('active');
		var prev = li.eq(0).addClass('reset');
		var bool = true, first_bool = true;
		var set_img = false;
		
		if (options.easing == ''){
			easing = 'linear';
		} else {
			easing = options.easing;
		}
		
		// -------------------- Initialization ---------------------
		init();
		
		function init(){
			slider.wrap('<div class="architector-slider" />');

			var sliderContainer = slider.parent();
			slider.css({width: options.sliderWidth, height: options.sliderHeight});
			sliderContainer.css({width: options.sliderWidth});

			if (options.numberNav == true){
				appendNumberNav();
			}

			if (options.timeLine == true){
				appendTimeLine();
			}
			
			if ($.browser.msie && $.browser.version < 9){
				li.first().find('.slide-description').fadeTo(options.animationSpeed, '0.8');
			} else {
				li.first().find('.slide-description').fadeTo(options.animationSpeed, options.descriptionOpacity);
			}
			sliderContainer.find('.architector-time-line').animate({width: options.sliderWidth}, options.pauseTime, function(){ 
				sliderContainer.find('.architector-time-line').css({width: 0}); 
			});
			current.children().hide();
			if (first_bool == true){
				current.children().show();
				li.not('.active').children().hide();
			}
			
			// -------------------- Slide switching module ---------------------
			function switcher(){
				if (current.prev().length > 0){
					prev = current.prev();
				} else {
					prev = li.eq(-1);
				} 
				
				li.removeClass('reset');
				current.toggleClass('active reset');

				if (current.next().length > 0){
					current = current.next();
				} else {
					current = li.eq(0);
				}
				
				current.children().hide();
				current.addClass('active');
				options.callback(current.children()[0]);
			}
			
			// --------------------- Cube In Linear Horizontal Image Animation Start --------------------------
			function cubeinlinearhor(image){
				in_animation = true;
			
				if (options.blocksize.width != '' && options.blocksize.height != ''){
					w = Math.floor(options.blocksize.width);
					h = Math.floor(options.blocksize.height);
				} else {
					w = Math.floor(options.customblocksize.cubeinlinearhor.width);
					h = Math.floor(options.customblocksize.cubeinlinearhor.height);	 
				}
				
				var cubeTime, cubeHor, cubeVer;
				cubeHor = Math.round(options.sliderWidth/w);
				cubeVer = Math.round(options.sliderHeight/h);
				cubeTime = cubeHor * cubeVer;
				
				parent = image.parent();
				arr = new Array();
				i = 0;
				index = 0;
				src = image.attr('src');
				
				block = $('<div />', {
					css: {
						position: 'absolute',
						width: 0,
						height: 0,
						marginTop: h/2,
						marginLeft: w/2,
						backgroundImage: 'url(' + src + ')',
						zIndex: 99
					}
				}).addClass('disblock');
				
				while (i < options.sliderWidth){
					j = 0;
					
					while (j < options.sliderHeight){
						arr[index] = block.clone().css({
							left: i, 
							top: j, 
							backgroundPosition: -i + 'px ' + -j + 'px'
						});
						parent.append(arr[index++]);
						
						j = j + h;
					}
					
					i = i + w;
				}
				i = 0;
				
				timer = setInterval(function(){
					if (i >= arr.length){
						endeffect(image);
						return;
					}
					
					arr[i++].animate({
						height: h, 
						width: w, 
						marginTop: 0, 
						marginLeft: 0
					}, {
						duration: options.animationSpeed, 
						easing: easing
					});
				}, options.animationSpeed/cubeTime);
			
			};
			// --------------------- Cube In Linear Horizontal Image Animation Finish --------------------------

			// --------------------- Cube In Linear Vertical Image Animation Start --------------------------
			function cubeinlinearver(image){
				in_animation = true;
			
				if (options.blocksize.width != '' && options.blocksize.height != ''){
					w = Math.floor(options.blocksize.width);
					h = Math.floor(options.blocksize.height);
				} else {
					w = Math.floor(options.customblocksize.cubeinlinearver.width);
					h = Math.floor(options.customblocksize.cubeinlinearver.height);	 
				}
				
				var cubeTime, cubeHor, cubeVer;
				cubeHor = Math.round(options.sliderWidth/w);
				cubeVer = Math.round(options.sliderHeight/h);
				cubeTime = cubeHor * cubeVer;
				
				parent = image.parent();
				arr = new Array();
				i = 0;
				index = 0;
				src = image.attr('src');
				
				block = $('<div />', {
					css: {
						position: 'absolute',
						width: 0,
						height: 0,
						marginTop: h,
						marginLeft: w,
						backgroundImage: 'url(' + src + ')',
						zIndex: 99,
						opacity: 0
					}
				}).addClass('disblock');
				
				while (i < options.sliderHeight){
					j = 0;
					
					while (j < options.sliderWidth){
						arr[index] = block.clone().css({
							left: j, 
							top: i, 
							backgroundPosition: -j + 'px ' + -i + 'px'
						});
						parent.append(arr[index++]);
						
						j = j + w;
					}
					
					i = i + h;
				}
				i = 0;
				
				timer = setInterval(function(){
					if (i >= arr.length){
						endeffect(image);
						return;
					}
					
					arr[i++].animate({
						height: h, 
						width: w, 
						marginTop: 0, 
						marginLeft: 0,
						opacity: 1
					}, {
						duration: options.animationSpeed, 
						easing: easing
					});
				}, options.animationSpeed/cubeTime);
			};
			// --------------------- Cube In Linear Vertical Image Animation Finish --------------------------
			
			// --------------------- Cube In Diagonal Image Animation Start --------------------------
			function cubeindiagonal(image){
				in_animation = true;
			
				if (options.blocksize.width != '' && options.blocksize.height != ''){
					w = Math.floor(options.blocksize.width);
					h = Math.floor(options.blocksize.height);
				} else {
					w = Math.floor(options.customblocksize.cubeindiagonal.width);
					h = Math.floor(options.customblocksize.cubeindiagonal.height);	 
				}
				
				var cubeTime, cubeHor, cubeVer;
				cubeHor = Math.round(options.sliderWidth/w);
				cubeVer = Math.round(options.sliderHeight/h);
				cubeTime = cubeHor * cubeVer;
				
				parent = image.parent();
				arr = new Array();
				i = 0;
				index = 0;
				src = image.attr('src');
				
				block = $('<div />', {
					css: {
						position: 'absolute',
						width: 0,
						height: 0,
						marginTop: h*2,
						marginLeft: w*2,
						backgroundImage: 'url(' + src + ')',
						zIndex: 99,
						opacity: 0
					}
				}).addClass('disblock');
				
				var wb, hb;
				wb = cubeHor;
				hb = cubeVer;
				k = 1;
				t = 1;

				while (k < (wb + hb)){
					j = 0;
					m = 0;
					
					if (k < hb){
						while (m < k){
							arr[index] = block.clone().css({
								left: i, 
								top: j, 
								backgroundPosition: -i + 'px ' + -j + 'px'
							});
							parent.append(arr[index++]);
							
							j = j + h;
							i = i - w;
							m++
						}
					} else {
						if (k > wb){
							m = t;
							i = options.sliderWidth - w;
						
							while (hb > m){
								j = h * m;
								
								arr[index] = block.clone().css({
									left: i, 
									top: j, 
									backgroundPosition: -i + 'px ' + -j + 'px'
								});
								parent.append(arr[index++]);
								
								j = j - h;
								i = i - w;
								m++
							}
							
							t++
						} else {
							m = 0;
						
							while (m < hb){
								arr[index] = block.clone().css({
									left: i, 
									top: j, 
									backgroundPosition: -i + 'px ' + -j + 'px'
								});
								parent.append(arr[index++]);
								
								j = j + h;
								i = i - w;
								m++
							}
						}
					}
					
					i = w * k;
					k++
				}
				i = 0;
				
				timer = setInterval(function(){
					if (i >= arr.length){
						endeffect(image);
						return;
					}
					
					arr[i++].animate({
						opacity: 1, 
						height: h, 
						width: w, 
						marginTop: 0, 
						marginLeft: 0
					}, {
						duration: options.animationSpeed, 
						easing: easing
					});
				}, options.animationSpeed/cubeTime);
			};
			// --------------------- Cube In Diagonal Image Animation Finish --------------------------
			
			// --------------------- Cube In Random Image Animation Start --------------------------
			function cubeinrandom(image){
				in_animation = true;
				
				if (options.blocksize.width != '' && options.blocksize.height != ''){ 
					w = Math.floor(options.blocksize.width);
					h = Math.floor(options.blocksize.height);
				} else { 
					w = Math.floor(options.customblocksize.cubeinrandom.width);
					h = Math.floor(options.customblocksize.cubeinrandom.height);	 
				}
				
				var cubeTime, cubeHor, cubeVer;
				cubeHor = Math.round(options.sliderWidth/w);
				cubeVer = Math.round(options.sliderHeight/h);
				cubeTime = cubeHor * cubeVer;
				
				parent = image.parent();
				arr = new Array();
				i = 0;
				index = 0;
				src = image.attr('src');
				
				block = $('<div />', {
					css:{
						position: 'absolute',
						opacity: 0,
						width: 0,
						height: 0,
						top: options.sliderHeight,
						backgroundImage: 'url(' + src + ')',
						zIndex: 99
					}
				}).addClass('disblock');
				
				 while (i < options.sliderWidth){
					j = 0;
					
					while (j < options.sliderHeight){
						arr[index] = block.clone().css({
							left: i, 
							top: j, 
							backgroundPosition: -i + 'px ' + -j + 'px'
						});
						parent.append(arr[index++]);
						
						j = j + h;
					}
					
					i = i + w;
				}
				i = 0;
				random_no = random_array(arr.length);
				
				timer = setInterval(function(){
					if (i >= arr.length){
						endeffect(image);
						return;
					}
					
					arr[random_no[i++]].animate({
						height: h, 
						width: w, 
						opacity: 1
					}, {
						duration: options.animationSpeed, 
						easing: easing
					});
				}, options.animationSpeed/cubeTime);
			};
			// --------------------- Cube In Random Image Animation Finish --------------------------
			
			// --------------------- Stripe Move Horizontal Image Animation Start --------------------------
			function stripemovehor(image){
				in_animation = true;
				
				if (options.blocksize.width != ''){
					w = Math.floor(options.blocksize.width);
				} else { 
					w = Math.floor(options.customblocksize.stripemovehor.width);
				}
				
				h = options.sliderHeight;
				var stripTime;
				stripTime = Math.round((options.sliderWidth/w)/2);
				
				parent = image.parent();
				arr = new Array();
				i = 0;
				j = 0;
				index = 0;
				src = image.attr('src');
				
				block = $('<div />', {
					css:{
						position: 'absolute',
						width: w,
						height: h,
						backgroundImage: 'url(' + src + ')',
						zIndex: 99,
						display: 'block',
						marginTop: -h
					}
				}).addClass('disblock');
				
				while (i < options.sliderWidth){
					arr[index] = block.clone().css({
						left: i, 
						backgroundPosition: -i + 'px 0px'
					});
					parent.append(arr[index++]);
					
					i = i + w;
				}
				i = 0;
				
				setTimeout(function(){
					timer = setInterval(function(){
						if (i >= arr.length){
							endeffect(image);
							return;
						}
						
						arr[i++].animate({marginTop: 0}, {
							duration: options.animationSpeed, 
							easing: easing
						});
					}, options.animationSpeed/stripTime);
				}, options.animationSpeed/stripTime);
			};	
			// --------------------- Stripe Move Horizontal Image Animation Finish --------------------------
			
			// --------------------- Stripe Move Vertical Image Animation Start --------------------------
			function stripemovever(image){
				in_animation = true;
				
				if (options.blocksize.height != ''){
					h = Math.floor(options.blocksize.height);
				} else {
					h = Math.floor(options.customblocksize.stripemovever.height);
				}
				
				w = options.sliderWidth;
				var stripTime;
				stripTime = Math.round((options.sliderHeight/h)/2);
				
				parent = image.parent();
				arr = new Array();
				i = 0;
				index = 0;
				src = image.attr('src');
				
				block = $('<div />', {
					css:{
						position: 'absolute',
						width: w,
						height: h,
						backgroundImage: 'url(' + src + ')',
						zIndex: 99,
						display: 'block',
						marginLeft: -w
					}
				}).addClass('disblock');
				
				while (i < options.sliderHeight){
					arr[index] = block.clone().css({
						top: i, 
						backgroundPosition: '0 ' + -i + 'px'
					});
					parent.append(arr[index++]);
					
					i = i + h;
				}
				i = 0;
				
				setTimeout(function(){
					timer = setInterval(function(){
						if (i >= arr.length){
							endeffect(image);
							return;
						}
						
						arr[i++].animate({marginLeft: 0}, {
							duration: options.animationSpeed, 
							easing: easing
						});
					}, options.animationSpeed/stripTime);
				}, options.animationSpeed/stripTime);
			};
			// --------------------- Stripe Move Vertical Image Animation Finish --------------------------
			
			// --------------------- Stripe Fade Horizontal Image Animation Start --------------------------
			function stripefadehor(image){
				in_animation = true;
				
				if (options.blocksize.width != ''){
					w = Math.floor(options.blocksize.width);
				} else { 
					w = Math.floor(options.customblocksize.stripefadehor.width);
				}
				
				h = options.sliderHeight;
				var stripTime;
				stripTime = Math.round(options.sliderWidth/w);
				
				parent = image.parent();
				arr = new Array();
				i = 0;
				j = 0;
				index = 0;
				src = image.attr('src');
				
				block = $('<div />', {
					css:{
						position: 'absolute',
						width: w,
						height: h,
						backgroundImage: 'url(' + src + ')',
						zIndex: 99,
						display: 'block',
						opacity: 0
					}
				}).addClass('disblock');
				
				while (i < options.sliderWidth){
					arr[index] = block.clone().css({
						left: i, 
						backgroundPosition: -i + 'px 0px'
					});
					parent.append(arr[index++]);
					
					i = i + w;
				}
				i = 0;
				
				setTimeout(function(){
					timer = setInterval(function(){
						if (i >= arr.length){
							endeffect(image);
							return;
						}
						
						arr[i++].animate({opacity: 1}, {
							duration: options.animationSpeed, 
							easing: easing
						});
					}, options.animationSpeed/stripTime);
				}, options.animationSpeed/stripTime);
			};	
			// --------------------- Stripe Fade Horizontal Image Animation Finish --------------------------
			
			// --------------------- Stripe Fade Vertical Image Animation Start --------------------------
			function stripefadever(image){
				in_animation = true;
				
				if (options.blocksize.height != ''){
					h = Math.floor(options.blocksize.height);
				} else {
					h = Math.floor(options.customblocksize.stripefadever.height);
				}
				
				w = options.sliderWidth;
				var stripTime;
				stripTime = Math.round(options.sliderHeight/h);
				
				parent = image.parent();
				arr = new Array();
				i = 0;
				index = 0;
				src = image.attr('src');
				
				block = $('<div />', {
					css:{
						position: 'absolute',
						width: w,
						height: h,
						backgroundImage: 'url(' + src + ')',
						zIndex: 99,
						display: 'block',
						opacity: 0
					}
				}).addClass('disblock');
				
				while (i < options.sliderHeight){
					arr[index] = block.clone().css({
						top: i, 
						backgroundPosition: '0 ' + -i + 'px'
					});
					parent.append(arr[index++]);
					
					i = i + h;
				}
				i = 0;
				
				setTimeout(function(){
					timer = setInterval(function(){
						if (i >= arr.length){
							endeffect(image);
							return;
						}
						
						arr[i++].animate({opacity: 1}, {
							duration: options.animationSpeed, 
							easing: easing
						});
					}, options.animationSpeed/stripTime);
				}, options.animationSpeed/stripTime);
			};
			// --------------------- Stripe Fade Vertical Image Animation Finish --------------------------
			
			// --------------------- Stripe Change Horizontal Image Animation Finish --------------------------
			function stripechangehor(image){
				in_animation = true;
				im = image;
				
				if (options.blocksize.width != ''){
					w = Math.floor(options.blocksize.width);
				} else { 
					w = Math.floor(options.customblocksize.stripechangehor.width);
				}
				
				h = options.sliderHeight;
				var stripTime;
				stripTime = Math.round(options.sliderWidth/w);
				
				parent = image.parent();
				arr = new Array();
				i = 0;
				j = 0;
				index = 0;
				src = image.attr('src');

				var css, flag;
				flag = true;
				
				block = $('<div />', { 
					css:{
						position: 'absolute',
						width: w,
						height: h,
						backgroundImage: 'url(' + src + ')',
						zIndex: 99,
						display: 'block',
						marginTop: options.sliderHeight,
						opacity: 0
					}
				}).addClass('disblock');
				
				while (i < options.sliderWidth){
					if (flag == true){
						css = {
							left: i, 
							backgroundPosition: -i + 'px 0px'
						};
						flag = false;
					} else {
						css = {
							left: i,
							backgroundPosition: -i + 'px 0px', 
							marginTop: -options.sliderHeight
						};
						flag = true;
					}
					
					arr[index] = block.clone().css(css);
					parent.append(arr[index++]);
					
					i = i + w;
				}
				i = 0;
				
				timer = setInterval(function(){
					if (i >= arr.length){
						endeffect(image);
						return;
					}
					
					arr[i++].animate({
						marginTop: 0,
						opacity: 1
					}, {
						duration: options.animationSpeed, 
						easing: easing
					});
				}, options.animationSpeed/stripTime);
			};
			// --------------------- Stripe Change Horizontal Image Animation Finish --------------------------
			
			// --------------------- Stripe Change Vertical Image Animation Finish --------------------------
			function stripechangever(image){
				in_animation = true;
				im = image;
				
				if (options.blocksize.height != ''){
					h = Math.floor(options.blocksize.height);
				} else { 
					h = Math.floor(options.customblocksize.stripechangever.height);
				}
				
				w = options.sliderWidth;
				var stripTime;
				stripTime = Math.round(options.sliderHeight/h);
				
				parent = image.parent();
				arr = new Array();
				i = 0;
				j = 0;
				index = 0;
				src = image.attr('src');

				var css, flag;
				flag = true;
				
				block = $('<div />', { 
					css:{
						position: 'absolute',
						width: w,
						height: h,
						backgroundImage: 'url(' + src + ')',
						zIndex: 99,
						display: 'block',
						marginLeft: options.sliderWidth,
						opacity: 0
					}
				}).addClass('disblock');
				
				while (i < options.sliderHeight){
					if (flag == true){
						css = {
							top: i, 
							backgroundPosition: '0px ' + -i + 'px'
						};
						flag = false;
					} else {
						css = {
							top: i,
							backgroundPosition: '0px ' + -i + 'px', 
							marginLeft: -options.sliderWidth
						};
						flag = true;
					}
					
					arr[index] = block.clone().css(css);
					parent.append(arr[index++]);
					
					i = i + h;
				}
				i = 0;
				
				timer = setInterval(function(){
					if (i >= arr.length){
						endeffect(image);
						return;
					}
					
					arr[i++].animate({
						marginLeft: 0,
						opacity: 1
					}, {
						duration: options.animationSpeed, 
						easing: easing
					});
				}, options.animationSpeed/stripTime);
			};
			// --------------------- Stripe Change Vertical Image Animation Finish --------------------------
			
			// --------------------- Stripe Half Horizontal Image Animation Start --------------------------
			function stripehalfhor(image){
				in_animation = true;
				
				if (options.blocksize.width != ''){
					w = Math.floor(options.blocksize.width);
				} else {
					w = Math.floor(options.customblocksize.stripehalfhor.width);
				}
				
				h = options.sliderHeight;
				var stripTime;
				stripTime = Math.round(options.sliderWidth/w);
				
				parent = image.parent();
				arr = new Array();
				i = 0;
				j = 0;
				index = 0;
				src = image.attr('src');

				var css;
				
				block = $('<div />', { 
					css:{
						position:"absolute",
						width:w,
						height:h/2,
						'background-image':'url('+src+')',
						zIndex:99,
						display:'block',
						opacity:0
					}
				}).addClass('disblock');
				
				while (i < options.sliderWidth){
					j = 0;
					
					while (j < h){
						if (j == 0){
							css = {
								left: i, 
								top: j, 
								backgroundPosition: -i + 'px ' + (-j) + 'px', 
								marginTop: -(h/2)
							};
						} else {
							css = {
								left: i, 
								top: j, 
								backgroundPosition: -i + 'px ' + (-j) + 'px', 
								marginTop: h
							};
						}
						
						arr[index] = block.clone().css(css);
						parent.append(arr[index++]);
						
						j = j + h/2;
					}
					
					i = i + w;
				}
				i = 0;
				
				setTimeout(function(){
					timer = setInterval(function(){
						if (i >= arr.length){
							endeffect(image);
							return;
						}
						
						arr[i++].animate({
							opacity: 1, 
							marginTop: 0
						}, {
							duration: options.animationSpeed, 
							easing: easing
						});
					}, options.animationSpeed/stripTime);
				}, options.animationSpeed/stripTime);
			};
			// --------------------- Stripe Half Horizontal Image Animation Finish --------------------------
			
			// --------------------- Stripe Half Vertical Image Animation Start --------------------------
			function stripehalfver(image){
				in_animation = true;
				
				if (options.blocksize.height != ''){
					h = Math.floor(options.blocksize.height);
				} else {
					h = Math.floor(options.customblocksize.stripehalfver.height);
				}
				
				w = options.sliderWidth;
				var stripTime;
				stripTime = Math.round(options.sliderHeight/h);
				
				parent = image.parent();
				arr = new Array();
				i = 0;
				j = 0;
				index = 0;
				src = image.attr('src');
				
				var css;
				
				block = $('<div />', { 
					css:{
						position: 'absolute',
						width: w/2,
						height: h,
						backgroundImage: 'url(' + src + ')',
						zIndex: 99,
						display: 'block',
						opacity: 0
					}
				}).addClass('disblock');
				
				while (i < options.sliderHeight){
					j = 0;
					
					while (j < w){
						if (j == 0){
							css = {
								left: j, 
								top: i, 
								backgroundPosition: -j + 'px ' + (-i) + 'px', 
								marginLeft: -(w/2)
							};
						} else {
							css = {
								left: j, 
								top: i, 
								backgroundPosition: -j + 'px ' + (-i) + 'px', 
								marginLeft: w
							};
						}
						
						arr[index] = block.clone().css(css);
						parent.append(arr[index++]);
						
						j = j + w/2;
					}
					
					i = i + h;
				}
				i = 0;
				
				setTimeout(function(){
					timer = setInterval(function(){
						if (i >= arr.length){
							endeffect(image);
							return;
						}

						arr[i++].animate({
							opacity: 1, 
							marginLeft: 0
						}, {
							duration: options.animationSpeed, 
							easing: easing
						});
					}, options.animationSpeed/stripTime);
				}, options.animationSpeed);
			};
			// --------------------- Stripe Half Vertical Image Animation Finish --------------------------
			
			// --------------------- Stripe Half Other Horizontal Image Animation Finish --------------------------
			function stripehalfotherhor(image){
				in_animation = true;
				
				if (options.blocksize.width != ''){
					w = Math.floor(options.blocksize.width);
				} else {
					w = Math.floor(options.customblocksize.stripehalfotherhor.width);
				}
				
				h = options.sliderHeight;
				var stripTime;
				stripTime = Math.round(options.sliderWidth/w);
				
				parent = image.parent();
				arr = new Array();
				i = 0;
				j = 0;
				index = 0;
				src = image.attr('src');
				
				var css;
				
				block = $('<div />', {
					css:{
						position: 'absolute',
						width: w,
						height: h/2,
						backgroundImage: 'url(' + src + ')',
						zIndex: 99,
						display: 'block',
						opacity: 0
					}
				}).addClass('disblock');
				
				while (i < options.sliderWidth){
					j = 0;
					
					while (j < h){
						if (j == 0){
							css = {
								left: i, 
								top: j, 
								backgroundPosition: -i + 'px ' + (-j) + 'px', 
								marginLeft: -w
							};
						} else {
							css = {
								left: i, 
								top: j, 
								backgroundPosition: -i + 'px ' + (-j) + 'px', 
								marginLeft: -(w/2)
							};
						}
						
						arr[index] = block.clone().css(css);
						parent.append(arr[index++]);
						
						j = j + h/2;
					}
					
					i = i + w;
				}
				i = 0;
				
				setTimeout(function(){
					timer = setInterval(function(){
						if (i >= arr.length){
							endeffect(image);
							return;
						}
						
						arr[i++].animate({
							opacity: 1, 
							marginLeft: 0
						}, {
							duration: options.animationSpeed, 
							easing: easing
						});
					}, options.animationSpeed/stripTime);
				}, options.animationSpeed*2);
			};
			// --------------------- Stripe Half Other Horizontal Image Animation Finish --------------------------
			
			// --------------------- Stripe Half Other Vertical Image Animation Start --------------------------
			function stripehalfotherver(image){
				in_animation = true;
				
				if (options.blocksize.height != ''){
					h = Math.floor(options.blocksize.height);
				} else {
					h = Math.floor(options.customblocksize.stripehalfotherver.height);
				}
				
				w = options.sliderWidth;
				var stripTime;
				stripTime = Math.round(options.sliderHeight/h);
				
				parent = image.parent();
				arr = new Array();
				i = 0;
				j = 0;
				index = 0;
				src = image.attr('src');
				
				var css;
				
				block = $('<div />', { 
					css: {
						position: 'absolute',
						width: w/2,
						height: h,
						backgroundImage: 'url(' + src + ')',
						zIndex: 99,
						display: 'block',
						opacity: 0
					}
				}).addClass('disblock');
				
				while (i < options.sliderHeight){
					j = 0;

					while (j < w){
						if (j == 0){
							css = {
								left: j, 
								top: i, 
								backgroundPosition: -j + 'px ' + (-i) + 'px', 
								marginTop: -h
							};
						} else {
							css = {
								left: j, 
								top: i, 
								backgroundPosition: -j + 'px ' + (-i) + 'px', 
								marginTop: -(h/2)
							};
						}
						
						arr[index] = block.clone().css(css);
						parent.append(arr[index++]);
						
						j = j + w/2;
					}
					
					i = i + h;
				}
				i = 0;
				
				setTimeout(function(){
					timer = setInterval(function(){
						if (i >= arr.length){
							endeffect(image);
							return;
						}
						
						arr[i++].animate({
							opacity: 1, 
							marginTop: 0
						}, {
							duration: options.animationSpeed, 
							easing: easing
						});
					}, options.animationSpeed/stripTime);
				}, options.animationSpeed*2);
			};
			// --------------------- Stripe Half Other Vertical Image Animation Finish --------------------------
			
			// --------------------- Slide Fade Image Animation Start --------------------------
			function slidefade(image){
				in_animation = true;
				
				h = options.sliderHeight;
				w = options.sliderWidth;
				
				parent = image.parent();
				arr = new Array();
				i = 0;
				index = 0;
				src = image.attr('src');
				
				block = $('<div />', { 
					css: {
						position: 'absolute',
						width: w,
						height: h,
						backgroundImage: 'url(' + src + ')',
						zIndex: 99,
						display: 'block',
						opacity: 0
					}
				}).addClass('disblock');
				
				while (i < h){
					arr[index] = block.clone().css({
						left: 0, 
						top: 0
					});
					parent.append(arr[index++]);
					
					i = i + h;
				}
				i = 0;
				
				timer = setInterval(function(){
					if (i >= arr.length){
						endeffect(image);
						return;
					}
					
					arr[i++].animate({opacity: 1}, {
						duration: options.animationSpeed*1.5, 
						easing: easing
					});
				}, options.animationSpeed);
			};
			// --------------------- Slide Fade Image Animation Finish --------------------------
			
			function endeffect(image){
				if ($.browser.msie && $.browser.version < 9){
					current.find('.slide-description').fadeTo(options.animationSpeed, '0.8');
				} else {
					current.find('.slide-description').fadeTo(options.animationSpeed, options.descriptionOpacity);
				}
				
				if (options.numberNav == true){
					numberNav.removeClass("active");
					numberNav.eq(current.index(".architector-slider li")).addClass("active");
				}
				
				clearInterval(timer);
				
				setTimeout(function(){
					sliderContainer.find('.architector-time-line').animate({width: options.sliderWidth}, options.pauseTime);
					
					image.show();
					$(".disblock").remove();
					
					in_animation = false;

					if (override == false){
						image_timer = setTimeout(function(){
							switcher();
							image.parent().find('.slide-description').fadeOut(options.animationSpeed);
							sliderContainer.find('.architector-time-line').stop(true, false).css({width: 0});
							effects();
						}, options.pauseTime);
					}
				}, 1000);
			};

			// -------------------- Effects selector module ---------------------
			function effects(){
				var ch = Math.floor(Math.random() * 15);
				
				if (options.effect != ''){
					if (options.effect == 'cubeInLinearHor'){
						effect = 0;
					} else {
						if (options.effect == 'cubeInLinearVer'){
							effect = 1;
						} else {
							if (options.effect == 'cubeInDiagonal'){
								effect = 2;
							} else {
								if (options.effect == 'cubeInRandom'){
									effect = 3;
								} else {
									if (options.effect == 'stripeMoveHor'){
										effect = 4;
									} else {
										if (options.effect == 'stripeMoveVer'){
											effect = 5;
										} else {
											if (options.effect == 'stripeFadeHor'){
												effect = 6;
											} else {
												if (options.effect == 'stripeFadeVer'){
													effect = 7;
												} else {
													if (options.effect == 'stripeChangeHor'){
														effect = 8;
													} else {
														if (options.effect == 'stripeChangeVer'){
															effect = 9;
														} else {
															if (options.effect == 'stripeHalfHor'){
																effect = 10;
															} else {
																if (options.effect == 'stripeHalfVer'){
																	effect = 11;
																} else {
																	if (options.effect == 'stripeHalfOtherHor'){
																		effect = 12;
																	} else {
																		if (options.effect == 'stripeHalfOtherVer'){
																			effect = 13;
																		} else {
																			if (options.effect == 'slideFade'){
																				effect = 14;
																			} else {
																				effect = ch;
																			}
																		}
																	}
																}
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
					
					ch = effect;
				}
				  
				if (bool == true){
					bool = false;
					li.first().find('.slide-description').fadeOut(options.animationSpeed);
				}

				if (first_bool == true && set_img != true){
					li.eq(0).removeClass('active');
					current = li.eq(1).addClass('active');
				}
				
				if ($.browser.msie && $.browser.version < 9){
					switch(ch){
						case ch: slidefade(current.find('img.slide-image')); break;
					}
				} else {
					switch(ch){
						case 0: cubeinlinearhor(current.find('img.slide-image')); break;
						case 1: cubeinlinearver(current.find('img.slide-image')); break;
						case 2: cubeindiagonal(current.find('img.slide-image')); break;
						case 3: cubeinrandom(current.find('img.slide-image')); break;
						case 4: stripemovehor(current.find('img.slide-image')); break;
						case 5: stripemovever(current.find('img.slide-image')); break;
						case 6: stripefadehor(current.find('img.slide-image')); break;
						case 7: stripefadever(current.find('img.slide-image')); break;
						case 8: stripechangehor(current.find('img.slide-image')); break;
						case 9: stripechangever(current.find('img.slide-image')); break;
						case 10: stripehalfhor(current.find('img.slide-image')); break;
						case 11: stripehalfver(current.find('img.slide-image')); break;
						case 12: stripehalfotherhor(current.find('img.slide-image')); break;
						case 13: stripehalfotherver(current.find('img.slide-image')); break;
						case 14: slidefade(current.find('img.slide-image')); break;
					}
				}
				
				if (first_bool == true){
					if (li.first().find('.slide-description').css('display') != 'none'){
						li.first().find('.slide-description').css({display: 'none'});
					}
				
					first_bool = false;
				}
			}
			
			function appendNumberNav(){
				var str = "<div class='architector-number-nav'>";
				
				for (var i = 0; i < li.length; i++){
					if (options.numberNavThumb == false) {
						str = str + '<a href="#">' + (i + 1) + '</a>';
					} else {
						str = str + '<a href="#"><img src="' + li.eq(i).find('img.slide-thumbnail').attr('src') + '" alt="" width="' + options.thumbnailWidth + '" height="' + options.thumbnailHeight + '" /><span style="width:' + options.thumbnailWidth + 'px; height:' + options.thumbnailHeight + 'px;">&nbsp;</span></a>';							
					}
				}
				
				str = str + "</div>";
				slider.after(str);
				
				numberNav = slider.parent().find(".architector-number-nav a");
				numberNav.first().addClass("active");
				
				numberNav.bind({
					click: function(){ setImage($(this).index()); return false; },
					mouseover: function(){ $(this).toggleClass("hover"); },
					mouseout: function(){ $(this).toggleClass("hover"); }
				});
				
				var numberNavContainer = numberNav.parent();
				
				if (options.numberNavHide == true){
					numberNavContainer.css({height: 0});
					sliderContainer.hover(function(){
						numberNavContainer.stop(true, false).animate({height: numberNav.outerHeight()}, options.animationSpeed);
					}, function(){
						numberNavContainer.stop(true, false).animate({height: 0}, options.animationSpeed);					
					});
				}
			}
			
			function appendTimeLine(){
				var timeLine = "<div class='architector-time-line' />";
				slider.after(timeLine);
				sliderContainer.find('.architector-time-line').css({top: options.sliderHeight-5});
			}
			 
			function setImage(index){
				if (in_animation == true || current.index('.architector-slider li') == index){ return; }
				
				set_img = true;
				li.removeClass('reset active');
				sliderContainer.find('.architector-time-line').stop(true, false).css({width: 0});
				current.find('.slide-description').fadeOut(options.animationSpeed);
				
				clearTimeout(image_timer);
				
				if (first_bool == true){
					li.first().find('.slide-description').fadeOut(options.animationSpeed);
					li.first().addClass("reset");
				}
				
				current.addClass("reset");
				current = li.eq(index).addClass("active");
				current.children().hide();
				
				effects();
			}

			image_timer = setTimeout(function(){ effects(); }, options.pauseTime);
		}
	}

	function random_array(maxn){
		var array = new Array();
		var temp;
		var flag = true;
		var index = 0;

		while (index < maxn){
			flag = true;
			temp = Math.floor(Math.random() * maxn);
			 
			for (i = 0; i < array.length; i++){
				if (temp == array[i]){
					flag = false;
					break;
				}
			}
			 
			if (flag == true) {
				array[index++] = temp;
			}
		}
		
		return array;
	};
})(jQuery);
