﻿var cityHtmlTpl='<li class="float"><img src="/images/index_08.gif" width="4" height="6" />&nbsp;&nbsp;<a href="javascript:GoToCity({0},this);"  title="{2}"   onmouseover="showsite(this.title)">{1}</a></li>'
jQuery(function(){
    jQuery("#backtoprivince").click(function(){
    $("#siteallname").text('');
    jQuery(this).hide();
    if(document.all)
    {
        jQuery("#listcity").hide("slow");
        jQuery("#listprovince").show("slow");
    }
    else
    {
        jQuery("#listcity").hide();
        jQuery("#listprovince").show();
    }
    
    });
//    jQuery("a[name='region0']").each(function(){
//        this.href='javascript:alert("您好！请切换到相应的城市浏览！");';
//    })
});
function showsite(title)
{
    $("#siteallname").text(title);
}
function GetCity(provinceid,o)
{
    jQuery(o).before("<img style='position:absolute' src='/images/loading1.gif' alt='加载中...'/>");
    jQuery.getJSON("/ajax.aspx?id="+provinceid+"&action=getcity",function(data){
    
        if(data.length>0){
            if(document.all)
                jQuery("#listprovince").hide("slow");
            else 
                jQuery("#listprovince").hide();
            
            jQuery("#listcity").show();
            jQuery("#backtoprivince").show();
            jQuery("#listcity").empty();
            jQuery("#listcity").html("");
            for(var ki=0;ki<data.length;ki++){jQuery("#listcity").append(String.Format(cityHtmlTpl,data[ki].ID,data[ki].City.substr(0,6),data[ki].City));}
        }
         jQuery(o).prev().remove();
    });
    }
function GoToCity(cityid,o)
{
    //jQuery(o).before("<img style='position:absolute' src='/images/loading1.gif' alt='加载中...'/>");

        window.location.replace("/GoToCity.aspx?ID="+cityid);
        return ;
//    $.getJSON("/ajax.aspx?id="+cityid+"&action=getcityurl",function(data){
//        if(parseInt(data.HasAgent)==0)
//        {
//            window.location.href="/AgentRead.aspx?Region="+data.Region+GetRandomNum(1000,9999);
//        }
//        else if(parseInt(data.HasAgent)==1)
//        window.location.href="/index.aspx?Region="+data.Region+GetRandomNum(1000,9999);
//    })
}
function FindPassword()
{
        var email=$("#txtemail").val();
        if(!(/^([a-zA-Z0-9._-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/).test(email))
        {
        $("#txtemail").after("<span style='color:red'> *</span>");
        return false;
        }
        $.ajax
        ({
            url:"/Ajax/UserService.asmx/SendMail",
            data:{email:email,c:DOM("c").checked},
            dataType:"xml",
            type: "POST",
            success:function(data)
            {
                var dataval=$("string",data).text();
                if(dataval=="1")
                {
                    $(".reg_con").html('<div class="yellow find_tt">我们已经把密码发送到你的邮箱'+email+'中,请注意查收！</a>');
                }
                else
                {
                    $(".find_tt").html("<span> 发送失败,可能你的邮箱不存在！</span>");
                }
            },
            error:function(err){alert(err.responseText);}
        });

}
function search()
{
    var keyword=jQuery("#txthkey").val();
    var stype=jQuery("#hstype").val();
    if(keyword=='请输入关键字...'||keyword=='')return ;
    if(stype=="")return;
    jQuery("#st").val(stype);
    jQuery("#sk").val(keyword);
    DOM("sform").submit();
}
jQuery(function(){
    if(jQuery("ul.pad02 li:last-child").text().indexOf('注销退出')>-1)
    {
        jQuery("ul.pad02 li:last-child").click(function(){if(confirm('确定退出管理?'))window.location.href='loginout.html'});
    }
});
var Init={
        loadok:[0,0,0],
        labels:["SSLabel_05_01","SSLabel_05_02","SSLabel_05_03"],
        ContentBoxs:["SSCont_05_01","SSCont_05_02","SSCont_05_03"],
        GBID:["grouprecommend","groupwillend"],
        I_GB_W:[],
        I_GB_E:[]
    };
function DOM(id){return document.getElementById(id)?document.getElementById(id):null;}
String.Format = function() {
if(arguments == null) return "";
if(arguments.length == 0)return "";
if(arguments.length == 1)return arguments[0];
var reg = /{(\d+)?}/g;
var args = arguments;
var result = arguments[0].replace(reg,function($0, $1) {return  args[parseInt($1)+1];});
return result;
}
String.EFormat = function() {
 if(arguments.length == 0)return "";
 if(arguments.length == 1)return arguments[0];
 var reg = /<!--%(\d+)?%-->/g;
 var args = arguments;
 var result = arguments[0].replace(reg,function($0, $1) {return  args[parseInt($1)+1];});
 return result;
}
function GetRandomNum(Min,Max){   
        var Range = Max - Min;   
        var Rand = Math.random();   
        return(Min + Math.round(Rand * Range));   
}  



 
function CreateWindow(id,title,subtitle,content,okval,okevent,escval,escevent)
{
    var htmlstr='<div id="float{0}" style="text-align:left">{1}<div class="float" ><img src="/images/float_01.gif" width="372" height="23" /></div><div class="float"><img src="/images/float_02.gif" width="28" height="23" border="0" onclick="MM_showHideLayers(\'float{0}\',\'\',\'hide\')" style="cursor:pointer" /></div><div class="show_float float"><strong class="yellow font-14">{2}</strong><br />{3}</div><div class="show_float_tt float"><ul><li class="float"><input type="button" name="Submit34" value="{4}" class="but_bg but_bg01" onclick="{5}" /></li><li class="float"><input type="button" name="Submit34" value="{6}" onclick="{7}" class="but_bg but_bg01" /></li></ul></div></div><br/><br/>';
    return String.Format(htmlstr,id,title,subtitle,content,okval,okevent,escval,escevent);
}
function AlertWinow(id,content,okevent,escevent)
{
    return CreateWindow(id,"","系统提示",content,"确定","MM_showHideLayers('float"+id+"','','hide');"+okevent, "取消","MM_showHideLayers('float"+id+"','','hide');"+escevent);
    
}
function ComfirmWinow(id,subtitle,content,okval,okevent,escval,escevent)
{
    return CreateWindow(id,"",subtitle,content,okval,"MM_showHideLayers('float"+id+"','','hide');"+okevent, escval,"MM_showHideLayers('float"+id+"','','hide');"+escevent);
    
}
function ShowWindow(id)
{
    MM_showHideLayers('float'+id,'','show');
}
function HideWindow(id)
{
    MM_showHideLayers('float'+id,'','hide');
}
