﻿
function CheckUserInput()
{var tbOriginName=$(CompanyInputClientIDs.tbOriginName);var rbtRename=$(CompanyInputClientIDs.rbtRename);if(tbOriginName.value.trim()==ORN_PROMPT)
{tbOriginName.value="";}
if(rbtRename.checked&&tbOriginName.value.trim()=="")
{alert("请输入原有公司名字。");tbOriginName.focus();tbOriginName.select();return;}
if(rbtRename.checked&&tbOriginName.value.trim().length>8)
{alert("原有名字的长度不能超过8个字符。提示：如果是公司名，您只需要输入公司名字的核心部分即可。\r\n例如，北京美名腾网络技术有限公司，输入‘美名腾’即可。");return;}
if(typeof(IsBaiduApp)=="undefined"||!IsBaiduApp)
{if(CheckAdvancedParams()==false)
{if(window.confirm("您指定了某些音、形、义的值（高级选项的指定信息），但没有指定具体位置。\r\n点击‘确认’指定，点击‘取消’则忽略。"))
{return;}}}
var tbWishes=$(CompanyInputClientIDs.tbWishes);var tbBiz=$(CompanyInputClientIDs.tbBusiness);var tbRaw=$(CompanyInputClientIDs.tbRawNames);if(tbWishes.value.trim()==HOPE_PROMPT)
{tbWishes.value="";}
if(tbBiz.value.trim()==BIZ_PROMPT)
{tbBiz.value="";}
if(tbRaw.value.trim()==RAW_PROMPT)
{tbRaw.value="";}
if(typeof(IsBaiduApp)=="undefined"||!IsBaiduApp)
{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($(CompanyInputClientIDs.lbtSubmit).href);if(re!=null)
{postID=re[1];}
else
{postID=CompanyInputClientIDs.lbtSubmit.replace(/\_/g,"$");}
__doPostBack(postID,"");}
function CheckAdvancedParams()
{var paramsCtrl=$("tableRowSpecifyWord").getElementsByTagName("INPUT");var slot1Ctrl=$(CompanyInputClientIDs.ddlSpecIndex1);var slot2Ctrl=$(CompanyInputClientIDs.ddlSpecIndex2);var specSlot1=false;var specSlot2=false;for(var i=0;i<paramsCtrl.length;++i)
{if(paramsCtrl[i].type.toLowerCase()=="text")
{if(paramsCtrl[i].value.trim()!="")
{var id=paramsCtrl[i].id;var index=id.indexOf("tb");if(index==-1)
{continue;}
id=id.substring(index);if(id.indexOf("1")!=-1)
{specSlot1=true;window.adValue=true;}
else if(id.indexOf("2")!=-1)
{specSlot2=true;window.adValue=true;}}}}
if((specSlot1==true&&slot1Ctrl.selectedIndex==0)||(specSlot2==true&&slot2Ctrl.selectedIndex==0))
{return false;}
return true;}
function AjustIframParentSize(showDialog)
{try
{var bar=parent.$("modiDialog");var barHolder=parent.$("modiHolder");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+(showDialog!=undefined?40:0);;parent.$("iframeModifyParam").width=width;bar.height=height+(showDialog!=undefined?40:0);bar.width=width;barHolder.height=height+(showDialog!=undefined?40:0);barHolder.width=width;}
catch(e)
{}}
function CloseParentWindow()
{try
{parent.$('modiDialog').style.display='none';parent.$('modiAllbody').style.display='none';}
catch(e)
{}}
var HOPE_PROMPT="请输入表达您愿望的关键词。";var BIZ_PROMPT="";var RAW_PROMPT="草稿名之间用空格分隔。";var ORN_PROMPT="原有名字";var specIndex1Sel=0,specIndex2Sel=0;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 OnHopesTextBoxBlur()
{var tbWishes=$(CompanyInputClientIDs.tbWishes);if(tbWishes.value.trim()=="")
{tbWishes.style.color="gray";tbWishes.value=HOPE_PROMPT;}}
function OnBizTextBoxBlur()
{var tbBiz=$(CompanyInputClientIDs.tbBusiness);if(tbBiz.value.trim()=="")
{tbBiz.style.color="gray";tbBiz.value=BIZ_PROMPT;}}
function OnRawNamesTextBoxBlur()
{var tbRaw=$(CompanyInputClientIDs.tbRawNames);if(tbRaw.value.trim()=="")
{tbRaw.style.color="gray";tbRaw.value=RAW_PROMPT;}}
function OnOriginNameTextBoxBlur()
{var tbOriginName=$(CompanyInputClientIDs.tbOriginName);if(tbOriginName.value.trim()=="")
{tbOriginName.style.color="gray";tbOriginName.value=ORN_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,forceOpen)
{var div=$("divAdOptions");var icn=$("showMoreImg");if(forceOpen||(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 OnNameLenChanged()
{var ddlNameLen=$(CompanyInputClientIDs.ddlNameLength);var ddlSpecIndex1=$(CompanyInputClientIDs.ddlSpecIndex1);var ddlSpecIndex2=$(CompanyInputClientIDs.ddlSpecIndex2);var len=parseInt(ddlNameLen.options[ddlNameLen.selectedIndex].value);var specChar2=$(CompanyInputClientIDs.tbSpecifiedWord2);if(specIndex1Sel!=5&&len<specIndex1Sel)
{specIndex1Sel=0;}
if(specIndex2Sel!=5&&len<specIndex2Sel)
{specIndex2Sel=0;}
ddlSpecIndex1.selectedIndex=specIndex1Sel;ddlSpecIndex2.selectedIndex=specIndex2Sel;if(ddlNameLen.selectedIndex==0)
{specChar2.disabled=true;specChar2.value="";}
else
{specChar2.disabled=false;}
if(ddlNameLen.selectedIndex==0)
{ddlSpecIndex1.options[3].className="readOnly";ddlSpecIndex1.options[4].className="readOnly";ddlSpecIndex2.options[3].className="readOnly";ddlSpecIndex2.options[4].className="readOnly";ddlSpecIndex1.options[3].style.backgroundColor="#ccc";ddlSpecIndex1.options[3].style.color="#666";ddlSpecIndex1.options[4].style.backgroundColor="#ccc";ddlSpecIndex1.options[4].style.color="#666";ddlSpecIndex2.options[3].style.backgroundColor="#ccc";ddlSpecIndex2.options[3].style.color="#666";ddlSpecIndex2.options[4].style.backgroundColor="#ccc";ddlSpecIndex2.options[4].style.color="#666";}
else if(ddlNameLen.selectedIndex==1)
{ddlSpecIndex1.options[3].className="readWrite";ddlSpecIndex1.options[4].className="readOnly";ddlSpecIndex2.options[3].className="readWrite";ddlSpecIndex2.options[4].className="readOnly";ddlSpecIndex1.options[3].style.backgroundColor="#fff";ddlSpecIndex1.options[3].style.color="#000";ddlSpecIndex1.options[4].style.backgroundColor="#ccc";ddlSpecIndex1.options[4].style.color="#666";ddlSpecIndex2.options[3].style.backgroundColor="#fff";ddlSpecIndex2.options[3].style.color="#000";ddlSpecIndex2.options[4].style.backgroundColor="#ccc";ddlSpecIndex2.options[4].style.color="#666";}
else
{ddlSpecIndex1.options[3].className="readWrite";ddlSpecIndex1.options[4].className="readWrite";ddlSpecIndex2.options[3].className="readWrite";ddlSpecIndex2.options[4].className="readWrite";ddlSpecIndex1.options[3].style.backgroundColor="#fff";ddlSpecIndex1.options[3].style.color="#000";ddlSpecIndex1.options[4].style.backgroundColor="#fff";ddlSpecIndex1.options[4].style.color="#000";ddlSpecIndex2.options[3].style.backgroundColor="#fff";ddlSpecIndex2.options[3].style.color="#000";ddlSpecIndex2.options[4].style.backgroundColor="#fff";ddlSpecIndex2.options[4].style.color="#000";}}
function OnSpecIndex1Changed()
{var me=$(CompanyInputClientIDs.ddlSpecIndex1);if(me.options[me.selectedIndex].className=='readOnly')
{ShowMsgInfo("您不能选择该项，因为该项和您指定的名字的长度相矛盾。");me.selectedIndex=specIndex1Sel;return;}
var ddlSpecIndex2=$(CompanyInputClientIDs.ddlSpecIndex2);if(ddlSpecIndex2.selectedIndex!=0&&me.selectedIndex!=5&&ddlSpecIndex2.selectedIndex==me.selectedIndex)
{ShowMsgInfo("当前指定位置不能和另外一个指定位置相同。");me.selectedIndex=specIndex1Sel;return;}
specIndex1Sel=me.selectedIndex;}
function OnSpecIndex2Changed()
{var me=$(CompanyInputClientIDs.ddlSpecIndex2);if(me.options[me.selectedIndex].className=='readOnly')
{ShowMsgInfo("您不能选择该项，因为该项和您指定的名字的长度相矛盾。");me.selectedIndex=specIndex2Sel;return;}
var ddlSpecIndex1=$(CompanyInputClientIDs.ddlSpecIndex1);if(ddlSpecIndex1.selectedIndex!=0&&me.selectedIndex!=5&&ddlSpecIndex1.selectedIndex==me.selectedIndex)
{ShowMsgInfo("当前指定位置不能和另外一个指定位置相同。");me.selectedIndex=specIndex2Sel;return;}
specIndex2Sel=me.selectedIndex;}
var bizSamplesCache=new Array();function GetBizSamples()
{var area=$(CompanyInputClientIDs.ddlArea);var selID=area.options[area.selectedIndex].value;if(bizSamplesCache[selID]!=null)
{$("spanBiz").innerHTML=bizSamplesCache[selID];return;}
try
{　　 xmlHttp=GetXmlHttpObject();　　 SendXmlHttpRequest(xmlHttp,GetBizSamplesCallBack,AppPath+"CompanyName/AJAXServices/BizSamples.aspx?AreaID="+escape(selID));}
catch(e)
{}}
function GetBizSamplesCallBack()
{try
{if(xmlHttp.readyState==4||xmlHttp.readyState=='complete')
{if(xmlHttp.status==200)
{var response=xmlHttp.responseText;if(response.length>0)
{var more=response.substring(0,1);response=response.substring(1);if(response=="")
{$("spanBiz").innerHTML="";return;}
var temp=response.split("|");var html="<br /><span style='color:gray'>比如，</span>";for(i=0;i<temp.length;++i)
{if(temp[i]!=null&&temp[i]!="")
{html+="<a title='点击加入' href='javascript:void(0);' onclick='PickBizSample(\""+temp[i]+"\")'>"+temp[i]+"</a>　";}}
if(more=="1")
{html+="<a title='点击查看更多' href=javascript:void(0) onclick='ShowMoreBizSamples()'>更多</a>";}
$("spanBiz").innerHTML=html;var area=$(CompanyInputClientIDs.ddlArea);var selID=area.options[area.selectedIndex].value;bizSamplesCache[selID]=html;if(IsModification)
{AjustIframParentSize();}}
else
{$("spanBiz").innerHTML="";}}
else
{$("spanBiz").innerHTML="";}}}
catch(e)
{}}
function PickBizSample(txt)
{var tb=$(CompanyInputClientIDs.tbBusiness);if(tb.value.trim()==BIZ_PROMPT)
{tb.style.color="#000000";tb.value="";}
var temp=" "+tb.value+" ";if(temp.indexOf(" "+txt+" ")==-1)
{tb.value=(tb.value.trim()+" "+txt).trim();}}
function ShowMoreBizSamples()
{var control=CompanyInputClientIDs.tbBusiness;var area=$(CompanyInputClientIDs.ddlArea);var selID=area.options[area.selectedIndex].value;var simpParts=popupDialog(control,AppPath+"CompanyName/SelectBizSamples.aspx?value="+escape($(control).value)+"&AreaID="+escape(selID),620,410);}
var currentAreaIndex=0;var currentAreaChar='';function CharPointItem(evt)
{evt=window.event?window.event:evt;var ddl=$(CompanyInputClientIDs.ddlArea);var itemCount=ddl.options.length;var selectStr='';var laseIndex=currentAreaIndex;var pressKey=String.fromCharCode(evt.keyCode).toLowerCase();if(itemCount<=1||IsEnChar(pressKey)==false)
return;if(pressKey!=currentAreaChar)
currentAreaIndex=0;for(var i=currentAreaIndex;i<itemCount;++i)
{if(ddl.options[i].getAttribute("py").toLowerCase()==pressKey)
{currentAreaChar=pressKey;ddl.selectedIndex=i;currentAreaIndex=i+1;break;}}
ddl.onchange();currentAreaIndex=laseIndex==currentAreaIndex?0:currentAreaIndex;}
function IsEnChar(str)
{t=str.charAt(0).toLowerCase();if(t<="z"&&t>="a")
return true;else
return false;}
function OnUnknownArea()
{var tbBiz=$(CompanyInputClientIDs.tbBusiness);var bizInfo=tbBiz.value.trim();if(bizInfo==BIZ_PROMPT)
{tbBiz.value="";}
if(tbBiz.value=="")
{alert("请输入您公司的业务介绍。");return;}
try
{　　 xmlHttp=GetXmlHttpObject();　　 SendXmlHttpRequest(xmlHttp,OnUnknownAreaCallback,AppPath+"CompanyName/AJAXServices/AreaClassify.aspx?BizInfo="+escape(bizInfo));}
catch(e)
{}}
function OnUnknownAreaCallback()
{try
{if(xmlHttp.readyState==4||xmlHttp.readyState=='complete')
{if(xmlHttp.status==200)
{var response=xmlHttp.responseText;if(response.length>0)
{var temp=response.split("|");var html="";for(i=0;i<temp.length;++i)
{if(temp[i]=="")
{continue;}
var t=temp[i].split(":");html+="<input type='radio' onclick='SelectArea(\""+t[0]+"\")' name='RD_AREA' id='rdArea"+i+"' /><label for='rdArea"+i+"'>"+t[1]+"</label>";}
if(html!="")
{html="<hr />根据您输入的业务介绍，我们为您推荐了几个最相关领域，请选择领域：<br />"+html;}
$("spanArea").innerHTML=html;if(IsModification)
{AjustIframParentSize();}}
else
{$("spanArea").innerHTML="暂无推荐。";}}
else
{$("spanArea").innerHTML="暂无推荐。";}}}
catch(e)
{}}
function SelectArea(areaID)
{var ddl=$(CompanyInputClientIDs.ddlArea);for(var i=0;i<ddl.options.length;++i)
{if(ddl.options[i].value==areaID)
{ddl.selectedIndex=i;GetBizSamples();break;}}}
function ShowMsgInfo(msg)
{try
{var msgDialog=$("msgContainer");var msgDialogTxt=$("msgContainerTxt");if(msgDialog.style.visibility=='hidden')
{msgDialog.style.visibility="visible";}
msgDialogTxt.innerHTML=msg.replace("<br>","");msgDialog.style.left=(screen.width-msgDialog.scrollWidth)/2+"px";msgDialog.style.top=document.documentElement.scrollTop+2+"px";msgDialog.style.borderColor="red";setTimeout("HighlightMsgInfo()",200);clearTimeout(autoCloseTimer);autoCloseTimer=setTimeout("AutoCloseMsgInfo()",4*1000);msgDialog.onmouseover=function()
{clearTimeout(autoCloseTimer);}
msgDialog.onmouseout=function()
{autoCloseTimer=setTimeout("AutoCloseMsgInfo()",2*1000);}}
catch(e)
{}}
var autoCloseTimer;function HighlightMsgInfo()
{try
{var msgDialog=$("msgContainer");msgDialog.style.borderColor="green";}
catch(e)
{}}
function AutoCloseMsgInfo()
{try
{var msgDialog=$("msgContainer");msgDialog.style.visibility="hidden";}
catch(e)
{}}
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 SetSampleWishes(wish)
{var tbOtherHopes=$(CompanyInputClientIDs.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 SetControlsStatus()
{CheckAdvancedParams();if(window.adValue)
{var button=$("btAdOption");if(button.innerHTML=="显示")
{ShowAdOptions(button);}}}
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 PickCountry()
{try
{InitQueryCode(CompanyInputClientIDs.tbCountry,"PickItemDiv",CountryValueChanged);isXingShi=false;showQueryDiv(locations["国家"],30,1,5);AjustIframParentSize(true);}
catch(e)
{}}
function CountryValueChanged()
{var country=$(CompanyInputClientIDs.tbCountry);var pro=$(CompanyInputClientIDs.tbProvince);var city=$(CompanyInputClientIDs.tbCity);if(country.value.trim()!="中国")
{pro.value="";city.value="";}}
function ProvinceValueChanged()
{var city=$(CompanyInputClientIDs.tbCity);city.value="";}
function PickProvince()
{try
{if($(CompanyInputClientIDs.tbCountry).value.trim()=="中国")
{InitQueryCode(CompanyInputClientIDs.tbProvince,"PickItemDiv",ProvinceValueChanged);isXingShi=false;showQueryDiv(locations["省市"],40,1,8);AjustIframParentSize(true);}}
catch(e)
{}}
function PickCity()
{try
{var country=$(CompanyInputClientIDs.tbCountry).value.trim();var pro=$(CompanyInputClientIDs.tbProvince).value.trim();var city=locations[pro];if(city!=undefined&&city!=null&&country=="中国")
{InitQueryCode(CompanyInputClientIDs.tbCity,"PickItemDiv");isXingShi=false;showQueryDiv(city,40,1,6);AjustIframParentSize(true);}}
catch(e)
{}}
function BubbleClick()
{var v=$("divBubblePrompt");v.style.display="none";SetCookie("BrandBubblePrompt","1");}
