function check_register()
{
	f = document.register_form;

	if(!validate_email(f.email, "Please fill in the correct email address!"))
	{
		return false;
	}

	if(!ck_text(f.username, "", "Please fill in the username"))
	{
		return false;
	}

	if(!ck_text(f.password, "", "Please fill in the password"))
	{
		return false;
	}

	if(!ck_text(f.repassword, "", "Please fill in the retype password"))
	{
		return false;
	}

	if(f.repassword.value!=f.password.value)
	{
		alert("Passwords do not match. Please retype the password!");
		return false;
	}

	
	


	return true;



}

//=========================

function check_clear(field,value)
{
	if(field.value==value)
	{
		field.value='';
	}

}

//=============================

function draw_game_box(prize_type_card, prize_value, prize_cards, prize_details,used_id)
{
	
	var url = dir_value+"/ajax/draw_game.php";
	var pars = "prize_type_card="+prize_type_card+"&prize_value="+prize_value+"&prize_cards="+prize_cards+"&prize_details="+prize_details+"&used_id="+used_id;
	
		
	var myAjax = new Ajax.Request( url,
											{
												
											  method: 'post',
											  parameters: pars,
											  onComplete: draw_game_box_from_server
											  
											}
									);			

}

//=============================


function draw_game_box_from_server(originalRequest)
{
	
	 Try.these(
            function ()
            {               
               
                var jsonObject = eval('(' + originalRequest.responseText + ')');

				               
                document.getElementById("div_game_play").innerHTML = jsonObject["additional_html_content"][0];

                

            }//function ()   
    )

}

//=============================

function draw_game_box_finish(prize_type_card, prize_value, prize_cards, prize_details,used_id,prize_id,prize_image)
{
	
	var url = dir_value+"/ajax/draw_game_finish.php";
	var pars = "prize_type_card="+prize_type_card+"&prize_value="+prize_value+"&prize_cards="+prize_cards+"&prize_details="+prize_details+"&used_id="+used_id+"&prize_id="+prize_id+"&prize_image="+prize_image;
	
		
	var myAjax = new Ajax.Request( url,
											{
												
											  method: 'post',
											  parameters: pars,
											  onComplete: draw_game_box_from_server
											  
											}
									);			

}

//=============================

function draw_game_box_new()
{
	/*
	var url = dir_value+"/ajax/draw_game_new.php";
	var pars = "";
	
		
	var myAjax = new Ajax.Request( url,
											{
												
											  method: 'post',
											  parameters: pars,
											  onComplete: draw_game_box_from_server
											  
											}
									);		
									*/

	window.location='draw_game_new.php';

}

//====================================

function buy_credits_account()
{
	f = document.buy_credit;

	f.action = "front_actions.php?act=buy_credits_account";
	f.submit();
}
//====================================

function buy_paypal_account()
{
	f = document.buy_credit;

	
	f.submit();
}

