﻿
function CheckUserInput(app)
{var tbMyNickNames=$(NickInputClientIDs.tbMyNickNames);if(app==1)
{var cbEnglish=$(NickInputClientIDs.cbEnglish);var cbKorea=$(NickInputClientIDs.cbKorea);var cbJapanese=$(NickInputClientIDs.cbJapanese);var cbNum=$(NickInputClientIDs.cbNum);var cbChinese=$(NickInputClientIDs.cbChinese);var cbSymbol=$(NickInputClientIDs.cbSymbol);if(cbEnglish.checked==false&&cbKorea.checked==false&&cbJapanese.checked==false&&cbNum.checked==false&&cbChinese.checked==false&&cbSymbol.checked==false)
{alert("请至少选择一种火星文“变换选项”后再提交。");return;}
if(tbMyNickNames.value.trim()==MY_NICKNAMES_PROMPT||tbMyNickNames.value.trim()==""||tbMyNickNames.value.trim().replace(/　/g,"")=="")
{alert("请输入您想要的昵称原型后再提交。");tbMyNickNames.value="";tbMyNickNames.focus();return;}
if(tbMyNickNames.value.trim().length>20)
{alert("昵称原型的长度最多允许20个字符，请修改。");tbMyNickNames.focus();return;}}
if(tbMyNickNames.value.trim()==MY_NICKNAMES_PROMPT)
{tbMyNickNames.value="";}
var tbWishes=$(NickInputClientIDs.tbWishes);if(tbWishes.value.trim()==HOPE_PROMPT)
{tbWishes.value="";}
if(app==2)
{var cbEnglish1=$(NickInputClientIDs.cbEnglish1);var cbKorea1=$(NickInputClientIDs.cbKorea1);var cbJapanese1=$(NickInputClientIDs.cbJapanese1);var cbNum1=$(NickInputClientIDs.cbNum1);var cbChinese1=$(NickInputClientIDs.cbChinese1);var cbSymbol1=$(NickInputClientIDs.cbSymbol1);if(cbEnglish1.checked==false&&cbKorea1.checked==false&&cbJapanese1.checked==false&&cbNum1.checked==false&&cbChinese1.checked==false&&cbSymbol1.checked==false)
{alert("请至少选择一种起昵称“变换选项”后再提交。");return;}
if(tbWishes.value.trim().length>20)
{alert("起昵称愿望的长度最多允许20个字符，请修改。");tbWishes.focus();return;}}
var tbXiaoMingWishes=$(NickInputClientIDs.tbXiaoMingWishes);if(tbXiaoMingWishes.value.trim()==HOPE_PROMPT)
{tbXiaoMingWishes.value="";}
if(app==3)
{if(tbXiaoMingWishes.value.trim().length>20)
{alert("起小名愿望的长度最多允许20个字符，请修改。");tbXiaoMingWishes.focus();return;}}
$(NickInputClientIDs.submitParam).value=app;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($(NickInputClientIDs.lbtSubmit).href);if(re!=null)
{postID=re[1];}
else
{postID=NickInputClientIDs.lbtSubmit.replace(/\_/g,"$");}
__doPostBack(postID,"");}
function AjustIframParentSize()
{try
{var bar=parent.$("modiDialog");var barHolder=parent.$("modiHolder");parent.$("iframeModifyParam").height=document.body.scrollHeight;parent.$("iframeModifyParam").width=document.body.scrollWidth;bar.height=document.body.scrollHeight;bar.width=document.body.scrollWidth;barHolder.height=document.body.scrollHeight;barHolder.width=document.body.scrollWidth;}
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 LUCKY_PROMPT="请输入您的幸运数字，幸运星座，吉祥物等。(请以空格分隔各个关键词，10个字以内)";var HOPE_PROMPT="请输入表达您愿望的词汇。(20个字符以内)";var MY_NICKNAMES_PROMPT="请输入您的昵称原型(比如：我酷故我在)，将变为：峩库故峩在。";window.onload=function()
{try
{OnHopesTextBoxBlur();OnMyNickNamesTextBoxBlur();var tbOtherHopes=$(NickInputClientIDs.tbWishes);var tbMyNickNames=$(NickInputClientIDs.tbMyNickNames);tbOtherHopes.onfocus=function()
{if(tbOtherHopes.value.trim()==HOPE_PROMPT)
{tbOtherHopes.style.color="#000000";tbOtherHopes.value="";}}
tbMyNickNames.onfocus=function()
{if(tbMyNickNames.value.trim()==MY_NICKNAMES_PROMPT)
{tbMyNickNames.style.color="#000000";tbMyNickNames.value="";}}
tbOtherHopes.onblur=OnHopesTextBoxBlur;tbMyNickNames.onblur=OnMyNickNamesTextBoxBlur;$(NickInputClientIDs.tbXing).onfocus=PickXingShi;}
catch(e)
{}}
function OnNameCategoryChanged()
{var ddlCat=$(NickInputClientIDs.ddlCategory);var ddlTypes=$(NickInputClientIDs.ddlNameTypes);var trMyNick=$("trMyNick");if(ddlCat.selectedIndex==1)
{ddlTypes.style.display="none";$("spCatPrompt").innerHTML="-如春儿、佳佳、小雪。";trMyNick.style.display="none";}
else
{ddlTypes.style.display="";$("spCatPrompt").innerHTML="&nbsp;";trMyNick.style.display="";}
AjustIframParentSize();}
function OnHopesTextBoxBlur()
{var tbOtherHopes=$(NickInputClientIDs.tbWishes);if(tbOtherHopes.value.trim()=="")
{tbOtherHopes.style.color="gray";tbOtherHopes.value=HOPE_PROMPT;}}
function OnMyNickNamesTextBoxBlur()
{var tbMyNickNames=$(NickInputClientIDs.tbMyNickNames);if(tbMyNickNames.value.trim()=="")
{tbMyNickNames.style.color="gray";tbMyNickNames.value=MY_NICKNAMES_PROMPT;}}
function OnLucyThingsTextBoxBlur()
{var tbLucy=$(NickInputClientIDs.tbLuckyThings);if(tbLucy.value.trim()=="")
{tbLucy.style.color="gray";tbLucy.value=LUCKY_PROMPT;}}
function PickXingShi()
{try
{InitQueryCode(NickInputClientIDs.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)
{}}
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)
{}
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!="")
{$(NickInputClientIDs.tbXing).value=xing;}
if(ming!="")
{$(NickInputClientIDs.tbMing).value=ming;needAnalyze=false;}}
function AutoCopyName(name)
{if(checkIsChinese(name)==false)
{return false;}
if(name.length==2)
{$(NickInputClientIDs.tbXing).value=name.substring(0,1);$(NickInputClientIDs.tbMing).value=name.substring(1,4);}}
function SetSampleWishes(wish)
{var tbOtherHopes=$(NickInputClientIDs.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 SetSampleXMWishes(wish)
{var tbOtherHopes=$(NickInputClientIDs.tbXiaoMingWishes);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 SetSampleNick(wish)
{var tbOtherHopes=$(NickInputClientIDs.tbMyNickNames);tbOtherHopes.style.color="#000000";if(tbOtherHopes.value.trim()==MY_NICKNAMES_PROMPT)
{tbOtherHopes.value="";}
wish=wish.trim();if(tbOtherHopes.value.indexOf(wish)==-1)
{tbOtherHopes.value+=" "+wish;}
tbOtherHopes.value=tbOtherHopes.value.trim();}
function SetSampleNickName(nick)
{var tbNick=$(NickInputClientIDs.tbMyNickNames);tbNick.style.color="#000000";if(tbNick.value.trim()==MY_NICKNAMES_PROMPT)
{tbNick.value="";}
nick=nick.trim();if(tbNick.value.indexOf(nick)==-1)
{if(tbNick.value.trim()=="")
{tbNick.value+=nick;}
else
{tbNick.value+="\r\n"+nick;}}
tbNick.value=tbNick.value.trim();}
