jQuery("document").ready(function(){
	jQuery(".sub-menu").parent("li").addClass("parent");
	jQuery(".sub-menu li:first-child").addClass("first");
	jQuery(".sub-menu li:last-child").addClass("last");

	jQuery(".topmenu .sub-menu .parent a").click(function() {
		jQuery(this).parent().children("ul").slideToggle(200);
		jQuery(this).parent().toggleClass("open");
	});
			
	jQuery("ul.tabs").tabs("> .tabcontent", {tabs: 'li'});
	jQuery(".row .col:first-child").addClass("alpha");
	jQuery(".row .col:last-child").addClass("omega"); 
	
// toggle content
	jQuery(".toggle_content, .highlighter").hide();
	
	jQuery("h3.toggle").toggle(function(){
		$(this).addClass("active");
		}, function () {
		$(this).removeClass("active");
	});
	
	jQuery("h3.toggle").click(function(){
		jQuery(this).next(".highlighter").slideToggle();
		jQuery(this).next(".toggle_content").slideToggle();
	});

// pagination
	var islast = jQuery(".pagination .inner a:last").hasClass('page_current');
	if(islast) jQuery(".pagination .inner").css('padding-right','35px');

	if (jQuery.browser.msie  && parseInt($.browser.version) == 7) {
	 	var ispageprev = $(".pagination .inner a").hasClass('page_prev');
		if(ispageprev) $(".pagination, .pagination .inner").css('padding-left','0px');
	}


// gallery
	jQuery(".gl_col_2 .gallery-item::nth-child(2n)").addClass("nomargin");
	jQuery(".gl_col_3 .gallery-item::nth-child(3n)").addClass("nomargin");
	jQuery(".gl_col_4 .gallery-item::nth-child(4n)").addClass("nomargin");

	jQuery(".gallery-image a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:'fast',overlay_gallery: false});

// comments scroll
	jQuery('.link-top').click(function () {
		jQuery('body,html').animate({
			scrollTop: 0
		},
		1500);
	});
	jQuery('.link-bottom, .link-addcomment').click(function () {
		jQuery('body,html').animate({
			scrollTop: $('#comments').offset().top
		},
		1500);
		return false;
	});
		
});

 

jQuery(function () {  
     jQuery(window).scroll(function () {  
         if (jQuery(this).scrollTop() != 0) {  
             jQuery('.link-top').fadeIn();  
         } else {  
             jQuery('.link-top').fadeOut();  
         }  
     });  
     jQuery('.link-top').click(function () {  
         jQuery('body,html').animate({  
             scrollTop: 0  
         },  
         1500);  
     });  
 });



