
function getParent(id){if(typeof allCategoriesTree[id]=="undefined")
return 0;var parentID=allCategoriesTree[id].p;return parentID;}
function getName(id){var name=allCategoriesTree[id].n;return name;}
function getAncestors(id){var parentID=getParent(id);var Ancestors=new Array();while(parentID>0){var name=getName(parentID);Ancestors.push(parentID);parentID=getParent(parentID);}
return Ancestors;}
function getChildren(id){var children=new Array();for(key in allCategoriesTree){var parentID=getParent(key);if(parentID==id){children.push(key);}}
if(Current.Browser.WebKit)
return children;else
return children.sort(stringsCompare);}
function stringsCompare(a,b){var s1=allCategoriesTree[a].n;var s2=allCategoriesTree[b].n;return s1.localeCompare(s2);}
function showChildrenCats(id,divid,divObj){var obj;if(divObj)
obj=divObj;else
obj=document.getElementById('cats_t'+divid);if(obj!=null&&obj.innerHTML!=''){obj.style.display='block';var img=obj.parentNode.childNodes[0].childNodes[0];img.src=wgStaticFilesServer+"/templates/icons/topics-arrow-on.gif";var linkobj=jQuery('#cats_t'+id)[0];if(id!=divid&&linkobj!=null){linkobj.innerHTML=obj.innerHTML;linkobj.style.display='block';}
return 1;}
var children=getChildren(id);var tbl="<table>";var max=children.length;var src=wgStaticFilesServer+"/templates/icons/no_chk.gif";for(var i=0;i<max;i++){var key=children[i];if((key==wikiAnswersLocalID&&!isSuper())||(key==2380&&!isSuper())||(key==uncategorizedID&&!isSuper())||(key==2092&&exsitsInJson(qcats,2092)))continue;var name=getName(key).replace(/\\/g,'');var hasChildren=(typeof allCategoriesTree[key].c!='undefined'&&allCategoriesTree[key].c>0)?true:false;var style="";tbl+="<tr><td style='margin: 0px; padding: 3px 3px 3px 10px; vertical-align: top;'>"
tbl+="<input name='i"+key+"' value='1' id='i"+key+"' type='hidden'>";tbl+="<img isTopCat='0' alt='Select/Deselect' title='Select/Deselect' onclick='toggleCheck(this);' src='"+src+"' class='c"+key+"'";tbl+="style='cursor: pointer; display: block; margin-top: 1px;' width='12' border='0' height='12'></td>";tbl+="<td style='margin: 0px; padding: 3px; width: 100%;'>";if(hasChildren){tbl+="<span style='white-space:nowrap;color:#003399;cursor:pointer;' class='cat"+key+"' onclick='showHideChildren(this);return false;'>";tbl+="<img border='0' src='"+wgStaticFilesServer+"/templates/icons/topics-arrow-off.gif?v=28333' class='arrowImg'/>";tbl+=name+"</span>";}
else
tbl+="<span class='cat"+key+"' style='white-space: nowrap;color:black;'>"+name.replace(/\\/g,'')+"</span>";tbl+="<div id='cats_t"+key+"' style='margin: 0px; padding: 3px 0px 0px; width: 100%; display: none;'>";tbl+="</div></td></tr>";}
tbl+="</table>";if(obj!=null&&max>0){obj.style.display='block';var img=obj.parentNode.childNodes[0].childNodes[0];img.src=wgStaticFilesServer+"/templates/icons/topics-arrow-on.gif";obj.innerHTML=tbl;}}
function showHideChildren(obj){var divNode=obj.parentNode.getElementsByTagName('div')[0];if(divNode!=null&&divNode.innerHTML!=""&&divNode.style.display=='block'){divNode.style.display='none';var img=obj.childNodes[0];img.src=wgStaticFilesServer+"/templates/icons/topics-arrow-off.gif";}else if(divNode!=null&&divNode.innerHTML!=""&&divNode.style.display=='none'){divNode.style.display='block';var img=obj.childNodes[0];img.src=wgStaticFilesServer+"/templates/icons/topics-arrow-on.gif";}else{var id=obj.className.replace("cat","");var link=allCategoriesTree[id].l;if(link>0)
showChildrenCats(link,id,divNode);else
showChildrenCats(id,id,divNode);}
setTimeout("repaintPage()",1);}
function printMainTree(){var tbl="<table>";var src=wgStaticFilesServer+"/templates/icons/no_chk.gif";for(n in topCatsJason){key=topCatsJason[n];if(key==wikiAnswersLocalID&&!isSuper())continue;var hasChildren=(typeof allCategoriesTree[key].c!='undefined'&&allCategoriesTree[key].c>0)?true:false;var parentID=getParent(key);if(key>0&&parentID==0){var name=getName(key).replace(/\\/g,'');tbl+="<tr><td style='margin: 0px; padding: 3px 3px 3px 10px; vertical-align: top;'>"
tbl+="<input name='i"+key+"' value='1' id='i"+key+"' type='hidden'>";tbl+="<img isTopCat='1' alt='Select/Deselect'";if(key!=wikiAnswersLocalID||(typeof isAdmin!='undefined'&&isAdmin))
tbl+=" onclick='toggleCheck(this);'";tbl+=" title='Select/Deselect' src='"+src+"' class='c"+key+"' style='"+((key!=wikiAnswersLocalID||(typeof isAdmin!='undefined'&&isAdmin))?"cursor: pointer;":"")+"display: block; margin-top: 1px;' width='12' border='0' height='12'>";tbl+="</td>";tbl+="<td style='margin: 0px; padding: 3px; width: 100%;'>";if(hasChildren){tbl+="<span style='white-space:nowrap;color:#003399;cursor:pointer;' class='cat"+key+"' onclick='showHideChildren(this);return false;'>";tbl+="<img border='0' src='"+wgStaticFilesServer+"/templates/icons/topics-arrow-off.gif?v=28333' class='arrowImg'/>";tbl+=name+"</span>";}
else{tbl+="<span style='white-space:nowrap;color:#003399;' class='cat"+key+"'>";tbl+=name+"</span>";}
tbl+="<div id='cats_t"+key+"' style='margin: 0px; padding: 3px 0px 0px; width: 100%; display: none;'>";tbl+="</div></td></tr>";}}
tbl+="</table>";fillMainList(tbl);setTimeout("repaintPage()",1);}
function showParentMirrors(parent){var strMirrors=(typeof allCategoriesTree[parent].m=='undefined')?"":allCategoriesTree[parent].m.trim();if(strMirrors!=""){var arrMirrors=strMirrors.split(",");var max=arrMirrors.length;for(var i=0;i<max;i++){showSubTree(arrMirrors[i]);copyOriginalToMirror(parent,arrMirrors[i]);}}}
function checkMirrors(orig){var strMirrors=(typeof allCategoriesTree[orig].m=='undefined')?"":allCategoriesTree[orig].m.trim();var arrMirrors=strMirrors.split(",");var max=arrMirrors.length;for(var i=0;i<max;i++){showSubTree(arrMirrors[i]);var parent=getParent(arrMirrors[i]);markParent(parent,arrMirrors[i]);copyOriginalToMirror(orig,arrMirrors[i]);showParentMirrors(parent);}}
function markParent(parent,child){var decs=getDecs("cats_t"+parent);var decsLen=decs.length;for(var x=0;x<decsLen;x++){if(decs[x].className=="c"+child)
checkCat(decs[x]);}}
function copyOriginalToMirror(orig,mirror){var mirrorObj=jQuery('#cats_t'+mirror)[0];var origObj=jQuery('#cats_t'+orig)[0];var childs=(typeof allCategoriesTree[orig].c=='undefined')?0:allCategoriesTree[orig].c;if(mirrorObj!=null&&origObj!=null&&childs>0){mirrorObj.innerHTML=origObj.innerHTML;mirrorObj.style.display='block';}}
function getDecs(id){var obj=document.getElementById(id);if(obj!=null){return obj.getElementsByTagName('*');}
else{return[];}}
function showSubTree(id){var ancestors=getAncestors(id);var max=ancestors.length;var toOpen=new Array();for(var i=0;i<max;i++){var obj=document.getElementById('cats_t'+ancestors[i]);if(obj!=null&&obj.style.display=='none'){showChildrenCats(ancestors[i],ancestors[i],obj);break;}else{toOpen.push(ancestors[i]);}}
max=toOpen.length;for(var x=max-1;x>=0;x--){showChildrenCats(toOpen[x],toOpen[x],null);}}
var isFirstTime=true;function showFaytSel(id,fromfayt){var len=selectedCatsArr.length;if(fromfayt){if(window.location.href.match(/newqAdded/i)!=null)
_hbLink('FAYT_cat');else
_hbLink('FAYT_recat');}
if(isFirstTime||(len<limit&&isSelected(id))){hideMsg();if(jwgData.config.useCatchAllCategory){if(isCatchallSelected(id)&&len>0){showMsg("You can\'t select a Catch-All category unless you deselect other categories.");return;}
if(isCatchallinAlreadySelected()){showMsg("You can\'t select another category unless you deselect the Catch-All category first.");return;}}
updateSuggested(id,1);showSubTree(id);markSelected(id);scrollTo(id);}else if(len>=limit){showLimit();}
updateCurrentCats();setTimeout("repaintPage()",1);}
function addToselectedlist(id){var orig=(typeof allCategoriesTree[id]=="undefined"||allCategoriesTree[id].l==0)?id:allCategoriesTree[id].l;if(selectedCatsArr.indexOf(orig,0,1)<0)
selectedCatsArr.push(orig);}
function isSelected(id){var obj=document.getElementById('cats_t'+id);if(obj!=null){var img=obj.parentNode.parentNode.childNodes[0].childNodes[1];var src=img.src;if(src.match(/no_chk\.gif/gi)==null)
return false;}
return true;}
function scrollTo(id){var obj=jQuery("#cats_t"+id)[0];var dtop=313;if(obj!=null){if(obj.style.display=='block'){dtop=getObjXY(obj)[1];}else if(obj.style.display=='none'){obj.style.display='block';dtop=getObjXY(obj)[1];obj.style.display='none';}}
var scrOfY=0;if(document.body&&document.body.scrollTop){scrOfY=document.body.scrollTop;}else if(document.documentElement&&document.documentElement.scrollTop){scrOfY=document.documentElement.scrollTop;}
var scroll=dtop-313-scrOfY;if(isNewQuestion&&jQuery('#suggestedcats').length>0)
scroll=dtop-400-scrOfY;if(jQuery("#brwscat").length>0)
setTimeout("scrollBrwscat("+scroll+")",0);}
function scrollBrwscat(scroll){var brwscat=document.getElementById('brwscat');if(brwscat!=null)
brwscat.scrollTop=scroll;}
function markSelected(id){var obj=document.getElementById('cats_t'+id);if(obj!=null){var img=obj.parentNode.parentNode.childNodes[0].childNodes[1];if(img!=null){img.src=wgStaticFilesServer+"/templates/icons/chk.gif";var span=img.parentNode.parentNode.childNodes[1].childNodes[0];span.style.backgroundColor='#f7941d';span.style.color='white';var cname=img.className;var curid=cname.replace("c","");curid=allCategoriesTree[curid].l>0?allCategoriesTree[curid].l:curid;addToselectedlist(curid);if(!isFirstTime)
deselectParents(img);var divNode=img.parentNode.parentNode.getElementsByTagName('div')[0];showChildrenCats(curid,curid,divNode);var deselectAlllspan=jQuery('#deselectAll')[0];if(deselectAlllspan!=null&&deselectAlllspan.style.color!='#003399'){deselectAlllspan.style.display='none';}
setTimeout("repaintPage()",1);}}}
function deselectParents(img){var parent=img.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.childNodes[0].childNodes[1];while(typeof parent!='undefined'&&parent!=null&&typeof parent.getAttribute("isTopCat")!="undefined"){if(parent.src.match(/no_chk\.gif/gi)==null){var cname=parent.className;var curid=cname.replace("c","");curid=allCategoriesTree[curid].l>0?allCategoriesTree[curid].l:curid;uncheckCat(parent);deselectLinks(curid);}
if(parent.getAttribute("isTopCat")=="1")
return false;parent=parent.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.childNodes[0].childNodes[1];}}
function deselectChilds(img){var childs=img.parentNode.parentNode.getElementsByTagName('img');var max=childs.length;for(var i=0;i<max;i++){if(childs[i]!=img&&childs[i].src.match(/chk\.gif/gi)!=null&&childs[i].src.match(/no_chk\.gif/gi)==null){var cname=childs[i].className;var curid=cname.replace("c","");curid=allCategoriesTree[curid].l>0?allCategoriesTree[curid].l:curid;uncheckCat(childs[i]);deselectLinks(curid);}}}
function checkCat(img){if(typeof(img)!="undefined"&&img!=null){img.src=wgStaticFilesServer+"/templates/icons/chk.gif";var span=img.parentNode.parentNode.childNodes[1].childNodes[0];span.style.backgroundColor='#f7941d';span.style.color='white';var cname=img.className;var curid=cname.replace("c","");curid=(allCategoriesTree[curid].l!=null&&allCategoriesTree[curid].l>0)?allCategoriesTree[curid].l:curid;addToselectedlist(curid);updateSuggested(curid,1);var divNode=img.parentNode.parentNode.getElementsByTagName('div')[0];showChildrenCats(curid,curid,divNode);deselectParents(img);var deselectAlllspan=jQuery('#deselectAll')[0];if(deselectAlllspan!=null&&deselectAlllspan.style.color!='#003399'){deselectAlllspan.style.display='none';}
updateCurrentCats();setTimeout("repaintPage()",1);}}
function uncheckCat(img){var len=selectedCatsArr.length;if(img!=null){img.src=wgStaticFilesServer+"/templates/icons/no_chk.gif";var span=img.parentNode.parentNode.childNodes[1].childNodes[0];span.style.backgroundColor='white';var cname=img.className;var curid=cname.replace("c","");curid=allCategoriesTree[curid].l>0?allCategoriesTree[curid].l:curid;var hasChildren=(typeof allCategoriesTree[curid].c!='undefined'&&allCategoriesTree[curid].c>0)?true:false;if(hasChildren)
span.style.color='#003399';else
span.style.color='black';selectedCatsArr.remove(curid);updateSuggested(curid,0);if(len==0){var deselectAlllspan=jQuery('#deselectAll')[0];if(deselectAlllspan!=null){deselectAlllspan.style.display='block';}}
if(((len>=0&&jwgData.config.useCatchAllCategory)||len==0)&&len<=limit){hideMsg();}
updateCurrentCats();setTimeout("repaintPage()",1);}}
function updateCurrentCats(){var currentCatsTbl=jQuery('#currentCatsTbl')[0];if(currentCatsTbl!=null){var str="<table width=\"100%\">";var max=selectedCatsArr.length;for(var i=0;i<max;i++){str+="<tr><td width='15'><input type='checkbox' name='suggestedCat' value='"+selectedCatsArr[i]+"' onclick='cuSuggested(this);' checked></td><td><span>"+allCategoriesTree[selectedCatsArr[i]].n.replace(/\\/g,'')+"</span></td></tr>";}
str+="</table>";currentCatsTbl.innerHTML=str;}
updateHeight();}
function toggleCheck(img){var src=img.src;var cname=img.className;var curid=cname.replace("c","");var len=selectedCatsArr.length;if(src.match(/no_chk\.gif/gi)!=null){if(len<limit){hideMsg();if(jwgData.config.useCatchAllCategory){if(isCatchallSelected(curid)&&len>0){showMsg("You can\'t select a Catch-All category unless you deselect other categories.");return;}
if(isCatchallinAlreadySelected()){showMsg("You can\'t select another category unless you deselect the Catch-All category first.");return;}}
checkCat(img);}else{showLimit();}}else{selectedCatsArr.remove(curid);uncheckCat(img);deselectLinks(curid);}}
var limit=3;function deselectLinks(id){var decs=getDecs("catTree");var origlink=allCategoriesTree[id].l;var max=decs.length;for(var i=0;i<max;i++){if(decs[i].tagName.toLowerCase()=='img'&&decs[i].src.match(/\/chk\.gif/i)!=null){var cname=decs[i].className;var curid=cname.replace("c","");var curlink=allCategoriesTree[curid].l;if(curid==id||(curlink>0&&id==curlink)||(origlink>0&&curid==origlink)||(curlink>0&&origlink>0&&curlink==origlink)){uncheckCat(decs[i]);}}}}
function deselectAll(){printMainTree();var deselectAlllspan=jQuery('#deselectAll')[0];if(deselectAlllspan!=null){deselectAlllspan.style.display='block';}
var suggestedcats=jQuery('#suggestedTree')[0];if(suggestedcats!=null){var elements=suggestedcats.getElementsByTagName('input');var max=elements.length;for(var i=0;i<max;i++){elements[i].checked=false;}}
selectedCatsArr=new Array();var errbox2=jQuery('#errorMsgBox2')[0];errbox2.innerHTML="";updateCurrentCats();updateHeight();}
function getAllSAelected(){var max=selectedCatsArr.length;var allSelectedStr="";for(var i=0;i<max;i++){if(i>0)allSelectedStr+=",";allSelectedStr+=selectedCatsArr[i];}
return allSelectedStr;}
var baseHeight=500;var targetElement=null;function callRecat(qTitle,obj){RecategorizeCats(qTitle);targetElement=obj;}
function RecategorizeCats(qTitle){var recategorizePopUp=jQuery('#catsWindow')[0];baseHeight=500;if(typeof(recategorizePopUp)!='undefined'){return 1;}
IncludeJS('catsjs',location.protocol+"//"+location.host+'/Q/Special:Cats&act=getList&ts='+topicTreeChangeTime+'&s='+isSuper());if(qTitle&&qTitle!="")
qTitle=qTitle.replace(/_/g," ");var url=location.protocol+"//"+location.host+"/Q/Special:Cats&ajax=1&act=selcats&question="+encodeURI(qTitle);jQuery.ajax({url:url,data:"",success:function(resp){fillCats(resp);}});if(jwgData.config.useCatchAllCategory){if(catchAllArray&&catchAllArray.length==0){setcatchAllArray();}}
var catsWindow=document.createElement('div');catsWindow.id="catsWindow";var bodyNode=document.body;var tarnsBg=document.createElement('div');catsWindow.innerHTML="<div id='ajaxLoaderImg'></div>";tarnsBg.id="tarnsBg";if(bodyNode!=null&&catsWindow!=null)
{if(tarnsBg!=null)bodyNode.appendChild(tarnsBg);bodyNode.appendChild(catsWindow);var scrOfY=0;var scrOfX=0;if(document.body&&document.body.scrollTop){scrOfY=document.body.scrollTop;scrOfX=document.body.scrollLeft;}else if(document.documentElement&&document.documentElement.scrollTop){scrOfY=document.documentElement.scrollTop;scrOfX=document.documentElement.scrollLeft;}
if(isIE6()){var hiddenIframe=document.createElement('iframe');hiddenIframe.id="hiddenIframe";bodyNode.appendChild(hiddenIframe);}
if(typeof(window.innerHeight)=='number'){var visibleAreaH=window.innerHeight;var visibleAreaW=window.innerWidth;}else{var visibleAreaH=document.documentElement.clientHeight;var visibleAreaW=document.documentElement.clientWidth;}
var leftalign=((visibleAreaW-442)/2)+scrOfX;if(visibleAreaH>500){baseHeight=visibleAreaH-25;if(Current.Browser.IE)
baseHeight=visibleAreaH-25;else
baseHeight=visibleAreaH-40;}else{baseHeight=475;}
if(window.location.href.match(/newqAdded/i)!=null)
baseHeight=baseHeight-15;jQuery(catsWindow).css({"height":baseHeight+"px","top":scrOfY+10+"px","left":leftalign+"px"});jQuery('#hiddenIframe').css({"height":baseHeight+"px","top":scrOfY+"px","left":leftalign+"px"});}
questionTitle=qTitle;}
var questionTitle=null;var isLoaded=false;function onKeyPressEvent(e){if(jQuery('#catsWindow').length==0)
return true;if(!e)var e=window.event;var tg=(window.event&&document.all)?e.srcElement:e.target;var keynum=((e.which)||(e.keyCode));if(tg.id=="textInputId"&&(jQuery('#suggestions').length>0&&jQuery('#suggestions')[0].style.display!="none")){return true;}
else if(keynum==13){clickonfayt+="oldEvt";return doRecatogorize(questionTitle);}}
var isNewQuestion=false;function fillMainList(tbl){var catTree=document.getElementById('catTree');if(catTree!=null)
catTree.innerHTML=tbl;else
setTimeout("fillMainList('"+tbl+"')",100);}
function moveFoCusTo(id){if(jQuery("#"+id).length>0){jQuery("#"+id).focus();jQuery("#"+id).focus();}
else
setTimeout("moveFoCusTo('"+id+"')",100);}
var checkIfCatsRecievedInterval=null;function fillCats(str){str=str.trim();if(str.indexOf("errormsg:")==0){eval(str.substring(9));return;}
if(jQuery('#catsWindow').length!=0){jQuery('#catsWindow').append(str);eval(jQuery("#firstcats").html());if(qcats!=null&&qcats[0]==uncategorizedID){isNewQuestion=true;}}
checkIfCatsRecievedInterval=setInterval("checkIfCatsRecieved()",1);}
function checkIfCatsRecieved(){if(typeof(allCategoriesTree)!="undefined"&&allCategoriesTree!=null&&typeof(qcats)!="undefined"&&qcats!=null){clearInterval(checkIfCatsRecievedInterval);showCatsList();}}
function repaintPage(){updateHeight();if(jQuery('#brwscat').length>0&&(Current.Browser.Opera||Current.Browser.WebKit)){jQuery('#brwscat')[0].scrollTop+=1;jQuery('#brwscat')[0].scrollTop-=1;}}
function closeWindow(clickedBtn){if(!isLoaded)return false;if(selectedCatsArr.indexOf(uncategorizedID,0,1)>-1&&selectedCatsArr.length>1){selectedCatsArr.remove(uncategorizedID);}
if(selectedCatsArr.indexOf(2092,0,1)>-1&&selectedCatsArr.length>1){selectedCatsArr.remove(2092);}
if(selectedCatsArr.indexOf(412,0,1)>-1&&selectedCatsArr.length>1){selectedCatsArr.remove(412);}
var catsList=jQuery('#catsList')[0];if(qcats!=null&&qcats[0]==uncategorizedID){var allsel=getSelectedSuggestedCats();if(allsel.length>0){var firstRecat=0;if(window.location.href.match(/newqAdded/i)!=null){firstRecat=1;_hbLink('NewQ_cated');}
var url=location.protocol+"//"+location.host+"/Q/"+encodeURI(questionTitle)+"&action=editfaq&newcats="+allsel+"&fromatlas=brute&firstRecat="+firstRecat;jQuery.ajax({url:url,data:"",type:"POST",success:function(resp){updateErrMsg(resp);}});}
else{if(window.location.href.match(/newqAdded/i)!=null)_hbLink('NewQ_notcated');resetRectParams('Close');}}else{if(window.location.href.match(/newqAdded/i)!=null)_hbLink('NewQ_notcated');resetRectParams('Close');}}
recatPopupClosed=true;function resetRectParams(clickedBtn){wssAutoRecat(clickedBtn);var catsWindow=jQuery('#catsWindow')[0];var tarnsBg=jQuery('#tarnsBg')[0];var hiddenIframe=jQuery('#hiddenIframe')[0];var bodyNode=document.body;if(bodyNode!=null)
{if(catsWindow!=null)bodyNode.removeChild(catsWindow);if(hiddenIframe!=null)bodyNode.removeChild(hiddenIframe);if(tarnsBg!=null)bodyNode.removeChild(tarnsBg);bodyNode.style.overflow="";recatPopupClosed=true;}
if(typeof ANSW!="undefined")
ANSW.AnswerTipEnabled=true;if(clickedBtn!="Close"){if(clickedBtn=="Save"&&window.location.href.match(/\/FAQ\/(\d+)/i)!=null){var currentCat=window.location.href.match(/\/FAQ\/(\d+)/i);if(targetElement!=null&&currentCat!=null&&selectedCatsArr.indexOf(currentCat[1],0,1)<0)
targetElement.style.display='none';}else if(targetElement!=null&&targetElement.id.match(/q_item_div/)!=null){var currentCat=window.location.href.match(/tid=(\d+)/i);if(currentCat!=null&&selectedCatsArr.indexOf(currentCat[1],0,1)<0)
targetElement.style.display='none';}else if(targetElement!=null&&window.location.href.match(/\/FAQ\/(\d+)/i)==null&&targetElement.parentNode!=null&&selectedCatsArr.length>0&&selectedCatsArr[0]!=uncategorizedID&&clickedBtn=="Save"){selectedCatsArr=selectedCatsArr.sort(sortByNumber);targetElement.parentNode.innerHTML="In:"+" <a target=\"_blank\" href=\"/Q/FAQ/"+selectedCatsArr[0]+"\" style=\"font-weight:normal;color: rgb(127, 127, 127);\">"+allCategoriesTree[selectedCatsArr[0]].n+"</a>";}
selectedCatsArr=new Array();if(window.location.href.match(/newqAdded/i)!=null){var href=window.location.href.replace("&newqAdded=1","").replace(/&action=editfaq&email=WatchUpds&link=Recat/,"");window.location.href=href;}}
selectedCatsArr=new Array();qcats=null;isLoaded=false;isNewQuestion=false;questionTitle=null;isFirstTime=true;targetElement=null;}
function sortByNumber(a,b)
{return a-b;}
function doRecatogorize(qTitle){if((document.all&&!isIE6())||clickonfayt=="oldEvt"||clickonfayt=="changeCatoldEvt"){var savebtn=jQuery('#buttonsTbl').length?jQuery('#buttonsTbl').find("a.btn"):null;if(savebtn==null||savebtn.isDisabledBtn()){return false;}
if(selectedCatsArr.indexOf(uncategorizedID,0,1)>-1&&selectedCatsArr.length>1){selectedCatsArr.remove(uncategorizedID);}
if(selectedCatsArr.indexOf(2092,0,1)>-1&&selectedCatsArr.length>1){selectedCatsArr.remove(2092);}
if(selectedCatsArr.indexOf(412,0,1)>-1&&selectedCatsArr.length>1){selectedCatsArr.remove(412);}
var allsel=getAllSAelected();if(allsel.length==0){allsel=uncategorizedID;}
var firstRecat=0;if(window.location.href.match(/newqAdded/i)!=null){firstRecat=1;_hbLink('NewQ_cated');}
var fromatlas=getCatsFromAtlas(allsel);var url=location.protocol+"//"+location.host+"/Q/"+encodeURI(qTitle)+"&action=editfaq&newcats="+allsel+"&fromatlas="+fromatlas+"&firstRecat="+firstRecat;jQuery.ajax({url:url,data:"",type:"POST",success:function(resp){updateErrMsg(resp);}});}else{clickonfayt="";}}
function getCatsFromAtlas(selectedCats){var suggestedcats=jQuery('#suggestedTree')[0];var fromatlas="";var suggestedcats=jQuery('#suggestedTree')[0];if(suggestedcats!=null){var elements=suggestedcats.getElementsByTagName('input');var max=elements.length;for(var i=0;i<max;i++){if(selectedCats.indexOf(elements[i].value,0,1)>-1){if(fromatlas!="")fromatlas+=",";fromatlas+=elements[i].value;}}}
return fromatlas;}
function getSelectedNames(){var max=selectedCatsArr.length;var str="";for(var i=0;i<max;i++){if(typeof allCategoriesTree[selectedCatsArr[i]]!='undefined'){if(str!="")str+=",";str+=allCategoriesTree[selectedCatsArr[i]].n;}}
if(str=="")
str="None";return str;}
function wssAutoRecat(clickedBtn){var wss="{"+getSelectedNames()+"}{"+getSuggestedCats()+"}{"+questionTitle+"}{"+getUserName()+"}";var cv=_hbEvent(cv);_hbSet("cv.c13",wss+"|"+clickedBtn);_hbLink("AutoRect");}
function getSelectedSuggestedCats(){var suggestedcats=jQuery('#suggestedTree')[0];var str="";selectedCatsArr=new Array();if(suggestedcats!=null){var elements=suggestedcats.getElementsByTagName('input');var max=elements.length;for(var i=0;i<max;i++){if(elements[i].className=='SelectedAutoSuggest'){if(str!="")str+=",";str+=elements[i].value;addToselectedlist(elements[i].value)}}}
return str;}
function checkSelectedSuggestedCats(){var suggestedcats=jQuery('#suggestedTree')[0];if(suggestedcats!=null){var elements=suggestedcats.getElementsByTagName('input');var max=elements.length;for(var i=0;i<max;i++){if(elements[i].className!='notSelectedAS'){elements[i].checked=true;cuSuggested(elements[i]);}else if(elements[i].checked!=true){elements[i].checked=false;}}}}
function getSuggestedCats(){var suggestedcats=jQuery('#suggestedTree')[0];var str="";if(suggestedcats!=null){var elements=suggestedcats.getElementsByTagName('span');var max=elements.length;for(var i=0;i<max;i++){if(i>0)str+=",";str+=elements[i].innerHTML;}}
if(str=="")
str="None suggested";return str;}
var catsElem=null;function updateErrMsg(str){if(window.location.href.match(/newqAdded/i)!=null){var href=window.location.href.replace("&newqAdded=1","").replace(/&action=editfaq&email=WatchUpds&link=Recat/,"");wssAutoRecat('Save');window.location.href=href;}
var catsList=jQuery('#catsList')[0];var max=selectedCatsArr.length;var str="";if(max==0&&catsElem==null){str="<a name='&lid=in_catlink' href='/Q/FAQ/"+uncategorizedID+"'>"+allCategoriesTree[uncategorizedID].n+"</a>";}
for(var i=0;i<max;i++){if(i==0){str+="<a name='&lid=in_catlink' href='/Q/FAQ/"+selectedCatsArr[i]+"'>"+allCategoriesTree[selectedCatsArr[i]].n.replace(/\\/g,'')+"</a>";if(isCatchallSelected(selectedCatsArr[i])){updateUI();}}
else str+=", <a name='&lid=in_catlink' href='/Q/FAQ/"+selectedCatsArr[i]+"'>"+allCategoriesTree[selectedCatsArr[i]].n.replace(/\\/g,'')+"</a>";}
if(catsList!=null&&str!=""){catsList.innerHTML=str+" ";}else if(catsElem!=null&&window.location.href.match(/(Special\:RecentQ|Special\:RecentA|Special\:watchlist|Special\:recentchanges)/i)!=null){if(max>0)
str="<b>"+"In:"+" </b>"+str;else{str="<a style=\"font-weight:bold;\"title=\""+questionTitle+"\" href=\"Categorize Question\" onclick=\"_hbLink('in_categorize');catsElem=this.parentNode;RecategorizeCats('"+questionTitle.replace("'","\\'")+"');return false;\">"+"Categorize"+"</a>";}
catsElem.innerHTML=str.replace(/, /gi," | ")+" ";}
resetRectParams('Save');clickonfayt="";}
function updateHeight(isCatchAllMsg){var errbox2=jQuery('#errorMsgBox2')[0];var selTopics=jQuery("#catsWindow")[0];var brwscat=jQuery('#brwscat')[0];if(brwscat!=null){var tableHeight=baseHeight-230;var currentCats=jQuery('#currentCats')[0];if(currentCats!=null){tableHeight=baseHeight-240-currentCats.offsetHeight;if(window.location.href.match(/newqAdded/i)!=null)
tableHeight=baseHeight-260-currentCats.offsetHeight;}else if(window.location.href.match(/newqAdded/i)!=null){tableHeight=baseHeight-250;}
var catTree_h=jQuery("#catTree").height();if(catTree_h>tableHeight)
brwscat.style.height=tableHeight+"px";else
brwscat.style.height=10+catTree_h+"px";var msgDivHeight=39;if(typeof isCatchAllMsg!='undefined')
msgDivHeight+=20;if(errbox2.innerHTML!=""){if(brwscat!=null)brwscat.style.height=brwscat.offsetHeight-msgDivHeight+'px';errbox2.style.display='block';}else if(errbox2.innerHTML==""&&errbox2.style.display=='block'){errbox2.style.display='none';if(brwscat!=null)brwscat.style.height=brwscat.offsetHeight+msgDivHeight+'px';}
if(catTree_h<tableHeight){var newheight=baseHeight-(tableHeight-catTree_h)+15;jQuery("#catsWindow").css({"height":newheight+"px"});}else{jQuery("#catsWindow").css({"height":baseHeight+"px"});}}
var len=selectedCatsArr.length;if(len==0){jQuery('#deselectAll').show();}
setTimeout("repaintPage()",1);}
function showMsg(msg){jQuery('#errorMsgBox2').html(msg);updateHeight(1);}
function showLimit(){var LIMIT=limit;jQuery('#errorMsgBox2').html("&nbsp; You\'ve already selected "+LIMIT+" categories");updateHeight();}
function hideMsg(){jQuery('#errorMsgBox2').html("");updateHeight();}
var qcats=null;var selectedCatsArr=new Array();function showCatsList(){printMainTree();catscancelBtn=jQuery('#catscancelBtn')[0];if(catscancelBtn){catscancelBtn.style.visibility='visible';}
var catsform=jQuery('#catsform')[0];var ajaxLoader=jQuery('#ajaxLoaderImg')[0];if(ajaxLoader!=null)
ajaxLoader.style.display='none';if(catsform!=null)
catsform.style.visibility='visible';fitTitle();if(!isNewQuestion){for(key in qcats){showFaytSel(qcats[key],0);}}else{jQuery('#catsWindow')[0].className='recatNewQuestion';var suggestedcats=jQuery('#suggestedcats')[0];var closeimg=jQuery('#closeimg')[0];if(closeimg!=null&&window.location.href.match(/newqAdded/i)!=null)
closeimg.style.visibility='hidden';if(window.location.href.match(/newqAdded/i)!=null){var oldText=jQuery('#topTitle').html();jQuery('#topTitle').html('<span style="font-size: 16px; color: black; margin-left: 5px;">Thank you for submitting your question</span><br/>'+oldText);jQuery('#topTitle').html(jQuery('#topTitle').html().replace("Categories for","Categorize"));}}
checkSelectedSuggestedCats();var brwscat=jQuery('#brwscat')[0];if(brwscat!=null){var tableHeight=baseHeight-230;var currentCats=jQuery('#currentCats')[0];if(currentCats!=null){tableHeight=baseHeight-240-currentCats.offsetHeight;if(window.location.href.match(/newqAdded/i)!=null)
tableHeight=baseHeight-260-currentCats.offsetHeight;}else if(window.location.href.match(/newqAdded/i)!=null){tableHeight=baseHeight-250;}
brwscat.style.height=tableHeight+"px";}
updateHeight();var inputRecat=jQuery('#textInputId')[0];if(inputRecat!=null)
inputRecat.focus();isLoaded=true;if(typeof ANSW=="undefined"){ANSW=new Object();}
ANSW.AnswerTipEnabled=false;isFirstTime=false;recatPopupClosed=false;}
function truncateString(id,len){var p=jQuery("#"+id)[0];if(p){var trunc=p.innerHTML;trunc=trunc.replace(/\.\.\.$/gi,'');if(trunc.length>len){trunc=trunc.substring(0,len);trunc=trunc.replace(/\w+$/,'');p.innerHTML=trunc+"...";}}}
function updateSuggested(id,removeORadd){var orig=(typeof allCategoriesTree[id]=="undefined"||allCategoriesTree[id].l==0)?id:allCategoriesTree[id].l;var suggestedcatsObj=jQuery('#suggestedcats')[0];if(suggestedcatsObj!=null){var suggestedCats=suggestedcatsObj.getElementsByTagName('input');var max=suggestedCats.length;for(var i=0;i<max;i++){if(suggestedCats[i].value==id){if(removeORadd==1)
suggestedCats[i].checked=true;else
suggestedCats[i].checked=false;cuSuggested(suggestedCats[i]);}}}}
function isSuggestionChecked(){var suggestedcatsObj=jQuery('#suggestedcats')[0];var isSChecked=false;if(suggestedcatsObj!=null){var suggestedCats=suggestedcatsObj.getElementsByTagName('input');var max=suggestedCats.length;for(var i=0;i<max;i++){if(suggestedCats[i].checked==true){cuSuggested(suggestedCats[i]);isSChecked=true;}}}
return isSChecked;}
function cuSuggested(obj){if(obj.checked){var len=selectedCatsArr.length;if(isFirstTime||(len>=0&&len<limit)||selectedCatsArr.indexOf(obj.value,0,1)>-1){addToselectedlist(obj.value);showSubTree(obj.value);markSelected(obj.value);scrollTo(obj.value);}else{obj.checked=false;showLimit();}
updateCurrentCats();setTimeout("repaintPage()",1);}else{selectedCatsArr.remove(obj.value);var len=selectedCatsArr.length;if(len==0){var deselectAlllspan=jQuery('#deselectAll')[0];if(deselectAlllspan!=null){deselectAlllspan.style.display='block';}}
else if(len>0&&len<=limit){hideMsg();}
deselectLinks(obj.value);updateCurrentCats();setTimeout("repaintPage()",1);}}
function fitTitle(){fitStringToWidth('truncateme',17);}
function fitStringToWidth(id,height){var obj=jQuery("#"+id)[0];if(obj!=null){var result=obj.innerHTML;var temp="";obj.style.display='block';if(obj.offsetHeight>height){while(obj.offsetHeight>17){temp=obj.innerHTML;obj.innerHTML=temp.substring(0,temp.length-2);}
if(result.length>obj.innerHTML.length){var str=obj.innerHTML;str=str.substring(0,str.length-4);result=str.replace(/\s+[^\s]*?\s*$/gi,"...");}}
obj.style.display='inline';obj.innerHTML=result;}}
catchAllArray=new Array();function setcatchAllArray(){var url=location.protocol+"//"+location.host+'/Q/Special:Cats&act=getCatchall';jQuery.ajax({url:url,data:"",type:"GET",success:function(resp){eval(resp);},error:function(requester,except){statusMessageShow("Error in Catchall category list");}});}
function isCatchallinAlreadySelected(){var len1=selectedCatsArr.length;var len2=catchAllArray.length;for(i=0;i<len1;i++){for(j=0;j<len2;j++){if(selectedCatsArr[i]==catchAllArray[j])
return true;}}
return false;}
function isCatchallSelected(id){var len=catchAllArray.length;for(i=0;i<len;i++){if(id==catchAllArray[i])
return true;}
return false;}
jQuery(document).keypress(onKeyPressEvent);function IncludeJS(sId,fileUrl)
{if(!document.getElementById(sId)){var HeadElement=document.getElementsByTagName('HEAD').item(0);var externalJScript=document.createElement("script");externalJScript.language="javascript";externalJScript.type="text/javascript";externalJScript.id=sId;externalJScript.src=fileUrl;HeadElement.appendChild(externalJScript);}}
var faytBoxId='faytBoxIdDefault';var lastOpenedItem="";var currentOpenedItem="";var clickonfayt="";var suggestionsHeight=0;var filledFaytList=false;var characterWrapLength=0;var selectedId=null;var templateName;var numOfItems=0;function HideLast(){if(lastOpenedItem=="suggestions"||lastOpenedItem==faytBoxId){var obj=jQuery("#"+lastOpenedItem)[0];if(obj!=null){obj.innerHTML='';obj.style.display='none';operaRefresh();}}
else if(currentOpenedItem!=lastOpenedItem){var obj=document.getElementById(lastOpenedItem);if(obj!=null)
obj.style.display='none';}
lastOpenedItem=currentOpenedItem;currentOpenedItem="";}
function selectItem(id,listid,inid){var newSelected=jQuery("#"+id)[0];var inputObj=jQuery("#"+inid)[0];var listObj1=jQuery("#"+listid)[0];if(newSelected!=null&&inputObj!=null){inputObj.value=newSelected.innerHTML.replace(/<\/?b>/gi,"");}
if(selectedId&&inputObj!=null){inputObj.name=selectedId.replace(/\_(.*)/,"");}
if(templateName&&templateName=="topics.tpl"){goToCat();}}
function changeColor(element,keynum){parentElement=jQuery(element).offsetParent()[0];parentHeight=parentElement.offsetHeight;parentScrollTop=parentElement.scrollTop;elementScrollTop=jQuery(element)[0].offsetTop;nsiblingScrollTop=(jQuery(element).next()[0]!=null)?jQuery(element).next()[0].offsetTop:null;if(keynum==40){if((nsiblingScrollTop>(parentScrollTop+parentHeight))||nsiblingScrollTop==null){parentElement.scrollTop=elementScrollTop;}}
else if(keynum==38){if(elementScrollTop<parentScrollTop){parentElement.scrollTop=nsiblingScrollTop-parentHeight;}}
var oldSelected=selectedId!=null&&jQuery("#"+selectedId).length>0?jQuery("#"+selectedId)[0]:null;if(oldSelected!=null){oldSelected.style.backgroundColor="";oldSelected.style.color="black";}
selectedId=element.id;if(element!=null){element.style.backgroundColor="#316ac5";element.style.color="white";}}
function startType(e,obj,faytlist){if(!e)var e=window.event;var keynum=((e.which)||(e.keyCode));var listObj=jQuery("#"+faytlist)[0];var firstItem=listObj.childNodes[0];if(keynum==13){if(listObj.style.display!='none'&&selectedId!=null){selectByclick(selectedId,faytlist,obj.id);}
return false;}
else{var str=obj.value.trim();str=str.replace(/[^A-Za-z0-9\- \u00c0-\u00ff]/g,'');getListFromServer(keynum,str,faytlist);}
if(jQuery('#textInputId')[0]&&jQuery('#textInputId')[0].value.replace(/ /g,'').length<=1&&keynum!=40&&keynum!=38)listObj.scrollTop=0;}
function startType2(e,obj,faytlist){if(!e)var e=window.event;var keynum=((e.which)||(e.keyCode));var listObj=jQuery("#"+faytlist)[0];if(keynum==13){if(listObj.style.display!='none'&&selectedId!=null)
selectByclick(selectedId,faytlist,obj.id);return false;}
else if(keynum==40){var firstItem=listObj.childNodes[0];if(!selectedId&&firstItem!=null)
changeColor(firstItem);else if(selectedId!=null){var index=jQuery("div#"+faytlist+" span").index(jQuery("#"+selectedId)[0]);var num=index+1;var nextElement=listObj.getElementsByTagName('span')[num];if(nextElement!=null)
changeColor(nextElement,keynum);}}
else if(keynum==38&&selectedId!=null){var index=jQuery("div#"+faytlist+" span").index(jQuery("#"+selectedId)[0]);var num=index-1;if(num>-1){var nextElement=listObj.getElementsByTagName('span')[num];if(typeof nextElement!="undefined"&&nextElement!=null){changeColor(nextElement,keynum);}}}
else listObj.scrollTop=0;}
function selectByclick(id,listid,inid){var listObj=jQuery("#"+listid)[0];var tin=jQuery("#"+inid)[0];clickonfayt="changeCat";selectItem(id,listid,inid);if(listObj!=null)listObj.innerHTML="";selectedId=null;if(inid=="textInputId"&&tin!=null){showFaytSel(tin.name,1);if(jQuery('#searchscat')[0])tin.value="";}
hide_fnc=function(elem){jQuery(elem).hide();};hide_fnc.defer(listObj);}
var checkIfArrReceived=null;function getListFromServer(keynum,text,listid){text=text.trim();if(text==""){HideLast();}
if(typeof(allCategoriesTree)!="undefined"&&text!=""&&keynum!=40&&keynum!=13&&keynum!=38){fillFaytList(text);}else if(typeof(allCategoriesTree)=="undefined"){if(checkIfArrReceived){clearInterval(checkIfArrReceived);}
checkIfArrReceived=setInterval("getListFromServer("+keynum+",'"+text.replace(/\'/g,"\\\'")+"','"+listid+"')",500);}}
function fillFaytList(text){var listObj3=jQuery('#suggestions')[0];var optionsList="";var optionsListAr=new Array();var firstLetterIndex=0;var i=0;var longCats=0;var re="/((^|\\b)("+text+")(.*))/i";re=eval(re);var suggestionOption="";for(key in allCategoriesTree){if((key==uncategorizedID&&!isSuper()&&window.location.href.match(/\/Q\/FAQ\/?$/i)==null)||(key==catchAllId&&!isSuper())||(key==2380&&!isSuper())||(key==wikiAnswersLocalID&&(typeof isAdmin=='undefined'||!isAdmin))||(key==2092&&exsitsInJson(qcats,2092)))
continue;if(key>0&&allCategoriesTree[key].l==0&&allCategoriesTree[key].n.match(re)!=null){if(allCategoriesTree[key].n.toLowerCase().indexOf(text.toLowerCase())==0){optionsListAr.splice(firstLetterIndex,0,"<span class=\"suggestion\" id=\""+key+"_"+i+"\" name=\""+key+"\" onmouseover=\"changeColor(this);\" onclick=\"selectByclick(this.id,'suggestions','textInputId')\" >"+highlightText(re,allCategoriesTree[key].n).replace(/\\/g,'')+"</span>");firstLetterIndex++;}
else{optionsListAr[i]="<span class=\"suggestion\" id=\""+key+"_"+i+"\" name=\""+key+"\" onmouseover=\"changeColor(this);\" onclick=\"selectByclick(this.id,'suggestions','textInputId')\" >"+highlightText(re,allCategoriesTree[key].n).replace(/\\/g,'')+"</span>";}
i++;if(allCategoriesTree[key].n.length>getCharacterWrapLength())
longCats++;}}
optionsList=optionsListAr.join("");numOfItems=i+longCats;if(optionsList!=""&&listObj3!=null){listObj3.innerHTML=optionsList;var itmHeight=numOfItems*16+4;suggestionsHeight=(suggestionsHeight>0)?suggestionsHeight:jQuery(listObj3).height();listObj3.style.height=Math.min(itmHeight,suggestionsHeight)+"px";if(itmHeight<suggestionsHeight){listObj3.style.overflowY="hidden";}
else{listObj3.style.overflowY="auto";}
listObj3.style.display="block";lastOpenedItem="suggestions";}else if(listObj3!=null){listObj3.innerHTML="";listObj3.style.display="none";}
selectedId=null;}
function highlightText(re,txt){return txt.replace(re,"<b>$3</b>$4");}
function getCharacterWrapLength(){if(characterWrapLength==0){characterWrapLength=(jQuery('#searchscat')[0]!=null)?43:51;}
return characterWrapLength;}
attachEventToFunction(document,"click",HideLast);function goToCat(){filledFaytList=false;getFaytAttempts=0;var catId=jQuery('#textInputId')[0].name;var catIdName=jQuery('#textInputId')[0].value.length;if((!catId&&catIdName<=0)||(catId&&catIdName<=0)){_hbLink('BrowseCatPgFAYT',wssStatus+"_Blank");return false;}
if(!catId&&catIdName>0){checkCatList();}
if(catId){_hbLink('BrowseCatPgFAYT',wssStatus+"_Match");window.location.href=goToURL+catId;}}
function checkCatList(){var suggestions=jQuery('#suggestions')[0];if(suggestions.childNodes.length!=0){for(i=0;i<suggestions.childNodes.length;i++){var matchSuggest=suggestions.childNodes[i].innerHTML.toLowerCase();matchSuggest=matchSuggest.replace(/<\/?b>/gi,"");inputValue=jQuery('#textInputId')[0].value.toLowerCase();if(matchSuggest==inputValue){suggestId=suggestions.childNodes[i].id;suggestId=suggestId.replace(/_\d+/,"");_hbLink('BrowseCatPgFAYT',wssStatus+"_Match");window.location.href=goToURL+suggestId;return;}}}
if(!filledFaytList&&getFaytAttempts<20){getFaytAttempts++;setTimeout('checkCatList();',200);}else{_hbLink('BrowseCatPgFAYT',wssStatus+"_NoMatch");jQuery('#favcatMessage').css({"color":"red"});jQuery('#favcatMessage').html("Oops! We couldn\'t find that category. Start typing and then choose one from the list.");}}
function DOMAlert(settings)
{var that,modalWindow,iframe,alertWindow,dropShadow,titleBar,title,ricon,licon,contentArea,buttonArea,okButton,okText,yesButton,cancelButton,noButton,cancelText,checkBox,defaultCallback,okCallback,cancelCallback,noCallback,yesCallback;that=this;this.settings=settings;this.html={};this.isIE6=(document.all&&window.external&&(typeof document.documentElement.style.maxHeight==='undefined'))?true:false;this.settings.skin=this.settings.skin?this.settings.skin:'default';if(!this.settings.ok)
{defaultCallback=function()
{that.close();};this.settings.ok={text:'OK',value:true,onclick:defaultCallback};}
modalWindow=document.createElement('div');modalWindow.style.height=((document.documentElement.clientHeight>document.documentElement.scrollHeight)?document.documentElement.clientHeight:document.documentElement.scrollHeight)+'px';modalWindow.style.width=document.documentElement.scrollWidth+'px';modalWindow.style.background='url('+wgStaticFilesServer+'/templates/images/blank.gif)';modalWindow.style.position='absolute';modalWindow.style.left='0px';modalWindow.style.top='0px';modalWindow.style.zIndex=997;modalWindow.style.visibility='hidden';document.body.appendChild(modalWindow);this.html.modalWindow=modalWindow;if(this.isIE6)
{iframe=document.createElement('iframe');iframe.style.position='absolute';iframe.style.visibility='hidden';iframe.style.zIndex=996;iframe.frameBorder=0;iframe.style.position='absolute';document.body.appendChild(iframe);this.html.iframe=iframe;}
alertWindow=document.createElement('div');alertWindow.className=this.settings.skin+'_alertWindow';alertWindow.style.position='absolute';alertWindow.style.zIndex=999;alertWindow.setAttribute("id","cs_alert");if(this.settings.width)
{alertWindow.style.width=this.settings.width+'px';}
document.body.appendChild(alertWindow);alertWindow.style.visibility='hidden';this.html.alertWindow=alertWindow;titleBar=document.createElement('div');titleBar.className=this.settings.skin+'_titleBar';alertWindow.appendChild(titleBar);this.html.titleBar=titleBar;ricon=document.createElement('div');ricon.className=this.settings.skin+'_titleBarRightIcon';ricon.style.cssFloat='right';ricon.style.styleFloat='right';closeCallback=function(){that.close();};mouseover=function(){this.style.background="transparent url("+wgStaticFilesServer+"/templates/icons/close-button1.gif) no-repeat";};mouseout=function(){this.style.background="transparent url("+wgStaticFilesServer+"/templates/icons/close-button2.gif) no-repeat";};ricon.onclick=closeCallback;ricon.onmouseover=mouseover;ricon.onmouseout=mouseout;titleBar.appendChild(ricon);this.html.ricon=ricon;licon=document.createElement('div');licon.className=this.settings.skin+'_titleBarLeftIcon';licon.style.cssFloat='left';licon.style.styleFloat='left';titleBar.appendChild(licon);this.html.licon=licon;title=document.createElement('span');title.innerHTML=this.settings.title;titleBar.appendChild(title);this.html.title=title;contentArea=document.createElement('div');contentArea.className=this.settings.skin+'_contentArea';contentArea.innerHTML=this.settings.text;if(this.settings.height)
{contentArea.style.height=this.settings.height+'px';}
alertWindow.appendChild(contentArea);this.html.contentArea=contentArea;buttonArea=document.createElement('div');buttonArea.className=this.settings.skin+'_buttonArea';alertWindow.appendChild(buttonArea);this.html.buttonArea=buttonArea;if(!this.settings.yes)
{if(this.settings.ok.text=='OK'){btnDOM=document.createElement("a");jQuery(btnDOM).addClass("btn std");btnDOM.setAttribute("href","javascript:void(0);");btnDOM.setAttribute("style","std");jQuery(btnDOM).click(function(){if(!jQuery(this).isDisabledBtn()){}else{xPreventDefault();return false;}});btnDOM.setAttribute("onclick","void(0);");btnDOM.setAttribute("alt","OK");btnDOM.setAttribute("title","OK");btnDOMSpan1=document.createElement("span");btnDOMSpan2=document.createElement("span");btnDOMFont=document.createElement("font");btnDOMFont.setAttribute("style","white-space: nowrap;");btnDOMInput=document.createElement("input");btnDOMInput.setAttribute("type","image");btnDOMInput.setAttribute("value","");btnDOMInput.setAttribute("src","http://en.site2.answcdn.com/templates/images/blank.gif?v=73210");btnDOMInput.setAttribute("style","display: inline; width: 1px; height: 1px;");btnDOMInput.setAttribute("tabindex","-1");btnDOMFont.appendChild(btnDOMInput);btnDOMFont2=document.createElement("font");btnDOMFont2.innerHTML="&nbsp;OK&nbsp;";btnDOMFont.appendChild(btnDOMFont2);btnDOMFontInput2=document.createElement("input");btnDOMFontInput2.setAttribute("type","image");btnDOMFontInput2.setAttribute("value","");btnDOMFontInput2.setAttribute("src","http://en.site2.answcdn.com/templates/images/blank.gif?v=73210");btnDOMFontInput2.setAttribute("style","display: inline; width: 1px; height: 1px;");btnDOMFontInput2.setAttribute("tabindex","-1");btnDOMFont.appendChild(btnDOMFontInput2);btnDOMSpan2.appendChild(btnDOMFont);btnDOMSpan1.appendChild(btnDOMSpan2);btnDOM.appendChild(btnDOMSpan1);}
else{btnDOM=document.createElement("a");jQuery(btnDOM).addClass("btn std");btnDOM.setAttribute("href","javascript:void(0);");btnDOM.setAttribute("style","std");jQuery(btnDOM).click(function(){if(!jQuery(this).isDisabledBtn()){}else{xPreventDefault();return false;}});btnDOM.setAttribute("onclick","void(0);");btnDOM.setAttribute("alt","Confirm");btnDOM.setAttribute("title","Confirm");btnDOMSpan1=document.createElement("span");btnDOMSpan2=document.createElement("span");btnDOMFont=document.createElement("font");btnDOMFont.setAttribute("style","white-space: nowrap;");btnDOMInput=document.createElement("input");btnDOMInput.setAttribute("type","image");btnDOMInput.setAttribute("value","");btnDOMInput.setAttribute("src","http://en.site2.answcdn.com/templates/images/blank.gif?v=73210");btnDOMInput.setAttribute("style","display: inline; width: 1px; height: 1px;");btnDOMInput.setAttribute("tabindex","-1");btnDOMFont.appendChild(btnDOMInput);btnDOMFont2=document.createElement("font");btnDOMFont2.innerHTML="&nbsp;Confirm&nbsp;";btnDOMFont.appendChild(btnDOMFont2);btnDOMFontInput2=document.createElement("input");btnDOMFontInput2.setAttribute("type","image");btnDOMFontInput2.setAttribute("value","");btnDOMFontInput2.setAttribute("src","http://en.site2.answcdn.com/templates/images/blank.gif?v=73210");btnDOMFontInput2.setAttribute("style","display: inline; width: 1px; height: 1px;");btnDOMFontInput2.setAttribute("tabindex","-1");btnDOMFont.appendChild(btnDOMFontInput2);btnDOMSpan2.appendChild(btnDOMFont);btnDOMSpan1.appendChild(btnDOMSpan2);btnDOM.appendChild(btnDOMSpan1);}
okButton=document.createElement("span");okButton.appendChild(btnDOM);okCallback=function()
{that.settings.ok.onclick(that,that.html.checkBox?that.html.checkBox.checked:false);};okButton.onclick=okCallback;if(this.settings.checkbox)
{okButtonDiv=document.createElement('div');okButtonDiv.className=this.settings.skin+'_okButtonDiv';buttonArea.appendChild(okButtonDiv);okButtonDiv.appendChild(okButton);}
else{buttonArea.appendChild(okButton);}
this.html.okButton=okButton;this.html.okButton.style.marginRight="15px";}
if(this.settings.yes)
{btnDOM=document.createElement("a");jQuery(btnDOM).addClass("btn std");btnDOM.setAttribute("href","javascript:void(0);");btnDOM.setAttribute("style","smallstd");jQuery(btnDOM).click(function(){if(!jQuery(this).isDisabledBtn()){}else{xPreventDefault();return false;}});btnDOM.setAttribute("onclick","void(0);");btnDOM.setAttribute("alt","Yes, this is my question");btnDOM.setAttribute("title","Yes, this is my question");btnDOMSpan1=document.createElement("span");btnDOMSpan2=document.createElement("span");btnDOMFont=document.createElement("font");btnDOMFont.setAttribute("style","white-space: nowrap;");btnDOMInput=document.createElement("input");btnDOMInput.setAttribute("type","image");btnDOMInput.setAttribute("value","");btnDOMInput.setAttribute("src","http://en.site2.answcdn.com/templates/images/blank.gif?v=73210");btnDOMInput.setAttribute("style","display: inline; width: 1px; height: 1px;");btnDOMInput.setAttribute("tabindex","-1");btnDOMFont.appendChild(btnDOMInput);btnDOMFont2=document.createElement("font");btnDOMFont2.innerHTML="&nbsp;Yes, <font style=\"font-weight:normal;\">this is my question</font>&nbsp;";btnDOMFont.appendChild(btnDOMFont2);btnDOMFontInput2=document.createElement("input");btnDOMFontInput2.setAttribute("type","image");btnDOMFontInput2.setAttribute("value","");btnDOMFontInput2.setAttribute("src","http://en.site2.answcdn.com/templates/images/blank.gif?v=73210");btnDOMFontInput2.setAttribute("style","display: inline; width: 1px; height: 1px;");btnDOMFontInput2.setAttribute("tabindex","-1");btnDOMFont.appendChild(btnDOMFontInput2);btnDOMSpan2.appendChild(btnDOMFont);btnDOMSpan1.appendChild(btnDOMSpan2);btnDOM.appendChild(btnDOMSpan1);yesButton=document.createElement("span");yesButton.appendChild(btnDOM);yesCallback=function()
{that.settings.yes.onclick(that,that.settings);};yesButton.onclick=yesCallback;buttonArea.appendChild(yesButton);this.html.yesButton=yesButton;this.html.yesButton.style.marginRight="15px";}
if(this.settings.cancel)
{btnDOM=document.createElement("a");jQuery(btnDOM).addClass("btn std");btnDOM.setAttribute("href","javascript:void(0);");btnDOM.setAttribute("style","std");jQuery(btnDOM).click(function(){if(!jQuery(this).isDisabledBtn()){}else{xPreventDefault();return false;}});btnDOM.setAttribute("onclick","void(0);");btnDOM.setAttribute("alt","Cancel");btnDOM.setAttribute("title","Cancel");btnDOMSpan1=document.createElement("span");btnDOMSpan2=document.createElement("span");btnDOMFont=document.createElement("font");btnDOMFont.setAttribute("style","white-space: nowrap;");btnDOMInput=document.createElement("input");btnDOMInput.setAttribute("type","image");btnDOMInput.setAttribute("value","");btnDOMInput.setAttribute("src","http://en.site2.answcdn.com/templates/images/blank.gif?v=73210");btnDOMInput.setAttribute("style","display: inline; width: 1px; height: 1px;");btnDOMInput.setAttribute("tabindex","-1");btnDOMFont.appendChild(btnDOMInput);btnDOMFont2=document.createElement("font");btnDOMFont2.innerHTML="&nbsp;Cancel&nbsp;";btnDOMFont.appendChild(btnDOMFont2);btnDOMFontInput2=document.createElement("input");btnDOMFontInput2.setAttribute("type","image");btnDOMFontInput2.setAttribute("value","");btnDOMFontInput2.setAttribute("src","http://en.site2.answcdn.com/templates/images/blank.gif?v=73210");btnDOMFontInput2.setAttribute("style","display: inline; width: 1px; height: 1px;");btnDOMFontInput2.setAttribute("tabindex","-1");btnDOMFont.appendChild(btnDOMFontInput2);btnDOMSpan2.appendChild(btnDOMFont);btnDOMSpan1.appendChild(btnDOMSpan2);btnDOM.appendChild(btnDOMSpan1);cancelButton=document.createElement("span");cancelButton.appendChild(btnDOM);if(that.settings.cancel.onclick){cancelCallback=function()
{that.settings.cancel.onclick(that,that.settings.cancel.value);};}else{cancelCallback=closeCallback;}
cancelButton.onclick=cancelCallback;buttonArea.appendChild(cancelButton);this.html.cancelButton=cancelButton;}
if(this.settings.no)
{btnDOM=document.createElement("a");jQuery(btnDOM).addClass("btn std");btnDOM.setAttribute("href","javascript:void(0);");btnDOM.setAttribute("style","std");jQuery(btnDOM).click(function(){if(!jQuery(this).isDisabledBtn()){}else{xPreventDefault();return false;}});btnDOM.setAttribute("onclick","void(0);");btnDOM.setAttribute("alt","No, but show me this one");btnDOM.setAttribute("title","No, but show me this one");btnDOMSpan1=document.createElement("span");btnDOMSpan2=document.createElement("span");btnDOMFont=document.createElement("font");btnDOMFont.setAttribute("style","white-space: nowrap;");btnDOMInput=document.createElement("input");btnDOMInput.setAttribute("type","image");btnDOMInput.setAttribute("value","");btnDOMInput.setAttribute("src","http://en.site2.answcdn.com/templates/images/blank.gif?v=73210");btnDOMInput.setAttribute("style","display: inline; width: 1px; height: 1px;");btnDOMInput.setAttribute("tabindex","-1");btnDOMFont.appendChild(btnDOMInput);btnDOMFont2=document.createElement("font");btnDOMFont2.innerHTML="&nbsp;No, <font style=\"font-weight:normal;\">but show me this one</font>&nbsp;";btnDOMFont.appendChild(btnDOMFont2);btnDOMFontInput2=document.createElement("input");btnDOMFontInput2.setAttribute("type","image");btnDOMFontInput2.setAttribute("value","");btnDOMFontInput2.setAttribute("src","http://en.site2.answcdn.com/templates/images/blank.gif?v=73210");btnDOMFontInput2.setAttribute("style","display: inline; width: 1px; height: 1px;");btnDOMFontInput2.setAttribute("tabindex","-1");btnDOMFont.appendChild(btnDOMFontInput2);btnDOMSpan2.appendChild(btnDOMFont);btnDOMSpan1.appendChild(btnDOMSpan2);btnDOM.appendChild(btnDOMSpan1);noButton=document.createElement("span");noButton.appendChild(btnDOM);noCallback=function()
{that.settings.no.onclick(that,that.settings);};noButton.onclick=noCallback;buttonArea.appendChild(noButton);this.html.noButton=noButton;this.html.noButton.style.marginRight="15px";cancelText=document.createElement('span');cancelText.className=this.settings.skin+'_cancelText';cancelText.innerHTML="<br/><a>cancel</a>";cancelText.onclick=closeCallback;buttonArea.appendChild(cancelText);this.html.cancelText=cancelText;}
if(this.settings.checkbox)
{buttonAreaCheckbox=document.createElement('div');buttonAreaCheckbox.className=this.settings.skin+'_buttonAreaCheckbox';buttonArea.appendChild(buttonAreaCheckbox);this.html.buttonAreaCheckbox=buttonAreaCheckbox;checkBox=document.createElement('input');checkBox.type='checkbox';checkBox.className=this.settings.skin+'_checkBox';buttonAreaCheckbox.appendChild(checkBox);this.html.checkBox=checkBox;checkText=document.createElement('span');checkText.innerHTML=this.settings.checkbox;buttonAreaCheckbox.appendChild(checkText);this.html.checkText=checkText;this.html.buttonArea.style.paddingBottom="38px";this.html.contentArea.style.textAlign="left";}
dropShadow=document.createElement('div');dropShadow.className=this.settings.skin+'_dropShadow';dropShadow.style.position='absolute';dropShadow.style.zIndex=998;if(alertWindow.clientWidth)
{dropShadow.style.width=alertWindow.clientWidth+'px';}
if(alertWindow.clientHeight)
{dropShadow.style.height=alertWindow.clientHeight+'px';}
document.body.appendChild(dropShadow);dropShadow.style.visibility='hidden';this.html.dropShadow=dropShadow;this.center();}
DOMAlert.prototype.show=function(titleText,contentText)
{if(contentText)
{this.html.title.innerHTML=titleText;this.html.contentArea.innerHTML=contentText;}
if(titleText&&!contentText)
{this.html.contentArea.innerHTML=titleText;}
this.html.modalWindow.style.visibility='visible';this.html.dropShadow.style.visibility='visible';this.html.alertWindow.style.visibility='visible';if(this.html.iframe)
{this.html.iframe.style.height=this.html.alertWindow.offsetHeight;this.html.iframe.style.width=this.html.alertWindow.offsetWidth;this.html.iframe.style.visibility='visible';}
if(this.html.noButton)
{}
else if(this.html.cancelButton)
{this.html.cancelButton.focus();}
else
{this.html.okButton.focus();}};DOMAlert.prototype.hide=function()
{this.html.modalWindow.style.visibility='hidden';this.html.dropShadow.style.visibility='hidden';this.html.alertWindow.style.visibility='hidden';if(this.html.iframe)
{this.html.iframe.style.visibility='hidden';}};DOMAlert.prototype.close=function()
{var obj,prop;if(this.settings.n)
setCursor(this.settings.n,this.settings.offset);for(obj in this.html)
{if(this.html[obj].parentNode)
{if(this.html[obj].onclick)
{this.html[obj].onclick=null;}
this.html[obj].parentNode.removeChild(this.html[obj]);delete this.html[obj];}}
for(prop in this)
{if(this[prop])
{this[prop]=null;delete this[prop];}}};DOMAlert.prototype.center=function()
{var alertWindow,scrollT,scrollL,iframe;alertWindow=this.html.alertWindow;dropShadow=this.html.dropShadow;adjustForLeftNav=jQuery("#left-pod").width();adjustForLeftNav=(null===adjustForLeftNav?0:adjustForLeftNav/2);if(alertWindow.style.position==='absolute')
{scrollT=window.pageYOffset||document.documentElement.scrollTop;scrollL=window.pageXOffset||document.documentElement.scrollLeft;alertWindow.style.left=adjustForLeftNav+(self.innerWidth||(document.documentElement.clientWidth||document.body.clientWidth))/2+scrollL-alertWindow.offsetWidth/2+'px';alertWindow.style.top=(self.innerHeight||(document.documentElement.clientHeight||document.body.clientHeight))/2+scrollT-alertWindow.offsetHeight/2+'px';dropShadow.style.left=adjustForLeftNav+(self.innerWidth||(document.documentElement.clientWidth||document.body.clientWidth))/2+scrollL-dropShadow.offsetWidth/2+4+'px';dropShadow.style.top=(self.innerHeight||(document.documentElement.clientHeight||document.body.clientHeight))/2+scrollT-dropShadow.offsetHeight/2+4+'px';if(this.html.iframe)
{this.html.iframe.style.left=alertWindow.style.left;this.html.iframe.style.top=alertWindow.style.top;}}
else
{alertWindow.style.left=(self.innerWidth||(document.documentElement.clientWidth||document.body.clientWidth))/2-alertWindow.offsetWidth/2+'px';alertWindow.style.top=(self.innerHeight||(document.documentElement.clientHeight||document.body.clientHeight))/2-alertWindow.offsetHeight/2+'px';dropShadow.style.left=(self.innerWidth||(document.documentElement.clientWidth||document.body.clientWidth))/2-dropShadow.offsetWidth/2+4+'px';dropShadow.style.top=(self.innerHeight||(document.documentElement.clientHeight||document.body.clientHeight))/2-dropShadow.offsetHeight/2+4+'px';}};