<?php
/**
 * File to handle the logout
 *
 * By clicking the logout link by the logged in user this file will clear
 * the session and redirect the user to the login page with success message.
 *
 * PHP version 5.0
 *
 * @category	###Anova###
 * @package		###index default###
 * @author 		Karthiselvam_75ag08
 * @copyright	Copyright (c) 2009 {@link http://www.agriya.com Agriya Infoway}
 * @license		http://www.agriya.com Agriya Infoway Licence
 * @version		SVN: $Id:
 * @since 		2008-12-19
 */
/**
 * File having common configuration variables required for the entire project
 */
class IndexHandler extends AnovaHandler
	{
		/**
		 *
		 * @return 		void
		 * @access 		public
		 */
		public function createAndShowWeekExperts($limit = 5)
			{
				$this->createWeekExperts();
				$Widget = new Widget();
				return $Widget->showThisWeekExperts($limit);
			}

		/**
		 * IndexHandler::getBestAnsQuestions()
		 *
		 * @param integer $limit
		 * @return
		 */
		public function getBestAnsQuestions($limit = 5)
			{
				$sql = 'SELECT q.ques_id FROM '.$this->CFG['db']['tbl']['questions'].' AS q'.
						' WHERE q.status IN (\'Open\', \'Resolved\') AND best_ans_id!=0'.
						' ORDER BY date_answered DESC LIMIT 0,'.$limit;
				$stmt = $this->dbObj->Prepare($sql);
				$rs = $this->dbObj->Execute($stmt);
				if (!$rs)
						trigger_db_error($this->dbObj);

				$best_ans_questions = array();
				while($row = $rs->FetchRow())
					{
						$best_ans_questions[] = $row['ques_id'];
					}
				return $best_ans_questions;
			}

		/**
		 * IndexHandler::displayBestAnswers()
		 *
		 * @param integer $limit
		 * @return
		 */
		public function displayBestAnswers($limit = 5)
			{
				$this->displayBestAnswers_arr = array();
				$this->displayBestAnswers_arr['best_answered_questions'] = $best_answered_questions = $this->getBestAnsQuestions($limit);
				$this->displayBestAnswers_arr['have_questions'] = $have_questions = false;

				global $best_answer;
				if ($best_answered_questions)
					{
						$this->displayBestAnswers_arr['best_answer'] = $best_answer = true;
						$this->displayBestAnswers_arr['row'] = array();
						$i = 0;
						$inc = 0;
						foreach($best_answered_questions as $eachQuestion)
							{
								$this->displayBestAnswers_arr['row'][$inc]['questionDetails'] = $questionDetails = $this->getQuestionDetails($eachQuestion);
								if (!$questionDetails)
									continue;
	                            $this->displayBestAnswers_arr['row'][$inc]['answerDetails'] = $answerDetails = $this->getAnswerDetails($questionDetails['best_ans_id']);
	                    		if (!$answerDetails)
									{
										$this->displayBestAnswers_arr['row'][$inc] = "";
										$inc++;
										continue;
									}
								$this->displayBestAnswers_arr['have_questions'] = $have_questions = true;
								$i++;
								$this->displayBestAnswers_arr['row'][$inc]['clsOddOrEvenQuestion'] = ($i%2) ? 'clsOddQuestion' : 'clsEvenQuestion';
								$this->displayBestAnswers_arr['row'][$inc]['answer_plural'] = ($questionDetails['total_answer']!= 1) ? $this->LANG['answers'] : $this->LANG['common_total_answer'];
								$this->displayBestAnswers_arr['row'][$inc]['views_plural'] = ($questionDetails['total_views']!= 1) ? $this->LANG['common_total_views'] : $this->LANG['common_total_view'];
								$this->displayBestAnswers_arr['row'][$inc]['image_id'] = $questionDetails['image_id'] = 'dba';
								$this->displayBestAnswers_arr['row'][$inc]['wordWrapManual_answer'] = wordWrapManual($answerDetails['answer'], 25, 100);
								$this->displayBestAnswers_arr['row'][$inc]['answer_url'] = getAnovaUrl('answer','?title='.$questionDetails['seo_title'], $questionDetails['seo_title'].'/');
								$inc++;
						 	} //foreach
						if ($have_questions)
							{
								$this->displayBestAnswers_arr['questions_url'] = getAnovaUrl('questions', '?view=best', 'best/');
							}
						return $this->displayBestAnswers_arr;
					}
			}

		/**
		 *
		 * @return 		void
		 * @access 		public
		 */
		public function popularVideosOnly($limit=4)
			{
				global $smartyObj;

				if (chkIsPaymentAllowed() and $this->CFG['plan']['plan_featured_video_count'] != $this->CFG['plan']['unlimited'] and $this->CFG['plan']['plan_featured_video_count'] < $limit)
					$limit = $this->CFG['plan']['plan_featured_video_count'];

				$popularVideoAudios_arr = array();
				$popularVideoAudio = array();
				$popularVideo = array();
				$this->popularAudio = array();
				$popularVideoAudios_arr['limit'] = $limit;

				$video_types_for = array();
				if(chkIsVideoAllowed('question'))
					$video_types_for[] = 'Question';
				if(chkIsVideoAllowed('answer'))
					$video_types_for[] = 'Answer';
				if(chkVideoModuleAllowed('blog'))
					$video_types_for[] = 'Blog';
				if(chkVideoModuleAllowed('blogcomment'))
					$video_types_for[] = 'Blogcomment';
				if(chkVideoModuleAllowed('forumresponse'))
					$video_types_for[] = 'Forumresponse';

				$video_type_fors = implode('\',\'', $video_types_for);

				//popular videos
				$sql = 'SELECT video_id AS type_id, content_id, video_for AS type_for, total_views, \'video\' AS type, playing_time'.
						' FROM '.$this->CFG['db']['tbl']['ans_video'].
						' WHERE total_views > 0 AND latest_viewed >= DATE_SUB(NOW(), INTERVAL '.$this->CFG['admin']['popular_days']['limit'].' DAY)'.
						' AND video_status = \'Ok\' AND video_encoded_status = \'Yes\''.
						' AND video_for IN (\''.$video_type_fors.'\') '.
						' ORDER BY total_views DESC LIMIT 0, 50';
				$stmt = $this->dbObj->Prepare($sql);
				$rs = $this->dbObj->Execute($stmt);
				if (!$rs)
					    trigger_db_error($this->dbObj);

				if ($rs->PO_RecordCount())
					{
						while($row = $rs->FetchRow()) {
							$popularVideo[] = $row;
						} // while
					}

				$popularVideoAudios_arr['popularVideo'] = $popularVideo;
				$popularVideoAudios_arr['popular_videos_audios']['url'] = getAnovaUrl('popularvideosaudios');
				$this->_popularVideoAudioCnt = 0;
				$this->contentDisplayedArray = array();
				$popularVideoAudios_arr['displayPopularVideoAudio'] = array();
				$inc = 0;
				foreach($popularVideo as $displayVideo) {
					if($resultant_arr = $this->displayPopularVideo($displayVideo)) {
						$inc++;
						$popularVideoAudios_arr['displayPopularVideoAudio'][$inc] = $resultant_arr;
					}
					else
						continue;

					if($inc == 1)
						{
							$smartyObj->assign('initial_url', getAnovaUrl('popularviewvideo', '?pg='.$displayVideo['type_for'].'_'.$displayVideo['type_id'].'&cnt=1', '?pg='.$displayVideo['type_for'].'_'.$displayVideo['type_id'].'&cnt=1'));
							$smartyObj->assign('initial_title', $resultant_arr['question']);
						}
				} // foreach

				$popularVideoAudios_arr['_popularVideoAudioCnt'] = $this->_popularVideoAudioCnt;

				$popularVideoAudios_arr['more_url'] = false;
				if ($this->_popularVideoAudioCnt >= $limit - 1)
					{
						$popularVideoAudios_arr['more_url'] = getAnovaUrl('popularvideosaudios');
					}
				$smartyObj->assign('popularVideoAudios_arr', $popularVideoAudios_arr);
				$smartyObj->assign('display_start', $this->fields_arr['s']);
				$smartyObj->assign('display_limit', $limit);
				setTemplateFolder('general/', $this->CFG['admin']['index']['anova_module']);
				$smartyObj->display('showPopularVideos.tpl');
			}

		/*
		 *
		 * @return 		void
		 * @access 		public
		 * @module		For index.php file
		 **/
		public function displayPopularVideo($row)
			{
				$contentDetails = $this->getContentDetails($row);

				if (!$contentDetails)
					return false;

				$displayPopularVideoAudio_arr = array();
				$displayPopularVideoAudio_arr['question'] = wordWrapManual($contentDetails['question'], 20, 75);
				$displayPopularVideoAudio_arr['link'] = $contentDetails['link'];
				//increment popular video audio count
				$this->_popularVideoAudioCnt++;

				$type_id = $row['type_id'];
				$type_for = $row['type_for'];
				$popularId = 'popular_'.$type_id.'_'.$this->_popularVideoAudioCnt;
				//popular video audio url
				$displayPopularVideoAudio_arr['popularVideoAudioUrl'] = getAnovaUrl('ansviewvideo', '?pg='.$type_for.'_'.$type_id, '?pg='.$type_for.'_'.$type_id);
				$displayPopularVideoAudio_arr['popularType'] = $row['type'];
				$displayPopularVideoAudio_arr['popularHeight'] = '';
				if ($row['type'] == 'audio')
					{
						$displayPopularVideoAudio_arr['popularVideoAudioUrl'] = getAnovaUrl('ansviewaudio', '?pg='.$type_for.'_'.$type_id, '?pg='.$type_for.'_'.$type_id);
						$displayPopularVideoAudio_arr['popularHeight'] = 'height';
					}
				$displayPopularVideoAudio_arr['end_tr'] = false;
				if ($this->_popularVideoAudioCnt == 5)
					{
						$displayPopularVideoAudio_arr['end_tr'] = true;
					}
				$popurl = getAnovaUrl('popularviewvideo', '?pg='.$type_for.'_'.$type_id, '?pg='.$type_for.'_'.$type_id);
				$displayPopularVideoAudio_arr['popularId'] = $popularId;
				$displayPopularVideoAudio_arr['imgSrc'] = $contentDetails['imgSrc'];
				$displayPopularVideoAudio_arr['img_attributes'] = $contentDetails['img_attributes'];
				$displayPopularVideoAudio_arr['playing_time'] = $row['playing_time'];
				$displayPopularVideoAudio_arr['callAjax'] = 'ajaxpopularUpdateDiv(\''.$popurl.'\', \'selShowVideoPopular\'); updateVideoTitleAndActivate(\''.$popularId.'\', this); return false;';

				return $displayPopularVideoAudio_arr;
			}

		public function updateFacebookProfileStatus($field, $value)
			{
		 		$sql = 'UPDATE '.$this->CFG['db']['tbl']['facebook_profile'].
		               	' SET '.$field.' = '.$this->dbObj->Param($value).
						' WHERE user_id = '.$this->dbObj->Param($this->CFG['user']['user_id']);
				$stmt = $this->dbObj->Prepare($sql);
				$rs = $this->dbObj->Execute($stmt, array($value, $this->CFG['user']['user_id']));
				if (!$rs)
						trigger_db_error($this->dbObj);
			}

	}
