$def with (group,contact,currGroup,currAccount,StorageLocation)
<!DOCTYPE html>
<html>
<head>
<META HTTP-EQUIV="pragma" CONTENT="no-cache"> 
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate"> 
<META HTTP-EQUIV="expires" CONTENT="0"> 
<meta http-equiv=Content-Type content="text/html;charset=utf-8" />
<link rel="stylesheet" type="text/css" href="/static/style/common.css" />
<link rel="stylesheet" type="text/css" href="/static/js/jqtransformplugin/jqtransform.css" />
<link rel="stylesheet" href="/static/style/jquery.Jcrop.css" type="text/css" />
<style>

</style>
<script type="text/javascript" src="/static/js/jquery-1.7.1.js"></script>
<script type="text/javascript" src="/static/js/jquery.artDialog.source.js?skin=aero"></script>
<script type="text/javascript" src="/static/js/jqtransformplugin/jquery.jqtransform.js"></script>
<script type="text/javascript" src="/static/js/jquery.smsdata.js"></script>
<script type="text/javascript" src="/static/js/smschar.js"></script>
<script type="text/javascript" src="/static/js/jquery.Jcrop.js"></script>
<script type="text/javascript" src="/static/js/plantform.js"></script>
<script type="text/javascript">

var PBMainView_WEB_USERDEF = '$trans('PBMainView_WEB_USERDEF')'
var PBMainView_WEB_USERDEF_CONTACTINFO = '$trans('PBMainView_WEB_USERDEF_CONTACTINFO')'
var PBMainView_WEB_ADDGROUP = '$trans('PBMainView_WEB_ADDGROUP')'
var PBMainView_WEB_GROUPNAME_CANOT_EMPTY = '$trans('PBMainView_WEB_GROUPNAME_CANOT_EMPTY')'
var PBMainView_WEB_GROUPNAME_TOOLONG = '$trans('PBMainView_WEB_GROUPNAME_TOOLONG')'
var PBMainView_WEB_GROUPNAME_EXISTS = '$trans('PBMainView_WEB_GROUPNAME_EXISTS')'
var PBMainView_OneInfoPanel_ScrollPanel_BtnGroup = '$trans('PBMainView_OneInfoPanel_ScrollPanel_BtnGroup')'
var PBMainView_EditPanel_BR_StaticBox_CB_Type = '$trans("PBMainView_EditPanel_BR_StaticBox_CB_Type")'
var PBMainView_WEB_CANCEL = '$trans('PBMainView_WEB_CANCEL')'
var PBMainSim_DetailInfoPhoneNumLabel = '&trans("PBMainSim_DetailInfoPhoneNumLabel")'
var PBMainSim_DetailInfoHomeNumLabel = '&trans("PBMainSim_DetailInfoHomeNumLabel")'
var PBMainSim_DetailInfoEmailLabel = '&trans("PBMainSim_DetailInfoEmailLabel")'
var PBMainView_AddItem_MustFill_Error = '&trans("PBMainView_AddItem_MustFill_Error")'
var PB_BUTTON_OK = '$trans('PB_BUTTON_OK')'
var PBMainView_MoreInfoPanel_BtnDelete = '$trans("PBMainView_MoreInfoPanel_BtnDelete")'
var WORDS_TOO_LONG = "$trans('WORDS_TOO_LONG')"
var WORDS_ILLEGAL = "$trans('WORDS_ILLEGAL')"
var MAILBOX_ILLEGAL = "$trans('MAILBOX_ILLEGAL')"





var m_StorageLocation = $:json_encode(StorageLocation)

