var $ = jQuery;
function var_dump(obj)
{
	w = window.open();
	for(a in obj)
	{
		w.document.write(a+' = '+obj[a]+'<br />');
	}
}
$(document).ready(function()
	{
		// loaded page
		$('IMG').fullsize({zoomInSpeed: 0, zoomOutSpeed: 0, shadow: 0});
		$('BODY').focus();
		$('INPUT[type=text]').not('INPUT.password_replacement').each(function()
			{
				if(!($(this).attr('title') != '' && ($(this).val() == '' || $(this).val() == $(this).attr('title'))))
					return;
				$(this).val($(this).attr('title'))
					.css('color', '#ababab');
				$(this).focus(function()
						{
							if($.rgb2hex($(this).css('color')) == '#ababab')
							{
								if($(this).val() == $(this).attr('title'))
								{
									$(this).val('')
										.css('color', '#fff');
								}
							}
						});
				$(this).blur(function()
						{
							if($(this).val() == '' || $(this).val() == $(this).attr('title'))
							{
								$(this).val($(this).attr('title'))
									.css('color', '#ababab');
							}
						});
				$(this).keydown(function(event)
						{
							if(event.keyCode == 27)
							{
								$(this).val('')
									.blur();
							}
						});
			});
		$('INPUT[type=password]').each(function()
			{
				// jezeli posiada title, jezeli value jest puste lub rowne title, jezeli posiada swoj zamiennik
				if(!($(this).attr('title') != '' && ($(this).val() == '' || $(this).val() == $(this).attr('title')) && $('INPUT#'+$(this).attr('id')+'-clear.password_replacement').length > 0))
					return;
				
				// ukryj pole hasla
				$(this).hide();
				// pokaz pole-zamiennik
				$('INPUT#'+$(this).attr('id')+'-clear').show();
				// ustaw wartosc, klase i referer
				$('INPUT#'+$(this).attr('id')+'-clear').val($(this).attr('title'))
					.addClass('deactived')
					.data('refererToPassword', $(this).attr('id'))
					.focus(function() 				// ustala zdarzenie na focusa

						{
							// jezeli posiada referer
							if($(this).data('refererToPassword'))
							{
								// ukryj zamiennik
								$(this).hide();
								// pokaz oryginalny
								$('INPUT#'+$(this).data('refererToPassword')).show().focus();
								
							}
						});
				$(this).blur(function() // jezeli traci focus
						{
//							var orig = $('INPUT#'+$(this).data('refererToPassword'));
							if($(this).val() == '' || $(this).val() == $(this).attr('title'))
							{
								$(this).hide();
								$('INPUT#'+$(this).attr('id')+'-clear').val($(this).attr('title'))
									.addClass('deactived')
									.data('refererToPassword', $(this).attr('id'))
									.show();
							}
						});
				$(this).keydown(function(event)
						{
							if(event.keyCode == 27)
							{
								$(this).val('')
									.blur();
							}
						});
				
			});
		
		$('#footer > *').mouseover(function()
			{
				$(this).stop().fadeTo('slow', 1);
			})
			.mouseout(function()
			{
				$(this).stop().fadeTo('slow', 0.6);
			}).each(function()
			{
				$(this).stop().fadeTo(0, 0.6);
			});
		$('#top_language_flagi > A > IMG').not('#top_language_flagi > A#lang_'+lang+' > IMG')
			.each(function()
				{
					$(this).fadeTo(0, 0);
				})
			.hover(function()
			{
				$(this).stop().fadeTo('normal', 1);
			},
			function()
			{
				$(this).stop().fadeTo('normal', 0);
			});
	}); // document.ready()




// EOF
