I've got this piece of code that should work if session is set (check.php), but for some reason it doesn't, so can someone explain to me what I'm I doing wrong here?
In addition, if there's another way to call javascript code from PHP rather than echoing it, please let me know.

input.php:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
	@import "stil.css";
</style>
<title>Untitled Document</title>
<script type="text/javascript" src="jq.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.13.custom.min.js"></script>
<script type="text/javascript" src="scripts.js"></script>
<script type="text/javascript" src="postme.js"></script>
<?php
include_once('check.php');
?>
</head>
<body>
<div id="wrap">
	<div id="chat">
	<div id="main">
	</div>
	<div id="input">
<form name="form"action="test.php" method="post">
<input type="text" name="tekst" id="msg" size="72" />
<input type="submit" name="dugme" value="posalji" id="dugme" />
</form>
	</div>
	</div>
	</div>
<div id="black">
</div>
<div id="name">
<form name="yname">
<input type="text" name="tekst2" id="tekst2" />
<input type="button" name="dugme2" value="Enter" onclick='send()' />	
</form>
</div>


</body>
</html>
postme.js:

Code:
function send(){
	var lol=document.yname.tekst2.value;
   $.post('sesion.php',{ime:lol},function(val){
            if(val!=null) {
                $('#black').fadeOut();
                $('#name').fadeOut();
            
            }

        }
   )};
sesion.php:

Code:
<?php
session_start();
if(isset($_POST['ime']))
	{
	$_SESSION['ime']=$_POST['ime']; 
	$sesion_n=$_SESSION['ime']; 
	echo $sesion_n; 
	}
?>
check.php:

Code:
<?php
include('sesion.php');
if (isset($sesion_n)){
	echo "<script type='text/javascript'>$('#black').hide();$('#name').hide();</script>";
}
?>