function commentReact(commentId, commentTitle) {
	
	var previousCommentId = commentId;
	var previousCommentTitle = commentTitle;
	$('#discuss_parent').attr( "value", previousCommentId );
	$('#discuss_title').attr( "value", 'Re: '+previousCommentTitle );
}

function setFillInType() 
{
	$('#rad_sign_in').removeAttr( "checked" );
	$('#rad_fill_in').attr( "checked", "checked" );
}

function setSingInType() 
{

	$('#rad_fill_in').removeAttr( "checked" );
	$('#rad_sign_in').attr( "checked", "checked" );
}

function chdop (val) {
  var platdop = new Array();
  platdop[1] = new Array();
  platdop[1][1] = 1;
  platdop[1][2] = 1;
  platdop[2] = new Array();
  platdop[2][3] = 1;
  platdop[3] = new Array();
  platdop[3][3] = 1;
	tmp = platdop[val];
	for (i = 1; i <= 4; i++) {
		if (document.getElementById("payment"+i)) {
			if (tmp [i]) {
				document.getElementById("payment"+i).disabled = "";
			} else {
				document.getElementById("payment"+i).disabled = "disabled";
				document.getElementById("payment"+i).checked = "";
			}
		}
	}
	if (val == 2 || val == 3) {
    document.getElementById("payment3").checked = "checked"
  } else {
    document.getElementById("payment3").checked = ""
  }
}

$(document).ready(function(){

	$("#good-subpage > ul").tabs();

	// inicialiyuje formularove policka pro prihlaseni
	$("#l_username").focus(function () {
		var text = $(this).val();
		if (text == 'jmeno') {
			$(this).val('');
		}
	}).blur(function () {
		var text = $(this).val();
		if (text == '') {
			$(this).val('jmeno');
		}
	});
	$("#l_password").focus(function () {
		var text = $(this).val();
	
		if (text == 'heslo') {
			$(this).val('');
		}
	}).blur(function () {
		var text = $(this).val();
		if (text == '') {
			$(this).val('heslo');
		}
	});
	
	// nastavi vysku stranky
	function autoHeight() {
		var left = $('#left').height();
		var main = $('#main').height();
		var right = $('#right').height();
		var help;
		if(left > right) {
			help = left;
		} else {
			help = right;
		}
		if(main < help) {
			$('#main').height(help);
		}
	}
	autoHeight();
	
	// funkce orderby
	$("#orderby").change(function () {
		var url = location.pathname + $(this).val();
		window.location.href = url;
	});
	$("#orderbysort").click(function () {
		var url = location.pathname + $(this).val();
		window.location.href = url;
	});
	
	$('a[@rel=lightbox]').lightBox();
	$('a[@rel=lightbox2]').lightBox();
	
});
