﻿
function CheckUserInput()
{var tbMing=$(ChineseInputClientIDs.tbMing);var tbXing=$(ChineseInputClientIDs.tbXing);var MAX_LEN=20;var MAX_SUR_LEN=15;if(tbMing.value.trim()=="")
{alert("请输入您的名字（First name）。(First name is required.)");tbMing.focus();return;}
if(tbMing.value.length>MAX_LEN)
{alert("名字(First name)的长度不要超过"+MAX_LEN+"(The max length of first name is "+MAX_LEN+")");tbMing.focus();tbMing.select();return;}
if(checkIsChinese(tbMing.value.trim())==false&&checkIsEnglish(tbMing.value.trim())==false)
{alert("名字(First name)要么全是英文字母，要么全是中文汉字。请重新输入。");tbMing.focus();tbMing.select();return;}
if(tbXing.value.trim()=="")
{alert("请输入您的姓（Family name）。(Family name is required.)");tbXing.focus();return;}
if(tbXing.value.length>MAX_SUR_LEN)
{alert("姓氏(Family name)的长度不要超过"+MAX_SUR_LEN+"(The max length of family name is "+MAX_SUR_LEN+")");tbMing.focus();tbMing.select();return;}
if(checkIsChinese(tbXing.value.trim())==false&&checkIsEnglish(tbXing.value.trim())==false)
{alert("姓氏(Family name)要么全是英文字母，要么全是中文汉字。请重新输入。");tbXing.focus();tbXing.select();return;}
var tbWishes=$(ChineseInputClientIDs.tbWishes);if(tbWishes.value.trim()==HOPE_PROMPT)
{tbWishes.value="";}
if(IsModification==false)
{ShowProgressBar_1($("btSubmit"),0);}
else
{try
{ShowProgressBar_1($("btSubmit"),0,"true");}
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($(ChineseInputClientIDs.lbtSubmit).href);if(re!=null)
{postID=re[1];}
else
{postID=ChineseInputClientIDs.lbtSubmit.replace(/\_/g,"$");}
__doPostBack(postID,"");}
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+50;parent.$("iframeModifyParam").width=width;bar.height=height+50;bar.width=width;barHolder.height=height+50;barHolder.width=width;}
catch(e)
{}}
function CloseParentWindow()
{try
{parent.$('modiDialog').style.display='none';parent.$('modiAllbody').style.display='none';}
catch(e)
{}}
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)
{}}
var HOPE_PROMPT="请输入表达您愿望的词汇。(100个字符以内)(Please enter your wishes within 100 characters.)";function OnHopesTextBoxBlur()
{var tbWishes=$(ChineseInputClientIDs.tbWishes);if(tbWishes.value.trim()=="")
{tbWishes.style.color="gray";tbWishes.value=HOPE_PROMPT;}}
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&&IsTheSonOf(event.srcElement,'divPickupXing')==false)
{showDiv(false);}}
else
{if(event.target.id!=queryField.id&&IsTheSonOf(event.target,"PickItemDiv")==false&&IsTheSonOf(event.target,'divPickupXing')==false)
{showDiv(false);}}}
catch(e)
{}}}
catch(e)
{}
function ShowAdOptions(control)
{var div=$("divAdOptions");if(div!=undefined&&div.style.display=="none")
{control.innerHTML="隐藏";div.style.display="";SetCookie("divAdOptions"," ");}
else
{control.innerHTML="显示";div.style.display="none";SetCookie("divAdOptions","none");}
if(IsModification)
{AjustIframParentSize();}}
var HOPE_FOR_MALE="高大英俊 聪敏睿智 才华横溢 幽雅潇洒 帅气 聪明 幽默 胸怀大志 风度翩翩 刚毅大度 胸襟宽广 气宇轩昂 卓尔不凡 神采奕奕 健康";var HOPE_FOR_FEMALE="温柔 漂亮 善良 聪明 聪敏睿智 英姿飒爽 贤惠 美丽 果断坚强 贤德有容 外美内淑 热情谦让 神采奕奕 秀外慧中 健康";function SetControlsStatus()
{if($(ChineseInputClientIDs.rbSolar).checked)
{$(ChineseInputClientIDs.cbIsLeapMonth).disabled=true;}
var nameTypes=$(ChineseInputClientIDs.ddlNameTypes);if(nameTypes.selectedIndex==1)
{$(ChineseInputClientIDs.tbMing2Stroke).disabled=false;$(ChineseInputClientIDs.ddlSpecifiedIndex).disabled=false;$(ChineseInputClientIDs.tbSpecifiedWord).disabled=false;}
else if(nameTypes.selectedIndex==2)
{$(ChineseInputClientIDs.ddlSpecifiedIndex).disabled=true;$(ChineseInputClientIDs.tbSpecifiedWord).disabled=true;$(ChineseInputClientIDs.tbMing2Stroke).disabled=true;}
else
{$(ChineseInputClientIDs.tbMing2Stroke).disabled=true;$(ChineseInputClientIDs.ddlSpecifiedIndex).disabled=true;$(ChineseInputClientIDs.tbSpecifiedWord).disabled=true;}
SpecifyBirthday();}
function SetSampleWishes(wish)
{var tbOtherHopes=$(ChineseInputClientIDs.tbWishes);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 tbWishes=$(ChineseInputClientIDs.tbWishes);tbWishes.style.color="#000000";if(tbWishes.value.trim()==HOPE_PROMPT)
{tbWishes.value="";}
if(gender=="1")
{var tokens=HOPE_FOR_MALE.split(" ");var temp="";for(var i=0;i<tokens.length;++i)
{if(tbWishes.value.indexOf(tokens[i])==-1)
{temp+=tokens[i]+" ";}}
tbWishes.value=(tbWishes.value==""?"":tbWishes.value+" ")+temp.trim();}
else
{var tokens=HOPE_FOR_FEMALE.split(" ");var temp="";for(var i=0;i<tokens.length;++i)
{if(tbWishes.value.indexOf(tokens[i])==-1)
{temp+=tokens[i]+" ";}}
tbWishes.value=(tbWishes.value==""?"":tbWishes.value+" ")+temp.trim();}}
function SpecifyBirthday()
{var rb1=$(ChineseInputClientIDs.rbSpecifyBirthday);var rb2=$(ChineseInputClientIDs.rbSpecifyLinChanQin);var rb3=$(ChineseInputClientIDs.rbNotSpecifyBirthday);var tbDate=$("spanSpecifyBirthdate");var tbTime=$("spanSpecifyBirthtime");if(rb1.checked)
{tbDate.style.display="";tbTime.style.display="";}
else if(rb2.checked)
{tbDate.style.display="";tbTime.style.display="none";}
else
{tbDate.style.display="none";tbTime.style.display="none";}}
function popupDialog(control,url,width,height)
{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");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)
{$(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();this.returnAction=function(strResult)
{if(strResult!=undefined)
{$(control).value=strResult;$(control).title=strResult;}}}}
function SelectSimpParts(control)
{var simpParts=popupDialog(control,AppPath+"Naming/SelectSimpParts.aspx?value="+escape($(control).value),620,500);}
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 PickXingShi()
{try
{InitQueryCode(ChineseInputClientIDs.tbXing,"PickItemDiv");isXingShi=true;autoHide=false;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(ChineseInputClientIDs.tbCountry,"PickItemDiv",CountryValueChanged);isXingShi=false;showQueryDiv(locations["国家"],30,1,5);AjustIframParentSize();}
catch(e)
{}}
function CountryValueChanged()
{var country=$(ChineseInputClientIDs.tbCountry);var pro=$(ChineseInputClientIDs.tbProvince);var city=$(ChineseInputClientIDs.tbCity);if(country.value.trim()!="中国")
{pro.value="";city.value="";}}
function ProvinceValueChanged()
{var city=$(ChineseInputClientIDs.tbCity);city.value="";}
function PickProvince()
{try
{if($(ChineseInputClientIDs.tbCountry).value.trim()=="中国")
{InitQueryCode(ChineseInputClientIDs.tbProvince,"PickItemDiv",ProvinceValueChanged);isXingShi=false;showQueryDiv(locations["省市"],40,1,8);AjustIframParentSize();}}
catch(e)
{}}
function PickCity()
{try
{var country=$(ChineseInputClientIDs.tbCountry).value.trim();var pro=$(ChineseInputClientIDs.tbProvince).value.trim();var city=locations[pro];if(city!=undefined&&city!=null&&country=="中国")
{InitQueryCode(ChineseInputClientIDs.tbCity,"PickItemDiv");isXingShi=false;showQueryDiv(city,40,1,6);AjustIframParentSize();}}
catch(e)
{}}
function SetNameSampleByGender()
{var gender=$(ChineseInputClientIDs.ddlGenders);var nameType=$(ChineseInputClientIDs.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="叠字名，如：李晶晶";}}
