﻿

$(document).ready(function (){

var tabContainers = $('div.tabs > div'); 
	tabContainers.hide().filter(':first').show();

	$('div.tabs ul.tabNavigation a').click(function () {
		tabContainers.hide();
		tabContainers.filter(this.hash).show();
		$('div.tabs ul.tabNavigation a').removeClass('selected');
		$(this).addClass('selected');
		return false;
	}).filter(':first').click();

  $("#marquee").marquee({scrollSpeed: 20, pauseSpeed: 4000, pauseOnHover: false});
  
  
  	$('#marquee').append('<li>Ładowanie zawartości...</li>');
	$('#marquee').marquee('update');
	$('#marquee').marquee("pause");
	setTimeout("wczytaj_pon();", 2000);

var tmpId = 0;
});

//####################
// # POZDROWIENIA ONLINE #
//###################
function wczytaj_pon() {
$('#marquee').marquee("pause");
$("#marquee li").remove();	
$('#marquee').append('<li>..::.. Dodaj własne pozdrowienia ..::..</li>');
$('#marquee').marquee('update');
$('#marquee').marquee("resume");
	$.ajax({
		url: BASE_LINK + 'pozdro_online.php',
		success: function (responseText) {	
				$('#marquee').append(responseText);
				$('#marquee').marquee('update');
				}
			});
};

function pokaz_ponFormularz() {
	$("#pon_dodaj").hide();
	$("#pon_zawartosc").hide();
	$("#pon_formularz").show();
}

function ukryj_ponFormularz() {
$("#pon_dodaj").show();
$("#pon_zawartosc").show();
$("#pon_tresc").val('') ;
$("#pon_formularz").hide();
	wczytaj_pon();
}

function dodaj_ponFormularz() {
	if($("#pon_kto").val() != "" && $("#pon_tresc").val() != "") {
		$.ajax({
			type: "POST",
			url: BASE_LINK + 'pozdro_online.php',
			data: "kto=" + $("#pon_kto").val() + "&tresc=" + $("#pon_tresc").val(),
			success: function() {
				ukryj_ponFormularz();
			}
		});
	}
}