//<<<<<-------------- Class IndexHandler begins ---------------//
//-------------------- Code begins -------------->>>>>//
$indexhandler = new IndexHandler();
$indexhandler->setPageBlockNames(array('msg_form_error', 'form_recent_questions', 'form_best_answer',
										'form_popular_questions', 'form_recently_answered_questions',
									   	'form_recent_forums', 'form_recent_blogs', 'form_featured_analyst',
									   	'form_popular_videos', 'form_top_analyst', 'form_week_experts',
										'form_popular_debates','form_recent_debates','form_video_debates','form_audio_debates'));
//form fields
$indexhandler->setFormField('search_question', '');
$indexhandler->setFormField('show', '');
$indexhandler->setFormField('change', '');
$indexhandler->setFormField('s', 1);
$indexhandler->setFormField('filter', 'all');
$indexhandler->sanitizeFormInputs($_REQUEST);
//Create widget object
$Widget = new Widget();
$indexhandler->showVideoAudio = false;
if(($CFG['admin']['module']['video_audio_blogsforum']) && (chkVideoModuleAllowed('blogcomment') || chkExternalVideoModuleAllowed('blogcomment') || chkAudioModuleAllowed('blogcomment') || chkExternalAudioModuleAllowed('blogcomment')))
	{
		$indexhandler->showVideoAudio = true;
	}

