    $(document).ready(function() { 
        $('ul.sf-menu').superfish({ 
            delay:       600,                            // one second delay on mouseout 
            animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
            speed:       'slow',                          // faster animation speed 
            autoArrows:  true,                           // disable generation of arrow mark-up 
            dropShadows: true                            // disable drop shadows 
        }); 
 
	/* This is basic - uses default settings */
	
	/*$("a.single_image").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true
	});*/
	var disclosuretext = $('.centerdisclosure').outerHeight();
	$('#search_wrapper').css('margin-top', disclosuretext+"px");
	
	/*11.12.2017*/
	$('.search_outer i').click(function(){
		$(this).parents('.full_width_header').find('.absolute_form').addClass('active_search');
	});
	
	$('.close_form').click(function(){
		$(this).parents('.full_width_header').find('.absolute_form').removeClass('active_search');
	});
	jQuery('body').on('click', '.stripes', function (){
	    jQuery('.stripes').toggleClass('activeclose');
	    jQuery('.responsive_menu').toggleClass('openedmenu');
	});
	
	
});	
$(window).resize(function(){
	var disclosuretext = $('.centerdisclosure').outerHeight();
	console.log(disclosuretext);
	$('#search_wrapper').css('margin-top', disclosuretext+"px");
});
/******Image Preload *******/


(function($){
    $.fn.preloadImages = function(options){

        var defaults = {
            showSpeed: 500,
        };

        var options = $.extend(defaults, options);

        return this.each(function(){
            var container = $(this);
            var image = container.find('img');

            $(image).css({ "visibility": "hidden", "opacity": "0" });
            $(image).bind('load error', function(){
                $(this).css({ "visibility": "visible" }).animate({ opacity:"1" }, {duration:options.showSpeed, easing:options.easing}).parent(container).removeClass('preload');
            }).each(function(){
                if(this.complete || ($.browser.msie && parseInt($.browser.version) == 6)) { $(this).trigger('load'); }
            });
        });
    }
})(jQuery);


jQuery(document).ready(function(){
    jQuery('#body_wrapper').preloadImages({
        showSpeed: 500,   // length of fade-in animation, 500 is default
     });
});
                
$('.star').rating();
$('.star').click(function() {
  $("input#rating").val($(this).text());
  
});
$('div.rating-cancel a').click(function() {
  $("input#rating").val("").css("display","block");
  
});  

if ($.browser.msie && $.browser.version.substr(0,1)<8) {
  $('.top_list').before('<div style="width:100%;background:red"><p style="width:960px;margin:auto;text-align:center;font-size:13px;padding:10px 0;"><a style="color:#fff;" href="http://windows.microsoft.com/en-IN/internet-explorer/products/ie/home">Hey Sparky Update your Browser its too old click here to update</a></p></div>');
}

/* pros cons boxes */
function boxes_same_height(){
	jQuery('.each_box').css('height', 'auto');
	var highestBox = 0;
	jQuery('.each_box').each(function(){  
        if(jQuery(this).height() > highestBox) 
        highestBox = jQuery(this).height(); 
	});
    jQuery('.each_box').height(highestBox);
}

//Make elements with same class the same height
function sameheight(elementclass){
	jQuery(elementclass).css('height','auto');
	el_height = 0;
	jQuery(elementclass).each(function(){
		if(jQuery(this).outerHeight() > el_height){
			el_height = jQuery(this).outerHeight();
		}
	});
	jQuery(elementclass).outerHeight(el_height);
}


