<link href="catalog/template/beststoreitems/css/forums.css" type="text/css" rel="stylesheet">
<link href="catalog/template/beststoreitems/css/page.css" type="text/css" rel="stylesheet">
<!--left-->
<div class="sidebar">
    <?php if(is_array($forums_cate_list)){?>
    <?php foreach($forums_cate_list as $fcl){?>
    <?php if(count($fcl['child'])>0){?>
		<div class="sub_menu">
	        <h3 class="forums_title"><?php echo $fcl['cate_name']?></h3>
	        <div class="clearfix menu_list">
	            <ul>
	               <?php foreach($fcl['child'] as $f){?>
	                <li><a <?php echo $f['forums_category_id']==$currently_forums_cate_info['forums_category_id']?'id="hoved"':''?>  href="index.php?controller=forums&action=topic_category&fcid=<?php echo $f['forums_category_id']?>" ><?php echo $f['cate_name']?></a></li>
	              <?php }?>
	            </ul>
	        </div>
	    </div>
   <?php }?>
   <?php }?>
   <?php }?> 

    
</div>
<!--left end-->

<!--right-->
<div class="sub_right">
	<div class="clearfix for_head">
    	<p class="ptx">
        	<a href="/index.php?controller=forums"><b>&laquo;</b>See all threads</a>
            <span class="mix">(in <?php echo $currently_forums_cate_info['cate_name']?>)</span>
        </p>
        <div class="min"><?php echo $currently_forums_cate_info['cate_name']?></div>
    </div>
    <div class="commentbox">
    	<h3 class="comment_title"><?php echo $topic_detail['subject']?></h3>
        <div class="comment_contmian">
           <?php if(isset($topic_detail['product_info'])){?>
        	<div class="comment_product">
            	<a href="/index.php?controller=product&product_id=<?php echo $topic_detail['product_info']['product_id']?>" class="commmet_pic"><img src="<?php echo $topic_detail['product_info']['thumb']?>"/></a>
                <div class="commmet_detail">
                    <h4><a href="/index.php?controller=product&product_id=<?php echo $topic_detail['product_info']['product_id']?>"><?php echo $topic_detail['product_info']['name']?></a></h4>
                    <div style="line-height:140%">
                        <p class="sales">Sales Price: <span class="price"><?php echo $topic_detail['product_info']['price']?></span></p>
                        <p class="item">Item Number: <?php echo $topic_detail['product_info']['product_id']?></p>
                        <p class="comment_cart">
                            <a href="/index.php?controller=product&product_id=<?php echo $topic_detail['product_info']['product_id']?>" target="_blank"><img src="https://www.beststoreitems.com/catalog/template/beststoreitems/image/topic_addtocart.gif"/></a>
                            <a href="/index.php?controller=product&product_id=<?php echo $topic_detail['product_info']['product_id']?>" target="_blank" class="tempView" rel="nofollow">View Product Details </a>
                        </p>
                    </div>
                </div>
            </div>
           <?php }?>
            <ul class="comment_list">
            	<li class="listOne">
                	<div class="head">
                        <span class="author">
                            <a><?php echo $topic_detail['author']?></a>
                        </span>
                        <span class="date"><?php echo date('l',strtotime($topic_detail['date_added']))?>,  <?php echo $topic_detail['date_added']?></span>
                        <a class="Reply">Reply</a>
                    </div>
                    <div class="info"><?php echo $topic_detail['content']?></div>
                    <!--<div class="bt">
                        <span class="oper">
                            <a href="">Posts(<u><?php echo $topic_detail['posts']?></u>)</a> |
                            <a target="_blank" href="">Reviews</a> |
                            <a href="" rel="nofollow">Tip post</a>
                        </span>
                        <a href="" title="Report Post" class="report"></a>
                    </div>-->
                </li>
                <?php if(is_array($reply_topic_data)){?>
                <?php foreach($reply_topic_data as $k=>$rtd){?>
                <li <?php if($k%2==0) echo 'class="listTwo"';?>>
                	<div class="head">
                        <span class="author">
                            <a><?php echo $rtd['author']?></a>
                        </span>
                        <span class="date"><?php echo date('l',strtotime($rtd['date_added']))?>,  <?php echo $rtd['date_added']?></span>
                        <a class="Reply">Reply</a>
                    </div>
                    <div class="info"><?php echo $rtd['content']?></div>
                    <!-- <div class="bt">
                        <span class="oper">
                            <a href="">Posts(<u><?php echo $topic_detail['posts']?></u>)</a> |
                            <a target="_blank" href="">Reviews</a> |
                            <a href="" rel="nofollow">Tip post</a>
                        </span>
                        <div>post edited  by astraya on 1/23/2013 at 2:12 AM</div>
                        <a href="" target="_parent" title="Edit Post" class="edit"></a>
                    </div>-->
                </li>
                <?php }?>
                <?php }?>
            </ul>
            <!--page start-->
            <div class="page_wrapper">
               <form action="<?php echo $action; ?>" method="post" name="pageform" enctype="multipart/form-data">
		        <input type="hidden" name="page" value="1" />		
			    <script type="text/javascript">		
					 function SelectPage(page)		
					 {
					    document.pageform.page.value = page;
			
					 	document.pageform.submit();
			
						return false;
			
			         };
				</script>
                 <table width="100%">
    
			            <tr><td align="left"><?php echo $text_results; ?></td>
			    
			            <td align="right">
			    
			          <table cellspacing="0" cellpadding="0" class="page">
			    
			            <tr>
			    
			            <?php if ($page>1) { ?>
			    
			            <td id="page_box_previous"><a href="#" onclick="return SelectPage(<?php echo ($page-1); ?>);"><?php echo 'Previous'?></a></td>
			    
			            <?php };
			    
			            foreach ($pages as $pageentry) {   
			    
			                    if ( $pageentry['value'] > ($page + max(9-$page,4)) ) {?>
			    
			                               <td id="page_box_next"><a href="#" onclick="return SelectPage(<?php echo ($page+1); ?>);"><?php echo 'Next'?></a></td>
			    
			                    <?php 
			    
			                         break;
			    
			                     } ;
			    
			                    
			    
			                    if ( $pageentry['value'] < ($page - 4) ) {continue; }
			    
			                    ?>
			    
			                                              
			    
			                    <?php if ($pageentry['value'] == $page) { ?>
			    
			                    <td width="20" height="16" align="center" valign="middle"><b class="current_i"><font size="1"><?php $x = explode(" ",$pageentry['text']);echo $x[0]; ?></font></b></td>
			    
			                    <?php } else { ?>
			    
			                    <td id="page_box" >
			    
			                    <a href="#" onclick="return SelectPage(<?php echo $pageentry['value']; ?>);"><?php $x = explode(" ",$pageentry['text']);echo $x[0]; ?></a></td>
			    
			                    <?php } ?>   
			    
			            <?php } ?>
			            <td>Go to Page         
			                <select onchange="return SelectPage(this.value)" style="width:50px;">
			                    <?php foreach ($pages as $pageentry){?>
			                        <option value="<?php echo $pageentry['value']?>" <?php if ($pageentry['value'] == $page){echo 'selected';}?>><?php echo $pageentry['value']?></option>
			                    <?php };?>
			                </select>
			            </td>
			          </tr></table>
			    
			    </td></tr></table>
			    </form>
            </div>
            <!--page end-->
        </div>
    </div>
    <div class="clearfix for_head" id="forBox">
    	<p class="ptx">
        	<a class="Reply"><b>&laquo;</b>Reply to this thread</a>
        </p>
	</div>
	<script type="text/javascript">
		function check_login_form(){  			
		  var email=document.getElementById("login_email").value;		
		  var password=document.getElementById("login_password").value;		
			  if(email==''||password==''){
			  	     alert("No match for email address and/or password.");				  
			  }
              else{
			    	document.getElementById('UserLogin').submit();
			  }	
		}
		function submit_topic(){	
		    var content=document.getElementById("topic_content").value;		
			  if(content==''){
			  	     alert("Message not empty");				  
			  }
              else{
			    	document.getElementById('add_topic').submit();
			  }	
		}
	</script>
	<?php if($customer_id==0){?>
     <div class="commentbox loginbox">
            <h3 class="comment_title">beststoreitems Account Sign In</h3>
            <form id="UserLogin" action="index.php?controller=account_login" method="post" onsubmit="check_login_form();return false;" enctype="multipart/form-data">
                <div class="comment_contmian login_contect">
                	<p class="intro">Please sign-in to post or reply to topic.</p>
                	<p class="eu">
                        <label class="lbleft">Email Address or Member ID:</label>
                        <input type="text" id="login_email" name="email" value="" class="lbright">
                    </p>
                    <p class="psd">
                        <label class="lbleft">Password:</label>
                        <input type="password" id="login_password" value="" name="password" class="lbright">
                    </p>
                    <input type="hidden" name="from" value="index.php?controller=forums&action=topic_threadid&ftid=<?php echo $topic_detail['forums_topics_id']?>" />	
                    <p class="login">
                        <label class="lbleft"></label>
                        <input type="submit" value="Sign in" class="signIn">
                    </p>
                    <p class="des">
                        <strong>Forgot password?</strong> 
                        Reset password to your account, <a href="">click here</a>.
                    </p>
                </div>
            </form>
    </div>
    <?php }elseif ($customer_id==1){?>
    <div class="accordion commentbox" style="display:none;">
    	<h3 class="comment_title">Post a new topic</h3>
        <div class="comment_contmian reply_content">
        	<form action="index.php?controller=forums&action=topic_threadid&ftid=<?php echo $topic_detail['forums_topics_id']?>" id="add_topic" method="post" onsubmit="submit_topic();return false;">
            	<p>Subject:</p>
                <input maxlength="50" disabled="disabled" readonly="readonly"  title="Enter Subject. This is a required field" class="txt_title" value="RE: <?php echo $topic_detail['subject']?>" name="txtSubject" id="txtSubject">
                <div class="tips"><span style="color: #F66907;">* 50</span> characters max</div>
                <p>Message:</p>
                <div class="editbox">
                	<textarea title="Enter Message. This is a required field" class="txt_title" id="topic_content" name="content" maxlength="5000" style="height: 150px"></textarea>
                    <div class="tips"><span style="color: #F66907;">* 5000</span> characters max</div>	
                </div>
                <div class="desbox">
                
                    <!--reportError begin-->
                    <div id="bg" class="bg" style="display:none;"></div>
                    <div id="reportError" class="mydiv" style="display:none;">
                            <div id="reportbox">
                                <div class="reportTitle">
                                    <h4>beststoreitems FORUM'S USAGE TERMS AND CONDITIONS</h4>
                                    <a id="close" onclick="javascript:closeDiv()">close</a>
                                </div>
                                <div id="reportMian">
                                	<div class="popContent">
                                    	<span>beststoreitems Forums are not a sales or product support board. For sales or specific product related questions, please send us a message. For after-sales support inquiries, please send us a message or submit a support incident to receive the fastest response.</span>
                                        <span>All postings not relating to product information or discussion will be forwarded to appropriate department accordingly and will be removed from our forum.</span>
                                        <span>No posting of any unsolicited advertising, promotional materials, or any other forms of solicitation. This includes any kind of references to other gadgets and/or electronics vendors, and price comparison web sites, appearing anywhere in the posts (including but not limited to subjects, contents, editorial comments and usernames).</span>
                                        <span>No pornography, obscenities, and defamatory postings are allowed anywhere on beststoreitems forum. Postings of this kind will be removed immediately, and a violation will be issued to the person responsible for the posting (several violations will result in blocking of your access to the forum).</span>
                                        <span>All users' IP will be recorded but real e-mail address is not required when posting on the forum. No usernames that contain obscene words, derogatory or racist remarks, or references to sexual acts or sexual anatomy are allowed on beststoreitems.com. Postings containing any usernames with obscene words, derogatory or racist remarks will be removed immediately.</span>
                                	</div> 
                                </div>          
                            </div>
                    </div>
                    <!--reportError end-->
                    <div class="clearfix">                        
                        <div class="popButton">
                            <input type="hidden" name="forums_topics_id" value="<?php echo $topic_detail['forums_topics_id']?>">
                            <input  type="submit" class="postMessage" value="Post Message">
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <?php }?>
    <p class="tips">Please note that Forums are not a sales or product support board. For support questions, please contact us via email or live chat for a guaranteed response. We make every effort to make the quickest replies.</p>
</div>
<!--right end-->
<script type="text/javascript">
	$(document).ready(function(){
		$(".Reply").click(function(){
			$(".accordion").slideToggle("fast",function(){
				var top = $("#forBox").offset().top;
				$("html,body").animate({ scrollTop: top }, 300);
			});
		});
	});
			
	function showDiv(){
		document.getElementById('bg').style.display='block';
		document.getElementById('reportError').style.display='block';
	}
	function closeDiv(){
		document.getElementById('bg').style.display='none';
		document.getElementById('reportError').style.display='none';
	}
</script>  