if ($indexhandler->isFormPOSTed($_REQUEST, 'popularvideos'))
	{
		if (!isAjax())
			{
				echo $LANG['err_tip_invalid_action'];
				die();
			}
		ob_start();
		$indexhandler->includeAjaxHeader();
		$indexhandler->popularVideosOnly();
		$indexhandler->includeAjaxFooter();
		die();
	}
if($indexhandler->isFormGETed($_REQUEST, 'change') && chkAllowedModule(array('facebook')))
	{
		ob_start();
		if(isMember())
			{
				$indexhandler->updateFacebookProfileStatus($indexhandler->getFormField('change'), $indexhandler->getFormField('status'));
			}
		ob_end_flush();
		die();
	}
if ($indexhandler->isFormPOSTed($_REQUEST, 'show'))
	{
		$indexhandler->setAllPageBlocksHide();
		$indexhandler->form_recent_questions['recentQStyle'] = $indexhandler->form_best_answer['bestQStyle'] = '';
		$indexhandler->form_popular_videos['popularVideoStyle'] = '';
		$indexhandler->form_popular_questions['popularQStyle'] = $indexhandler->form_recently_answered_questions['recentAnsweredQStyle'] =	'';
		$indexhandler->form_recent_forums['recentFStyle'] = $indexhandler->form_recent_blogs['recentBStyle'] = $indexhandler->form_featured_analyst['featuredBStyle'] = '';
		$indexhandler->form_recent_debates['recentDStyle']	=	$indexhandler->form_popular_debates['popularDStyle']	=	$indexhandler->form_video_debates['videoDStyle']	=	$indexhandler->form_audio_debates['audioDStyle']	=	'';
		ob_start();
		switch($indexhandler->getFormField('show')){
			case 'selRecentQuestions':
				$indexhandler->form_recent_questions['displayRecentQuestions'] = $Widget->displayRecentQuestions($CFG['admin']['index']['recent_questions_count'], $indexhandler->getFormField('filter'));
				$indexhandler->setPageBlockShow('form_recent_questions');
				break;
			case 'selBestAnsweredQuestions':
				$indexhandler->form_best_answer['displayBestAnswers'] = $indexhandler->displayBestAnswers($CFG['admin']['index']['best_ans_questions_count']);
				$indexhandler->setPageBlockShow('form_best_answer');
				break;
			case 'selRecentlyAnswered':
				$indexhandler->form_recently_answered_questions['displayRecentlyAnsweredQuestions'] = $Widget->displayRecentlyAnsweredQuestions($CFG['admin']['index']['recently_answered_count']);
				$indexhandler->setPageBlockShow('form_recently_answered_questions');
				break;
			case 'selRecentForums':
				$indexhandler->form_recent_forums['displayRecentForums'] = $Widget->displayRecentForums($CFG['admin']['index']['recent_forums_count'], $indexhandler->getFormField('filter'));
				$indexhandler->setPageBlockShow('form_recent_forums');
				break;
			case 'selRecentBlogs':
				$indexhandler->form_recent_blogs['displayRecentBlogs'] = $Widget->displayRecentBlogs($CFG['admin']['index']['recent_blogs_count'], $indexhandler->getFormField('filter'));
				$indexhandler->setPageBlockShow('form_recent_blogs');
				break;
			case 'selFeaturedAnalysts':
				if ($indexhandler->getFormField('filter') == 'all_time')
					{
						$indexhandler->form_top_analyst['displayTopAnalyst'] = $Widget->displayTopAnalyst($CFG['admin']['index']['top_analyst_count']);
						$indexhandler->setPageBlockShow('form_top_analyst');
					}
				elseif ($indexhandler->getFormField('filter') == 'this_week')
					{
						$indexhandler->form_week_experts['createAndShowWeekExperts'] = $indexhandler->createAndShowWeekExperts($CFG['admin']['index']['top_analyst_count_week']);
						$indexhandler->setPageBlockShow('form_week_experts');
					}
				else
					{
						$indexhandler->form_featured_analyst['displayFeaturedAnalyst'] = $Widget->displayFeaturedAnalyst($CFG['admin']['index']['featured_analyst_count']);
					}
				$indexhandler->setPageBlockShow('form_featured_analyst');
				break;
		} // switch
		$indexhandler->includeAjaxHeader();
		setTemplateFolder('general/', $CFG['admin']['index']['anova_module']);
		$smartyObj->display('index.tpl');
		$indexhandler->includeAjaxFooter();
		die();
	}
