<?php
  $age_from		= (isset($_SESSION['agefrom'])&&$_SESSION['agefrom']<>"")	?	$_SESSION['agefrom']		:	"18";
       $age_to		= (isset($_SESSION['ageto'])&&$_SESSION['ageto']<>"")	?	$_SESSION['ageto']		:$age_from	+ 22;
       $user_gender	= (isset($_SESSION['user_gender'])&&$_SESSION['user_gender']<>"")	?	$_SESSION['user_gender']	:	"Male";


//checking user login status

?>

<script language="javascript" type="text/javascript">
    if (typeof changeCSS == 'function')
    {
        function changeCSS(obj, type)
        {
            if (type == 'text') {

                    obj.className = 'textbox';

            } else if (type == 'textarea') {

                    obj.className = 'textbox';

            } else if (type == 'select') {

                    obj.className = 'textbox';

            } else {

                    obj.className = 'textbox';

            }
        }
    }

    if (typeof validate == 'function')
    {
        function validate()
        {

            var frm = document.frmTellsl;

            if (frm.user.value=="")
            {

                    alert("Please enter username.");

                    frm.user.className ='errorinput';

                    frm.user.focus();

                    return false;

            }//end if

            if (frm.pass.value=="")

            {

                    alert("Please enter password.");

                    frm.pass.className ='errorinput';

                    frm.pass.focus();

                    return false;

            }//end if

            return true;

        }
    }
</script>


<div class="search-partnrt-home">
	<h2>Search Partner</h2>
	<form name="frmSearch" method="post" action="search_profiles.php">
				<div class="R_search_outer home_srch">
					<div class="R_search_inner">
						<div class="R_search_txt bx-txt-sz">I am a</div>
						<div class="R_search_feild">
							<select name="vSG" class="select-mini">
								<option value="Female" <?php echo ($_SESSION['user_gender']=="Male") ? "selected" : ""?>>Man looking for a Woman</option>
								<option value="Male" <?php echo ($_SESSION['user_gender']=="Female") ? "selected" : ""?>>Woman looking for a Man</option>
								<?php if($enable_same_sex_search == 'Y') { ?>
								<option value="Females" <?php echo ($_SESSION['gender_search']=="Females") ? "selected" : ""?>>Women looking for a Woman</option>
								<option value="Males" <?php echo ($_SESSION['gender_search']=="Males") ? "selected" : ""?>>Man looking for a Man</option>
								<?php } ?>
							</select>
						</div>
					</div>
					<div class="R_search_inner">
						<div class="R_search_txt bx-txt-sz">Who is from</div>
						<div class="R_search_feild">
							<div class="select-small_outer">
								<select name="vSAF" class="select-small">
									<?php foreach ($arrPartnerAgeFrom as $key => $value){?>
									<option value="<?php echo $value;?>" <?php echo $age_from==$value?"selected":""?>><?php echo $value;?></option>
									<?php }//end foreach ?>
								</select> 
							</div>
							<div class="select-small_txt">to</div>
							<div class="select-small_outer">
								<select name="vSAT" class="select-small">
									<?php foreach ($arrPartnerAgeFrom as $key => $value) {?>
									<option value="<?php echo $value;?>" <?php echo $age_to==$value?"selected":""?>><?php echo $value;?></option>
									<?php }//end foreach ?>
								</select>
							</div>
						</div>
					</div>
					<div class="clear"></div>
					<div class="R_search_inner">
						<div class="R_search_feild">
							<input type="checkbox" name="vSP" value="Y"> Who has a photo 
						</div>
					</div>
					<div class="R_search_inner">
						<div class="R_search_feild">
						<div class="log-btn">
							<input type="hidden" name="SearchNow" value=" Search ">
							<input name="imageField" type="submit" class="search-sml-btn"  value="Search">
							<input type="hidden" name="sex" value="<?php echo $_SESSION['user_gender']; ?>">
							<input type="hidden" name="agefrom" value="<?php echo $_SESSION['agefrom']; ?>">
							<input type="hidden" name="ageto" value="<?php echo $_SESSION['ageto']; ?>">
						</div>
						</div>
					</div>
				</div>					
			</form>
</div>
                            


					<!--<table width="100%"  border="0" cellspacing="0" cellpadding="0">

                  <tr>

                          <td class="box1"><table width="100%"  border="0" cellspacing="0" cellpadding="0">

                        <tr>

                                <td class="maintextCopy bx-login-hd" align="center">Already a member? Login here </td>

                              </tr>
							  

                            </table-->

                              <!--<table width="100%"  border="0" cellspacing="0" cellpadding="3">

								<form name="frmTellsl" method="post" action="login.php" onSubmit="return validate();">

                                <tr>

                                  <td width="49%" align="right" class="maintextCopy bx-txt-sz">Username &nbsp;</td>

                                  <td width="51%" align="left"><input name="user" type="text" class="textbox textbox01" onKeyDown="changeCSS(this, 'text');" tabindex="1"></td>

                                </tr>

                                <tr>

                                  <td align="right" class="maintextCopy bx-txt-sz">Password &nbsp;</td>

                                  <td align="left"><input name="pass" type="password" class="textbox textbox01" onKeyDown="changeCSS(this, 'text');" tabindex="2"></td>

                                </tr>

                                <tr>

                                  <td align="right">&nbsp;</td>

                                  <td align="left"><input type="hidden" name="sex" value="<?php echo $_SESSION['gender_search']; ?>">

                                    <input type="hidden" name="agefrom" value="<?php echo $_SESSION['agefrom']; ?>">

									<input type="hidden" name="ageto" value="<?php echo $_SESSION['ageto']; ?>"><input name="LN" type="submit" class="loginbutton" value=" Login " tabindex="3">&nbsp;<a href="register.php"><input type="button" class="back-btn" value="Register" tabindex="4" onClick="location.href='register.php';"></a></td>

                                </tr>

								</form>

                      </table></td>

                  </tr>

                      </table>-->


<?php

//}//end else

//subpage banner display

if($PG_TITLE!='index.php')

{

	$sqlBanners = $objST->select_rows(TABLEPREFIX.'Banners','*,min(nCount)',"where vActive='1' and vLocation='Sub'

							GROUP BY nBId order by rand(),nPosition desc limit 0,4");

	

	if(mysql_num_rows($sqlBanners)>0)

	{

		while($arrBanner=mysql_fetch_array($sqlBanners))

		{

				$Newbannerwidth=($arrBanner['vWidth']!='')?$arrBanner['vWidth']:'234';

				$Newbannerheight=($arrBanner['vHeight']!='')?$arrBanner['vHeight']:'60';

			

				if($arrBanner['nType']=='OpenX')

				{

					$showBannerCode='<div style="overflow:auto; width:'.$Newbannerwidth.'px;height:'.$Newbannerheight.'px;">'.$arrBanner['vOpenxDes'].'</div>';

				}//end if

				else

				{

					if($arrBanner['vImg']!='')

					{

						$showBannerCode='<a href="'.$arrBanner['vlocUrl'].'" target="_blank"><img src="./banners/'.$arrBanner['vImg'].'" name="img1" width="'.$Newbannerwidth.'" height="'.$Newbannerheight.'" border="0" alt="'.$arrBanner['vName'].'"></a>';

					}//end if

				}//end else

			

				mysql_query("update ".TABLEPREFIX."Banners set nCount=nCount+1 where nBId='".$arrBanner['nBId']."'") or die(mysql_error());

?>




						  <div class="twelve"><?php echo $showBannerCode;?></div>

<?php

		}//end while

	}//end if

}//end if

?>