$(document).ready(function(){
	// FaceBox Init
/*	if ($('a[rel*=facebox]').length == 1) {
		$('a[rel*=facebox]').facebox();
	} else if ($('a[rel*=facebox]').length > 1) {
		$('a[rel*=facebox]').facebox({
			close_text    : 'ZATVOR'
		});
	}*/
	
	$("A[rel='fancybox'],A[rel='fancybox-dialog']").fancybox({
		'centerOnScroll' : true,
		'autoScale' : true,
		'padding' : 20,
		'scrolling' : 'no'
	});
	
	// IE6 PNG Fix
	$('.png, .ui-icon').ifixpng();
	
	// IE6 Menu Fix
	if($.browser.msie && $.browser.version=="6.0") {
		$("UL.dropdown > LI").mouseover( function() {
			var pos = $(this).position();
			$(this).children("UL").css("top", (pos.top+31)+"px");
			$(this).children("UL").css("left", pos.left+"px");
			$(this).children("UL").css("visibility", "visible");
		});
		$("UL.dropdown > LI").mouseout( function() {
			$(this).children("UL").css("visibility", "hidden");
		});
	}
	
	if ($(".baliky").length > 0) product_packs();
	
	resize();
});

function resize() {
	hl = $("#widgets-left").height();
	hr = $("#widgets-right").height();
	hc = $("#content").height();
	hc = $("#widgets-homepage").height();
	h = Math.max(hl, hr, hc);
	if($.browser.msie && $.browser.version=="6.0") {
		$("#content,#widgets-homepage").css("height", (h+30)+"px");
	} else {
		$("#content,#widgets-homepage").css("min-height", h+"px");
	}
}

function product_packs() {
	$("TABLE.baliky TR").each(function(){
		$(this).children().each(function(i){
			if (i==1) $(this).addClass("bstandard");
			if (i==2) $(this).addClass("bprofi");
			if (i==3) $(this).addClass("bpremium");
		});
	});
	$("TABLE.baliky").after('<div id="bublina"><div id="bublina-content"></div><div id="bublina-sipka"></div></div>');
	$("#bublina").hide();
	$(".bstandard").hover(
		function(){
			$("TD.bstandard").css("background-color", "#c0c0c0");
			$("TH.bstandard").css("background-color", "#c0c0c0");
			$("#bublina-content").html('Pacienti jednoducho<br />a rýchlo nájdu potrebné<br /><b>informácie o Vašej<br />ambulancii na internete.</b>');
			$("#bublina").show();
			wb = $("#bublina").width();
			hb = $("#bublina").height();
			wc = $(this).width();
			p = $("TABLE.baliky TR:first TH.bstandard").offset();
			$("#bublina").offset({top:(p.top-hb), left:(p.left-((wb-wc)/2)+2)});
		},
		function(){
			$("TD.bstandard").css("background-color", "#eaeaea");
			$("TH.bstandard").css("background-color", "#ffffff");
			$("#bublina-content").html('');
			$("#bublina").hide();
		}
	);
	$(".bprofi").hover(
		function(){
			$("TD.bprofi").css("background-color", "#c0c0c0");
			$("TH.bprofi").css("background-color", "#c0c0c0");
			$("#bublina-content").html('Ak chcete mať <b>vlastnú internetovú<br />stránku za výhodnú cenu</b>, je tento<br />balíček práve pre Vás. Vlastná stránka<br />poskytuje možnosť <b>komplexnej<br />prezentácie ambulancie</b>/zariadenia,<br />vrátane publikácie neobmedzeného<br />množstva informácií, ako aj<br />audiovizuálnych médií.');
			$("#bublina").show();
			wb = $("#bublina").width();
			hb = $("#bublina").height();
			wc = $(this).width();
			p = $("TABLE.baliky TR:first TH.bprofi").offset();
			$("#bublina").offset({top:(p.top-hb), left:(p.left-((wb-wc)/2)+2)});
		},
		function(){
			$("TD.bprofi").css("background-color", "#eaeaea");
			$("TH.bprofi").css("background-color", "#ffffff");
			$("#bublina-content").html('');
			$("#bublina").hide();
		}
	);
	$(".bpremium").hover(
		function(){
			$("TD.bpremium").css("background-color", "#c0c0c0");
			$("TH.bpremium").css("background-color", "#c0c0c0");
			$("#bublina-content").html('<b>Vlastná internetová stránka</b><br />podľa Vášho návrhu<br /><b>za najatraktívnejšiu cenu</b>.<br />Riešenie vytvorené najmä<br />pre klientov s potrebou<br />individuálnej prezentácie<br />nadštandardných alebo<br />špeciálnych služieb.');
			$("#bublina").show();
			wb = $("#bublina").width();
			hb = $("#bublina").height();
			wc = $(this).width();
			p = $("TABLE.baliky TR:first TH.bpremium").offset();
			$("#bublina").offset({top:(p.top-hb), left:(p.left-((wb-wc)/2)+2)});
		},
		function(){
			$("TD.bpremium").css("background-color", "#eaeaea");
			$("TH.bpremium").css("background-color", "#ffffff");
			$("#bublina-content").html('');
			$("#bublina").hide();
		}
	);
}
