<?php

include("includes/site_config.php");

include('session_handler.inc');

include('pop_lists.inc');

include('error.php');

include('functions.php');

include("includes/tab_functions.js");

$db = & db::getInstance();

include_once __INCLUDE_CLASS_PATH."/class.ItemManager.php";
$option_manager = new OptionManager();
$avataar=$option_manager->GetValue('avatars_gallery');
$sec = $option_manager->GetValue('security_registration');
$Picture=$option_manager->GetValue('pic_Enable');
$max_size=$option_manager->GetValue('maxpicsize');


/*if (isset($_POST['avat'])) {

    $avatar_id = $_POST['avat'];

} elseif (isset($_SESSION['post']['avatar'])) {

    $avatar_id = $_SESSION['post']['avatar'];

}
*/

# retrieve the template

	$area = 'member';

$WUsername=$_REQUEST['adv_username'];

$txtSurname=$_REQUEST['txtSurname'];
$WCountry=$_REQUEST['WCountry'];
$WState=$_REQUEST['WState'];
$WCity=$_REQUEST['WCity'];

$txtForename=$_REQUEST['txtForename'];

$WDay=$_REQUEST['WDay'];

$WMonth=$_REQUEST['WMonth'];

$WGender=$_REQUEST['WGender'];

$security=$_REQUEST['security'];

$WAuthEmail=$_REQUEST['WAuthEmail'];

$WYear=$_REQUEST['WYear'];
if (isset($_REQUEST['chkNews'])) $chkNews=$_REQUEST['chkNews'];

if (isset($_REQUEST['WTerms'])) $WTerms=$_REQUEST['WTerms'];

$WPassConfirm=$_REQUEST['WPassConfirm'];

$WPassword=$_REQUEST['WPassword'];

$chkSeekwmn=$_REQUEST['chkSeekwmn'];

$chkSeekmen=$_REQUEST['chkSeekmen'];
        
		$WPostcode=$_REQUEST['WPostcode'];

        $lstSmoker=$_REQUEST['lstSmoker'];

        $lstDrink=$_REQUEST['lstDrink'];

        $lstBodyType=$_REQUEST['lstBodyType'];

        $lstChildren=$_REQUEST['lstChildren'];

        $lstMarital=$_REQUEST['lstMarital'];

        $lstReligion=$_REQUEST['lstReligion'];

        $lstEthnicity=$_REQUEST['lstEthnicity'];

        $lstEducation=$_REQUEST['lstEducation'];

        $lstHeight=$_REQUEST['lstHeight'];

        $lstEyecolor=$_REQUEST['lstEyecolor'];

        $lstHaircolor=$_REQUEST['lstHaircolor'];

        $lstEmployment=$_REQUEST['lstEmployment'];

        $lstIncome=$_REQUEST['lstIncome'];

        $txtTitle=$_REQUEST['txtTitle'];

        //$txtComment=$_REQUEST['txtComment'];
		 $txtComment=trim($_REQUEST['txtComment']);
			$str=strstr($txtComment," ");	
		if($str==""){ $txtComment = chunk_split($txtComment,25," ");}
		
		$lstSeeking=$_REQUEST['lstSeeking'];
		
		$arrOptions=$_REQUEST['dropoptions'];
		
		$arrQuestions_name=$_REQUEST['question_name'];




$Sess_UserId = $_SESSION['Sess_UserId'];

$Sess_UserName = $_SESSION['Sess_UserName'];

# select advert data

$result = mysql_query("SELECT * FROM adverts WHERE adv_userid=$Sess_UserId",$link);

$TOTAL = mysql_num_rows($result);

# if nothing is returned then show error otherwise get data

# if advert does not exist go to create page

/*if ($TOTAL < 1) {

       ?> 

<script language="javascript">

window.location='advertise.php';

//header("Location: $CONST_LINK_ROOT/advertise.php?PHPSESSID=".session_id());

       // exit;

</script>



<?php

}
*/
$sql_array = mysql_fetch_object($result);

