$(document).ready(function() {
$('.qform input[type=submit], .qform input[type=button]').hover(function() { $(this).addClass("on"); }, function() { $(this).removeClass("on"); });

$("a").each(function(){
var current_href = 'http://www.wlochy.edu.pl'+$(this).attr("href");
if (document.location == current_href) {
  $(this).blur();
  $(this).addClass('active');
}
});

      $('#keyword').click(function(){
      	if($('#keyword').val() == 'wpisz szukaną frazę')
      		$('#keyword').val('');
      }).blur(function(){
      	if($('#keyword').val() == '')
      		$('#keyword').val('wpisz szukaną frazę');
      });


	$('.submenu').each(function() {
 		//pobierz pozycje
 		var position = $('div#menu li[rel='+$(this).attr('rel')+']').position();
 		//alert (p.top);
 		$(this).css("top", (position.top + 38) + 'px' );
 		$(this).css("left", (position.left - 0) + 'px');

 		var id = $(this).attr('rel');

		$( 'div#menu li[rel='+id+']' ).mouseover( function() {
					$('.submenu[rel='+id+']').show();
					$( 'div#menu li[rel='+id+'] a' ).addClass('on');
				}).mouseout( function() {
					$('.submenu[rel='+id+']').hide();
				 	$( 'div#menu li[rel='+id+'] a' ).removeClass('on');
			});
		$( this ).mouseover( function() {
					$('.submenu[rel='+id+']').show();
					$( 'div#menu li[rel='+id+'] a' ).addClass('on');
				}).mouseout( function() {
					$('.submenu[rel='+id+']').hide();
					$( 'div#menu li[rel='+id+'] a' ).removeClass('on');
			});
 	});


$('#dodaj_publikacje input[type=text], #szukam_pracy input[type=text], #dam_prace input[type=text], #katalog input[type=text], #dodaj_wydarzenie input[type=text]').addClass('w4xx');



$('select.kategoria').change( function (){
sid = $('input[name=sid]').val();
if (this.value == '1') {
$('table.qform tr:nth-child(10)').after('<tr class="galeria"></tr>');
$('table.qform tr:nth-child(10)').next("tr.galeria").load('/jquery/galeria_dodaj?sid=' + sid);
}
else {
$('tr.galeria').load('/jquery/galeria?sid=' + sid);
$('tr.galeria').remove();
}
});

$('.podpis_imie').before('<b>Imię i nazwisko:&nbsp;</b>');
$('.podpis_nazwisko').before('<b>Email:&nbsp;</b>');

if ($("#menu_2").length)
$("#menu_2").tabs();

if ($("textarea.resizable").length)
$('textarea.resizable:not(.processed)').TextAreaResizer();

// Ustawienia kalendarza

/* Polish initialisation for the jQuery UI date picker plugin. */
/* Written by Jacek Wysocki (jacek.wysocki@gmail.com). */
if ($(".data").length)
jQuery(function($){
	$.datepicker.regional['pl'] = {
		closeText: 'Zamknij',
		prevText: '&#x3c;Poprzedni',
		nextText: 'Następny&#x3e;',
		currentText: 'Dziś',
		monthNames: ['Styczeń','Luty','Marzec','Kwiecień','Maj','Czerwiec',
		'Lipiec','Sierpień','Wrzesień','Październik','Listopad','Grudzień'],
		monthNamesShort: ['Sty','Lu','Mar','Kw','Maj','Cze',
		'Lip','Sie','Wrz','Pa','Lis','Gru'],
		dayNames: ['Niedziela','Poniedzialek','Wtorek','Środa','Czwartek','Piątek','Sobota'],
		dayNamesShort: ['Nie','Pn','Wt','Śr','Czw','Pt','So'],
		dayNamesMin: ['N','Pn','Wt','Śr','Cz','Pt','So'],
		isRTL: false};
	$.datepicker.setDefaults($.datepicker.regional['pl']);
});

if ($(".data").length)
$.datepicker.setDefaults({
	yearRange: '-90:0',
	changeMonth: true,
	changeYear: true,
	regional: 'pl',
	altFormat: 'yy-mm-dd',
	dateFormat: 'yy-mm-dd',
	showOn: 'both',
	speed: 'fast',
	buttonImage: 'http://www.praca4u.pl/images/silk_png/calendar.png',
	showAnim: false
});

// Zaladowanie kalendarza
if ($(".data").length)
$('.data').datepicker();


});

function uif_zobacz(sid) {
$('div.results').load('/jquery/uif_zobacz?sid=' + sid);
}


function uif_usun(sid, file) {
$('div[rel*="' + file + '"]').load('/jquery/uif_usun?sid=' + sid + ';' + file);
}

function uif_usun_wszystko(sid) {
$('div.results').load('/jquery/uif?sid=' + sid);
$('div.galeria').remove();
}

function test() {
alert('test');
}