if (m_StorageLocation == "0")
{

    var infoType = 	{
        '$trans('PBMainView_WEB_MobilePhone')' : ['$trans('PBMainView_WEB_MobilePhone')','$trans('PBMainView_WEB_HomePhone')', '$trans('PBMainView_WEB_WorkPhone')', '$trans('PBMainView_WEB_HomeFaxPhone')', '$trans('PBMainView_WEB_BBPhone')', '$trans('PBMainView_WEB_OtherPhone')','$trans('PBMainView_WEB_USERDEF')'],
        '$trans('PBMainView_WEB_EMail')' : ['$trans('PBMainView_WEB_WorkMail')', '$trans('PBMainView_WEB_HomeMail')', '$trans('PBMainView_WEB_OtherMail')','$trans('PBMainView_WEB_USERDEF')'],
        '$trans('PBMainView_WEB_TalkTool')': ['AIM', 'Msn', 'Yahoo', 'Skype', 'QQ', 'Gtalk', 'ICQ', 'Jabber','$trans('PBMainView_WEB_USERDEF')'],
        '$trans('PBMainView_WEB_Address')' : ['$trans('PBMainView_WEB_WorkAddress')', '$trans('PBMainView_WEB_HomeAddress')', '$trans('PBMainView_WEB_OtherAddress')','$trans('PBMainView_WEB_USERDEF')'],
        '$trans('PBMainView_WEB_Company')': ['$trans('PBMainView_WEB_Company')', '$trans('PBMainView_WEB_Other')','$trans('PBMainView_WEB_USERDEF')'],
        '$trans('PBMainView_WEB_Remarks')': ['$trans('PBMainView_WEB_Remarks')']
    }


    var infoTypeName = 	{
        '$trans('PBMainView_WEB_MobilePhone')' : ['PhoneNumber-Mobile','PhoneNumber-Home', 'PhoneNumber-Work', 'PhoneNumber-FaxHome', 'PhoneNumber-Page', 'PhoneNumber-Other','PhoneNumber'],
        '$trans('PBMainView_WEB_EMail')' : ['Email-Work', 'Email-Home', 'Email-Other','Email'],
        '$trans('PBMainView_WEB_TalkTool')' : ['IM-Aim', 'IM-Msn', 'IM-Yahoo', 'IM-Skype', 'IM-Qq', 'IM-Gtalk', 'IM-Icq', 'IM-Jabber','IM'],
        '$trans('PBMainView_WEB_Address')' : ['PostalAddress-Work', 'PostalAddress-Home', 'PostalAddress-Other','PostalAddress'],
        '$trans('PBMainView_WEB_Company')': ['Organization-Work', 'Organization-Other','Organization'],
        '$trans('PBMainView_WEB_Remarks')': ['Notes']
    }


    //var infoGroup = ['分组','家人','朋友','同事','其他','添加分组'];
    var infoTypeOther = ['PhoneNumber','Email','IM','PostalAddress','Organization'];
    //需传入的账户分组数据
    var selectedGroup = $:json_encode(currGroup);
    var selectedAccount = $:json_encode(currAccount);
    var AccountData  =$:json_encode(group)
    /*
    {
        '': ['分组','家人','朋友','同事','其他','添加分组'],
        '手机账户': ['分组','企业','驴友','基友','添加分组']
    }
    */
    var curGroup = '';//记录当前分组
    var groupLen = 32;//分组名称长度限制默认为10
    var viewOrEdit = true;
    var initimgPath = "/static/imgs/avatar.png";
   
    $$(function() {
    
        m_accountgroup = $$("<div class='fl account mart4' id='account'><select class='' name='phoneaccount'id='phoneaccount'></select></div><div class='fl group mart4'  id='grupDefine'></div>");
        $$("#maininfor").append(m_accountgroup);
        
        m_addwarp = $$("<div id='addWrap'><select id='infoTypeSelector'><option val='0'>$trans('PBMainView_WEB_SELECT')</option></select></div>");
        $$("#pad15").append(m_addwarp);
        
        m_firstname = $$("<input id='name' type='text'  name='name' class='name' placeholder='$trans('PBMainView_FuncBtn_BR_StaticBox_TC_Name')' maxlength='320'/>");
        $$(".mainInfor").append(m_firstname);
        
        m_nickname = $$("<input type='text' id='nickname' name='nickname' class='nickname mart4' placeholder='$trans('PBMainView_EditPanel_NickNameSBox_Key')' maxlength='320'/>");
        $$(".mainInfor").append(m_nickname);
        
        $$("#avatar img").attr("src",initimgPath);
    
        var j = 0;
        for(var k in infoType) {
            $$('#optionContainer').append(createSelect(k,false,j));		
            $$('<option />').html(k).appendTo($$('#infoTypeSelector'));
            j++;
        }
        creatAccountSelect();
        creatGroupSelect(selectedAccount);
        //初始化美化表单
        $$('#contact-form').jqTransform();
        
        
        $$('#infoTypeSelector').change(function() {
            //console.log($$(this).val());
            $$('#optionContainer ul[rel="' + $$(this).val() + '"]').after(createSelect($$(this).val(), true));
            $$(this).val('0');
            $$('#contact-form').removeClass('jqtransformdone').jqTransform();
        })
        $$('#grupDefine>.jqTransformSelectWrapper>ul li:eq(0)').hide();
        $$('#addWrap>.jqTransformSelectWrapper>ul li:eq(0)').hide();
    //===================	
        $$('#addWrap>.jqTransformSelectWrapper>ul li a').click(function(){
            if($$(this).attr('index')) {
                var key = function(idx) {
                    var i=0;
                    for(var j in infoType) {
                        if(++i == idx) {
                            return j;
                        };
                    }
                }($$(this).attr('index'));
                var k = $$(this).attr('index') - 1;
                $$('#optionContainer ul[rel="' + key + '"]').after(createSelect(key, true, k));
                $$('#contact-form').removeClass('jqtransformdone').jqTransform();
                $$('.jqTransformSelectWrapper').each(function(index) {
                    $$(this).css('zIndex', 100 - index);
                })
                $$(this).attr('class','').parents('ul').find('li:eq(0) a').attr('class','selected');
                $$('#addWrap span:eq(0)').html('$trans("PBMainView_WEB_SELECT")');
            }												
        })
    //==================	
    })
    
    var createSelect = function(type, dropable, j) {
        var liElement = [];
        liElement[0] = $$('<select />');
        for(var i=0, len=infoType[type].length; i<len; i++) {
            $$('<option />').html(infoType[type][i]).appendTo(liElement[0]);
        }
        var name = infoTypeName[type][0];
        liElement[1] = $$('<input />').attr({'type':'text','rel':infoTypeOther[j]});
        if(dropable) {
            //liElement[2] = $$('<a />').html('$trans("PBMainView_MoreInfoPanel_BtnDelete")').click(function() {
            liElement[2] = $$('<img />').attr("src","../../static/imgs/clear__.png").attr("style","margin:5px 0px 0px 0px").attr('title',PBMainView_MoreInfoPanel_BtnDelete).click(function(){
                if(type == $$(this).parents('ul').attr('rel')) {
                    $$(this).parents('ul').prev().attr('rel', type);
                }
                $$(this).parents('ul').remove();
            });
            
        }
        $$('#optionContainer ul[rel="' + type + '"]').removeAttr('rel').addClass('ulSlt');
        var ulElement = $$('<ul />').attr({'rel':type, 'wording': type}).addClass('ulSlt');
        
        for(var i=0, len=liElement.length; i<len; i++) {
            ulElement.append(liElement[i]);
            liElement[i].wrap('<li class="li_' + i + '"/>');
        }
        ulElement.append('<li class="errorMsg"></li>');
        return ulElement;
    }
    //创建分组列表
    var creatGroupSelect = function(num){

        var num = num ? num : '';
        curGroup = num;
        $$("#grupDefine").html("");
        var groupStr = "<select class='' name='group' id='group'>";
        groupStr += "<option value=''>" +'$trans("PBMainView_OneInfoPanel_ScrollPanel_BtnGroup")'+"</option>";
        $$(AccountData[num]).each(function(i,n){
            /*if (i==0) {
                groupStr += "<option value=''>" +n+"</option>";
                
            }
            else {*/
                groupStr += "<option value='"+i+"'>" +n+"</option>";
            //}
        })
        groupStr += "<option value=''>" +'$trans("PBMainView_WEB_ADDGROUP")'+"</option>";
        groupStr += "</select>";
        $$("#grupDefine").html(groupStr);
    }
    //创建账户列表
    var creatAccountSelect = function(){
        $$("#account").html("");
        var groupStr = "<select class='' name='phoneaccount' id='phoneaccount'>";
        for(var p in AccountData){
             if(p == '') p = '$trans("PBMainView_EditPanel_BR_StaticBox_CB_Type")';
            groupStr += "<option>" +p+"</option>";
        }
        groupStr += "</select>";
        $$("#account").html(groupStr);
    }
    /*$$('#optionContainer>.jqTransformSelectWrapper>ul li a').click(function(){
        alert("222");
    })*/
    
    var imgWidth = 0;
    var imgHeight = 0;
    var jcrop_api;
    var Jcrop_init=false;
    function getImageUrlPath(){
        $$.ajax({url: '/PB/loadImagePath?now='+ new Date().getTime(), async: false, dataType: 'json', success: function(result){
            if(result.status == "wait") {
                setTimeout(function(){getImageUrlPath();}, 1000);
            }else{
                if(result.status == "finish"){
                    jcrop_api.setImage(result.path);
                    $$('#imgText').val(result.path);
                    imgWidth = result.width;
                    imgHeight = result.height;
                }
            }
        }});
    }
    $$(document).ready(function(){
        //上传头像事件
        
        /*
        $$("#defaultPic").Jcrop({
            aspectRatio:1
        },function() {
            jcrop_api = this;
        });
        */
        $$('#avatar').click(function(){
        if (Jcrop_init == false)
        {
            $$("#defaultPic").Jcrop({
                aspectRatio:1
            },function() {
                jcrop_api = this;
            });
            Jcrop_init = true;
        }
        //return false;
            $$('#imgText').val('');
            art.dialog({
                 title: '$trans('SELECT_YOUR_IMG')',
                 content: $$('#uploadImg')[0],
                 lock: true,
                 okVal: PB_BUTTON_OK,
                 cancelVal: PBMainView_WEB_CANCEL,
                 background:'#fff',
                 opacity: 0.7,
                 ok: function(){
                    this.close;
                    //alert(imgWidth+"==="+imgHeight);
                    var path = $$('#imgText').val();
                    if(path == '') return ;
                    $$('#loadPic img').attr('src',path);
                    var inWidth = imgWidth + 50;
                    var inHeight= imgHeight + 75;
                    var outWidth = $$('#wrap').width();
                    var outHeight = $$('#wrap').height() + 76;
                    var left = (outWidth - inWidth)/2;
                    var top = (outHeight - inHeight)/2;
                    //alert(inWidth+":"+inHeight+":"+outWidth+":"+outHeight+":"+left+":"+top);
                    //art.dialog({id: 'uploadAvater'}).position({'left':left});
                    //记得放在jQuery(window).load(...)内调用，否则Jcrop无法正确初始化
                    
                    var dialog = art.dialog({			
                        id: 'uploadAvater',
                        lock: true,
                        background: '#fff',
                        okVal: PB_BUTTON_OK,
                        cancelVal: PBMainView_WEB_CANCEL,
                        opacity: 0.70,
                        content: $$('#loadPic')[0],
                        title: false,
                        left: left+'px',
                        top: top+'px',
                        ok:function(){
                           var data = {};
                           data.path = path;
                           /*
                           data.x = marginleftImg;
                           data.y = margintopImg;
                           data.w = widthImg;
                           data.h = heightImg;
                           */
                           var jcropData = jcrop_api.tellSelect();
                           data.x = jcropData.x;
                           data.y = jcropData.y;
                           data.w = jcropData.w;
                           data.h = jcropData.h;
                            $$.post('/PB/cutImage',data,function(resp){
                                $$('#avatar').html('<img src="data:image/png;base64,'+resp.img+'" width="70" height="70" />');							
                                //alert($$('#avatar img').attr('src'));
                            })
                        },
                         cancel: function(){
                            //jcrop_api.destroy();
                         }
                    });
                 },
                 cancel: function(){
                    //jcrop_api.release();	
                 }
                })
        })

        $$('#imgButton').click(function(){
            
            var data={}
            $$.post('/PB/ImageAdd',data,function(){
                        
            })
            setTimeout("getImageUrlPath()",1000);
        })

        
        //点击头像事件
        $$('#headImg').click(function(){
        //你要写的函数
        /*
        <FORM NAME="oForm"
        ACTION="repost.asp"
        ENCTYPE="multipart/form-data"
        METHOD="post">
        <INPUT TYPE="file" NAME="oFile1"/>
        <INPUT TYPE="submit" 
        VALUE="上载文件">
        </FORM>
        */

        })
        //===================账户选择逻辑==================
        $$('#account ul li a').click(function(){
            var num = $$(this).html() == '$trans("PBMainView_EditPanel_BR_StaticBox_CB_Type")' ? '' : $$(this).html();
            creatGroupSelect(num);
            $$('#contact-form').removeClass('jqtransformdone').jqTransform();
            $$('#grupDefine>.jqTransformSelectWrapper>ul li:eq(0)').hide();
        })
        //=============================================
        $$("#cancel").click(function() {
            var data = {};
            $$.post("/PB/cancel/new",data,function(){
                })
        })

        $$("#save").click(function(){
				document.getElementById("save").disabled=true
                var inputHaveContentLen = $$(':input[type = text]').filter(function(){
                    return $$(this).val() != '';
                }).length;
                var inputErrorLen = $$('li[class = errorMsg]').filter(function(){
                    return $$(this).css('display') != 'none';
                }).length;
                if(inputHaveContentLen == 0) {
                    art.dialog({
                        title:'',
                        content: '$trans("PBMainView_AddItem_Error")',
                        lock: true,
                        background:'#fff',
                        opacity: 0.7,
                        icon: 'error',
                        ok: function(){
                            
                        }
                        })
                    //alert('请输入只剩一项信息');
                    return false;
                }
                if(inputErrorLen > 0) return ;
                var data = {};
                data.Name_FirstName = $$("#name").val();
                data.Nickname = $$("#nickname").val();
                //if($$.trim(data.Name_FirstName) == "" && $$.trim(data.Nickname) == "") return false;
                var tempACctName = $$("#phoneaccount").val();
                data.Account = tempACctName == "$trans('PBMainView_EditPanel_BR_StaticBox_CB_Type')" ? "" : tempACctName;
                //var tempGroupName = $$('div.group > .jqTransformSelectWrapper span').html();
                //data.Group = tempGroupName == "分组" ? "" : tempGroupName;
                data.Group = [];
                var len = $$('#grupDefine ul li a.seling').length;
                if(len == 0){
                    data.Group[0] = '';
                }else{
                    $$('#grupDefine ul li a.seling').each(function(){
                        data.Group.push($$(this).text());
                    })
                }
                var dataArr = [];
                var dataArr = $$("#optionContainer :input[type = text]");
                //dataArr.reverse();
                var arr = [];
                var arrOther = [];
                $$(dataArr).each(function(i,n){
                    var val = $$(this).val();
                    var type = $$(this).parents('ul').attr("wording");
                    var index = $$(this).parents('ul').find('a[class = selected]').attr('index') * 1;
                    var tempName = infoTypeName[type][index];
                    if($$.inArray(tempName,infoTypeOther) != -1){//判断是否是自定义名称
                        var nameOther = $$(this).parents('ul').find('span').text();
                        var tempNameOther = tempName + "-" + nameOther;
                        if($$.inArray(tempNameOther,arrOther) != -1){//判断是否有重名
                            for(var i = 0, k = 0; i < arrOther.length; i++){
                            if(arrOther[i] == tempNameOther) k++;
                            var name = tempNameOther + "-" + k;
                            }
                        }else{
                            var name = tempNameOther + "-" + 0;
                        }
                        arrOther.push(tempNameOther);
                        data[name] = val;
                    }else{
                        if($$.inArray(tempName,arr) != -1){//判断是否有重名
                            for(var i = 0, k = 0; i < arr.length; i++){
                                if(arr[i] == tempName) k++;
                                var name = tempName + "-" + k;
                            }
                        }else{
                            var name = tempName + "-" + 0;
                        }
                        arr.push(tempName);
                        data[name] = val;
                    }
                })
                data.StorageLocation = m_StorageLocation;
                //提交数据
                $$.post("/PB/save",data,function(){
                
                })
            })
            
        data = {}
        $$.post('/PB/loadfinish', data, function() {
		})
    })

	
}
else
{
    var restriction  =$:json_encode(group);
    var addnumber = $:json_encode(contact);
    var sim_ecount = $:json_encode(currGroup);

    if (parseInt(restriction['ContactItemPhoneNumberCount']) > 1){
        var infoType = 	{
            '$trans('PBMainSim_DetailInfoPhoneNumLabel')' : ['$trans('PBMainSim_DetailInfoPhoneNumLabel')'],
            '$trans('PBMainSim_DetailInfoHomeNumLabel')' : ['$trans('PBMainSim_DetailInfoHomeNumLabel')'],
            '$trans('PBMainSim_DetailInfoEmailLabel')' : ['$trans('PBMainSim_DetailInfoEmailLabel')'],
        }
        var infoTypeName = 	{
            '$trans('PBMainSim_DetailInfoPhoneNumLabel')' : ['PhoneNumber-Mobile'],
            '$trans('PBMainSim_DetailInfoHomeNumLabel')' : ['PhoneNumber-Home'],
            '$trans('PBMainSim_DetailInfoEmailLabel')' : ['Email-Work'],
        }
        var infoTypeOther = ['PhoneNumber1','PhoneNumber2','Email'];
    }
    else{
        var infoType = 	{
            '$trans('PBMainSim_DetailInfoPhoneNumLabel')' : ['$trans('PBMainSim_DetailInfoPhoneNumLabel')'],     
        }

        var infoTypeName = 	{
            '$trans('PBMainSim_DetailInfoPhoneNumLabel')' : ['PhoneNumber-Mobile'], 
        }
        var infoTypeOther = ['PhoneNumber1','Email'];
    }
    
    if (sim_ecount == 1)
    {
        var initimgPath = "/static/imgs/contacts_default_sim.png";
    }
    else{
        if (m_StorageLocation == "1")
        {
            var initimgPath = "/static/imgs/contacts_default_sim1.png";
        }
        else
        {
            var initimgPath = "/static/imgs/contacts_default_sim2.png";
        }
    }
    
    $$(function() {
    
        
        m_name = $$("<ul rel='$trans('PBMainView_FuncBtn_BR_StaticBox_TC_Name')' wording='$trans('PBMainView_FuncBtn_BR_StaticBox_TC_Name')' class='ulSlt' style='margin-left: 22px; margin-top: 10px;'><li calss='li_1'> <input id='name' type='text'  name='name' class='name' placeholder='$trans('PBMainView_FuncBtn_BR_StaticBox_TC_Name')'/></li><li class='errorMsg'></li></ul>");
        $$('.mainInfor').append(m_name);
        
        $$("#avatar img").attr("src",initimgPath);
    
        var j = 0;
        for(var k in infoType) {
                $$('#optionContainer').append(createSelect(k,false,j));		
                //$$('<option />').html(k).appendTo($$('#infoTypeSelector'));
                j++;
            }       
            //初始化美化表单
            $$('#contact-form').jqTransform();      
    })
  
    var createSelect = function(type, dropable, j) {
        var liElement = [];
        liElement[0] = $$('<select />');
        for(var i=0, len=infoType[type].length; i<len; i++) {
            $$('<option />').html(infoType[type][i]).appendTo(liElement[0]);
        }
        var name = infoTypeName[type][0];
        liElement[1] = $$('<input />').attr({'type':'text','rel':infoTypeOther[j]});
        
        $$('#optionContainer ul[rel="' + type + '"]').removeAttr('rel').addClass('ulSlt');
        var ulElement = $$('<ul />').attr({'rel':type, 'wording': type}).addClass('ulSlt');
        
        for(var i=0, len=liElement.length; i<len; i++) {
            ulElement.append(liElement[i]);
            liElement[i].wrap('<li class="li_' + i + '"/>');
        }
        ulElement.append('<li class="errorMsg"></li>');
        return ulElement;
    }
 
    $$(document).ready(function(){
        if (typeof(addnumber) == "string"){
            $$(':input[rel = PhoneNumber1]').val(addnumber);
        }
        
        $$('.mainInfor :input[type = text]').live('keyup',function(){
            var str = $$(this).val();
            var cArr = str.match(/[^\x00-\xff]/ig);
            count = str.length;
            var input = $$(this).parents('ul').find('li[class = errorMsg]');
            var restriction_length = 14;
            if (m_StorageLocation != '0')
            {
                restriction_length = restriction['ContactItemNameLen'];
                if (cArr)
                {
                    restriction_length = restriction_length/2;
                }
            }
            if(count > restriction_length){
                input.html(WORDS_TOO_LONG).show();
                recaculate(input);
                vaild = false;
                return ;
            }else{
                input.html('').hide().parents('ul').css('height','30px');
                vaild = true;
            }
           
        })
        
        var recaculate = function(input){
            var height = input.css('height');
            height = height.substring(0,height.length-2) * 1;
            input.parents('ul').css('height',35+height + 'px');
        }
    
        $$("#cancel").click(function() {
            var data = {};
            $$.post("/PB/cancel/new",data,function(){
            })
        })
        
        $$("#save").click(function(){
			document.getElementById("save").disabled=true
                var inputHaveContentLen = $$(':input[rel = PhoneNumber1]').filter(function(){
                    return $$(this).val() != '';
                }).length;
                
                var hasfirstname = $$("#name").val() != "";
                
                var inputErrorLen = $$('li[class = errorMsg]').filter(function(){
                    return $$(this).css('display') != 'none';
                }).length;
                if(inputHaveContentLen == 0 || hasfirstname == false) {
                    art.dialog({
                        title:'',
                        content: '$trans("PBMainView_AddItem_MustFill_Error")',
                        lock: true,
                        background:'#fff',
                        opacity: 0.7,
                        icon: 'error',
                        ok: function(){
                            
                            }
                        })

                    return false;
                }
                if(inputErrorLen > 0) return ;
                var data = {};
                data.Name_FirstName = $$("#name").val();


                var dataArr = [];
                var dataArr = $$("#optionContainer :input[type = text]");
                //dataArr.reverse();
                var arr = [];
                var arrOther = [];
                $$(dataArr).each(function(i,n){
                    var val = $$(this).val();
                    var type = $$(this).parents('ul').attr("wording");
                    var index = $$(this).parents('ul').find('a[class = selected]').attr('index') * 1;
                    var tempName = infoTypeName[type][index];
                    if($$.inArray(tempName,infoTypeOther) != -1){//判断是否是自定义名称
                        var nameOther = $$(this).parents('ul').find('span').text();
                        var tempNameOther = tempName + "-" + nameOther;
                        if($$.inArray(tempNameOther,arrOther) != -1){//判断是否有重名
                            for(var i = 0, k = 0; i < arrOther.length; i++){
                            if(arrOther[i] == tempNameOther) k++;
                            var name = tempNameOther + "-" + k;
                            }
                        }else{
                            var name = tempNameOther + "-" + 0;
                        }
                        arrOther.push(tempNameOther);
                        data[name] = val;
                    }else{
                        if($$.inArray(tempName,arr) != -1){//判断是否有重名
                            for(var i = 0, k = 0; i < arr.length; i++){
                                if(arr[i] == tempName) k++;
                                var name = tempName + "-" + k;
                            }
                        }else{
                            var name = tempName + "-" + 0;
                        }
                        arr.push(tempName);
                        data[name] = val;
                    }
                })
                data.Account = "";
                data.Nickname = "";
                data.StorageLocation = m_StorageLocation;
                //提交数据
                $$.post("/PB/Simsave",data,function(){
                
                })
            })
        
        data = {}
        $$.post('/PB/loadfinish', data, function() {
		})
    })
        
}