# place advert data into variables for display



$country=$sql_array->adv_countryid;

$state=$sql_array->adv_stateid;

$city=$sql_array->adv_cityid;

$location=$sql_array->adv_location;

$adv_username=$sql_array->adv_username;

$seeking=$sql_array->adv_seeking;

$bodytype=$sql_array->adv_bodytype;

$marital=$sql_array->adv_marital;

$ethnicity=$sql_array->adv_ethnicity;

$religion=$sql_array->adv_religion;

$children=$sql_array->adv_children;

$smoker=$sql_array->adv_smoker;

$drink=$sql_array->adv_drink;

$height=$sql_array->adv_height;

$advtitle=$sql_array->adv_title;

$employment=$sql_array->adv_profession;

$eyecolor=$sql_array->adv_eyecolor;

$haircolor=$sql_array->adv_haircolor;

$income=$sql_array->adv_income;

$education=$sql_array->adv_education;

$picture=$sql_array->adv_picture;

if(isset($_REQUEST['picture'])){$picture= $_REQUEST['picture'];}

if ($sql_array->adv_seekmen=='Y') {$seekmen='checked';} else {$seekmen='';}

if ($sql_array->adv_seekwmn=='Y') {$seekwmn='checked';} else {$seekwmn='';}

if ($sql_array->adv_seekcpl=='Y') {$seekcpl='checked';} else {$seekcpl='';}

$comment=$sql_array->adv_comment;

$comment=stripslashes($comment);

$advtitle=stripslashes($advtitle);

if ($CONST_ZIPCODES=='Y') $zipcode=$sql_array->adv_zipcode;

/*

$country_res = mysql_query("SELECT * FROM geo_country");

$state_res = mysql_query("SELECT * FROM geo_state");

$city_res = mysql_query("SELECT * FROM geo_city");

*/



$result=mysql_query("SELECT * FROM mymatch WHERE mym_userid=$Sess_UserId") or die(mysql_error());

$sql_mymatch=mysql_fetch_object($result);

$sql_mymatch->mym_comment=stripslashes($sql_mymatch->mym_comment);

?>

<script language=javascript>

 function main_image()
 {
	 document.getElementById('avatar').disabled=true;
	 document.getElementById('fupload').disabled=false;
	 document.getElementById('avatar').value="";
	 return(false);
 }
  function avtar_image()
 {
	 window.open('<?php echo $CONST_LINK_ROOT?>/edit_picture_gallery.php', 'Pictures','dependent=yes,resizable=no,width=400, scrollbars=yes');
	 //document.getElementById('fupload').disabled=true;
//	  document.getElementById('fupload').value="";
//	 document.getElementById('avatar').disabled=false;
//	 return(false);
 }
 
function getCookie(name){

   var result = null;

   var myCookie = " " + document.cookie + ";";

   var searchName = " " + name + "=";

   var startOfCookie = myCookie.indexOf(searchName);

   var endOfCookie;



   if (startOfCookie != -1){

      startOfCookie += searchName.length;

      endOfCookie = myCookie.indexOf(";",startOfCookie);

      result = unescape(myCookie.substring(startOfCookie,endOfCookie));

   }

   return result;

}

	country = getCookie('WCountry');

	state = getCookie('WState');

	city = getCookie('WCity');

</script>

<?=$skin->ShowHeader($area)?>
<? include("tab_my_account.php");?>

<!--<form action="<?php// echo $CONST_LINK_ROOT?>/edit_profile.php" name="gallery" method="post" class="margin0">
<input type="hidden" name="avat" id="avat" value="">
</form>-->

