$(document).ready(function () {
	$(".btn").mouseover(function () {
	      $(this).addClass("btnhov");
	    });
	
	$(".btn").mouseout(function () {
	      $(this).removeClass("btnhov");
	    });
});
function pitbullajax(id)
{
  
	var rejteni = '#' + id;
	var kep = '#' + id; 

	if ($(rejteni).css('display') == 'none') {
  		$(rejteni).show('slow',function(){$(rejteni).fadeTo('slow',1)});
  		$(kep).attr("src","pic/minus.gif");

	}
	else {
  		$(rejteni).fadeTo('slow',0,function(){$(rejteni).hide('slow');});
      $(kep).attr("src","pic/plus.gif");
	}
}

function PitbullTorrentAJAX(id){
	var legordul_szoveg = '#obj_' + id;
	var legordul_kep = '#pic_' + id; 
if ($(legordul_szoveg).css('display') == 'none') {
  	$(legordul_szoveg).show('slow',function(){$(legordul_szoveg).fadeTo('slow',1)});
  	$(legordul_kep).attr("src","pic/minus.gif");
	$(legordul_kep).attr("alt","-");
	$(legordul_kep).attr("title","Elrejt");}
else {
	$(legordul_szoveg).fadeTo('slow',0,function(){$(legordul_szoveg).hide('slow');});
	$(legordul_kep).attr("src","pic/plus.gif");
	$(legordul_kep).attr("alt","+");
	$(legordul_kep).attr("title","Mutat");}
	}
function appendInput(what, id)
{
	var inp = $('#'+id);
	inp.val(inp.val()+what);
}

function PopMoreSmiles(id)
{
	newWin=window.open('moresmiles.php?id='+id, 'moresmile', 'height=500,width=450,resizable=no,scrollbars=yes');
	if (window.focus)
		newWin.focus()
}

function changeshoutbox(prefix)
{
	if (prefix == undefined)
		prefix = '';
	shbox = prefix + 'shoutbox.php';
	$('#shframe').attr('src', shbox);
	$('#shform').attr('action', shbox);
	$('#shlink').attr('name', shbox);
}

function kvizkerdes()
{
	var kerdes = prompt("Kérdés");
	var nyeremeny = prompt("Nyeremény (pl.: 500 MB; 1 GB)");
	appendInput("[b][color=red]Kérdés: [/color][/b] [color=white]"+kerdes+"[/color] [color=lime]"+nyeremeny+"[/color]", 'shout');
}

function nyertes()
{
	var nyertes = prompt("Nyertes");
	var nyeremeny = prompt("Nyeremény (pl.: 500 MB; 1 GB)");
	$.ajax(
	{
		url: "kviz.php",
		type: "POST",
		data: ({username : nyertes, nyeremeny: nyeremeny}),
		dataType: "html",
		success: function(msg)
		{
			alert(msg);
			appendInput("[b][color=red]Nyertes: [/color][/b][color=white]"+nyertes+" válaszolta meg a leggyorsabban! [/color] [color=lime] Gratulálunk! [Nyereménye: "+nyeremeny+"] [/color]", 'shout');
		},
		error: function(msg)
			{
				alert('Sikertelen ürítés');
			}
	}
	);
}

function rendszeruzenet()
{
	var uzenet = prompt("Rendszerüzenet");
	appendInput("[b][color=red]Információ [/color]"+uzenet+"[/b]", 'shout');
}

function urites()
{
	if ($('#shlink').attr('name') == 'staffshoutbox.php')
		what = ' vezetőségi üzenőfalat?';
	else
		what = 'z üzenőfalatfalat?';
	if (confirm('Biztos ki akarod üríteni a'+what))
	{
		$.ajax(
		{
			url: $('#shlink').attr('name'),
			type: "GET",
			dataType: "html",
			data: ({truncate: 1}),
			success: function(msg)
			{
				alert('Sikeres ürítés');
				$('#shframe').attr('src', $('#shlink').attr('name'));
			},
			error: function(msg)
			{
				alert('Sikertelen ürítés');
			}
		}
		);
	}
}

function sb_reply(id, username, color)
{
	top.appendInput("[b][url=userdetails.php?id="+id+"][color="+color+"]"+username+"[/color][/url][/b]: ", 'shout');
}

function changestate(state, statestr)
{
	$.ajax(
	{
		url: 'changestate.php',
		type: "POST",
		dataType: "html",
		data: ({state: state}),
		success: function(msg)
		{
			alert('Az új állapotod: '+statestr);
			window.location.href = window.location.href;
		}
	}
	);
}

function validateSpeedTest(img)
{
	re = /^http:\/\/(www\.|)speedtest\.net\/result\/\d+\.png$/
	if (re.test(img))
		return true;
	else
		return false;
}

var checkflag = false;
function check(field)
{
	if (checkflag == false)
	{
		for (i = 0; i < field.length; i++)
			field[i].checked = true;
		checkflag = true;
		return "Kijelölés megszüntetés";
	}
	else
	{
		for (i = 0; i < field.length; i++)
			field[i].checked = false;
		checkflag = false;
		return "Mindet kijelöli";
	}
}
//Áll az alku rendszer by fuggteddy
function all_az_alku(taska) {
var answer = confirm("Áll az alku?")
if (answer){
	alert("Rendben játszunk!")
	window.location = "all.php?taska="+taska;
	}
	else{
	alert("Rendben van!Nem játszunk találkozunk legközelebb!")
	}
}
function klappe_news(id)
{
	picid = '#pic'+id;
	newsid = '#k'+id;

	if ($(newsid).css('display') == 'none')
	{
		$(newsid).show();
		$(picid).attr('src', 'pic/minus.gif');
	}
	else
	{
		$(newsid).hide();
		$(picid).attr('src', 'pic/plus.gif');
	}
}

NcodeImageResizer.MODE = 'newwindow';
NcodeImageResizer.MAXWIDTH = 640;
NcodeImageResizer.MAXHEIGHT = 0;

NcodeImageResizer.Msg1 = 'Kattintson ide a teljes képmérethez.';
NcodeImageResizer.Msg2 = 'A kép át lett méretezve. Kattintson ide a teljes mérethez.';
NcodeImageResizer.Msg3 = 'A kép át lett méretezve. Kattintson ide a teljes mérethez.';
NcodeImageResizer.Msg4 = 'Kattintson ide a kis kép mérethez.';
