Not sure if this should go here or in the php thread.

I'm making directories and uploading the file with php but I have functions that determine how that upload is set up with javascript. I want the radio button to be selected when the input field is entered which it doesn't do. I also think there are a few ways to simplify this but can't think of the right now. Thanks for any help you can offer ( I took out 60 or so lines of code to simplify it a bit).

PHP Code:
<?php
$page_on 
$_GET['id'];
if (
$page_on === "send" && isset($_POST['pass'])) {
?>
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
<script type="text/javascript" src="js/swfupload/swfupload.js"></script>
<script type="text/javascript" src="js/jquery.swfupload.js"></script>
<script type="text/javascript">
$(function(){
    $('#swfupload-control').swfupload({
        upload_url: "upload-file.php?pass=" + "<?php echo $_POST['pass'];?>"<?php if ((isset($_POST['Gal_Is'])) || (isset($_POST['Gal_Is_New']))) { if (isset($_POST['Gal_Is_New'])) { $gal_name $_POST['Gal_Is_New']; } else { $gal_name $_POST['Gal_Is']; } ?> + "&gal=<?php echo $gal_name "\",\n";} else { echo ",\n"; } ?>
//MORE JS HERE REMOVED TO SIMPLIFY
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link href="style.css" type="text/css" rel="stylesheet" />
</head>
<body>
<?php
if ($page_on === "send") {
if (isset(
$_POST['pass'])) {
?>
<div style="display:none;">
<?php 
}
?>
    <form method="post" action="<?php echo $_SERVER['PHP_SELF']. "?id=send";?>">
    Password to Upload Files:<input type="password" name="pass" /><br />
    <input type="submit" value="Submit" />
    </form>
<?php
if (isset($_POST['pass'])) {
?>
</div>
<?php 
}
}
if (isset(
$_POST['pass'])) {
    
$password_is $_POST['pass'];
}
if (
$page_on === "send" && isset($password_is)) {
     switch (
$password_is) {
        case 
"pass":
            
$user "fraser";
        break;
        case 
"pass2":
            
$user "chris";
        break;
        case 
"pass3":
            
$user "hogan";
        break;
        default:
         
$user "unset";
    }
    if (isset(
$_POST['Selected'])) {
        
?><div style="display:none;">
        <?php
    
}
    
?>
    <form action="<?php echo $_SERVER['PHP_SELF']. "?id=send"?>" method="post" onsubmit="if (document.New_Gal.Gal_Is.value != '') { document.New_Gal.submit } else { alert('Enter a Name');}" name="New_Gal">
    Create a New Gallery Named:<br /><input type="text" name="Gal_Is_New" /><input type="radio" name="Selected" /><br />
    <input type="hidden" name="pass" value="<?php echo $password_is?>" />
    Already Exisiting Galleries:<br />
    <?php
    
if ($user != "unset") {
        
$path "./images/$user/";
        if (
$handle opendir($path)) {
            while (
false !== ($file readdir($handle))) {
                if (
is_dir($path $file)) {
                     if ((
substr($file01) != ".") && ($file != "thumb"))  {
        
?> 
                        <input type="text" name="Gal_Is" value="<?php echo $file?>" /><input type="radio" name="Selected" /><br />
                        <?php
                    
}
            }
        }
        
closedir($handle);
    }
    }
    
?>
    <input type="submit" value="Set Gallery" />
    </form>
    <?php
    
if (isset($_POST['Selected'])) {
        
?></div>
    <?php
    $selected 
$_POST['Selected'];
    }
    if (isset(
$gal_name)) {
        if (
$selected == "on") {
            if (
file_exists($path $gal_name)) {
                echo 
"<script type=\"text/javascript\">\nalert('Gallery Already Exists');\n</script>\n";
            } else {
                
mkdir($path $gal_name0777);
                
mkdir($path $gal_name "/thumb"0777);
            }
        } else {
            echo 
"<script type=\"text/javascript\">\nalert('Select a Gallery');\n</script>\n";
        }
    }
    
?>
    <?php
    
if (isset($_POST['Selected'])) {
    
?>
        You are uploading into the <strong><?php echo $gal_name;?></strong> Gallery.<br />
        <div id="swfupload-control">
        <input type="button" id="button" />
        <p class="jove_title">Files Begin Uploaded:</p>
        <p id="queuestatus" ></p>
        <ol id="log"></ol>
        </div>
        <?php 
    
}
}
?>
</body>
</html>