
$(document).ready(function(){
	//hislide для всех рисунков
	$('.content img').each(function(){
		path = $(this).attr('src');
		if(path.indexOf('preview')+1) {
			href = path.replace('/preview/','/');
			$(this).wrap('<a href="'+href+'" class="highslide" title="Нажмите, для просмотра в полном размере..." onclick="return hs.expand(this)"></a>');
		}
	});
	$('.content a:not(.highslide)').click(function(){
		href = $(this).attr('href');
		if(href.indexOf('http') + 1) {
			if(href.indexOf('bytdobru.info')==-1) {
				window.open(href);
				return false;
			}
		}
	});
	//полезные ссылки
	$('.anchor').click(function(){		$(this).next('div').toggle();
	});
	var anchor = get_val (document.location.hash);
	if (anchor) $('.a_'+anchor).show().parents('.links_category_list').show();
});
hs.graphicsDir = '/highslide/graphics/';
hs.align = 'center';
hs.transitions = ['expand', 'crossfade'];
hs.outlineType = 'rounded-white';
hs.fadeInOut = true;
hs.showCredits = false;
//hs.dimmingOpacity = 0.75;
// Add the controlbar
hs.addSlideshow({
	//slideshowGroup: 'group1',
	interval: 5000,
	repeat: false,
	useControls: true,
	fixedControls: 'fit',
	overlayOptions: {
		opacity: 0.75,
		position: 'bottom center',
		hideOnMouseOut: true
	}
});


function gebi(id) {return document.getElementById(id);}

function hidden2 (id) {
	if (gebi(id).style.display == 'block') gebi(id).style.display = 'none';
	else gebi(id).style.display = 'block';
}

function get_val (str) {
	var arr = Array();
	arr = str.toString().split('#'.toString() );
	return arr[1];
}

///////////////////////////////////////////////////////////
this.tooltip = function(){
	/* CONFIG */
		xOffset = 10;
		yOffset = 20;
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
	/* END CONFIG */
	$("a.tooltip").hover(function(e){
		this.t = this.title;
		this.title = "";
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");
    },
	function(){
		this.title = this.t;
		$("#tooltip").remove();
    });
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});
};
// starting the script on page load
$(document).ready(function(){
	tooltip();
});



