// JavaScript Document
function trigger_click (id){
	jQuery('#ngg-gallery-'+id.split('_')[1]+'-0 a.highslide:first').trigger('click');
};

jQuery(document).ready(function() {

var levels = 0;
var max = 0;
var deepest;
jQuery('.simple_title').each(function(){
	jQuery(this).find('*').each(function() {
		var cur = jQuery(this).parents().length;
		if (cur > max) 
		{
			max = cur;
			deepest=this;
			//alert(deepest);
		}
	});
	jQuery(this).html(deepest.innerHTML);
	max=0;
});

jQuery('.simple_excerpt').each(function(){
	jQuery(this).find('p:first').css('margin-top','0px');
	jQuery(this).find('p:first').css('margin-bottom','0px');

});

jQuery(".content , .simple_content , .b a").each(function(){
	jQuery(this).find('p:first').css('margin-top','0px');
});

jQuery(".content , .simple_content , .b a").each(function(){
	jQuery(this).find('p:last').css('margin-bottom','0px');
});
jQuery(".doctor_right , .doctor_left").each(function(){
	jQuery(this).find('a img').attr('title',jQuery(this).find('a').attr('title'));
});

jQuery('.ngg-galleryoverview').each(function(){
	jQuery(this).before('<img src="/images/btn_lnk2.gif" /><span class="btnlink"><a href="javascript:var k=1;" onclick="trigger_click(this.id)" class="highslide_start" id="start_'+jQuery(this).attr('id').split('-')[2]+'">Галерея</a></span>');
});



});
