
function morebox_resp(x){
bajax.insertHTML('morebox',x); 
}

function load_morebox(site,myargs)
{	
	bajax.insertHTML('morebox','<center><img src="templates/0/images/loading.gif"></center>');
	if (typeof(myargs) == 'object')
	{
		bajax.bajax_request_type="POST";
		bajax.call('index.php?dir='+site,morebox_resp,myargs);
	}else{
		bajax.bajax_request_type="GET";
		bajax.call('index.php?dir='+site,morebox_resp,myargs);
	}
}

function vote_submit(from)
{
	from.disabled=true;
	var myargs = new Array();
	myargs['vote'] = document.getElementById('vote_score').value;	
	load_morebox('info',myargs);
}

function toggle_comment()
{
	var toggle_img=document.getElementById('commentless');
	var toggle_img2=document.getElementById('infoless');
	var toggle_box=document.getElementById('morebox');
	if (toggle_img.src.match('more.gif')!=null)
	{
		load_morebox('comments',0);
		toggle_img.src='templates/0/images/less.gif';
		toggle_img2.src='templates/0/images/more2.gif';
		toggle_box.style.display='block';
	}else{
		toggle_img.src='templates/0/images/more.gif';
		toggle_box.style.display='none';
	}
}

function toggle_info()
{
	var toggle_img=document.getElementById('infoless');
	var toggle_img2=document.getElementById('commentless');
	var toggle_box=document.getElementById('morebox');
	if (toggle_img.src.match('more2.gif')!=null)
	{
		load_morebox('info',0);
		toggle_img.src='templates/0/images/less.gif';
		toggle_img2.src='templates/0/images/more.gif';
		toggle_box.style.display='block';
	}else{
		toggle_img.src='templates/0/images/more2.gif';
		toggle_box.style.display='none';
	}
}

function get_comment_resp(x){
bajax.insertHTML('commentlist',x);
window.location.hash="comments"; 
}

function get_commentbox_resp(x){
bajax.insertHTML('commentbox',x); 
}

var last_limit=0;

function get_comment(limit)
{
	var myargs = new Array();
	myargs['limit'] = limit;
	last_limit=limit;
	bajax.insertHTML('commentlist','<center><img src="templates/0/images/loading.gif"></center>');
	bajax.bajax_request_type="GET";
	bajax.call('?dir=commentlist',get_comment_resp,myargs);
}

function send_comment()
{
	var myargs = new Array();
	myargs['newcomment'] = document.getElementById('cbox_comment').value;
	document.getElementById('cbox_comment').value='';
	bajax.insertHTML('commentlist','<center><img src="templates/0/images/loading.gif"></center>');
	bajax.bajax_request_type="POST";
	bajax.call('?dir=commentlist',get_comment_resp,myargs);	
}
function check_login(pid)
{
	bajax.insertHTML('commentbox','<center><img src="templates/0/images/loading.gif"></center>');
	bajax.bajax_request_type="GET";
	bajax.call('?dir=commentbox',get_commentbox_resp,new Array());
}


function add_favorite_resp(x){
	if (x!="")
		alert(x); 
}

function add_favorite()
{
	bajax.bajax_request_type="GET";
	bajax.call('?dir=add_favorite',add_favorite_resp,new Array());	
}

//játékidő mérése
function game_timer_resp(x)
{
}
function game_timer()
{
	bajax.bajax_request_type="GET";
	bajax.call('?dir=game&played',game_timer_resp,new Array());	
}
function start_timer()
{
	setTimeout(game_timer,1000*60*2);
}


function thumb(id,change)
{
	var myargs = new Array();
	myargs['postid'] = id;
	myargs['thumb'] = change;
	myargs['limit'] = last_limit;
	bajax.insertHTML('commentlist','<center><img src="templates/0/images/loading.gif"></center>');
	bajax.bajax_request_type="GET";
	bajax.call('?dir=commentlist',get_comment_resp,myargs);	
	
}

function show_spam(id)
{
	var comment_cont=document.getElementById("comment_"+id);
	var comment_spam=document.getElementById("comment_"+id+"_spam");
	if ((comment_cont) && (comment_spam))
	{
		comment_cont.style.display='block';	
		comment_spam.style.display='none';
	}
}
//teljes képernyő
var is_flash_full=0;
var flash_origh=0;
var flash_origw=0;

function align_flash_pre()
{
	setTimeout(align_flash,100);
}

function align_flash()
{
	var game_container=document.getElementById("game_container");
	var game_inside=document.getElementById("game_inside").style;
	var game_copy=document.getElementById("game_copy").style;
  	var newh=0;
  	var neww=0;
  	if(document.body) 
	{
	  	newh= document.body.clientHeight;
	  	neww= document.body.clientWidth;
	}else
	if(window.innerWidth)
	{
		newh= window.innerHeight;
		neww= window.innerWidth;
	}else{
		newh=game_container.style.clientHeight;
		neww=game_container.style.clientWidth;
	}
  	newh=parseInt(newh+'')-38;
  	neww=parseInt(neww+'');
  	
  	var calcw=flash_origw*newh/flash_origh;
  	var calch=newh;
  	if (calcw>neww)
  	{
		calcw=neww;
		calch=flash_origh*calcw/flash_origw;
	}
	calch=Math.round(calch);
	calcw=Math.round(calcw);
	game_inside.marginLeft=((neww-calcw)/2)+'px';
	game_inside.marginTop=((newh-calch)/2)+'px';
  	game_inside.height=calch+'px';
	game_inside.width=calcw+'px';

	if (navigator.userAgent.toLowerCase().indexOf("msie") != -1)	//IE
		game_copy.top=(newh+20)+'px';else
		game_copy.top=(newh+21)+'px';

	game_copy.width=neww+'px';
	//ie
  	game_container.style.width=neww+'px';
  	game_container.style.height=(newh+22)+'px';	
}
function switch_full()
{
  var game_container=document.getElementById("game_container");
  var game_info=document.getElementById("game_info").style;
  var game_copy=document.getElementById("game_copy").style;
  var game_inside=document.getElementById("game_inside").style;
  var game_nofull=document.getElementById("game_nofull").style;

  if (is_flash_full==0)
  {
  	is_flash_full=1;
  	window.scrollTo(0,0);
  	if (flash_origh==0)
  	{
  		flash_origh=parseInt(game_container.style.height+'');
  		flash_origw=parseInt(game_container.style.width+'');
  	}
  	game_container.style.left='0px';
  	game_container.style.top='0px';
  	game_container.style.backgroundImage="url('templates/0/images/backg.png')";
  	game_info.display='block';
  	game_nofull.display='block';
  	game_copy.display='block';
  	setTimeout(align_flash,30);
  	onresize=align_flash_pre;
  }else
  {
  	window.scrollTo(1,0);
  	window.scrollTo(0,0);
  	is_flash_full=0;
  	onresize=function(){};
  	game_container.style.left='';
  	game_container.style.top='';
	game_inside.height=flash_origh+'px';
	game_inside.width=flash_origw+'px';
	game_inside.marginLeft='0px';
	game_inside.marginTop='0px';	
	game_container.style.width=flash_origw+'px';
	game_container.style.height=flash_origh+'px';
	game_info.display='none';
	game_copy.display='none';
  }
}