var cBrowser=navigator.userAgent.toLowerCase();var compliant=cBrowser.indexOf('msie')==-1?true:false;var wServ='http://www.itnewb.com/';var sServ='http://static.itnewb.com/';var fServ='http://files.itnewb.com/';var flashCharts=flashCharts?true:false;var slideRotation=slideRotation?slideRotation:false;var slideBusy=false;
function in_array(needle, haystack){for (key in haystack) if( haystack[key]==needle)return true;return false;}
function rotateSlide(numSlides, slideNum, slideClass, disableRotation){if(slideBusy) return;slideBusy=true;if(disableRotation){clearTimeout(slideRotation);slideRotation=false;}else{var nextSlide=slideNum==numSlides?1:slideNum+1;slideRotation=setTimeout(function(){rotateSlide(numSlides, nextSlide, slideClass, false)}, 12000);}for(var i=1;i<=numSlides;i++)getElm('slideBtn'+i).className=i==slideNum?'sel':'';var elm=getElm('slideImg');var start=0;var stop=350;var gap=stop-start;var speed=10;var step=Math.round(gap/25);var leap=start+step;var timer=0;for(var i=start;i<stop;i+=step){setTimeout("getElm('slideImg').style.top='"+leap+"px';", timer*speed);leap+=step;timer++;}setTimeout(function(){elm.className='slideImg '+slideClass+slideNum;elm.style.top='0px';if(compliant) fadeIn('slideImg');}, timer*speed+10);setTimeout(function(){getElm('slideBtmBtn').innerHTML=slideBtnTxt[slideNum-1];getElm('slideBtmBtn').href=slideBtnURL[slideNum-1];slideBusy=false;}, timer*speed+500);}
function vis(id, turnOn){turnOn?getElm(id).style.visibility='visible':getElm(id).style.visibility='hidden';}
function ofcGetData(chart_data){return JSON.stringify(eval(chart_data));}
function findSWF(movieName){return (navigator.appName.indexOf("Microsoft")!=-1)?window[movieName]:document[movieName];}
function loadRatingChart(id){var data='chart_data'+id;findSWF('chart1').load( JSON.stringify(eval(data)) );}
function loadTrafficChart(){var chartMode=getElm('trafficChartMode');chartMode=chartMode.options[chartMode.selectedIndex].value;var chartDur=getElm('trafficChartDuration');chartDur=chartDur.options[chartDur.selectedIndex].value;var data='chart_'+chartMode+'_'+chartDur;findSWF('chart2').load( JSON.stringify(eval(data)) );}
function toggleHelpSidebar(id){var d=getElm('sbh'+id).style.display;getElm('sbt'+id).className=d=='block'?'rel':'rel sel';getElm('sbh'+id).style.display=d=='block'?'none':'block';}
function toggleAuthorBio(bottom){var bioOpen=getElm('authorView').style.display=='block'?true:false;if(bioOpen&&! bottom){hide('authorView');toggleFade('articleView');}else{if(bottom){smoothScroll('top');if(! bioOpen) setTimeout(function(){hide('articleView');toggleFade('authorView')}, 1000);}else{hide('articleView');toggleFade('authorView');}}}
function smoothScroll(eID){var start=currentYPosition();var stop=elmYPosition(eID);var gap=stop>start?stop-start:start-stop;if(gap<100){scrollTo(0, stop);return;}var speed=Math.round(gap/100);var step=Math.round(gap/25);var leapY=stop>start?start+step:start-step;var timer=0;if(stop>start){for(var i=start;i<stop;i+=step){setTimeout("window.scrollTo(0, "+leapY+")", timer*speed);leapY+=step;if(leapY>stop) leapY=stop;timer++;}return;}for(var i=start;i>stop;i-=step){setTimeout("window.scrollTo(0, "+leapY+")", timer*speed);leapY-=step;if(leapY<stop) leapY=stop;timer++;}}
function currentYPosition(){if(self.pageYOffset) return self.pageYOffset;if(document.documentElement&&document.documentElement.scrollTop) return document.documentElement.scrollTop;if(document.body.scrollTop) return document.body.scrollTop;return 0;}
function elmYPosition(eID){var elm=getElm(eID);var y=elm.offsetTop;var node=elm;while (node.offsetParent&&node.offsetParent!=document.body){node=node.offsetParent;y+=node.offsetTop;}return y;}
function getElm(eID){return document.getElementById(eID);}
function submitSearch(){getElm('navSearch').submit();}
function setFocus(eID){getElm(eID).focus();}
function pageRedirect(fURL){window.location.href=fURL;}
function show(eID){getElm(eID).style.display='block';}
function hide(eID){getElm(eID).style.display='none';}
function toggleDisplay(eID){var style=getElm(eID).style;style.display=style.display=='none'?'block':'none';}
function fadeIn(eID){setOpacity(eID, 0);show(eID);var timer=0;for (var i=1;i<=100;i++){setTimeout("setOpacity('"+eID+"',"+i+")", timer*5);timer++;}}
function fadeOut(eID){var timer=0;for (var i=100;i>=1;i--){setTimeout("setOpacity('"+eID+"',"+i+")", timer*3);timer++;}setTimeout("hide('"+eID+"')", 310);}
function toggleFade(elmID){if(getElm(elmID).style.display=='block'){compliant?fadeOut(elmID):hide(elmID);}else{compliant?fadeIn(elmID):show(elmID);}}
function fade(eID, start, stop, duration){var speed=Math.round(duration/100);var timer=0;if(start<stop){for (var i=start;i<=stop;i++){setTimeout("setOpacity('"+eID+"',"+i+")", timer*speed);timer++;}return;}for (var i=start;i>=stop;i--){setTimeout("setOpacity('"+eID+"',"+i+")", timer*speed);timer++;}}
function setOpacity(eID, opac){var elmStyle=getElm(eID).style;elmStyle.opacity=opac/100;elmStyle.filter='alpha(opacity='+opac+')';elmStyle.MozOpacity=opac/100;}var openMenu=false;var hideMenuTimer=false;
function navMenu(menuID, turnOn){turnOn?showNavMenu(menuID):setHideMenuTimer(menuID);}
function showNavMenu(menuID){if(openMenu){hide(openMenu+'_menu');}openMenu=menuID;if(hideMenuTimer){clearTimeout(hideMenuTimer);hideMenuTimer=false;}if(flashCharts){vis('chart1', false);vis('chart2', false);}show(menuID+'_menu');}
function setHideMenuTimer(menuID){hideMenuTimer=setTimeout("hideNavMenu('"+menuID+"')", 100);}
function hideNavMenu(menuID){hide(menuID+'_menu');openMenu=false;if(flashCharts){vis('chart1', true);vis('chart2', true);}}
function pageMeasurements(){var m=new Array(0,0,0,0,0,0);if(document.body.scrollHeight>document.body.offsetHeight){m[0]=document.body.scrollWidth;m[1]=document.body.scrollHeight;}else{m[0]=document.body.offsetWidth;m[1]=document.body.offsetHeight;}if(self.innerHeight){m[2]=self.innerWidth;m[3]=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){m[2]=document.documentElement.clientWidth;m[3]=document.documentElement.clientHeight;}else{m[2]=document.body.clientWidth;m[3]=document.body.clientHeight;}if(self.pageYOffset){m[4]=self.pageXOffset;m[5]=self.pageYOffset;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){m[4]=document.documentElement.scrollLeft;m[5]=document.documentElement.scrollTop;}else{m[4]=document.body.scrollLeft;m[5]=document.body.scrollTop;}return m;}
function mouseXY(evt){var c={x:0, y:0};if(self.innerHeight){c.x=evt.pageX;c.y=evt.pageY;}else if(document.documentElement&&document.documentElement.scrollTop){c.x=evt.clientX+document.documentElement.scrollLeft;c.x-=document.documentElement.offsetLeft;c.y=evt.clientY+document.documentElement.scrollTop;}else{c.x=evt.clientX+document.body.scrollLeft;c.y=evt.clientY+document.body.scrollTop;c.x-=document.body.offsetLeft;}return c;}
function toggleLogin(){if(getElm('easyLogin').style.display!='block'){if(flashCharts){vis('chart1', false);vis('chart2', false);}var m=pageMeasurements();posOverlay(m);posOverlayLogin(m);setTimeout(function(){getElm('easyLoginU').focus()}, 200);}else{if(compliant){fadeOut('easyLogin');setTimeout("hide('overlay')", 310);}else{hide('easyLogin');hide('overlay');}if(flashCharts) setTimeout(function(){vis('chart1', true);vis('chart2', true);}, 350);}return false;}
function posOverlay(m){var overlayStyle=getElm('overlay').style;overlayStyle.left=parseInt(m[4])+'px';overlayStyle.top=parseInt(m[5])+'px';overlayStyle.display='block';}
function posOverlayLogin(m){getElm('easyLogin').style.top=parseInt( m[5]+(m[3]/4))+'px';compliant?fadeIn('easyLogin'):show('easyLogin');}
function charCount(eID){return getElm(eID).value.length;}var updateCounter=true;
function updateCharCounter(eID, rID, maxChars){if(updateCounter){updateCounter=false;var charsLeft=maxChars-charCount(eID);var responseDiv=getElm(rID);if(charsLeft<0){responseDiv.innerHTML='Too many chars.';}else if(charsLeft==0){responseDiv.innerHTML='0 chars left.';}else if(charsLeft==1){responseDiv.innerHTML='1 char left.';}else{responseDiv.innerHTML=charsLeft+' chars left.';}setTimeout(function(){updateCounter=true}, 50);}}
function isEnabled(eID){return getElm(eID).disabled==false?true:false;}
function toggleTick(eID){var elm=getElm(eID);elm.checked=elm.checked?false:true;}
function toggleTicks(fElement, tCmd){for (var i=0;i<fElement.length;i++){if(fElement[i].type=='checkbox'&&fElement[i].disabled!=true) fElement[i].checked=tCmd=='select'?true:false;}}
function disableTick(fElement, tName){for (var i=0;i<fElement.length;i++) if(fElement[i].type=='checkbox'&&fElement[i].name==tName) fElement[i].disabled=true;}
function numChecked(fElement){var n=0;for (var i=0;i<fElement.length;i++) if(fElement[i].type=='checkbox'&&fElement[i].checked==true) n++;return n;}
function activeCkBoxes(fElement){for (var i=0;i<fElement.length;i++) if(fElement[i].type=='checkbox'&&fElement[i].disabled==false) return true;return false;}
function refreshCkBoxForm(fName, rURL){if(!activeCkBoxes(document.forms[fName])) pageRedirect(rURL);}
function showLNotice(type, evt, blockID){var msg=getElm('lnMsg');if(type=='expired'||type=='archived') var vTally=getElm('tally'+blockID).innerHTML;if(type=='expired'){vTally=vTally.replace('%','');var xMsg=vTally>=75?'archiving</span> because it received a high approval rating.':'deletion</span> because it did not achieve the minimal approval rating.';msg.innerHTML='This article has been <span>marked for '+xMsg;}if(type=='expiry') var expiry=getElm('expLink'+blockID).innerHTML;getElm('lnTitle').innerHTML=(type!='login')?(type!='archived')?(type!='expiry')?(type!='expired')?(type!='votedApprove'&&type!='votedSink')?(type!='saved')?(type!='unavailable')?'Insufficient Privilege':'Temporarily Unavailable':'Already Bookmarked':'Thank you for voting!':'Expired':'Grading Schedule':'Archived Article':'Please <a href="/login" onclick="hide(\'listingNotice\');toggleLogin();return false">Login</a>';if(type=='login') msg.innerHTML='You must login to your account to do that.&nbsp;&nbsp;If you don\'t have an account, go <a href="/join">get one</a> (it\'s free!).';if(type=='archived') msg.innerHTML='This is an archived article, which means the Community has already reviewed it and a majority voted to archive it.<br/><br/><span>Approval Rate</span> '+vTally+' voted to archive</span>.';if(type=='expiry') msg.innerHTML='This article will expire in <span>'+expiry+'</span>, at which time it will be graded and either archived or deleted.<br/><br/>Go <a href="/about">here</a> to learn more.';if(type=='votedApprove') msg.innerHTML='You already <span>voted to approve</span> this article.<br/><br/>If you wish to change your vote, use the sink icon!';if(type=='votedSink') msg.innerHTML='You already <span>voted to sink</span> this article.<br/><br/>If you wish to change your vote, use the approve icon!';if(type=='unavailable') msg.innerHTML='This feature is temporarily unavailable, but will be restored shortly. We appologize for the inconvenience.';if(type=='restricted') msg.innerHTML='You lack the necessary privilege to perform this action.';var c=mouseXY(evt);var style=getElm('listingNotice').style;style.top=(c.y-35)+'px';var newX=(c.x-125);if(newX<=50) newX=50;style.left=newX+'px';if(style.display!='block') toggleFade('listingNotice');}
function changeProfileTab(tab){var infoTab=getElm('tabInfo');var activityTab=getElm('tabActivity');if(tab=='profileInfo'){infoTab.className='tabSel';activityTab.className='tabLrg';hide('profileActivity');show('profileInfo');return;}infoTab.className='tab';activityTab.className='tabLrgSel';hide('profileInfo');show('profileActivity');}
function submitForm(formID){show('progImg');getElm(formID).submit();}var loadingProfilePhoto=false;var profilePhotoInterval=false;
function loadProfilePhoto(photoName){if(!loadingProfilePhoto){loadingProfilePhoto=true;var newPhoto=fServ+'members/'+photoName;if(getElm('mainPhoto').src!=newPhoto){fade('mainPhoto', 100, 50, 150);photoObj=new Image();photoObj.src=newPhoto;profilePhotoInterval=setInterval( function(){fadeProfilePhoto(photoObj)}, 155);}else{loadingProfilePhoto=false;}}}
function fadeProfilePhoto(photoObj){if(photoObj.complete==true){clearInterval(profilePhotoInterval);profilePhotoInterval=false;var mainPhoto=getElm('mainPhoto');fade('mainPhoto',50,0,150);setTimeout(function(){mainPhoto.src=photoObj.src}, 155);setTimeout(function(){fade('mainPhoto', 0, 100, 300)}, 165);setTimeout(function(){loadingProfilePhoto=false}, 500);}}
function changeContactReasonHelper(helperID){if(helperID==''||helperID=='business'||helperID=='other'){hide('reasonHelper');return;}getElm('reasonMsg').innerHTML=getElm(helperID+'Msg').innerHTML;show('reasonHelper');}var reqBusy=false;commonAjaxResponses=new Array('{Unavailable}', '{Session}', '{Privilege}', '{Disabled}');
function commonAjaxResponse(respString){return respString!='{Unavailable}'?respString!='{Session}'?respString=='{Privilege}'?'Insufficient privilege':'Recipient account disabled':'Please <span class="link" onclick="toggleLogin()">login</a>':'Feature unavailable';}
function sendRequest(mode, url, args, async, callback, cArgs, respType, timeout){var httpRequest=false;if( window.XMLHttpRequest ){httpRequest=new XMLHttpRequest();}else if( window.ActiveXObject ){try {httpRequest=new ActiveXObject("Msxml2.XMLHTTP")}catch (e){try {httpRequest=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){httpRequest=false;}}}if( ! httpRequest ){alert("[ ITNewb AJAX Error ]\n\nUnable to create AJAX httpRequest object. Does your web browser support AJAX?");return false;}if( mode=='GET'&&args.length)url+='?'+args;httpRequest.open(mode, url, async);var timedOut=true;setTimeout( function(){if(timedOut){httpRequest.abort();alert("[ ITNewb AJAX Error ]\n\nThe request has timed out. Please try your request again.");}httpRequest=null;reqBusy=false;}, timeout*1000 );if( mode=='POST' ){httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');httpRequest.setRequestHeader('Content-Length', args.length);}httpRequest.onreadystatechange=function(){if( httpRequest.readyState==4 ){if( httpRequest.status==200 ){timedOut=false;var response=respType=='text'?httpRequest.responseText:httpRequest.responseXML;cArgs!=null?callback(response, cArgs):callback(response);}}};httpRequest.send(args);}