function getCity(obj){$("#regbn_1").css("display","none");document.getElementById("cities").disabled=true;$("#img_1").css("display","block");$.ajax({url:"/users/getcity?provinceId="+obj.value,type:'GET',dataType:'html',success:function(str){document.getElementById("cities").disabled=false;$("#regbn_1").css("display","block");$("#img_1").css("display","none");str=str.substring(0,str.lastIndexOf("</option>")+9);$('#cities').html(str);}});}
function get_maillist(){var mail_name=$.trim($("#mail_name").val());var mail_website=$.trim($("#mail_website").val());var mail_password=$.trim($("#mail_password").val());if(mail_name==''){alert("请填写邮箱地址！");$("#mail_name").focus();return false;}
if(mail_password==''){alert("请填写邮箱密码！");$("#mail_password").focus();return false;}
tb_show();$.ajax({url:"/users/addmail?act=get_maillist&mail_name="+mail_name+"&mail_website="+mail_website+"&mail_password="+mail_password,type:'POST',dataType:'html',success:function(str){if(str==1){tb_show('','/users/popup_import/&type=mail&mail_name='+mail_name+'&mail_website='+mail_website+'&TB_iframe=true&height=600px&width=600px',"thickbox");return false;}else{alert("结果出错，请检查输入是否有误，网络连接是否正常，邮箱通讯录是否为空。");tb_remove();return false;}}});}
function invite_friends(){var mails=$("#mails").val();var yzm=document.getElementsByName('in_yanzhengma')[0].value;if(yzm==undefined||yzm==''){alert('请输入验证码');return false;}
var arr_mails=mails.split("\n");if(arr_mails.length>10){alert("抱歉，每次最多可选择10人为邀请对象。请重新选择。");return false;}
var invite_say=$.trim($("#invite_say").val());if(mails.lastIndexOf("@")<=0||mails.lastIndexOf(".")<=0){alert("请填写对方Email地址！");$("#mails").focus();return false;}
if(confirm('确定发送吗？')){}else{return false;}
tb_show();$.ajax({url:"/users/send_invite?act=invite_bk&mails="+encodeURI(mails)+"&captcha="+yzm,type:'POST',data:{invite_say:invite_say},dataType:'html',success:function(str){if(str=='msg:captcha'){alert('验证码不正确。');tb_remove();}
else if(str==33){alert('抱歉，每次最多可选择10人为邀请对象。请重新选择。');tb_remove();$("#mails").focus();}
else if(str==1){tb_show('','/users/popup_import_ok&TB_iframe=true&height=600px&width=600px',"thickbox");}else{alert("发送失败，请检查输入是否有误！");tb_remove();$("#mails").focus();}
document.getElementById('in_captcha').src="/users/captcha#"+new Date().getTime();return false;}});}
function get_msnlist(){var msn_account=$.trim($("#msn_account").val());var msn_password=$.trim($("#msn_password").val());if(msn_account.lastIndexOf("@")<=0||msn_account.lastIndexOf(".")<=0){alert("请输入格式正确的MSN地址！");$("#msn_account").focus();return false;}
if(msn_password==''){alert("请输入MSN密码！");$("#msn_password").focus();return false;}
tb_show();$.ajax({url:"/users/addmail?act=get_msnlist&msn_account="+msn_account+"&msn_password="+msn_password+"",type:'POST',dataType:'html',success:function(str){if(str==1){tb_show('','/users/popup_import/&type=msn&msn_account='+msn_account+'&TB_iframe=true&height=600px&width=600px',"thickbox");return false;}else{alert("结果出错，请检查输入是否有误，网络连接是否正常，联系人名单是否为空。");tb_remove();}}});}
function show_info_tabs(obj,isact){if(obj=="reg_1"){$("#"+obj).css("display","block");$("#reg_2").css("display","none");$("#reg_3").css("display","none");$("#reg_4").css("display","none");$("#reg_5").css("display","none");}
if(obj=="reg_2"){$("#reg_2").css("display","");$("#reg_1").css("display","none");$("#reg_3").css("display","none");$("#reg_4").css("display","none");$("#reg_5").css("display","none");}
if(obj=="reg_3"){$("#"+obj).css("display","block");$("#reg_2").css("display","none");$("#reg_1").css("display","none");$("#reg_4").css("display","none");$("#reg_5").css("display","none");}
if(obj=="reg_4"){if(isact===0){window.document.location.href="/users/jh";return false;}
$("#"+obj).css("display","block");$("#reg_2").css("display","none");$("#reg_3").css("display","none");$("#reg_1").css("display","none");$("#reg_5").css("display","none");}
if(obj=="reg_5"){$("#"+obj).css("display","block");$("#reg_2").css("display","none");$("#reg_1").css("display","none");$("#reg_4").css("display","none");$("#reg_3").css("display","none");}}
function checkImgtype(obj,ext){var album_images=obj.value;var album_images_ext=album_images.substr(album_images.lastIndexOf(".")+1).toLowerCase();if(ext.lastIndexOf(album_images_ext)==-1){alert("请选择jpeg,jpg,gif,png类型的图片。");return false;}}
function checkF(ext){var album_images=document.getElementById("user_img").value;var qq=document.getElementById("qq").value;var album_images_ext=album_images.substr(album_images.lastIndexOf(".")+1).toLowerCase();var phone=document.getElementById("phone").value;var rephone=new RegExp("^(1[0-9]{10})?$");var re=new RegExp("^([0-9]{4,})?$");var rezip=new RegExp("^([0-9]{6})?$");if(rephone.test(phone)){$.ajax({type:"GET",url:"/users/checkPhone",data:"phone="+phone,success:function(msg){if(msg==1){alert("此手机号码已经存在，请修改!");return false;}else{if(ext.lastIndexOf(album_images_ext)==-1){alert("请选择jpeg,jpg,gif,png类型的图片。");return false;}else{if(re.test(qq)){$.ajax({type:"GET",url:"/users/checkQQ",data:"qq="+qq,success:function(msg){if(msg==1){alert("此QQ号码已经存在，请修改!");return false;}else{if(!rezip.test($("#zipcode").val())){alert('邮编不正确！');return false;}
window.document.form3.submit();}}});return false;}else{alert("请输入正确的QQ号码");return false;}}}}});return false;}else{alert("请输入正确的手机号码");return false;}}
function folow_people(id){if(id==""){return false;}
$.ajax({type:"POST",url:"/users/ajax_follow",data:"id="+id+"&popup=1",success:function(msg){if(msg.replace(/<.*?>/g,"")==1){close_dialog();}else if(msg.replace(/<.*?>/g,"")==2){alert("不能关注自己");return false;}else{alert("已经关注过此人");return false;}}});}
function delfollow(follow_id){$.ajax({url:"/users/del_follow&act=delfollow&follow_id="+follow_id,type:'GET',dataType:'html',success:function(str){if(str==1){alert("删除成功。");location.reload();}else{alert("删除失败。");return false;}}});}
function cancel_bookmark(id){$.ajax({type:"POST",url:"/users/ajax_unbookmark",data:"id="+id,success:function(msg){if(msg.replace(/<.*?>/g,"")==1){alert("取消收藏成功。");location.reload();return false;}else{alert("添加有错误");return false;}}});}
function display_comment(brand_id,user_id,default_zero_score,img_path){var comment_html="";var comment_title;$.getJSON("/users/ajax_getcomment?brand_id="+brand_id+"&user_id="+user_id,function(data){$.each(data,function(i,comment){var cat_name=comment.comments.cat_name;var brand_name_cat=comment.comments.brand_name_cat;var brand_name_all=comment.comments.brand_name_all;if(comment.comments.pro_name!=null){comment_html+='<dd style="overflow-x:hidden;width:466px"><h3>'+comment.comments.comment_create_time+'</h3>'+((comment.comments.pro_name!=null)?"关于<a href=\""+comment.comments.pro_name_url+"\"><b>"+comment.comments.pro_name+"</b></a>的评论":"")+'<p>'+comment.comments.comment+'</p></dd><dt><b>'+comment[0].countnum+'</b>人投票，本评论可信度为 <b>'+((comment[0].avgscore==null)?default_zero_score:comment[0].avgscore)+'</b> <img src="'+img_path+'/img/s_c_hx.gif" /></dt>';comment_title="#comment"+comment.comments.magic_id;}
if(cat_name!=null&&brand_name_cat!=null){comment_html+='<dd style="overflow-x:hidden;width:466px"><h3>'+comment.comments.comment_create_time+'</h3>'+((comment.comments.cat_name!=null)?"关于<a href=\"/"+comment.comments.brand_name_url_cat+"/"+comment.comments.cat_name_url+"\"><b>"+comment.comments.brand_name_cat+cat_name+"</b></a>的评论":"")+'<p>'+comment.comments.comment+'</p></dd><dt><b>'+comment[0].countnum+'</b>人投票，本评论可信度为 <b>'+((comment[0].avgscore==null)?default_zero_score:comment[0].avgscore)+'</b> <img src="'+img_path+'/img/s_c_hx.gif" /></dt>';comment_title="#comment"+comment.comments.magic_id;}
if(brand_name_all!=null){comment_html+='<dd style="overflow-x:hidden;width:466px"><h3>'+comment.comments.comment_create_time+'</h3>'+((comment.comments.brand_name_all!=null)?"关于<a href=\"/"+comment.comments.brand_name_url_all+"\"><b>"+comment.comments.brand_name_all+"</b></a>的评论":"")+'<p>'+comment.comments.comment+'</p></dd><dt><b>'+comment[0].countnum+'</b>人投票，本评论可信度为 <b>'+((comment[0].avgscore==null)?default_zero_score:comment[0].avgscore)+'</b> <img src="'+img_path+'/img/s_c_hx.gif" /></dt>';comment_title="#comment"+comment.comments.magic_id;}});$(comment_title).show();$(comment_title).html(comment_html);});}
function dis_comment(obj){$("#comment"+obj).show();$("#spanc"+obj).css("display","none");$("#spanh"+obj).css("display","block");}
function hide_comment(obj){$("#comment"+obj).hide();$("#spanc"+obj).css("display","block");$("#spanh"+obj).css("display","none");}
function delalbum(album_id){$.ajax({url:"/users/opalbum&act=delalbum&album_id="+album_id,type:'GET',dataType:'html',success:function(str){if(str===0){alert("删除成功。");location.reload();}}});}
function seticon(album_id){$.ajax({url:"/users/opalbum&act=seticon&album_id="+album_id,type:'GET',dataType:'html',success:function(str){if(str===0){alert("设置成功。");location.reload();}}});}
function editalbum(album_id){$("#"+album_id+"").css("display","block");$("#submit"+album_id+"").css("display","block");$("#cancel"+album_id+"").css("display","block");$("#span"+album_id+"").css("display","none");}
function cancelalbum(album_id){$("#"+album_id+"").css("display","none");$("#submit"+album_id+"").css("display","none");$("#cancel"+album_id+"").css("display","none");$("#span"+album_id+"").css("display","block");}
function subalbum(album_id){$.ajax({url:"/users/opalbum&act=editalbum&album_name="+$('#'+album_id+'').val()+"&album_id="+album_id,type:'GET',dataType:'html',success:function(str){alert("编辑成功。");location.reload();}});}
$(function(){$("#bookmark_pro_content").hide();$("#bookmark_brand").addClass("sm2");$("#bookmark_brand").click(function(){$("#bookmark_brand_content").show();$("#bookmark_pro_content").hide();$("#bookmark_brand").addClass("sm2");$("#bookmark_pro").removeClass("sm2");return false;});$("#bookmark_pro").click(function(){$("#bookmark_brand_content").hide();$("#bookmark_pro_content").show();$("#bookmark_brand").removeClass("sm2");$("#bookmark_pro").addClass("sm2");return false;});$("#follow_content").hide();$("#followed_tab").addClass("sm2");$("#followed_tab").click(function(){$("#followed_content").show();$("#follow_content").hide();$("#followed_tab").addClass("sm2");$("#follow_tab").removeClass("sm2");return false;});$("#follow_tab").click(function(){$("#followed_content").hide();$("#follow_content").show();$("#followed_tab").removeClass("sm2");$("#follow_tab").addClass("sm2");return false;});});function check_info(){var exp_chinese=/^[0-9\u4e00-\u9faf]+$/;var exp_english=/^[A-Za-z]+$/;var realname_v=$.trim($("#user_realname").val());if(exp_english.test(realname_v)){if(realname_v.length<2||realname_v.length>10){alert("真实姓名只能由2-10个英文或1-5个中文组成。");$("#user_realname").focus();return false;}}else{if(exp_chinese.test(realname_v)){if(realname_v.length<1||realname_v.length>5){alert("真实姓名只能由2-10个英文或1-5个中文组成。");$("#user_realname").focus();return false;}}else{alert("真实姓名只能由2-10个英文或1-5个中文组成。");$("#user_realname").focus();return false;}}
if($.trim($("#password").val()).length>0){if($.trim($("#password").val()).length<6||$.trim($("#password").val()).length>16){alert("密码长度6～16位，由英文字母(区分大小写)，数字，特殊字符组成。");$("#password").focus();return false;}
if($.trim($("#password").val())!=$.trim($("#password1").val())){alert("两次密码输入不一致。");$("#password1").focus();return false;}}
if($("#provinces").val()==0)
{alert("请选择省份。");return false;}
if($("#cities").val()==0)
{alert("请选择城市/地区。");return false;}
if($("#regRoles").val()=='')
{alert("请选择工作状况。");return false;}}
