// colorbox pro fotky
$(document).ready(function(){
	$("a[href$='.jpg'][target!='_blank'], a[href$='.jpeg'][target!='_blank'], a[href$='.png'][target!='_blank'], a[href$='.gif'][target!='_blank'], a[href$='.JPG'][target!='_blank'], a[href$='.JPEG'][target!='_blank'], a[href$='.PNG'][target!='_blank'], a[href$='.GIF'][target!='_blank']").colorbox({
		current		: '{current} z {total}',
		opacity		: 0.6,
		scalePhotos	: true,
		maxWidth	: "700px",
		maxHeight	: "450px"
	});
});



// colorbox - pridani do kosiku
$(document).ready(function(){


	$("form.do-kosiku").submit(function () {
		$.post('koupit-ajax.php', $(this).serialize(), function(data) {
			$("#json_kosik").html(data.kosik_text);

			$.colorbox({
			width	: 500,
			height	: 300,
			opacity	: 0.6,
			speed	: 50,
			href	: 'koupit-ajax-result.php?stav='+encodeURI(data.stav)+'&title='+encodeURI(data.title)
			});

		}, "json");

		$(this).find("input[type=text]").val("");
		return false;
	});

});



// tooltipy
$(document).ready(function() {
	xOffset = 10;
	yOffset = 10;
	$(".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();
	});
	$(".tooltip").mousemove(function(e) {
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});
});

