﻿
function CheckUserInput()
{var xingShi=$(InputClientIDs.tbXing).value;var mings=$(InputClientIDs.tbMingWords).value;if(xingShi==null||xingShi.trim()=="")
{alert("请输入姓氏!");event.returnValue=false;return;}
xingShi=xingShi.trim();if(xingShi.length>2)
{alert("姓氏输入有误,最多允许两个中文字符!");event.returnValue=false;return;}
if(checkIsChinese(xingShi)==false)
{alert("姓氏输入中包含非法字符,必须是中文!");event.returnValue=false;return;}
if(showTag.indexOf(TAG_ANALYSENAME)!=-1)
{if(mings==null||mings.trim()=="")
{alert("请输入名字!");event.returnValue=false;return;}
if(mings.length>2)
{alert("名字输入有误,最多允许两个中文字符!");event.returnValue=false;return;}
if(checkIsChinese(mings)==false)
{alert("名字输入中包含非法字符,必须是中文!");event.returnValue=false;return;}}
if($(InputClientIDs.ddlHour).selectedIndex==0&&$(InputClientIDs.rbSpecifyBirthday).checked&&(typeof(IsBaiduApp)=="undefined"||!IsBaiduApp))
{alert("请选择出生的时辰时间!");$(InputClientIDs.ddlHour).focus();event.returnValue=false;return;}
if($(InputClientIDs.tbOtherHopes).value.trim()==HOPE_PROMPT)
{$(InputClientIDs.tbOtherHopes).value="";}
if($(InputClientIDs.tbOtherHopes).value.replace(/ /g,"").length>20)
{alert('美好祝愿最多不能超过20个字!');$(InputClientIDs.tbOtherHopes).select();$(InputClientIDs.tbOtherHopes).focus();event.returnValue=false;return;}
if(typeof(IsBaiduApp)=="undefined"||!IsBaiduApp)
{if(IsModification==false)
{ShowProgressBar_1($("btSubmit"),0);}
else
{try
{ShowProgressBar_1($("btSubmit"),0,"true");}
catch(e)
{}}}
if(typeof(IsQQApp)!="undefined"&&IsQQApp)
{try
{$(InputClientIDs.lbMsg).innerHTML="<span style='height:16px; width:16px;padding-left:20px;background:url("+AppPath+"Images/loading.gif) no-repeat'>正在为您起名，请稍候...　</span>";}catch(e){}}
try
{document.getElementById("imgVisitorStat").src=document.getElementById("imgVisitorStat").src+"?rand="+Math.random();}
catch(e)
{}
var postID;var r=/javascript\:__doPostBack\(["|'](.*)["|'],/g;var re=r.exec($(InputClientIDs.btNext).href);if(re!=null)
{postID=re[1];}
else
{postID=InputClientIDs.btNext.replace(/\_/g,"$");}
__doPostBack(postID,"");}
function ShowAdOptions(control,forceOpen)
{var div=$("divAdOptions");var icn=$("showMoreImg");if(forceOpen||(typeof(div)!="undefined"&&div.style.display=="none"))
{control.innerHTML="隐藏";div.style.display="";SetCookie("divAdOptions"," ");icn.src=icn.src.replace("down.gif","up.gif");}
else
{control.innerHTML="显示";div.style.display="none";SetCookie("divAdOptions","none");icn.src=icn.src.replace("up.gif","down.gif");}
if(IsModification)
{AjustIframParentSize();}}
function AjustIframParentSize()
{try
{var bar=parent.$("modiDialog");var barHolder=parent.$("modiHolder");var width,height;if(navigator.userAgent.toLowerCase().indexOf("safari")!=-1)
{height=document.documentElement.scrollHeight;width=document.documentElement.scrollWidth;}
else
{height=document.body.scrollHeight;width=document.body.scrollWidth;}
parent.$("iframeModifyParam").height=height;parent.$("iframeModifyParam").width=width;bar.height=height;bar.width=width;barHolder.height=height;barHolder.width=width;}
catch(e)
{}}
function HideImagoAndAdOptions()
{try
{$("divImagoOptions").style.display="none";$("divAdOptions").style.display="none";$("btAdOption").style.display="none";$(InputClientIDs.ddlNameTypes).disabled=true;}
catch(e)
{}}
String.prototype.realLength=function()
{return this.replace(/[^\\x00-\\xff]/g,"**").length;}
function CloseParentWindow()
{try
{parent.$('modiDialog').style.display='none';parent.$('modiAllbody').style.display='none';}
catch(e)
{}}
var needAnalyze=true;function AnalyzeName(name,evt)
{if(needAnalyze==false&&name.length<=2)
{return;}
if(!evt&&window.event)
{evt=window.event;}
if(checkIsChinese(name)==false)
{return false;}
var xing="";var ming="";if(name.length==1)
{return;}
if(name.length>=2&&name.length<=3)
{var maxXing=name.substring(0,2);var minXing=name.substring(0,1);var alpha="abcdefghjklmnopqrstwxyz";var containsMaxXing=false;var containsMinXing=false;for(var i=0;i<alpha.length;++i)
{var temp=xingShi[alpha.charAt(i).toString()];if(temp)
{for(var j=0;j<temp.length;++j)
{if(temp[j]==maxXing)
{containsMaxXing=true;}
if(temp[j]==minXing)
{containsMinXing=true;}
if(containsMaxXing&&containsMinXing)
{break;}}}
if(containsMaxXing&&containsMinXing)
{break;}}
if(containsMaxXing)
{xing=maxXing;ming=name.substring(xing.length,4);}
else
{xing=minXing;ming=name.substring(xing.length,4);}}
else if(name.length==4)
{xing=name.substring(0,2);ming=name.substring(2,4);}
if(xing!="")
{$(InputClientIDs.tbXing).value=xing;}
if(ming!="")
{$(InputClientIDs.tbMingWords).value=ming;needAnalyze=false;}}
function AutoCopyName(name)
{if(checkIsChinese(name)==false)
{return false;}
if(name.length==2)
{$(InputClientIDs.tbXing).value=name.substring(0,1);$(InputClientIDs.tbMingWords).value=name.substring(1,4);}}
var HOPE_PROMPT="输入您的个性化意愿，个性化意愿将会体现在名字中。";var HOPE_FOR_MALE="高大英俊 聪敏睿智 才华横溢 幽雅潇洒 帅气 聪明 幽默 胸怀大志 风度翩翩 刚毅大度 胸襟宽广 气宇轩昂 卓尔不凡 神采奕奕 健康";var HOPE_FOR_FEMALE="温柔 漂亮 善良 聪明 聪敏睿智 英姿飒爽 贤惠 美丽 果断坚强 贤德有容 外美内淑 热情谦让 神采奕奕 秀外慧中 健康";function SetControlsStatus()
{if($(InputClientIDs.rbSolar).checked)
{$(InputClientIDs.cbIsLeapMonth).disabled=true;}
var nameTypes=$(InputClientIDs.ddlNameTypes);SpecifyBirthday();var tbOtherHopes=$(InputClientIDs.tbOtherHopes);if(tbOtherHopes.value.trim()=="")
{tbOtherHopes.style.color="gray";tbOtherHopes.value=HOPE_PROMPT;}
tbOtherHopes.onfocus=function()
{if(tbOtherHopes.value.trim()==HOPE_PROMPT)
{tbOtherHopes.style.color="#000000";tbOtherHopes.value="";}}
tbOtherHopes.onblur=function()
{if(tbOtherHopes.value.trim()=="")
{tbOtherHopes.style.color="gray";tbOtherHopes.value=HOPE_PROMPT;}}}
function SetSampleWishes(wish)
{var tbOtherHopes=$(InputClientIDs.tbOtherHopes);tbOtherHopes.style.color="#000000";if(tbOtherHopes.value.trim()==HOPE_PROMPT)
{tbOtherHopes.value="";}
wish=wish.trim();if(tbOtherHopes.value.indexOf(wish)==-1)
{tbOtherHopes.value+=" "+wish;}
tbOtherHopes.value=tbOtherHopes.value.trim();}
function SetGoodExpressions(gender)
{var male=$("GoodExpressionsForMale");var female=$("GoodExpressionsForFemale");var tbOtherHopes=$(InputClientIDs.tbOtherHopes);tbOtherHopes.style.color="#000000";if(tbOtherHopes.value.trim()==HOPE_PROMPT)
{tbOtherHopes.value="";}
if(gender=="1")
{var tokens=HOPE_FOR_MALE.split(" ");var temp="";for(var i=0;i<tokens.length;++i)
{if(tbOtherHopes.value.indexOf(tokens[i])==-1)
{temp+=tokens[i]+" ";}}
tbOtherHopes.value=(tbOtherHopes.value==""?"":tbOtherHopes.value+" ")+temp.trim();}
else
{var tokens=HOPE_FOR_FEMALE.split(" ");var temp="";for(var i=0;i<tokens.length;++i)
{if(tbOtherHopes.value.indexOf(tokens[i])==-1)
{temp+=tokens[i]+" ";}}
tbOtherHopes.value=(tbOtherHopes.value==""?"":tbOtherHopes.value+" ")+temp.trim();}}
function SpecifyBirthday()
{var rb1=$(InputClientIDs.rbSpecifyBirthday);var rb2=$(InputClientIDs.rbSpecifyLinChanQin);var rb3=$(InputClientIDs.rbNotSpecifyBirthday);var tbDate=$("spanSpecifyBirthdate");var tbTime=$("spanSpecifyBirthtime");if(rb1.checked)
{$(InputClientIDs.ddlYear).disabled=false;$(InputClientIDs.ddlMonth).disabled=false;$(InputClientIDs.ddlDay).disabled=false;$(InputClientIDs.ddlHour).disabled=false;$(InputClientIDs.ddlMinute).disabled=false;}
else if(rb2.checked)
{$(InputClientIDs.ddlYear).disabled=false;$(InputClientIDs.ddlMonth).disabled=false;$(InputClientIDs.ddlDay).disabled=false;$(InputClientIDs.ddlHour).disabled=true;$(InputClientIDs.ddlMinute).disabled=true;}
else
{$(InputClientIDs.ddlYear).disabled=true;$(InputClientIDs.ddlMonth).disabled=true;$(InputClientIDs.ddlDay).disabled=true;$(InputClientIDs.ddlHour).disabled=true;$(InputClientIDs.ddlMinute).disabled=true;}}
function popupDialogCallback(control,url,width,height,callBack,arg)
{var x=parseInt(screen.width/2.0)-(width/2.0);var y=parseInt(screen.height/2.0)-(height/2.0);var isMSIE=(navigator.appName=="Microsoft Internet Explorer");var retval="";if(isMSIE)
{retval=window.showModalDialog(url,window,"dialogWidth:"+width+"px; dialogHeight:"+height+"px; dialogLeft:"+x+"px; dialogTop:"+y+"px; status:no; directories:yes;scrollbars:no;Resizable=no; ");if(retval!=undefined)
{if(control!=undefined&&control!="")
{$(control).value=retval;$(control).title=retval;}}}
else
{window.myAction=this;var win=window.open(url,"mcePopup","top="+y+",left="+x+",scrollbars=no,dialog=yes,modal=yes,width="+width+",height="+height+",resizable=no");eval('try { win.resizeTo(width, height); } catch(e) { }');win.focus();window.addEventListener('click',function(){win.focus();},false);this.returnAction=function(strResult)
{if(strResult!=undefined)
{retval=strResult;if(control!=undefined&&control!="")
{$(control).value=strResult;$(control).title=strResult;}
if(callBack!=undefined)
{callBack(strResult,arg);}}}}
return retval;}
function SelectSimpParts(control)
{var simpParts=popupDialog(control,AppPath+"Naming/SelectSimpParts.aspx?value="+escape($(control).value),620,400);}
function SelectSpell(control)
{var simpParts=popupDialog(control,AppPath+"Naming/SelectSpell.aspx?value="+escape($(control).value),500,250);}
function SelectYunMu(control)
{var yunmu=popupDialog(control,AppPath+"Naming/SelectYunMu.aspx?value="+escape($(control).value),600,250);}
function SelectStructures(control)
{var structures=popupDialog(control,AppPath+"Naming/SelectStructure.aspx?value="+escape($(control).value),520,200);}
function SelectStrokes(control)
{var strokes=popupDialog(control,AppPath+"Naming/SelectStroke.aspx?value="+escape($(control).value),600,250);}
function SelectTunes(control)
{var tunes=popupDialog(control,AppPath+"Naming/SelectTune.aspx?value="+escape($(control).value),500,200);}
function SelectPromptedStrokes()
{var xing=$(InputClientIDs.tbXing).value;var control=$(InputClientIDs.ddlNameTypes);var type=control.options[control.selectedIndex].value;var dieZi=0;if(type=="3")
{dieZi=1;}
if(xing.trim()==""||checkIsChinese(xing.trim())==false)
{alert("输入的姓氏有误，系统暂时不能推荐笔画组合。要继续，请指定一个合法的姓氏。");return;}
var strokes=popupDialogCallback("",AppPath+"Naming/SaleStrokeCombination.aspx?xingshi="+escape(xing)+"&nametype="+type+"&diezi="+dieZi,600,280,SelectPromptedStrokesCallBack,type);if(strokes==undefined||strokes.toString().trim()=="")
{return;}
if(document.all)
{SelectPromptedStrokesCallBack(strokes,type);}}
function SelectPromptedStrokesCallBack(strokes,type)
{var c1=$(InputClientIDs.tbMing1Stroke);var c2=$(InputClientIDs.tbMing2Stroke);var temp=strokes.split("-");if(temp!=undefined&&temp.length>=2)
{if(type=="1")
{if(temp.length==2)
{c1.value=temp[1];}
else if(temp.length==3)
{c1.value=temp[2];}}
else
{if(temp.length==3)
{c1.value=temp[1];c2.value=temp[2];}
else if(temp.length=4)
{c1.value=temp[2];c2.value=temp[3];}}}}
function SelectPromptedParts()
{var solarCtrl=$(InputClientIDs.rbSolar);var lunarCtrl=$(InputClientIDs.cbIsLeapMonth);var yearCtrl=$(InputClientIDs.ddlYear);var monthCtrl=$(InputClientIDs.ddlMonth);var dayCtrl=$(InputClientIDs.ddlDay);var hourCtrl=$(InputClientIDs.ddlHour);var minuteCtrl=$(InputClientIDs.ddlMinute);var knownBirth=$(InputClientIDs.rbNotSpecifyBirthday);if(knownBirth.checked)
{alert("您没有指定出生日期，暂时无法推荐。要继续，请指定出生日期。");return;}
var birth=yearCtrl.options[yearCtrl.selectedIndex].value+"-"+
monthCtrl.options[monthCtrl.selectedIndex].value+"-"+dayCtrl.options[dayCtrl.selectedIndex].value+" ";birth+=hourCtrl.options[hourCtrl.selectedIndex].value+":"+minuteCtrl.options[minuteCtrl.selectedIndex].value+":00";var parts=popupDialogCallback("",AppPath+"Naming/SaleChineseZodiacParts.aspx?birthday="+escape(birth)+"&solar="+(solarCtrl.checked?"1":"0")+"&leap="+(lunarCtrl.checked?"1":"0"),600,250,SelectPromptedPartsCallBack);if(parts==undefined||parts.toString().trim()=="")
{return;}
if(document.all)
{SelectPromptedPartsCallBack(parts);}}
function SelectPromptedPartsCallBack(parts)
{var c1=$(InputClientIDs.tbMing1SpecSimpParts);var c2=$(InputClientIDs.tbMing2SpecSimpParts);var pos=parts.charAt(0).toString();parts=parts.substring(1);if(pos=="1")
{c1.value=parts;}
else if(pos=="2")
{c2.value=parts;}
else
{c1.value=parts;c2.value=parts;}}
document.body.onkeydown=function(event)
{if(!event)
{event=window.event;}
var isMSIE=(navigator.appName=="Microsoft Internet Explorer");try
{if(!IsModification)
{return;}
if(isMSIE)
{if(event.keyCode==8)
{if(event.srcElement.tagName.toLowerCase()!="input"&&event.srcElement.tagName.toLowerCase()!="textarea")
{return false;}}}
else
{if(event.keyCode==8)
{if(event.target.tagName.toLowerCase()!="input"&&event.target.tagName.toLowerCase()!="textarea")
{event.preventDefault();event.stopPropagation();}}}}
catch(e)
{}}
function PickXingShi()
{try
{InitQueryCode(InputClientIDs.tbXing,"PickItemDiv");isXingShi=true;if(curIndex==undefined||curIndex==null||curIndex==-1)
{curIndex="a";showQueryDiv(xingShi["a"],80,1,17);}
else
{showQueryDiv(xingShi[curIndex],80,1,17);}
AjustIframParentSize();}
catch(e)
{}}
function PickCountry()
{try
{InitQueryCode(InputClientIDs.tbCountry,"PickItemDiv",CountryValueChanged);isXingShi=false;showQueryDiv(locations["国家"],30,1,5);AjustIframParentSize();}
catch(e)
{}}
function CountryValueChanged()
{var country=$(InputClientIDs.tbCountry);var pro=$(InputClientIDs.tbProvince);var city=$(InputClientIDs.tbCity);if(country.value.trim()!="中国")
{pro.value="";city.value="";}}
function ProvinceValueChanged()
{var city=$(InputClientIDs.tbCity);city.value="";}
function PickProvince()
{try
{if($(InputClientIDs.tbCountry).value.trim()=="中国")
{InitQueryCode(InputClientIDs.tbProvince,"PickItemDiv",ProvinceValueChanged);isXingShi=false;showQueryDiv(locations["省市"],40,1,8);AjustIframParentSize();}}
catch(e)
{}}
function PickCity()
{try
{var country=$(InputClientIDs.tbCountry).value.trim();var pro=$(InputClientIDs.tbProvince).value.trim();var city=locations[pro];if(city!=undefined&&city!=null&&country=="中国")
{InitQueryCode(InputClientIDs.tbCity,"PickItemDiv");isXingShi=false;showQueryDiv(city,40,1,6);AjustIframParentSize();}}
catch(e)
{}}
try
{var oldBodyClickFunction=document.body.onclick;document.body.onclick=function(event)
{try
{if(oldBodyClickFunction!=undefined&&oldBodyClickFunction!=null)
{oldBodyClickFunction(event);}}
catch(e)
{}
if(!event)
{event=window.event;}
var isMSIE=(navigator.appName=="Microsoft Internet Explorer");try
{if(isMSIE)
{if(event.srcElement.id!=queryField.id&&IsTheSonOf(event.srcElement,"PickItemDiv")==false)
{showDiv(false);}}
else
{if(event.target.id!=queryField.id&&IsTheSonOf(event.target,"PickItemDiv")==false)
{showDiv(false);}}}
catch(e)
{}}}
catch(e)
{}
function SetNameSampleByGender()
{var gender=$(InputClientIDs.ddlGenders);var nameType=$(InputClientIDs.ddlNameTypes);if(gender.selectedIndex==0)
{nameType.options[0].text="单字名，如：李白";nameType.options[1].text="双字名，如：李商隐";nameType.options[2].text="叠字名，如：李明明";}
else
{nameType.options[0].text="单字名，如：李花";nameType.options[1].text="双字名，如：李清照";nameType.options[2].text="叠字名，如：李晶晶";}}
function CancelCateSelect()
{try
{$(InputClientIDs.rbtLunYu).checked=false;$(InputClientIDs.rbtShiJing).checked=false;$(InputClientIDs.rbtPoem).checked=false;$(InputClientIDs.rbtIdiom).checked=false;}
catch(e)
{}}
function BubbleClick()
{var v=$("divBubblePrompt");v.style.display="none";SetCookie("BabyBubblePrompt","1");}