//To get users options
$user_options = $indexhandler->getUserOptions();
// Default page block
$indexhandler->setAllPageBlocksHide();
if ($indexhandler->isShowIndexBlock($CFG['admin']['index']['recent_questions'], $user_options['recent_questions']))
	$indexhandler->setPageBlockShow('form_recent_questions');
if ($indexhandler->isShowIndexBlock($CFG['admin']['index']['best_answered_questions'], $user_options['best_answered_questions']))
	$indexhandler->setPageBlockShow('form_best_answer');
if ((chkIsVideoAllowed('question') or chkIsVideoAllowed('answer')) AND $indexhandler->isShowIndexBlock($CFG['admin']['index']['popular_videos'], $user_options['popular_videos']))
	$indexhandler->setPageBlockShow('form_popular_videos');
if ($indexhandler->isShowIndexBlock($CFG['admin']['index']['popular_questions'], $user_options['popular_questions']))
	$indexhandler->setPageBlockShow('form_popular_questions');
if ($indexhandler->isShowIndexBlock($CFG['admin']['index']['recently_answered'], $user_options['recently_answered']))
	$indexhandler->setPageBlockShow('form_recently_answered_questions');
if (chkIsAllowedModule(array('forums')) AND $indexhandler->isShowIndexBlock($CFG['admin']['index']['recent_forums'], $user_options['recent_forums']))
	$indexhandler->setPageBlockShow('form_recent_forums');
