var strMsgWidth='100%';var clicked=0;window.addEvent('domready',function(){if(Cookie.read('msgResize')!=''){if(parseInt(Cookie.read('msgResize'))<600)strMsgWidth=Cookie.read('msgResize')+'px;';}
if($chk($('aShowAll')))$('aShowAll').addEvent('click',function(){clicked=1;expandAll();});if($chk($('aShowAll')))$('aShowAll').store('tip:title','Expand All Messages');$(document.body).getElements('span.ExpandImage').each(function(item){if(item.getChildren('img').get('src')=='http://resources.investorvillage.com/Images/expand.gif'){item.getParent().store('tip:title','Expand Message');}else if(item.getChildren('img').get('src')=='http://resources.investorvillage.com/Images/contract.gif'){item.getParent().store('tip:title','Contract Message');}});$(document.body).getElements('a.auth').each(function(item){if(item.get('premium')=='True'){item.store('tip:title','Premium Member');}});if($chk($('aResetResults')))$('aResetResults').store('tip:title','Reset Search Results');if($chk($('aResetResults')))$('aResetResults').addEvent('click',function(){clearSearch();clearFilter();document.frmSearch.submit();});if($chk($('aResetResults')))$('aResetResults').addEvent('mouseenter',function(){$('aResetResults').style.cursor='pointer';});if($chk($('aResetResults')))$('aResetResults').addEvent('mouseleave',function(){$('aResetResults').style.cursor='auto';});if($chk($('aResetFilter')))$('aResetFilter').store('tip:title','Remove Message Filter');if($chk($('aResetFilter')))$('aResetFilter').addEvent('click',function(){clearSearch();clearFilter();document.frmSearch.submit();});if($chk($('aResetFilter')))$('aResetFilter').addEvent('mouseenter',function(){$('aResetFilter').style.cursor='pointer';});if($chk($('aResetFilter')))$('aResetFilter').addEvent('mouseleave',function(){$('aResetFilter').style.cursor='auto';});if($chk($('spnFilterBlurb')))$('spnFilterBlurb').set('text','These messages are being filtered. ('+$('div'+$('hdnCategoryFilter').get('value')).get('text')+')');if($chk($('btnGoMsgNum1'))){$('btnGoMsgNum1').addEvent('click',function(){goToMessage($('txtGoMsgNum1').get('value'));});}
if($chk($('btnGoMsgNum2'))){$('btnGoMsgNum2').addEvent('click',function(){goToMessage($('txtGoMsgNum2').get('value'));});}
var myCookie=Cookie.read('ExpandAll');if(myCookie=='True'&&pr=='1')expandAll();scrollPage();});function scrollPage(){if(autoScroll=='1'){var scrollPos=document.body.scrollTop;if(scrollPos==0){if(window.pageYOffset){scrollPos=window.pageYOffset;}else{scrollPos=document.body.parentElement?document.body.parentElement.scrollTop:0;}}
if(scrollPos==0){if(samePage=='true'){var myFx=new Fx.Scroll(window).set(0,$('divMsgNav').getCoordinates().top);}else{setTimeout('var myFX = new Fx.Scroll(window).toElement($(\'tblSMBDHeader\'));',500);}}}}
function ShowPrevious(){$('hdnd').set('value','-1');$('hdnr').set('value',r);$('hdnpm').set('value',pmText);$('hdnnh').set('value',pnhText);document.frmSearch.submit();}
function ShowNext(){$('hdnd').set('value','1');$('hdnr').set('value',r);$('hdnnm').set('value',nmText);$('hdnnh').set('value',nnhText);document.frmSearch.submit();}
function sortByRecs(dir){$('hdnnm').set('value',nextMsgNum);$('hdnpm').set('value',prevMsgNum);$('hdnr').set('value',dir);$('hdnnh').set('value',nh);document.frmSearch.submit();}
function goToMessage(intMsgNum){document.location=scriptName+'?mb='+mbId+'&pt=msg&mn='+intMsgNum;return false;}
function openRecs(intMid){window.open('dialogs/Recommendations.asp?messageid='+intMid,'','scrollbars=yes,width=400,height=400,top='+(screen.height-400)/2+',left='+(screen.width-418)/2);}
function expandAll(){if(pr!='1'){modalMsgBox('<div style="width:300px;">To save time with multi-message viewing, <br /><a href="/registration.asp">become a Premium Member</a>.<br />Already Premium? <a href="/login.asp">Sign in.</a></div>','alert');}else{if($('imgShowAll').get('src')=='http://resources.investorvillage.com/Images/expand.gif'){if(clicked==0){doExpandAll();}else{if(confirm('Are you sure you want to expand all messages? This process can take up to 20 seconds to complete, depending on the amount of data.')){doExpandAll();}}}else{var myCookie=Cookie.read('ExpandAll');if(myCookie=='True')Cookie.dispose('ExpandAll');$('imgShowAll').set('src','http://resources.investorvillage.com/Images/expand.gif');$('aShowAll').store('tip:title','Expand All Messages');var arrExpanded=$('tblMessages').getElements('tr[class=mmboardSelected]');arrExpanded.each(function(item){expandMessage(item.get('id').substr(9));});}}}
function doExpandAll(){var myCookie=Cookie.write('ExpandAll','True');$('imgShowAll').set('src','http://resources.investorvillage.com/Images/contract.gif');$('aShowAll').store('tip:title','Collapse All Messages');var strMsgListIds='';var intCount=0;var arrCollapsed=$('tblMessages').getElements('tr.mmBoardWasSelected');arrCollapsed.each(function(item){msgId=item.get('id').substr(9);if($chk($('trMsgDetails'+msgId))){$('trMsgHeader'+msgId).set('class','new-plastic_top-tile');$('trMsgDetails'+msgId).set('class','mmboardPost');if($chk($('trReplyTo'+msgId)))$('trReplyTo'+msgId).set('class','mmboardPost');$('trMsgFooter'+msgId).set('class','new-plastic_bottom-tile');$('trMessage'+msgId).set('class','mmboardSelected');$('imgExpandMsg'+msgId).set('src','http://resources.investorvillage.com/Images/contract.gif');}});var arrCollapsed=$('tblMessages').getElements('tr.mmBoardUnselected');arrCollapsed.each(function(item){msgId=item.get('id').substr(9);if(intCount>0)strMsgListIds+=',';strMsgListIds+='\''+msgId+'\'';intCount+=1;});if(intCount>0)ajaxRequest('ajaxManagers/BoardAjaxManager.asp','action=getMessageDetails&fromList=True&messageIds='+strMsgListIds+'&ignoreList=0&markExpanded='+markExpanded,'getMessageDetails');}
function expandMessage(msgId){if(pr!='1'){modalMsgBox('<div style="width:300px;">To save time with multi-message viewing, <br /><a href="/registration.asp">become a Premium Member</a>.<br />Already Premium? <a href="/login.asp">Sign in.</a></div>','alert');}else{if($('trMessage'+msgId).get('class')=='mmboardSelected'){$('trMessage'+msgId).set('class','mmBoardWasSelected'+iif(markExpanded==1,' msgRead',''));$('imgExpandMsg'+msgId).set('src','http://resources.investorvillage.com/Images/expand.gif');$('aExpandMsg'+msgId).store('tip:title','Expand Message');attachTips();$('trMsgHeader'+msgId).set('class','dn');if($chk($('trReplyTo'+msgId)))$('trReplyTo'+msgId).set('class','dn');$('trMsgDetails'+msgId).set('class','dn');$('trMsgFooter'+msgId).set('class','dn');}else{if($chk($('trMsgDetails'+msgId))){$('trMessage'+msgId).set('class','mmboardSelected');$('imgExpandMsg'+msgId).set('src','http://resources.investorvillage.com/Images/contract.gif');$('trMsgHeader'+msgId).set('class','new-plastic_top-tile');$('trMsgDetails'+msgId).set('class','mmboardPost');if($chk($('trReplyTo'+msgId)))$('trReplyTo'+msgId).set('class','mmboardPost');$('trMsgFooter'+msgId).set('class','new-plastic_bottom-tile');}else{ajaxRequest('ajaxManagers/BoardAjaxManager.asp','action=getMessageDetails&messageId='+msgId+'&ignoreList=0&markExpanded='+markExpanded,'getMessageDetails');}
$('aExpandMsg'+msgId).store('tip:title','Contract Message');attachTips();}}}
function convertDraftToPost(intMsgId){ajaxRequest('ajaxManagers/BoardAjaxManager.asp','action=convertDraftToPost&messageId='+intMsgId,'convertDraftToPost');}
function deleteDraft(intMsgId){ajaxRequest('ajaxManagers/BoardAjaxManager.asp','action=deleteDraft&messageId='+intMsgId,'deleteDraft');}
function previewPost(msgId){window.open('/mbPostPreview.asp?msgId='+msgId,'','scrollbars=yes,width=825,height=475,top='+(screen.height-475)/2+',left='+(screen.width-825)/2);}
function doReply(intMessageId,intCategoryId){if((isAdminBoard!='True'&&isGroupMember)||(isAdminBoard=='True'&&isAdmin=='True')){window.location.href='mbpostmessage.asp?ref='+scriptName+'&ReplyTo='+intMessageId+'&mb='+mbId+'&ct='+intCategoryId;}
else{alert('Posting on this board is restricted to members of the board only');}}
function confirmRecommendTopic(){if(confirmRecs=='Yes'){res=confirm('Click OK to recommend this message.');}else{res=1;}}
function submitgo(myfield,e){var keycode;if(window.event)keycode=window.event.keyCode;else if(e)keycode=e.which;else return true;if(keycode==13){if($('txtGoMsgNum1').get('value')!=''){goToMessage($('txtGoMsgNum1').get('value'));return false;}
else if($('txtGoMsgNum2').get('value')!=''){goToMessage($('txtGoMsgNum2').get('value'));return false;}}}