(function ($) {

	$.fn.vAlign = function() {
	return this.each(function(i){
	var ah = $(this).height();
	var ph = $(this).parent().height();
	var mh = (ph - ah) / 2;
	$(this).css("margin-top", mh);
	});
};
})(jQuery);




Cufon.replace('#footer .information .row_footer, .yellow-line-all .big_black, .yellow-line-all .small_black, .survey-top h1, .form-page h1, .register-first, .cols1, .subcontent',{hover:true,  fontFamily: 'Avenir Black'});

Cufon.replace('.up-to',{hover:true });

Cufon.replace('.up-to',{hover:true, textShadow:"2px 2px 2px #999" });


//Cufon.replace('#content .block-girl-right  h5, #content .block-girl-right  h4, .blok-what-clients-say_bottom h2',{textShadow:"3px 3px 3px #b6c626"});
//Cufon.replace('.blok-what-clients-say_bottom h2, .testimonials-slider .testimonials-slider-right h3',{textShadow:"3px 3px 3px #959595"});

$(document).ready(function(){





 $($('#content .block-what-we-do ul').children()[0]).addClass('first_item');
 $($('#content .block-what-we-do ul').children()[1]).addClass('second_item');
 $($('#content .block-what-we-do ul').children()[2]).addClass('third_item');


 $($('.block-chiropractic').children()[0]).addClass('first_item');
 $($('.block-chiropractic').children()[1]).addClass('second_item');
 $($('.block-chiropractic').children()[2]).addClass('third_item');

 


$('#wrapper').css({minHeight: $('body').outerHeight(false)+'px'});


//========for left menu
	  $('.left-menu').children('li').children('a').each(function(){
          str = jQuery(this).text();
          jQuery(this).html('<span>' + str + '</span>');
         });
		 
//========for right menu		 
	$('.right-btn').each(function(){
          str = jQuery(this).text();
          jQuery(this).html('<span>' + str + '</span>');
         });
	  


 $('.left-menu li a span').vAlign();
 $('.right-btn span').vAlign();

 // Scrolling
$('.slider-text, .slider-block ul li, .slider-block2 ul li, .some-home-slider-class ul li').jScrollPane({verticalDragMaxHeight: 20});
 
// Tabs Slideshow

$(".slider-block").easySlider({
		auto: false,
		continuous: false,
		speed: 400
	});

$(".slider-block2").easySlider({
		auto: false,
		continuous: false,
		speed: 400,
		prevId: 'prevBtn2',
		nextId: 'nextBtn2'
	});

$(".phd-slider").easySlider({
		auto: false,
		continuous: false,
		speed: 400,
		prevId: 'prevBtn3',
		nextId: 'nextBtn3'
	});

$(".pref-slider").easySlider({
		auto: false,
		continuous: true,
		speed: 400,
		prevId: 'prevBtn4',
		nextId: 'nextBtn4'
	});
	
$(".pref-slider2").easySlider({
		auto: false,
		continuous: true,
		speed: 400,
		prevId: 'prevBtn5',
		nextId: 'nextBtn5'
	});
	
$(".home-slider").easySlider({
		auto: false,
		continuous: true,
		speed: 400,
		prevId: 'prevBtn6',
		nextId: 'nextBtn6'
	});
	





$('.slider2-text, .pane').jScrollPane({verticalDragMaxHeight: 20});

// Scrolling
$('.testimonials-slider-left .inside').jScrollPane({verticalDragMaxHeight: 19});

//========================STORE PAGES===========================
	$('.store-long-block-bottom .third-column').css({minHeight: $('.store-long-block-bottom').outerHeight(false)+'px'});
	$('.vert-cent').vAlign();
	$('.store-long-block .third-column a.store-detail span').vAlign();
	
	$('.inside-gategoy-store-block .third-column').css({minHeight: $('.inside-gategoy-store-block').outerHeight(false)+'px'});
	$('.store-category-main-block .third-column a.store-detail span').vAlign();

Cufon.replace('.store-navigation ul li a',{hover:true,  fontFamily: 'Avenir Black'});

 $($('.content-block-store-detail ul.category-detail-products').children()[0]).addClass('first_item');
 
 $($('.block-add-to-cart-store .discount-quantity ul').children()[0]).addClass('first-item');
 $($('.block-add-to-cart-store .discount-quantity ul').children()[1]).addClass('second-item');

 $($('.buttons-store-cart ul').children()[0]).addClass('first-item');
 
 
 $('#wp-calendar td span').click(function(){
	 if($(this).hasClass('redclass')){
		 $('.calendar-ul').hide();
		 $('.calDeck').show();
		 $(this).children('.desc').clone().show().appendTo($('.calDeck'));
		 if($('.calDeck').children('.desc').height() >= 570){
			 $('.calDeck').children('.desc').css({'overflow-y': 'scroll', 'height': '575px'});
		 } 
	 }
 });
 
 $('.closePop').click(function(){
	  $('.calDeck').hide();
	  $('.calendar-ul').show(); 
		$('.calDeck').children('.desc').remove();
 });
 
 
});

window.onload = function(){
 $('.redclass').click(function(){
   $('.little-inform-calendar').children().remove();
	 $('#tooltip').children().clone().appendTo($('.little-inform-calendar'));
	 $('.EC-tt-widget-clickdate').hide();
 });
 
 $('.close-last-page').click(function(){
	 $('#overlay').hide();
 });
 
  $('.preflist-logo img').vAlign();
  $('#video-popup').vAlign();
  
 
}