if (chkIsAllowedModule(array('blog')) AND $indexhandler->isShowIndexBlock($CFG['admin']['index']['recent_blogs'], $user_options['recent_blogs']))
	$indexhandler->setPageBlockShow('form_recent_blogs');
if ($indexhandler->isShowIndexBlock($CFG['admin']['index']['featured_analyst'], $user_options['featured_analyst']))
	$indexhandler->setPageBlockShow('form_featured_analyst');
//<<<<<-------------------- Code ends ----------------------//

//---------------------------------debates module start from  here ---------------------------------
if($CFG['admin']['module']['debate']){
	if ($indexhandler->isShowIndexBlock($CFG['admin']['index']['recent_debates'], $user_options['recent_debates']))
		$indexhandler->setPageBlockShow('form_recent_debates');
	if ($indexhandler->isShowIndexBlock($CFG['admin']['index']['popular_debates'], $user_options['popular_debates']))
		$indexhandler->setPageBlockShow('form_popular_debates');
	//if (chkIsVideoAllowed('debate') AND $indexhandler->isShowIndexBlock($CFG['admin']['index']['debates_with_videos'], $user_options['debates_with_videos']))
	//	$indexhandler->setPageBlockShow('form_video_debates');
	//if (chkIsAudioAllowed('debate') AND $indexhandler->isShowIndexBlock($CFG['admin']['index']['debates_with_audios'], $user_options['debates_with_audios']))
	//	$indexhandler->setPageBlockShow('form_audio_debates');
}
//---------------------------------- debates module end here ---------------------------------
//--------------------Page block templates begins-------------------->>>>>//
if ($indexhandler->isShowPageBlock('form_recent_questions') || $indexhandler->isShowPageBlock('form_best_answer'))
	{
		$indexhandler->form_recent_questions['recentQStyle'] = $indexhandler->form_best_answer['bestQStyle'] = '';
		if ($indexhandler->isShowPageBlock('form_recent_questions'))
			{
				$indexhandler->form_best_answer['bestQStyle'] = 'style=display:none;';
				$indexhandler->form_recent_questions['displayRecentQuestions'] = $Widget->displayRecentQuestions($CFG['admin']['index']['recent_questions_count']);
			}
		if ($indexhandler->isShowPageBlock('form_best_answer') AND !$indexhandler->form_best_answer['bestQStyle'])
			{
				$indexhandler->form_best_answer['displayBestAnswers'] = $indexhandler->displayBestAnswers($CFG['admin']['index']['best_ans_questions_count']);
			}
	}