<div class="mainwidth">
<div class="page-header"><div class="page-heading"><?php echo ADVERTISE_SECTION_NAME?></div></div>
<div class="clear"></div>
<div class="page">
	<table align="<?php print("$CONST_TABLE_ALIGN"); ?>" border="0" cellspacing="0" cellpadding="0" align="left">
	<!--<tr>
			<td align="right">&nbsp;</td>
			</tr>
			<tr>
			<td class="titlehead" style="background-repeat:repeat-y; padding-left:15px"><?php// echo ADVERTISE_SECTION_NAME ?></td>
	   </tr>-->
		<tr>
   			<td><?=$text?></td>
  		</tr>
  		<tr>
    		<td>
        		<table width="92%"  border="0" align="center" cellpadding="5" cellspacing="0">
        			<!--<input type="hidden" name="avatar" id="avatar" value="<?//=$avatar_id?>">-->
					<input name="mode" value="update" type="hidden">
          			<?php
                        $sql_result = mysql_query("SELECT adv_rejectreason FROM adverts WHERE adv_userid = $Sess_UserId AND adv_approved = 2", $link);
                        if(mysql_num_rows($sql_result) > 0)
                        {
                                $reason = mysql_fetch_object($sql_result);
                                $text = sprintf(PRGAMENDAD_TEXT3, $reason->adv_rejectreason);
                        }
                        else
                                $text = PRGAMENDAD_TEXT1;
          			?>
		  			<? if($_REQUEST['frm']==1) {?>
					<!--<td width="70">-->
           				<form action="<?php echo $CONST_LINK_ROOT?>/edit_profile.php?frm=2" name="FrmAdvert" method="post" enctype='multipart/form-data'>
						 <input type="hidden" name="adv_username" value="<?=$adv_username?>">
						 <input type="hidden" name="picture" value="<?=$picture?>">
						 <? //if ($GEOGRAPHY_JAVASCRIPT){?>
          				<script language="javascript" src="geography.js"></script>
				  <tr class="tdodd" >
            			 <td  align="left"><?php echo GENERAL_COUNTRY?></td>
           				 <td width="156" > <select class="input" name="WCountry" id="WCountry" size="1" tabindex="1" onchange="onCountryListChange('FrmAdvert', 'WCountry', 'WState', 'WCity');">
                		<option value="0" selected></option></select> 
						</td>
						 <!-- <td width="107"  align="left">&nbsp;</td>-->
    					<td width="95"  align="left"><?php echo GENERAL_STATE?></td>
            			<td width="138"> <select class="input" name="WState" id="WState" size="1" tabindex="1" onchange="onStateListChange('FrmAdvert', 'WCountry', 'WState', 'WCity');">
                		<option value="0" selected></option></select> 
						</td>
				</tr>
          		<tr class="tdeven" >
           			 <td  align="left"><?php echo GENERAL_CITY?></td>
            		 <td colspan="4" > <select class="input" name="WCity" id="WCity" size="1" tabindex="1" onchange="onCityListChange('FrmAdvert', 'WCity');">
                     <option value="0" selected></option></select>
				   </td>
           		</tr>
          <script language="javascript">
                        initialize('FrmAdvert', 'WCountry', 'WState', 'WCity', new Array('<?=$country?>'), new Array('<?=$state?>'), new Array('<?=$city?>'));

          </script>

        <? //} else {?>

          <!--<tr class="tdeven" >

            <td  align="left"><//?php echo GENERAL_COUNTRY?>/<//?php echo GENERAL_STATE?></td>

            <td >

                <select class="input" name="WCountry" id="WCountry"  style="width:auto;" size="1" tabindex="1">

                    <option value="0" selected>- <//?php echo GENERAL_CHOOSE?> -</option>

                    <//?= country_state_list($country.";".($state?$state:""));?>

                </select>

            </td>

            <td  align="left"><//?php echo GENERAL_CITY?></td>

            <td  width="272">

                <input type=text class="input" name=txtLocation value="<//?=$location?>">

            </td>

          </tr>-->

          <? //}?>
			 <?
	    $sql="SELECT DISTINCT lst_type,name,qOrder from vlistbox ORDER BY qOrder";
		$resultvalue=mysql_query($sql) or die(mysql_error());
		$countrow=mysql_num_rows($resultvalue);
		$j=0;
		 $i=0;
		while($rowvalue=mysql_fetch_array($resultvalue))
		{
			if(($i%2)==0)
		    {
		print "<tr class=tdeven>";
			}
			$j < $countrow;
		?>
	    <td align="left"><input type="hidden" value="<?=$rowvalue['name'];?>" name="question_name[]" /><?=$rowvalue['name'];?></td>
		<td><select class="input" name="dropoptions[]" size="1" id="dropoptions<?=$j;?>" tabindex="23">
          <? 
				 $sql_SKG="SELECT * FROM vlistbox WHERE lst_type = '".$rowvalue['lst_type']."' order by lst_order";
				   $result=mysql_query($sql_SKG) or die(mysql_error());
				   while($row=mysql_fetch_array($result))
					{
						$lowelcase = strtolower($row['name']);
						$newphrase9 = str_replace(" ","", $lowelcase);
						$tablefield = "adv_$newphrase9";
						$sql_Query = mysql_fetch_object(mysql_query("SELECT * FROM adverts_dropdown WHERE $tablefield = '".$row['lst_value']."' AND adv_userid = $Sess_UserId"));
					if($sql_Query->$tablefield == stripslashes($row['lst_value']))
					{ ?>
					<option value="<?=$row['lst_value'];?>" selected="selected"><?=stripslashes($row['lst_value']); ?></option>
				 <?	} else { ?>
          			<option value="<?=$row['lst_value'];?>" ><?=stripslashes($row['lst_value']); ?></option>
         		 <? }

				  }

				?>
        </select>     </td>
		<? 
		 $i++;
		 $j++;
		 }
		 ?>
		</tr>


          
          <?php

                                if ($CONST_ZIPCODES=='Y') {

                                  print("<tr class='tdodd'>

                                        <td align='left'>".ADVERTISE_ZIPCODE."</td>

                                        <td colspan='3'><input type='text' name='WPostcode' size='15' maxlength='5' value='$zipcode' class='input'> (".ADVERTISE_USA.")</td>

                                  </tr>");

                                  }

                        ?>

       <!--   <tr >

            <td colspan="5" align="center" class="tdfoot">&nbsp;</td>
          </tr>-->

          <tr >

            <td colspan="5" class="normal">

              <input type="checkbox" name="chkSeekmen" value="men" tabindex="11" <?php print($seekmen); ?>>

              <?php echo PRGAMENDAD_SEEKING_MEN?>&nbsp;

              <input type="checkbox" name="chkSeekwmn" value="wmn" tabindex="12" <?php print($seekwmn); ?>>

              <?php echo PRGAMENDAD_SEEKING_WOMEN?>&nbsp;

              <input type="hidden" name="chkSeekcpl" value="cpl" tabindex="12" ></td>
          </tr>

<? /*

          <tr class="tdodd" >

            <td align="left" ><?php echo PRGAMENDAD_MAIN_PICTURE?><br>

                <?php echo PRGAMENDAD_DELETE_PHOTO?></td>

            <td  colspan="2" align="left">

                <input name="fupload" type="file" tabindex="14" size="20"><br>

                <input type="checkbox" name="chkDelPhoto" value="del" tabindex="15" >

            </td>

            <td align="center" ><a href="javascript:MDM_openWindow('<?php echo $CONST_LINK_ROOT ?>/prgdisplaypic.php?thePic=<?php echo $picture ?>','Photograph','width=1,height=1')">

            <?php if ((!empty($avatar_id)&&($CONST_AVATARS_GALLERY == "Y") )) {

                    $res_avatar = mysql_query($query_avat = "SELECT * FROM avatars AS a

                    INNER JOIN pictures AS p

                        ON (a.pic_id = p.pic_id)

                    WHERE

                        a.avatar_id = $avatar_id

                    ");



                    $oAvatar = mysql_fetch_object($res_avatar);



                    $picture = str_replace("/members/", "/thumbs/large-", $oAvatar->pic_picture);

                } ?>

              <img name='thePic' border='0' src='<?php echo $CONST_LINK_ROOT.$picture ?>' width='60'  vspace="5" hspace="5"></a></td>

          </tr>

          <?if ($CONST_AVATARS_GALLERY == "Y") {?>

              <tr class="tdodd" >

                <td colspan="3" align="left">

                        <a href="#" onClick="javascript:window.open('<?php echo $CONST_LINK_ROOT?>/picture_gallery.php', 'Pictures', 'dependent=yes,resizable=no, width=400')"><?php echo AVATAR_SELECT ?></a>

                </td>

                <td>&nbsp;



                </td>

              </tr>

          <?}?>

*/ ?>

          <tr class="tdeven" >
            <td colspan="2"> 
			  <table>
			   <? if($Picture=='Y'){?>
			    <tr class="tdodd" >
   		<!--<td height="36" align="left" ><a href="#" onclick="return main_image()"><?php echo ADVERTISE_MAIN_PIC?></a></td>-->
		<td height="36" align="left" ><?php echo ADVERTISE_MAIN_PIC?></td>
    	<td colspan="3" align="left"><input type="file" name="fupload" id="fupload"  tabindex="36" size="20"> </td>
  				</tr>
				<? }?>
				
				<? if($avataar=='Y'){?>
      				<tr>
        			<td class="normal"><a href="#" onclick="return avtar_image()"><?php echo AVATAR_SELECT ?></a></td><td><input type="hidden" name="avat" id="avatar" value="" /> </td>
					 <td colspan="3" align="left">&nbsp;</td>
					</tr>
					<? } ?>
			 </table>
		  </td>
         </tr><p>&nbsp;</p>
		 <tr class="tdeven" >
		 	<td align="left" ><?php echo PRGAMENDAD_TITLE?><br><p>&nbsp;</p></td>
            <td  colspan="4" align="left"> <input type="text" class="inputl" name="txtTitle" size="30" maxlength='30' tabindex="15" value="<?=stripslashes($advtitle)?>"></td>
         </tr>
          <tr class="tdodd" >
            <td align="left" valign="top" ><?php echo PRGAMENDAD_TEXT2?></td>
            <td  colspan="4" align="left"> <textarea  class="inputl"rows="8" name="txtComment" cols="59" tabindex="15"><?=stripslashes($comment)?></textarea> </td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
          </tr>
		  </table>
		</td>
	</tr>
    	<tr>
            <td align="center" class="tdfoot" height="26px" >
			<input type="hidden" name="area" value="reg">
			<input type="image" src="<?=$SKIN_IMAGE_PATH?>/step2.gif" name="Submit2" value="Continue to Step2 >>"></td>
        </tr>
		</form>
	</table>
</div>
<div class="page-bottom"></div>
</div>
<?=$skin->ShowFooter($area)?>


<? } if($_REQUEST['frm']==2) { ?>
<?


/*if($_FILES['fupload']['size'] != 0) {
				
                        if ( $_FILES['fupload']['type'] == "image/pjpeg" ) { $extension=".jpg"; }

                        if ( $_FILES['fupload']['type'] == "image/jpeg" ) { $extension=".jpg"; }

                        $filename="$WUsername"."$extension";

                     echo   $targetfile="members/$WUsername/"."$filename";
   
   						//echo $targetfile;
   						$rs=mysql_fetch_array(mysql_query("SELECT * FROM adverts WHERE adv_userid = ".$Sess_UserId));
						$filename1 = $rs['adv_picture'];
						
			if( ($filename1!="templates/default/images/genericm.gif") && ($filename1!="templates/default/images/genericf.gif") )
			{
			unlink($filename1);
			//echo $filename1;
			}
						
						mysql_query("UPDATE adverts SET adv_imageappr='0' WHERE adv_userid=".$Sess_UserId);

                        copy($_FILES['fupload']['tmp_name'],"$targetfile");

}
if($_REQUEST['avat'] != 0)
{
		$value = $_REQUEST['avat'];
		$extension=".jpg";
 		$filename="avatar_$value"."$extension";

        $targetfile="members/"."$filename";
		$avatar = "on";
		mysql_query("UPDATE adverts SET adv_imageappr='1' WHERE adv_userid=".$Sess_UserId);
}*/


if (isset($_FILES['fupload'])) {
    # check whether immediate authorisation
    if ($_FILES['fupload']['name'] != "") {
        if ($_FILES['fupload']['size'] > $max_size) {
            $max_size=round($max_size/1024);
            error_page(sprintf(PRGPICADMIN_ERROR2,$max_size),GENERAL_USER_ERROR);
        }
        if ($_FILES['fupload']['type'] == "image/pjpeg" || $_FILES['fupload']['type'] == "image/jpeg") {
            if ( $_FILES['fupload']['type'] == "image/pjpeg" ) { $extension=".jpg"; }
            if ( $_FILES['fupload']['type'] == "image/jpeg" ) { $extension=".jpg"; }
            $tempusername="temp_".$Sess_UserId."_".time();						
            $targetfile="$tempusername"."$extension";		
			//echo "members/".$Sess_UserName."/$filename";	
			//$target="members/$WUsername/"."$targetfile";
			//copy($targetfile,$targetfile);	   
			
			move_uploaded_file($_FILES['fupload']['tmp_name'],"members/$targetfile");	
				$targetfile="members/".$targetfile;  
        } 
    }
}






if($_REQUEST['avat'] != 0)
{
		$value = $_REQUEST['avat'];
		$extension=".jpg";
 		$filename="avatar_$value"."$extension";

        $picture="members/"."$filename";
		$avatar = "on";
		mysql_query("UPDATE adverts SET adv_imageappr='1' WHERE adv_userid=".$Sess_UserId);
}


?>


<form enctype='multipart/form-data' method='post' action='<?php echo $CONST_LINK_ROOT?>/edit_profile_complete.php<?php print("?PHPSESSID=".session_id()); ?>' name="FrmAdvert" onSubmit="return Validate_FrmAdvert('update')">


<input type="hidden" name="avatar" value="<?php echo $avatar; ?>">
<input type="hidden" name="WUsername" value="<?php echo $WUsername; ?>">
<input type="hidden" name="WPassword" value="<?php echo $WPassword; ?>">
<input type="hidden" name="WPassConfirm" value="<?php echo $WPassConfirm; ?>">
<input type="hidden" name="WAuthEmail" value="<?php echo $WAuthEmail; ?>">
<input type="hidden" name="WAuthEmail2" value="<?php echo $WAuthEmail2; ?>">
<input type="hidden" name="WDay" value="<?php echo $WDay; ?>">
<input type="hidden" name="WMonth" value="<?php echo $WMonth; ?>">
<input type="hidden" name="WYear" value="<?php echo $WYear; ?>">
<input type="hidden" name="WGender" value="<?php echo $WGender; ?>">
<input type="hidden" name="WCountry" value="<?php echo $WCountry; ?>">
<input type="hidden" name="WCity" value="<?php echo $WCity; ?>">
<input type="hidden" name="WState" value="<?php echo $WState; ?>">
<input type="hidden" name="WPostcode" value="<?php echo $WPostcode; ?>">

<? 
if($arrQuestions_name!="")
{
for($intCounter=0;$intCounter<=count($arrQuestions_name)-1;$intCounter++)
		{
			$Questions=$arrQuestions_name[$intCounter];
?>
     <input type="hidden" name="Question_value[]" value="<?php echo $Questions; ?>">
<? } }
 if($arrOptions!="")
	{
			
		for($intCounter=0;$intCounter<=count($arrOptions)-1;$intCounter++)
		{
			$options=$arrOptions[$intCounter];
		
		?>
		<input type="hidden" name="drop_value[]" value="<?php echo $options; ?>">
	<? 	 } } 
	?> 
<!--<input type="hidden" name="lstSeeking" value="<?php// echo $lstSeeking; ?>">
<input type="hidden" name="lstBodyType" value="<?php// echo $lstBodyType; ?>">
<input type="hidden" name="lstHeight" value="<?php// echo $lstHeight; ?>">
<input type="hidden" name="lstChildren" value="<?php// echo $lstChildren; ?>">
<input type="hidden" name="lstEyecolor" value="<?php// echo $lstEyecolor; ?>">
<input type="hidden" name="lstHaircolor" value="<?php// echo $lstHaircolor; ?>">
<input type="hidden" name="lstSmoker" value="<?php// echo $lstSmoker; ?>">
<input type="hidden" name="lstReligion" value="<?php// echo $lstReligion; ?>">
<input type="hidden" name="lstMarital" value="<?php// echo $lstMarital; ?>">
<input type="hidden" name="lstEthnicity" value="<?php// echo $lstEthnicity; ?>">
<input type="hidden" name="lstEducation" value="<?php// echo $lstEducation; ?>">
<input type="hidden" name="lstEmployment" value="<?php// echo $lstEmployment; ?>">
<input type="hidden" name="lstIncome" value="<?php// echo $lstIncome; ?>">
<input type="hidden" name="lstDrink" value="<?php// echo $lstDrink; ?>">-->
<input type="hidden" name="chkSeekcpl" value="<?php echo $chkSeekcpl; ?>">
<input type="hidden" name="txtTitle" value="<?php echo $txtTitle; ?>">
<input type="hidden" name="txtComment" value="<?php echo $txtComment; ?>">
<input type="hidden" name="remLentext" value="<?php echo $remLentext; ?>">
<input type="hidden" name="targetfile" value="<?php echo $targetfile; ?>">
<!--<input type="hidden" name="lstSeeking" value="<?php// echo $lstSeeking; ?>">-->
<input type="hidden" name="chkSeekwmn" value="<?php echo $chkSeekwmn; ?>">
<input type="hidden" name="chkSeekmen" value="<?php echo $chkSeekmen; ?>">
<input type="hidden" name="targetfile" value="<?php echo $targetfile; ?>">
<!--<input type="hidden" name="targetfile" value="<?php// echo $targetfile; ?>">-->
<!--<input type="hidden" name="picture" value="<?//=$picture?>">-->
<? if($targetfile!="")
{ ?>
<input type="hidden" name="targetfile" value="<?php echo $targetfile; ?>">
<? } else { ?>
<input type="hidden" name="picture" value="<?=$picture?>">
<? } ?>
          <tr>

            <td colspan="4" class="tdhead" ></td>

          </tr>

          <tr class="tdodd">

            <!--<td ><?php echo PRGRETUSER_GENDER?></td>

            <td  colspan="3"> <select name="lstMySex" size="1" class="input"  tabindex="20">

                <option value='- Any -'>- <?php echo GENERAL_CHOOSE?> -</option>

                <option <?php if ($sql_mymatch->mym_gender=='M') print("selected");?> value="M"><?php echo SEX_MALE ?></option>

                <option <?php if ($sql_mymatch->mym_gender=='F') print("selected");?> value="F"><?php echo SEX_FEMALE ?></option>

              </select></td>

          </tr>

          <tr class="tdeven" >

            <td >

              <?=PRGRETUSER_AGES?>

            </td>

            <td colspan="3" class="tdeven" > <select name="txtMyFromAge" size="1" class="inputs"  tabindex="21">

                <?php

                        for ($i=18; $i < 100; $i++) {

                            if ($i == $sql_mymatch->mym_agemin) {

                                print("<option value='$i' selected>$i</option>");

                            } else {

                                    print("<option value='$i'>$i</option>");

                            }

                        }

                ?>

              </select>

              -

              <select class="inputs" size="1" name="txtMyToAge"  tabindex="22">

                <?php

                        for ($i=18; $i <= 99; $i++) {

                            if ($i == $sql_mymatch->mym_agemax) {

                                print("<option value='$i' selected>$i</option>");

                            } else {

                                print("<option value='$i'>$i</option>");

                            }

                        }

                ?>

              </select></td>

          </tr>

          <tr class="tdodd">

            <td >

              <?=PRGRETUSER_HEIGHT?>

            </td>

            <td  colspan="3"> <select class="inputs" name="lstMyMinHeight" size="1"tabindex="23">

                <?

                $out = "";

                $prev = "";

                for ($cm=122; $cm<=232; $cm++) {

                    $in_inches = round($cm/2.54);

                    $in_feets = floor($cm/30.48);

                    if ($in_inches-$in_feets*12 == 12) $in_feets++;

                    $cur_i = $in_feets."'".($in_inches-$in_feets*12)."&quot;";

                    $selected = ($cm == $sql_mymatch->mym_minheight) ? " SELECTED" : "";

                    if ($prev != $cur_i) $out .= '<option value="'.$cm.'"'.$selected.'>'.$cur_i.'('.$cm.ADVERTISE_CM.')'.'</option><br>';

                    $prev = $cur_i;

                }

                echo $out;

                ?>

              </select>

              -

              <select class="inputs" name="lstMyMaxHeight" size="1"tabindex="24">

                <?

                $out = "";

                $prev = "";

                for ($cm=122; $cm<=230; $cm++) {

                    $in_inches = round($cm/2.54);

                    $in_feets = floor($cm/30.48);

                    if ($in_inches-$in_feets*12 == 12) $in_feets++;

                    $cur_i = $in_feets."'".($in_inches-$in_feets*12)."&quot;";

                    if (isset($sql_mymatch->mym_maxheight)) {

                        $selected = ($cm == $sql_mymatch->mym_maxheight) ? " SELECTED" : "";

                    }

                    else {

                        $selected = ($cm == 230) ? " SELECTED" : "";

                    }

                    if ($prev != $cur_i) $out .= '<option value="'.$cm.'"'.$selected.'>'.$cur_i.'('.$cm.ADVERTISE_CM.')'.'</option><br>';

                    $prev = $cur_i;

                }

                echo $out;

                ?>

              </select> </td>

          </tr>

          <tr class="tdeven">

            <td >

              <?=PRGRETUSER_SMOKER?>

            </td>

            <td > <select name="lstMySmoker" size="1" class="input" tabindex="25">

                <option value="- Any -" selected>

                <?=SEARCH_ANY?>

                </option>

                <?php populate_lists('SMK','base','adv',$sql_mymatch->mym_smoker); ?>

              </select></td>

            <td >

              <?=PRGRETUSER_BODYTYPE?>

            </td>

            <td > <select class="input" name="lstMyBodyType" size="1" tabindex="26">

                <option value="- Any -" selected>

                <?=SEARCH_ANY?>

                </option>

                <?php populate_lists('BDY','base','adv',$sql_mymatch->mym_bodytype); ?>

              </select> </td>

          </tr>

          <tr class="tdodd">

            <td >

              <?=PRGRETUSER_RELATIONSHIP?>

            </td>

            <td  colspan="3" class="tdodd"> <select class="input" name="lstMySeeking" size="1" tabindex="27">

                <option value="- Any -" selected>

                <?=SEARCH_ANY?>

                </option>

                <?php populate_lists('SKG','base','adv',$sql_mymatch->mym_relationship); ?>

              </select> </td>

          </tr>-->

          <tr class="tdeven">

            <td  valign="top">

              <?=PRGRETUSER_COMMENT?>

            </td>

            <td  colspan="3" class="tdeven"> <textarea  class="inputl"rows="8" name="txtMyComment" cols="59" tabindex="28"><?=stripslashes($sql_mymatch->mym_comment)?></textarea>

            </td>

          </tr>

          

        

      </table>
	   <tr>

            <td align="center"  valign="top" class="tdfoot" height="26px" >
<input type="hidden" name="area" value="reg">
 <input type="submit" name="Submit" value="<?php echo BUTTON_SUBMIT ?>" style="color:#71293e" ></td>

  </tr></form></td></tr></table></div><div class="page-bottom"></div></div>

<?=$skin->ShowFooter($area)?>

<? } ?>