</script>
</head>
<body oncontextmenu="return false" onselectstart="return false" onkeydown="KeyDownFunction()">
		<form  method="get" id="contact-form">
			<div id="wrap">
				<div class="pad15" id="pad15">
					<div class="clearfix">
						<div class="fl" id="avatar"><img  width="70" height="70" />
						</div>
						<div class="fl" id="maininfor">
							<div class="mainInfor">
							</div>
						</div>
					</div>
					<h2>$trans("PBMainView_WEB_CONINFO")</h2>

					<div id="optionContainer" class="clearfix">
						<div class="claer"></div>
					</div>
					<!--div id="addWrap">
						<select id="infoTypeSelector">
							<option val='0'>$trans("PBMainView_WEB_SELECT")</option>
						</select>
					</div-->
				</div>
			</div>
			<div class="btnbox pad15">
				<input type="button" class="save" name="save" id="save" value="$trans('PBMainView_EditPanel_BtnSave_Key')" />
				<input type="reset" class="save" name="cancel" id="cancel" value="$trans('PBMainView_WEB_CANCEL')" />
			</div>
		</form>
				
		<div id='uploadImg' style="display:none">
			<form action = "/PB/ImageAdd" enctype = "multipart/form-data" method = "post" target="JoinIframe">
				<table width="100%">
				   <tr>
				     <td>
				        $trans('CHOICE_IMG')
				     </td>
				     <td>
				        &nbsp;&nbsp;<input type="text" id="imgText" readonly style="border:1px #ccc solid; height:20px;"/>
				     </td>
				     <td>
				        &nbsp;&nbsp;<input type="button" class="save" id="imgButton" value=$trans('CHOICE_IMG_SELECT') />
				     </td>
				   </tr>
				</table>
				<br />
				<input type="file" name="uploadImgFile" id="uploadImgFile" onchange="document.getElementById('imgText').value=this.value;"  style="visibility:hidden;/>
				</form>
				</div>
				<iframe name="JoinIframe"  style="display:none;">
				</iframe>
				<!-- 图片裁剪 start-->
				<div class="rel" id="loadPic" style="display:none;">
				<img id="defaultPic" src="" />
				<span id="preview_box" class="crop_preview" style="display:none;"><img id="crop_preview" src="" width="280px" height="250px"/></span>
				<!--<input id="clickImg" type="button" value="click"/>-->
				</div>
				<div id='userGroup' style="display:none">
				$trans("PBMainView_WEB_NAME")<input type="text" id="userDefindName" class="newAdd"/><br />
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span id='userDefindNameWrong' style="display:none;color:#ff0000">$trans("PBMainView_WEB_NAMECANOT_EMPTY")</span>
		</div>
		<div id='userGroupTwo' style="display:none">
			$trans("PBMainView_WEB_GROUPNAME")
			<input type="text" id="userDefindGroup" class="newAdd"/>
			<br />
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span id='userDefindGroupWrong' style="display:none;color:#ff0000">$trans("PBMainView_WEB_GROUPNAME_CANOT_EMPTY")</span>
		</div>
	</body>

<script language="javascript">
//=============================================
function KeyDownFunction()
	{
	if (typeof window.event != 'undefined') {  
	           document.onkeydown = function() {  
	             var type = event.srcElement.type;  
	             var code = event.keyCode;  
	             return ((code != 8 && code != 13) ||  
	                     (type == 'text' && code != 13 ) ||  
	                     (type == 'textarea') ||  
	                     (type == 'submit' && code == 13))  
	           }  
	         } else { // FireFox/Others  
	           document.onkeypress = function(e) {  
	   
	             var type = e.target.localName.toLowerCase();  
	             var code = e.keyCode;  
	             if ((code != 8 && code != 13) ||  
	                 (type == 'input' && code != 13 ) ||  
	                 (type == 'textarea') ||  
	                 (type == 'submit' && code == 13)) {  
	                 return true;  
	             } else {  
	                 return false ;  
	             }  
	           }  
	         } 
	}
</script>
<!--<div id="optionContainer">
</div>
<select id="infoTypeSelector">
    <option val='0'>$trans("PBMainView_WEB_SELECT")</option>
</select>-->
</html>