if ($indexhandler->isShowPageBlock('form_popular_questions') || $indexhandler->isShowPageBlock('form_recently_answered_questions'))
	{
		$indexhandler->form_popular_questions['popularQStyle'] = $indexhandler->form_recently_answered_questions['recentAnsweredQStyle'] = '';
		if ($indexhandler->isShowPageBlock('form_popular_questions'))
		 	{
				$indexhandler->form_recently_answered_questions['recentAnsweredQStyle'] = 'style=display:none;';
				$indexhandler->form_popular_questions['displayPopularQuestions'] = $Widget->displayPopularQuestions($CFG['admin']['index']['popular_questions_count']);
			}
		if ($indexhandler->isShowPageBlock('form_recently_answered_questions') AND !$indexhandler->form_recently_answered_questions['recentAnsweredQStyle'])
			{
			   $indexhandler->form_recently_answered_questions['displayRecentlyAnsweredQuestions'] = $Widget->displayRecentlyAnsweredQuestions($CFG['admin']['index']['recently_answered_count']);
			}
	}
if ($indexhandler->isShowPageBlock('form_recent_debates') || $indexhandler->isShowPageBlock('form_popular_debates') || $indexhandler->isShowPageBlock('form_video_debates') || $indexhandler->isShowPageBlock('form_audio_debates'))
	{
		$recentDStyle = $popularDStyle = $videoDStyle = $audioDStyle = '';
		$indexhandler->form_recent_debates['recentDStyle']	=	$indexhandler->form_popular_debates['popularDStyle']	=	$indexhandler->form_video_debates['videoDStyle']	=	$indexhandler->form_audio_debates['audioDStyle']	=	'';
		if ($indexhandler->isShowPageBlock('form_recent_debates') || $indexhandler->isShowPageBlock('form_popular_debates'))
			{
				$popularDStyle = $videoDStyle = $audioDStyle = 'style=display:none;';
				$indexhandler->form_popular_debates['popularDStyle']	=	$indexhandler->form_video_debates['videoDStyle']	=	$indexhandler->form_audio_debates['audioDStyle']	=	'style=display:none;';
			}
		if ($indexhandler->isShowPageBlock('form_video_debates'))
			{
				$audioDStyle = 'style=display:none;';
				$indexhandler->form_audio_debates['audioDStyle']	=	'style=display:none;';
			}
	}
if ($indexhandler->isShowPageBlock('form_recent_debates'))
	{
	   	$indexhandler->form_recent_debates['displayRecentDebates']	=	$Widget->displayRecentDebates($CFG['admin']['index']['recent_debates_count']);
	}

if ($indexhandler->isShowPageBlock('form_popular_debates'))
	{
		//if (!$popularDStyle)
			$indexhandler->form_popular_debates['displayPopularDebates']	=	$Widget->displayPopularDebates($CFG['admin']['index']['popular_debates_count']);

	}
