$(document).ready(function(){

	if(0)//location.href.indexOf("/ua/")==-1)
	{

	$('h1').flash(
		{
			src: '/js/jfr.swf',
			wmode:'transparent' ,
			flashvars: {
				css: [
					'* {color:#9c191f;}'
				].join(' ')
			}
		},
		{ version: 7 },
		function(htmlOptions) {

			htmlOptions.flashvars.txt = this.innerHTML;
			this.innerHTML = '<div style="height:30px;width:630px">'+this.innerHTML+'</div>';

			var $alt = $(this.firstChild);
			htmlOptions.height = $alt.height();
			htmlOptions.width = $alt.width();
			$alt.addClass('alt');
			$(this)
				.addClass('flash-replaced')
				.prepend($.fn.flash.transform(htmlOptions));
		}
	);
	$('h2').flash(
		{
			src: '/js/jfr.swf',
			wmode:'transparent' ,
			flashvars: {
				css: [
					'* {color:#484430;}'
				].join(' ')
			}
		},
		{ version: 7 },
		function(htmlOptions) {

			htmlOptions.flashvars.txt = this.innerHTML;
			this.innerHTML = '<div style="height:28px;width:250px">'+this.innerHTML+'</div>';

			var $alt = $(this.firstChild);
			htmlOptions.height = $alt.height();
			htmlOptions.width = $alt.width();
			$alt.addClass('alt');
			$(this)
				.addClass('flash-replaced')
				.prepend($.fn.flash.transform(htmlOptions));
		}
	);

	$('.jfr').flash(
		{
			src: '/js/jfr2.swf',
			//wmode:'transparent' ,
			flashvars: {
				css: [
					'* {color:#0b174f;}'
				].join(' ')
			}
		},
		{ version: 7 },
		function(htmlOptions) {

			htmlOptions.flashvars.txt = this.innerHTML;
			this.innerHTML = '<div style="height:26px;width:632px">'+this.innerHTML+'</div>';

			var $alt = $(this.firstChild);
			htmlOptions.height = $alt.height();
			htmlOptions.width = $alt.width();
			$alt.addClass('alt');
			$(this)
				.addClass('flash-replaced')
				.prepend($.fn.flash.transform(htmlOptions));
		}
	);
		
	}
});

function loadNewsComsForm()
{
	$.get("/news-coms-form.html?news_id="+news_id, function(data) {
		document.getElementById('comments_form').innerHTML = data;
		$('textarea#comment').autoResize({
			// On resize:
			/*
			onResize : function() {
				$(this).css({opacity:0.8});
			},
			// After resize:
			animateCallback : function() {
				$(this).css({opacity:1});
			},*/
			// Quite slow animation:
			animateDuration : 300,
			// More extra space:
			extraSpace : 16
		});
	});
}
var news_com_count = 1;
function addNewsCom()
{
	var msg = '';
	if(document.add_com_form.content.value=="") msg += "- Podaj treść komentarza\n";
	if(document.add_com_form.nick.value=="") msg += "- Podaj swój nick\n";

	if(msg)
	{
		alert("Błędne dane:\n"+msg);
		return false;
	}

	$.post("/news-coms-form.html",
		{
			news_id: news_id,
			nick: document.add_com_form.nick.value,
			user_id: document.add_com_form.user_id.value,
			content: document.add_com_form.content.value
		}, function(data) {

		coms_count++;
		document.getElementById('div_coms_count').innerHTML = coms_count;

		document.getElementById('news_com'+news_com_count).style.display = 'none';
		document.getElementById('news_com'+news_com_count).innerHTML = data;
		$('#news_com'+news_com_count).slideDown('slow',function(){});

		document.getElementById('news_com_msg').innerHTML = 'Dodano!';

		news_com_count++;
		if(document.add_com_form.user_id.value==0) document.add_com_form.nick.value = '';
		document.add_com_form.content.value = '';
	});

	return false;
}
