// jScrollPane (http://www.kelvinluck.com/assets/jquery/jScrollPane/jScrollPane.html)
$(function(){
	if($('body').hasClass('single') || $('body').hasClass('page-template-pg-oprema-single-php') || $('body').hasClass('page-template-pg-ekipa-single-php')) {
		$('.entry').jScrollPane({dragMaxHeight: 26, scrollbarWidth: 26 });
	};
	if($('body').hasClass('search') || $('body').hasClass('archive')) {
		$('#hugelist').jScrollPane({dragMaxHeight: 26, scrollbarWidth: 26 });
	};
	$("#nojs").remove();
});
$(document).ready(function(){
	// FORM LABEL DISSAPEAR helper
	$("input.inlined, textarea.inlined").each(function (type) {
 		
 		$(this).addClass("js");
 		
 		
		if (!($(this).val() == "")) {
			$(this).addClass("has-text");
		}
		
		$(this).focus(function () {
			$(this).addClass("focus");
		});
 
		$(this).keypress(function () {
			$(this).addClass("has-text").removeClass("focus");
		});
 
		$(this).blur(function () {
			if($(this).val() == "") {
				$(this).removeClass("has-text").removeClass("focus");
			}
		});
	});
	// Balloon click to show
	$(".popover").each(function (type) {
	
		$(this).parent().addClass("js").removeClass("nojs");
		
		$(this).click(function (){
			$(this).parent().toggleClass("clicked");
		});
	});
	$(".mailicon a").attr("href","#");
	// css3 rounded corners
	// http://www.webdesignerwall.com/tutorials/css3-rounded-image-with-jquery/
	$("#other_features img, .tubepress_thumbs img, #postlist img, #imageside img, .page-template-pg-ekipa-select-php img, .gallery img").each(function() {
    	$(this).wrap(function(){
      		return '<span class="' + $(this).attr('class') + ' rounded_img" style="background:url(' + $(this).attr('src') + ') no-repeat center center; width: ' + $(this).width() + 'px; height: ' + $(this).height() + 'px;" />';
    	});
    	$(this).css("opacity","0");
  	});
});