if ($indexhandler->isShowPageBlock('form_video_debates'))
	{
		if (!$videoDStyle)
			$indexhandler->form_video_debates['displayVideoDebates']	=	$Widget->displayVideoDebates($CFG['admin']['index']['video_debates_count']);
	}

if ($indexhandler->isShowPageBlock('form_audio_debates'))
	{
		if (!$audioDStyle)
			$indexhandler->form_audio_debates['displayAudioDebates']	=	$Widget->displayAudioDebates($CFG['admin']['index']['audio_debates_count']);
	}
if ($indexhandler->isShowPageBlock('form_recent_forums') || $indexhandler->isShowPageBlock('form_recent_blogs') || $indexhandler->isShowPageBlock('form_featured_analyst'))
	{
		$indexhandler->form_recent_forums['recentFStyle'] = $indexhandler->form_recent_blogs['recentBStyle'] = $indexhandler->form_featured_analyst['featuredBStyle'] = '';
		if ($indexhandler->isShowPageBlock('form_recent_forums'))
			{
				$indexhandler->form_recent_blogs['recentBStyle'] = $indexhandler->form_featured_analyst['featuredBStyle'] = 'style=display:none;';
				$indexhandler->form_recent_forums['displayRecentForums'] = $Widget->displayRecentForums($CFG['admin']['index']['recent_forums_count']);
 			}
 		if ($indexhandler->isShowPageBlock('form_recent_blogs') AND !$indexhandler->form_recent_blogs['recentBStyle'])
 			{
 				$indexhandler->form_featured_analyst['featuredBStyle'] = 'style=display:none;';
				$indexhandler->form_recent_blogs['displayRecentBlogs'] = $Widget->displayRecentBlogs($CFG['admin']['index']['recent_blogs_count']);
			}
		if ($indexhandler->isShowPageBlock('form_featured_analyst') AND !$indexhandler->form_featured_analyst['featuredBStyle'])
			{
				$indexhandler->form_featured_analyst['displayFeaturedAnalyst'] = $Widget->displayFeaturedAnalyst($CFG['admin']['index']['featured_analyst_count']);
			}
	}
//include the header file
$indexhandler->includeHeader();
//include the content of the page
setTemplateFolder('general/', $CFG['admin']['index']['anova_module']);
$smartyObj->display('index.tpl');
//includ the footer of the page
?>
<script type="text/javascript" language="javascript">
	var ajax_url = '<?php echo getAnovaUrl('index'); ?>';
	var hideBlocks = function(){
		for(var i=0;i<arguments.length;i++){
			var objName = arguments[i];
			var liName = objName+'LI';
			var spanName = objName+'SPAN';
			var aName = objName+'A';
			if(obj = $(objName)){
				obj.style.display = 'none';
				$(liName).className="clsLeftInActiveQuestionsLink";
			}
		}
	}
	var showBlocks = function(){
		for(var i=0;i<arguments.length;i++){
			var objName = arguments[i];
			var liName = objName+'LI';
			var spanName = objName+'SPAN';
			var aName = objName+'A';
			if(obj = $(objName)){
				obj.style.display = '';
				if (objName == 'selRecentQuestions' || objName == 'selPopularQuestions' || objName == 'selRecentForums')
					$(liName).className="clsFirstQuestionLink clsLeftActiveQuestionsLink";
				else if (objName == 'selBestAnsweredQuestions' && !($('selRecentQuestions')))
					$(liName).className="clsFirstQuestionLink clsLeftActiveQuestionsLink";
				else if (objName == 'selRecentlyAnswered' && !($('selPopularQuestions')))
					$(liName).className="clsFirstQuestionLink clsLeftActiveQuestionsLink";
				else
					$(liName).className="clsLeftActiveQuestionsLink";
			}
		}
	}

</script>
<?php
//<<<<<<--------------------Page block templates Ends--------------------//
$indexhandler->includeFooter();
?>