/* load more posts ajax */
jQuery(document).ready(function(){
	
	jQuery('.loadmoreposts').on('click', function(){
		jQuery('.postsloader').fadeIn();
		if(jQuery(".loadmoreposts").is(":disabled")){}
		else{
			var nextpage = jQuery(this).attr('nextpage');				
			var website_link = jQuery('#website_link').val();
			
			jQuery.ajax({
				type: "POST",
				cache : false,
				url: website_link+"/wp-content/themes/proreview/ajax.php",
				dataType: "json",
				data: { action: 'loadmoreposts', nextpage: nextpage } 
			})
			.done(function( result ) {   
				if(result['nextpage'] == '0'){
					jQuery('.loadmoreposts').attr('disabled', true);
				}
				else{
					jQuery('.loadmoreposts').attr('nextpage', result['nextpage']);
				}				
				setTimeout(function(){						
					jQuery('.all-posts-container').append(result['allposts']);
					jQuery('.postsloader').fadeOut();
				}, 1000);
				
			});  
		}
	});
	
	jQuery('.loadmorereviews').on('click', function(){
		jQuery('.reviewsloader').fadeIn();
		if(jQuery(".loadmorereviews").is(":disabled")){}
		else{
			var nextpage = jQuery(this).attr('nextpage');				
			var website_link = jQuery('#website_link').val();
			
			jQuery.ajax({
				type: "POST",
				cache : false,
				url: website_link+"/wp-content/themes/proreview/ajax.php",
				dataType: "json",
				data: { action: 'loadmorereviews', nextpage: nextpage } 
			})
			.done(function( result ) {   
				if(result['nextpage'] == '0'){
					jQuery('.loadmorereviews').attr('disabled', true);
				}
				else{
					jQuery('.loadmorereviews').attr('nextpage', result['nextpage']);
				}
				
				setTimeout(function(){			
					jQuery('.all-reviews-container').append(result['allposts']);
					jQuery('.reviewsloader').fadeOut();
				}, 1000);
				
			});  
		}
	});
	
	boxes_same_height();
	sameheight('body .crp_related .crp_title');
	
	setTimeout(function(){
		boxes_same_height();
		sameheight('body .crp_related .crp_title');
	},1500);
	
});
function check_ads(){
	jQuery('#sidebar .widget:last-child').removeClass('sticky');
	cats = document.querySelector('#sidebar .widget:last-child');
	origOffsetY = cats.offsetTop;
	
	window.scrollY >= origOffsetY ? cats.classList.add('sticky') :	cats.classList.remove('sticky');
}

jQuery(window).resize(function(){
	boxes_same_height();
	sameheight('body .crp_related .crp_title');
});

jQuery(window).load(function(){
	boxes_same_height();
	sameheight('body .crp_related .crp_title');
});
jQuery(document).ready(function(){	
	check_ads();

	setTimeout(function(){
		 check_ads();
	},500);
	setTimeout(function(){
		 check_ads();
	},1000);
	setTimeout(function(){
		 check_ads();
	},1500);
	 setTimeout(function(){
		 check_ads();
	},2500);
	 setTimeout(function(){
		 check_ads();
	},3000);
	 
	 
	 jQuery('.crp_related .crp_thumb').each(function(){
		 var imgsrc = jQuery(this).attr('src');
		 jQuery(this).parent().prepend('<span class="bkgimage" style="background-image:url('+imgsrc+')"></span>');
		 
	 });
});

function onScroll(e) {
  window.scrollY >= origOffsetY ? cats.classList.add('sticky') :
	  							  cats.classList.remove('sticky');
 // window.scrollY >= origOffsetY ? jQuery('.fb-footer-iframe').addClass('visible_facebook') :
	 // jQuery('.fb-footer-iframe').removeClass('visible_facebook');
  
  	footerheight = jQuery('#footer').outerHeight();
	adsheight = jQuery('#sidebar .widget:last-child').outerHeight();
	//windowheight = jQuery(window).height();
	//console.log(windowheight+" "+adsheight+" "+footerheight);
	//console.log("window scroll "+window.scrollY);
	//console.log("window inner width "+window.innerWidth );
	
	scrolltop = window.scrollY + adsheight + footerheight + 30;
	if(scrolltop > jQuery(document).height()){
		cats.classList.add('sticky--bottom')
	}
	else{
		cats.classList.remove('sticky--bottom')
	}
	//console.log(scrolltop+' '+ jQuery(document).height());
}
document.addEventListener('scroll', onScroll);

jQuery(document).ready(function(){
	new ClipboardJS('.coupon_box .coupon_2 .gotocode');
});
