var charCount=1;var maxCharCount=2000;function displayRemLength(fieldName){var remField=document.getElementById(fieldName);if(remField!=null){remField.innerHTML=(maxCharCount-charCount>0)?maxCharCount-charCount:0;}}
function evalEntryLength(curField,maxLimit,discardXtra,errClass,normalClass,isJSpell){maxCharCount=maxLimit;if(curField==null)
return;var fieldLength=getCharCount((isJSpell)?curField.body.innerText:curField.value);if(fieldLength>maxLimit){if(errClass!=""){curField.className=errClass;}
if(discardXtra){showAllowedLength(curField,maxLimit,isJSpell);}}else if(normalClass!=""){curField.className=normalClass;}}
function getCharCount(curField){if(curField!=null){var temp=new String(curField);while(temp.indexOf('\r\n')>=0){temp=temp.replace('\r\n','  ');}
while(temp.indexOf('\n')>=0){temp=temp.replace('\n','  ');}
charCount=temp.length;return charCount;}
return 0;}
function showAllowedLength(curField,maxLimit,isJSpell){if(curField!=null)
{if(isJSpell){curField.body.innerText=curField.body.innerText.substr(0,maxLimit);window.status=curField.body.innerText;}
else{curField.value=curField.value.substr(0,maxLimit);window.status=curField.value;}}}
function forwardRequestToFriendsWindow(requestId){var url="/ForwardRequestToFriendPopup.do?requestId="+requestId;var win=new Window('forward_request_to_frineds_win_'+Math.random(),{className:"askv_cube",title:"Forward to Friends",width:520,height:450,minimizable:false,maximizable:false,resizable:true,url:url,hideEffectOptions:{duration:0.5},showEffectOptions:{duration:0.5}});win.setDestroyOnClose();win.toFront();win.showCenter(true);}
function reportAbuse(culpritType,culpritId)
{var abuseCategory=document.getElementById('report_abuse_category_'+culpritType+'_'+culpritId).value;var abuseDescription=document.getElementById('report_abuse_text_'+culpritType+'_'+culpritId).value;var url='/ajax/ReportAbuse.do';var pars='culpritType='+culpritType+'&culpritId='+culpritId+'&abuseCategory='+abuseCategory+'&abuseDescription='+abuseDescription;if(culpritType=='PROFILE'){if(document.getElementById('report_abuse_'+culpritType+'_'+culpritId+'_nickname').checked){pars=pars+'&nickname=true';}
if(document.getElementById('report_abuse_'+culpritType+'_'+culpritId+'_avatar').checked){pars=pars+'&avatar=true';}
if(document.getElementById('report_abuse_'+culpritType+'_'+culpritId+'_city').checked){pars=pars+'&city=true';}}
ajaxUpdateDiv(url,pars,'get','report_abuse_div_'+culpritType+'_'+culpritId);hide('report_abuse_link_'+culpritType+'_'+culpritId);}
function suggestATag(requestId){var formId='suggest_alternate_tag_form_'+requestId;var contentDivId='tags_'+requestId;var suggest_tag_url="/ajax/UserSuggestedTag.do";ajaxFormSubmit(formId,suggest_tag_url,contentDivId);hide('suggest_a_tag_'+requestId);}
function onEnterSuggestATag(event,requestId){if(event.keyCode==13){suggestATag(requestId);return false;}
else{return true;}}
function voteForRequest(requestId,colorScheme,reload){if(isUserLoggedIn()){var url="/ajax/QuestionVote.do";var pars="requestId="+requestId+"&boxColor="+colorScheme;ajaxLoad(url,pars,'post','question_vote_div_'+requestId,'question_vote_progress_div_'+requestId,null,reload?function(){window.location.href="#";}:null);}
else{alert('You are not signed in - please sign in first.');}}
function suggestTagForRequest(requestId){if(isUserLoggedIn()){var str=prompt("List topics that you think should be associated with this question (comma separated):","");if(str){var url="/ajax/UserSuggestedTag.do";var pars="requestID="+requestId+"&questionListItem=true&suggestedTags="+str;ajaxLoad(url,pars,'post','tags_'+requestId,'tags_progress_'+requestId,null,null);}}
else{alert('You are not signed in - please sign in first.');}}
var documentLoadListenerFunctions=new Array();var documentUnloadListenerFunctions=new Array();function addCookie(name,value,days){var expires;if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires="; expires="+date.toGMTString();}
else expires="";document.cookie=name+"="+value+expires+"; path=/";}
function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;}
function eraseCookie(name){addCookie(name,"",-1);}
function addDocumentLoadListenerFunction(fn){documentLoadListenerFunctions.push(fn);}
function documentLoadListener(){if(window.location.href.indexOf('.mydiscussions#discussion')==-1)
{for(var i=0;i<documentLoadListenerFunctions.length;i++){eval(documentLoadListenerFunctions[i]);}
loadMapAlready=true;}
else
{loadMapAlready=false;}}
function addDocumentUnloadListenerFunction(fn){documentUnloadListenerFunctions.push(fn);}
function documentUnloadListener(){for(var i=0;i<documentUnloadListenerFunctions.length;i++){eval(documentUnloadListenerFunctions[i]);}}
function hide(elementId){if(document.getElementById(elementId)!=null)
{document.getElementById(elementId).style.display="none";}}
function hideElt(element){if(element!=null){element.style.display="none";}}
function showBlock(elementId){if(document.getElementById(elementId)!=null)
{document.getElementById(elementId).style.display="block";}}
function showInline(elementId){if(document.getElementById(elementId)!=null)
{document.getElementById(elementId).style.display="inline";}}
function toggleHideShowReturnStatus(elementId){if(document.getElementById(elementId).style.display=="none"){document.getElementById(elementId).style.display="block";return true;}
else{document.getElementById(elementId).style.display="none";return false;}}
function toggleHideShow(elementId){toggleHideShowReturnStatus(elementId);}
function toggleHideShowInlineReturnStatus(elementId){if(document.getElementById(elementId).style.display=="none"){document.getElementById(elementId).style.display="inline";return true;}
else{document.getElementById(elementId).style.display="none";return false;}}
function toggleHideShowInline(elementId){toggleHideShowInlineReturnStatus(elementId);}
function toggleHideShowWithCtlReturnStatus(elementId,ctlPrefix){var isShown=toggleHideShowReturnStatus(elementId);toggleHideShow(ctlPrefix+"-hide");toggleHideShow(ctlPrefix+"-show");return isShown;}
function toggleHideShowWithCtl(elementId,ctlPrefix){toggleHideShowWithCtlReturnStatus(elementId,ctlPrefix);}
function toggleHideShowWithCtlInlineReturnStatus(elementId,ctlPrefix){var isShown=toggleHideShowReturnStatus(elementId);toggleHideShowInline(ctlPrefix+"-hide");toggleHideShowInline(ctlPrefix+"-show");return isShown;}
function toggleHideShowWithCtlInline(elementId,ctlPrefix){toggleHideShowWithCtlInlineReturnStatus(elementId,ctlPrefix);}
function nowEnteringText(element){element.innerHTML="";element.setAttribute("value","");element.setAttribute("class","enteringText");}
function setRelatedTagStyle(style){document.getElementById("related_tags").className=style;}
function isTextAreaBlankById(textAreaId,alertMsg){var result=false;if(document.getElementById(textAreaId).value.length<1){if(alertMsg!=undefined){alert(alertMsg);}
result=true;}
return result;}
function formatDateAshhmma(oDate){var hr=oDate.getHours();var hrToShow='';var ampm='';if(hr==0){hrToShow=12;ampm='am';}
else if(hr<12){hrToShow=hr;ampm='am';}
else if(hr==12){hrToShow=hr;ampm='pm';}
else if(hr>12){hrToShow=hr-12;ampm='pm';}
var mm=oDate.getMinutes();var mmToShow='';if(mm<10){mmToShow='0'+mm;}
else{mmToShow=mm;}
return hrToShow+":"+mmToShow+ampm;}
function isUserLoggedIn(){return(document.cookie.indexOf('a002_askville')!=-1);}
function updateBackToListCookie(listLocation){addCookie('a012_askville',escape(listLocation),3);}
function signIn(curUrl,avctx,newbieToWelcomePage){if(!document.cookie){alert("Sorry but you don't seem to have cookies enabled for your web browser. Without cookies, you will not be able to sign in to Askville.");return;}
var controller="/SignIn.do";if(!avctx){avctx='default';}
else if(avctx.match('signup')||avctx.match('signInOptIn1')||avctx.match('signInOptIn-ad1')){controller="/SignUpStart.do";}
if(curUrl==undefined){curUrl="";}
else{var extraParamInCurUrl='';if(curUrl.indexOf('?')>0||curUrl.indexOf('%3F')>0||curUrl.indexOf('%3f')>0){extraParamInCurUrl+='&';}
else{extraParamInCurUrl+='?';}
extraParamInCurUrl+='msgcode=sirc.retstat&signin=true'+window.location.hash;if(newbieToWelcomePage){extraParamInCurUrl+='&getStarted=true';}
curUrl=curUrl+escape(extraParamInCurUrl);}
window.location.href=controller+'?avctx=signin.'+avctx+'&action='+curUrl;}
function updateBackToListSpan(spanId,linkURL,linkText){var backToList=linkURL?linkURL:readCookie('a012_askville');if(backToList!=null&&backToList!=''){document.getElementById(spanId).innerHTML='<a onmouseover=\"if(document.getElementById(\'backImgId-'+spanId+'\') == null)return false;document.getElementById(\'backImgId-'+spanId+'\').src=\'http://g-ecx.images-amazon.com/images/G/01/askville/icons/arrow-left-hover-v0001.gif\'\" onmouseout=\"if(document.getElementById(\'backImgId-'+spanId+'\') == null)return false;document.getElementById(\'backImgId-'+spanId+'\').src=\'http://g-ecx.images-amazon.com/images/G/01/askville/icons/arrow-left-v0001.gif\'\" href=\"'+
unescape(backToList)+'\"><img id="backImgId-'+spanId+'" src=\"http://g-ecx.images-amazon.com/images/G/01/askville/icons/arrow-left-v0001.gif\" alt=\"back\" style=\"position:relative;top:4px;\" />'+(linkText?linkText:' back to question list')+'</a>&nbsp;';return true;}
else{return false;}}
function setCaretPos(obj,pos){if(obj.createTextRange){var range=obj.createTextRange();range.move("character",pos);range.select();}else if(obj.selectionStart){obj.focus();obj.setSelectionRange(pos,pos);}}
function isNavigationKey(e){var evt=e||window.event;var keynum=evt.keyCode;switch(keynum){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 188:return true;default:return false;}}
function trim(str){return str.replace(/^\s+|\s+$/g,'');}
function showAlphaLabFeedbackWindow(){var win=new Window('feedback_win_'+Math.random(),{className:"askv_cube",title:"Alpha Lab Feedback",width:480,height:350,minimizable:false,maximizable:false,resizable:true,url:"/AlphaLabFeedbackPopup.do",hideEffectOptions:{duration:0.5},showEffectOptions:{duration:0.5}});win.setDestroyOnClose();win.toFront();win.showCenter(true);}
function getDateStringToMinute(mins){var cd=new Date();var minBlock=Math.floor(cd.getMinutes()/mins);return cd.getFullYear()+'-'+cd.getMonth()+'-'+cd.getDate()+'-'+cd.getHours()+'-'+minBlock;}
var cur_user_message_div_id;function renderUserMessageForm(div_id,recipientId,subject,submitJs,inputWidth,disableSpellCheck){if(document.getElementById(cur_user_message_div_id)){hide(cur_user_message_div_id);}
cur_user_message_div_id=div_id;var url='/ajax/SubmitUserMessage.do';var pars='userId='+recipientId;if(subject){pars=pars+'&subject='+subject;}
if(submitJs){pars=pars+'&submitJs='+submitJs;}
if(inputWidth){pars=pars+'&inputWidth='+inputWidth;}
if(disableSpellCheck){pars=pars+'&disableSpellCheck='+disableSpellCheck;}
ajaxUpdateDiv(url,pars,'get',div_id);showBlock(div_id);}
function userMessageFormSubmit(formId){ajaxFormSubmit(formId,'/ajax/SubmitUserMessage.do',cur_user_message_div_id);}
function pageXY(el){var XY={x:0,y:0};for(var node=el;node;node=node.offsetParent){XY.x+=node.offsetLeft;XY.y+=node.offsetTop;}
return XY;}
function windowHeight(){var myHeight=0;if(typeof(window.innerHeight)=='number'){myHeight=window.innerHeight;}
else if(document.documentElement&&document.documentElement.clientHeight){myHeight=document.documentElement.clientHeight;}
else if(document.body&&document.body.clientHeight){myHeight=document.body.clientHeight;}
return myHeight;}
function escapeHtmlBrackets(input){input=input.replace(/</g,"&lt;");input=input.replace(/>/g,"&gt;");return input;}
function scrollToDiv(id){var scrollDiv=document.getElementById(id);if(scrollDiv.scrollIntoView){scrollDiv.scrollIntoView(false);}
else{var XY=pageXY(scrollDiv);var scrollY=XY.y;if(scrollY>windowHeight()){scrollY-=windowHeight();}
window.scrollTo(0,scrollY);}}
function watchQuestion(requestId,resultDivId,progressDivId){if(isUserLoggedIn()){var url="/ajax/QuestionWatchList.do";var pars="action=modify&requestId="+requestId+"&status=STATUS_WATCHED";ajaxLoad(url,pars,'post',resultDivId,progressDivId);}
else{alert('Please sign-in before watching questions');}}
function showHelpPopupWindow(helpMsgId,w,h){var helpUrl="/HelpPopup.do?helpMsgId="+helpMsgId;if(typeof w=='undefined'){w=480;}
if(typeof h=='undefined'){h=350;}
var win=new Window('help_win_'+Math.random(),{className:"askv_cube",title:"Askville Help",width:w,height:h,minimizable:false,maximizable:false,resizable:true,url:helpUrl,hideEffectOptions:{duration:0.5},showEffectOptions:{duration:0.5}});win.setDestroyOnClose();win.toFront();win.showCenter(true);}
var submitcommentonce=false
function checkCommentSubmit(){if(!submitcommentonce){submitcommentonce=true;return true}
else{return false;}}
function addSearchProvider(){if(window.external&&window.external.AddSearchProvider){window.external.AddSearchProvider('http://askville.amazon.com/opensearch.xml');}
else{alert('Sorry, your browser does not support search providers.');}}
function showMainTopicsWindow(){var commentUrl='/MainTopicsWindow.do';var win=new Window('main_topic_win_'+Math.random(),{className:"askv_cube",title:'Popular Topics on Askville',width:300,height:360,minimizable:false,maximizable:false,resizable:true,url:commentUrl,hideEffectOptions:{duration:0.5},showEffectOptions:{duration:0.5}});win.setDestroyOnClose();win.showCenter(true);win.toFront();}
function showReportAbuseForm(id,type,curUrl){var pars='id='+id+'&type='+type+'&curUrl='+escape(curUrl);ajaxLoad('/ajax/ReportAbuseForm.do',pars,'get','report_abuse_div_'+type+'_'+id,'report_abuse_progress_'+type+'_'+id);}
var mouseX=0;var mouseY=0;var isHoverActive=false;function captureMouse(){if(document.layers){document.captureEvents(Event.MOUSEMOVE);}
document.onmousemove=findMouseCrossBrowser;}
function findMouseCrossBrowser(e){if(document.all){mouseX=window.event.x+document.body.scrollLeft;mouseY=window.event.y+document.body.scrollTop;}
else if(document.layers||document.getElementById){mouseX=e.pageX;mouseY=e.pageY;}}
function moveHoverWithMouse(){var thingToManipulate=document.getElementById('1437');thingToManipulate.style.left=""+(mouseX+10)+"px";thingToManipulate.style.top=""+(mouseY+10)+"px";}
function findPos(obj){var curleft=0;var curtop=0;if(obj&&obj.offsetParent){curleft=obj.offsetLeft
curtop=obj.offsetTop
while(obj=obj.offsetParent){curleft+=obj.offsetLeft
curtop+=obj.offsetTop}}
return[curleft,curtop];}
function hideHoverDiv(id){isHoverActive=false;setTimeout('hideHoverActual(\''+id+'\')',400);}
function hideHoverActual(id){if(!isHoverActive){hide(id);document.getElementById(id).className='askville_hover greenbox';}}
function showHoverAnimRight(linkId,hoverId,contentId,width,height){showHoverAnimStep(1,linkId,hoverId,contentId,width,height,false);}
function showHoverRight(linkId,hoverId,contentId){showHoverAnimStep(1,linkId,hoverId,contentId,null,null,false,1);}
function showHoverAnimBottom(linkId,hoverId,contentId,width,height){showHoverAnimStep(1,linkId,hoverId,contentId,width,height,true);}
function showHoverBottom(linkId,hoverId,contentId){showHoverAnimStep(1,linkId,hoverId,contentId,null,null,true,1);}
function showHoverBottomDelay(linkId,hoverId,contentId){isHoverActive=true;setTimeout("showHoverBottomCheck('"+linkId+"','"+hoverId+"','"+contentId+"')",400);}
function showHoverBottomCheck(linkId,hoverId,contentId){if(isHoverActive){showHoverAnimStep(1,linkId,hoverId,contentId,null,null,true,1);}}
function showHoverAnimStep(step,linkId,hoverId,contentId,width,height,fromBottom,maxSteps){var hoverDiv=document.getElementById(hoverId);var link=document.getElementById(linkId);if(!maxSteps){maxSteps=3;}
isHoverActive=true;if(step==1){if(contentId!=null){hoverDiv.innerHTML='';}
if(fromBottom){hoverDiv.style.left=findPos(link)[0]+'px';hoverDiv.style.top=findPos(link)[1]+link.offsetHeight+'px';}
else{hoverDiv.style.left=findPos(link)[0]+link.offsetWidth+'px';hoverDiv.style.top=findPos(link)[1]+'px';}
hoverDiv.style.display='block';}
if(step<maxSteps){hoverDiv.style.width=width/(maxSteps-step)+'px';hoverDiv.style.height=height/(maxSteps-step)+'px';++step;setTimeout("showHoverAnimStep("+step+",'"+linkId+"', '"+hoverId+"','"+contentId+"', "+width+","+height+","+fromBottom+","+maxSteps+")",50);}
else{showHoverActual(hoverId,contentId,!fromBottom);}}
function showHoverActual(hoverId,contentId,autoScrollWidth){var hoverDiv=document.getElementById(hoverId);hoverDiv.className='askville_hover';if(contentId!=null){hoverDiv.innerHTML=document.getElementById(contentId).innerHTML;if(autoScrollWidth){window.scrollBy(hoverDiv.offsetWidth,0);}}}