var Eredmenyek = 1;
function OldalBetolto(Link){
	document.getElementById('LoadingAnim').style.visibility = "visible";
	
	$('#Tartalom').stop().animate({'opacity':'0.1'},200,function(){
		Link = Link.replace(/ /g,"_");		
		$('#Tartalom').load('/'+Link,function(){			
			SetTop();
			$('#Tartalom').stop().animate({'opacity':'1'},200,function(){
				document.getElementById('LoadingAnim').style.visibility = "hidden";
			});
			
		});
	});
}
function SetTop(OB){
	$('html, body').animate({'scrollTop':226},600,function(){
		
	});
}
function Kozepre(){
	var DivHeight = $('#LoadinAnim').height();
	var DivWidth = $('#LoadingAnim').width();
	var WindowHeight = $(window).height();
	var WindowWidth = $(window).width();
	var wd = ((WindowHeight-DivHeight)/2)+$(window).scrollTop();
	var hd = ((WindowWidth-DivWidth)/2);	
	$('#LoadingAnim').stop().animate({'left':hd,'top':wd},200);
}
function Kereses(){	
	$('.Keresohoz').css({'display':'none'});
	var szo = document.getElementById("KeresoSzo").value;
	szo = szo.replace(/ /g,"_");
	OldalBetolto('ajax.php?page=termek_kereso&x=1&szo='+szo);
}
function Rejteget(ID){
	if(eval(ID+"==1")){
		$('.'+ID).css({'display':'none'});
		eval(ID+"=0");
	}
	else{
		$('.'+ID).css({'display':'block'});
		eval(ID+"=1");
	}
}
function Keresos(){
	var akt = $('.Keresohoz').css('display');
	var szo = $('#KeresoSzo').val();
	szo = szo.replace(/ /g,"_");
	if(szo.length>2){		
		$('.Keresohoz').load("/ajax.php?page=keresohoz&szo="+szo,function(){
			
			if($('.Keresohoz').html()=='')
				$('.Keresohoz').css({'display':'none'});
			else
				$('.Keresohoz').css({'display':'block'});
		});
	}
	else{
///		if($('.Keresohoz').css('display')!='none')
			$('.Keresohoz').css({'display':'none'});
	}
}
function Keresobe(szo){
	$('#KeresoSzo').val(szo);
	$('.Keresohoz').css({'display':'none'});
	Kereses();
}

function AutoLink(){
$(document).ready(function() {
	$('.AjaxLink').click(function(){
		var Title = $(this).attr('title');
		document.title = Title;
		OldalBetolto($(this).attr('AjaxUrl'));
		return false;
	});
});
}
function Help(){
	$(document).ready(function() {
		$('.PopUp').click(function(){
			
			return false;
		});	
	});
}
function Kosarba(TID){
	var darab = document.getElementById("darab").value;	
	$.get("/ajax.php?page=termek&id="+TID+"&kosarba="+darab+"&termek="+$('.s:radio:checked').val());
	alert('A terméket a kosárba tettük!');
}
function Temakuld(tid){
	var temaszoveg = $('input[name="tema'+tid+'"]').val();
	$.post('ajax.php?page=temak',{'tema':tid,'szoveg':temaszoveg},function(){
		$('#Tartalom').load("ajax.php?page=temak");
	});
}
function Tematorol(tid){
	$('#Tartalom').load("ajax.php?page=temak&ttorol="+tid);
}
function Hkuld(tid,szulo,oldal){
	var elkuld = $('textarea[name="szoveg'+szulo+'"]').val();
	$.post('ajax.php?page=forum&tid='+tid,{'tid':tid,'szoveg':elkuld,'szulo':szulo},function(){
		$('#Tartalom').load("ajax.php?page=forum&tid="+tid+"&oldal="+oldal);
		 $('textarea[name="szoveg'+szulo+'"]').val('');
	});	
}
function Hmutat(fid,szulo,oldal){
	$('#H'+szulo).css({"display":'block'});
	$('#H'+szulo).load("js/hozzaszolas.php?tid="+fid+"&szulo="+szulo+"&oldal="+oldal);
}
$('#instant').keyup(function(){	
	alert("dasd");
	delay(function(){
		
	},1000);
});
