<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="search.aspx.cs" Inherits="JuSNS.Web.inc.Ajax.search" %>
<!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>
<title><% Response.Write(JuSNS.Config.UiConfig.SiteName); %> | 高级搜索</title>
<link href="../../../template/<% Response.Write(JuSNS.Config.UiConfig.SkinStyle); %>/css/base.css" id="skinpath" type="text/css" rel="stylesheet" />
<script language="javascript" type="text/javascript" src="../../../js/ajax.js"></script>
<script language="javascript" type="text/javascript" src="../../../js/public.js"></script>
</head>
<body>
    <form id="Form1" runat="server" action="../../../home/search.aspx" method="post">
    <input type="hidden" id="Seach_txtCity" runat="server" />
    <input type="hidden" id="Seach_txtBegin" runat="server" />
    <input type="hidden" id="Seach_txtEnd" runat="server" />
    <input type="hidden" id="Seach_txtSex" runat="server" />

   <div class="padding10"> 
       <div class="spline"></div>
       <div class="content pstr">
                <label class="f-label" for="homeprovince">姓名或Email</label>
               <input type="text" class="f-text s30" id="dnameKeys" name="dnameKeys" /> 
       </div> 
        <div class="content pstr">
                <label class="f-label" for="homeprovince">所在地区</label>
                 <select name="Seach_homeprovince" id="Seach_homeprovince" onchange="ChangeProv(this);">
                        <option value="0" selected="selected">省份</option>
                        <%Response.Write(province);%>
                 </select>    
                <select name="Seach_SlctCity" id="Seach_SlctCity">
                <option value="0" selected="selected">城市</option>     
               </select> 
       </div> 
         <div class="spline"></div>
        <div class="content pstr">
                <label class="f-label" for="homeprovince">年龄范围</label>
               <select  id="Seach_selBegin" runat="server"><option value="0" selected="selected">不限</option></select>
               ~ <select  id="Seach_selEnd" runat="server" ><option value="0" selected="selected">不限</option></select> 
        </div> 
         <div class="spline"></div>
        <div class="content pstr">
                <label class="f-label" for="homeprovince">性别</label>
                <input type="radio" name="rad" id="Seach_rad1" value="1"/>男 
               <input type="radio" name="rad" id="Seach_rad2" value="0" />女
               <input type="radio" name="rad" id="Seach_rad3" value="2" checked="checked" />不限        
                有头像 <label><input type="checkbox"  value="1" id="Seach_CheTX" runat="server"/>是</label>
       </div>
       <div class="content pstr">
            <label class="f-label">&nbsp;</label>  
            <input type="button" class="f-button" id="networkFormSubmit" value="开始找朋友..."  onclick="Void();"/>&nbsp;
       </div>
        
      </div> 
   <div class="spline"></div>
   </form>
</body>
</html>

<script language="JavaScript" type="text/javascript">
//function $(o){return document.getElementById(o);}
LoadYear();
ChangeProv(document.getElementById("Seach_homeprovince"));
LoadInfo();
var arryprv_search = new Array(<%= cityarray%>);
function LoadYear()
{
    for(var i=12;i<70;i++)
    {
        $("Seach_selBegin").options.add(new Option(i,i));
        $("Seach_selEnd").options.add(new Option(i,i));
    }
}

function ChangeProv(obj) 
{
   var objcity = document.getElementById('Seach_SlctCity');
     var s = obj.options[obj.selectedIndex].value;
    objcity.options.length = 0;
    var optn = document.createElement('option');
    optn.value = '0';
    optn.innerHTML = '不限';
    objcity.appendChild(optn);
    if( s == '0')
    {
        return;
    }
    for(var i=0;i<arryprv_search.length;i++)
    {
        var arr = arryprv_search[i];
        if(arr[0] == s)
        {
            var opt = document.createElement('option');
            opt.value = arr[1];
            opt.innerHTML = arr[2];
            objcity.appendChild(opt);
        }
    }
}

//初始化搜索选项
function LoadInfo()
{
    selected($('Seach_SlctCity'),$("Seach_txtCity").value);
    selected($('Seach_selBegin'),$("Seach_txtBegin").value);
    selected($('Seach_selEnd'),$("Seach_txtEnd").value);
    
    var s=$("Seach_txtSex").value;
    if(s==0)
    {
        $("Seach_rad2").checked=true;
    }
    else if(s==1)
    {
        $("Seach_rad1").checked=true;
    }
    else if(s==2)
    {
        $("Seach_rad3").checked=true;
    }
}

function selected(obj,value)
{
    for(var i=0;i<obj.options.length;i++)
    {
        if(obj.options[i].value==value)
        {
            obj.selectedIndex=i;
        }
    }
}

function Void()
{
    var tx=$("Seach_CheTX").value;
    var sex=$("Seach_rad1").value;
    if(!$("Seach_CheTX").checked)
    {
       tx=0; 
    }
    if($("Seach_rad2").checked)
    {
       sex=0; 
    }
    else if($("Seach_rad3").checked)
    {
       sex=2; 
    }
    window.top.location.href="<%=root %>/home/search/?namekey="+escape($("dnameKeys").value)+"&Pr="+$("Seach_homeprovince").value+"&City="+$("Seach_SlctCity").value+"&Begin="+$("Seach_selBegin").value+"&End="+$("Seach_selEnd").value+"&Sex="+sex+"&TX="+tx;
    LoadInfo();
}
</script>