$(document).ready( function() {
	
	$(".clearit input, .clearit textarea, .clearit").on({
		focus: function() {
		    if( this.value == this.defaultValue ) {
				this.value = "";
			}
		},
		blur: function() {
		    if( !this.value.length ) {
				this.value = this.defaultValue;
			}
		}
	});
	
	/* Home Search */
	
	/*$('body.home .search-vacancies-content .topSearch select').select2({
	    placeholder: "Please select",
	    width: "100%"
	});*/
	
	/* Job Vacancies */
	
	/*$('body.blog .search-vacancies-content .topSearch select').select2({
	    placeholder: "Please select",
	    width: "100%"
	});*/
	
	$(".faq_list .filter li").on("click", function(){
		$(".faq_list .filter li").removeClass("active");
		$(this).addClass("active");
	});
	$(".faq_list .filter a").on("click", function() {
		$("#pagefaq > *").hide();
		$("#pagefaq > " + $(this).attr("data-filter")).show();
	});
	
	$(".faq").each(function() {
		$(this).simpleFAQ();
	});
	
	$('p').each(function() {
	    var $this = $(this);
	    if($this.html().replace(/\s|&nbsp;/g, '').length == 0)
	        $this.remove();
	});
	
	$('a.top').click(function(e){
		e.preventDefault();
		$("html, body").animate({ scrollTop: 0 }, "fast");
	});
	
	$(window).on('scroll', function(){
	    (window.scrollY > 0) ? $('.header-top').addClass('fixed') : $('.header-top').removeClass('fixed');
	});
        
        if(location.pathname == "/submit-resume/" && location.hash == "#gf_3" && $('.gform_validation_error').length == 0) {
            $('.gform_title').text('Additional info and resume');
            $('.gform_description').text('Thank you! Now, please provide additional info about yourself, so we could find a better fitting offer for you.');
            $('<p>By providing your personal details and CV, you agree that HealthStaff Recruitment can provide this information to prospective employers for employment purposes and enter your information on our database. Please see our <a href="/privacy-policy/" target="_blank">Privacy Policy</a>.</p>').insertAfter('.gform_page_footer');
        }
	
});

$(window).load(function() {
	
	flexSliderLoad();
	
});

function flexSliderLoad() {
	  
    $('.sliderBlock ul.slides').bxSlider({
		mode: 'fade',
		captions: false,
		auto: true,
		pause: 6000
	});
	
	$('.jobs').bxSlider({
		slideWidth: 250,
	    minSlides: 2,
	    maxSlides: 3,
	    slideMargin: 20
	});
	$(".jobSlider").css({'visibility':'visible'});
    
}