<?php
/**
 * File handling the necessary information displaying at the footer
 *
 * This file includes the html_footer file. Also on the basis of config
 * variable setting this will display executed queries and parsing time
 * to the developer. By changing the config setting the admin can hide this.
 *
 * PHP version 5.0
 *
 * @category	###Framework###
 * @package		###Common###
 * @author 		rajesh_04ag02
 * @copyright	Copyright (c) 2009 {@link http://www.agriya.com Agriya Infoway}
 * @license		http://www.agriya.com Agriya Infoway Licence
 * @version		SVN: $Id: application_bottom.inc.php 763 2008-06-20 06:24:35Z selvaraj_47ag04 $
 * @since 		2006-13-17
 */
/*
echo '<pre>'."\n";
print_r($GLOBALS);
echo '</pre>'."\n";
*/
if ($CFG['feature']['external_links_open_new_window'])
    {
?>
<script language="javascript" type="text/javascript">
	window.onload = function() {
		externalLinks();
	}
</script>
<?php
    }
?>
<script language="javascript" type="text/javascript">
var forms_count = document.forms.length;
window.onload = function() {
		helpTipInitialize();
	}
<?php
if ($CFG['feature']['auto_hide_success_block'])
    {
?>
if($('selMsgSuccess')){
		hideAnimateBlock('selMsgSuccess');
	}
<?php
	}
?>
</script>
<?php
	if(class_exists('ListRecordsHandler'))
		{
?>
<script language="javascript" type="text/javascript">	
<?php
			foreach($CFG['data_tbl']['css_alternative_row_classes'] as $key=>$value)
				{
					$class_name = 'clsDataRow '.$value;
?>

	var trTag_arr = document.getElementsByClassName('<?php echo $class_name;?>', 'main');	
	for(var i=0; i<trTag_arr.length;i++)
		{			
			trTag_arr[i].onmouseover = addClassNameForDataTable;
			trTag_arr[i].onmouseout = removeClassNameForDataTable;			
		}
<?php
				}
?>
</script>
<?php
		}
//html footer...
if ($CFG['html']['is_use_footer'])
	{
		/**
		 * Including the html_footer file
		 */
	    require_once($CFG['site']['project_path'] .sprintf($CFG['html']['footer'], $CFG['lang']['default']));
	}
updateAdvertisementCount();
if ($CFG['debug']['is_debug_mode'])
	{
		if ($DEBUG_TRACE)
			{
				echo "\n\n".'<!--'."\n";
				echo '<debugtrace>'."\n";
				echo $DEBUG_TRACE;
				echo '</debugtrace>'."\n\n";
				echo '-->';
			}
	}
if ($CFG['debug']['is_db_debug_mode'] &&
		$CFG['db']['is_use_db'])
	{
		echo "\n\n".'<!--'."\n";
		echo '<benchmark>'."\n";
		echo $SQL_QUERIES;
		echo '</benchmark>'."\n";
		echo '-->';
	}
if ($CFG['benchmark']['query_time']['is_expose'] &&
		$CFG['db']['is_use_db'])
	{
		echo "\n\n".'<!--'."\n";
		echo '<benchmark>'."\n";
		echo '  <querytime>'."\n";
	    $query_timings_arr = $db->getQueryTimings();
		foreach($query_timings_arr as $key=>$query_and_time_arr)
			{
				foreach($query_and_time_arr as $query=>$query_time)
					{
						$query = ($CFG['benchmark']['query_time']['is_expose_query']) ? htmlspecialchars($query) : md5($query);
						echo '   <sec>'.$query_time.'</sec><sql>'.$query.'</sql>'."\n";
					}
			}
		echo '  </querytime>'."\n";
		echo '</benchmark>'."\n";
		echo '-->';
	}
//finishing up parsing work as by config...
if ($CFG['benchmark']['is_expose_parse_time'])
	{
		$CFG['parse_time']['end'] = explode(' ', microtime());
		$CFG['parse_time']['total'] = number_format(($CFG['parse_time']['end'][1] + $CFG['parse_time']['end'][0] - ($CFG['parse_time']['start'][1] + $CFG['parse_time']['start'][0])), 5);
		echo "\n\n".'<!--'."\n";
		echo '<benchmark>'."\n";
		echo '  <parsetime>'."\n";
		echo '    <sec>'.$CFG['parse_time']['total'].'</sec>'."\n";
		echo '  </parsetime>'."\n";
		echo '</benchmark>'."\n";
		echo '-->';
	}
if ($CFG['debug']['is_custom_handler'])
	{
		//cleanup
		echo $errHandler->processTrappedErrors();
	}
