<?php
/*
osCommerce, Open Source E-Commerce Solutions 
http://www.oscommerce.com 

Copyright (c) 2003 osCommerce 

osCommRes, Services Online 
http://www.oscommres.com 
Copyright (c) 2005 osCommRes 

Freeway eCommerce 
http://www.zac-ware.com/freeway 
Copyright (c) 2007 ZacWare 

Released under the GNU General Public License 
*/
// close session (store variables)

// Check to ensure this file is included in Freeway!
defined('_FEXEC') or die();
?>
<!-- Prepare Initial JS VALUES and default functions //-->
<script type="text/javascript">
<?php
	$js_string='';
	$js_func="";
	if ($JS_VARS && count($JS_VARS)>0){
		reset($JS_VARS);
		while(list($key,)=each($JS_VARS)){
			$js_string.="var " . $key . "=";
			if (count($JS_VARS[$key])>0){
				json_string($JS_VARS[$key]);
			}
			$js_string.=";\n";
		}
	}
	if ($JS_FUNCS && count($JS_FUNCS)>0){
		reset($JS_FUNCS);
		while(list($key,$value)=each($JS_FUNCS)){
			$js_func.=$value .";";
		}
	}
	echo $js_string;


?>
	function pageLoaded(){
		<?php echo $js_func;?>
	}
</script>
<!-- JS VALUES //-->
<?php  
	tep_session_close();

  if (STORE_PAGE_PARSE_TIME == 'true') {
    $time_start = explode(' ', PAGE_PARSE_START_TIME);
    $time_end = explode(' ', microtime());
    $parse_time = number_format(($time_end[1] + $time_end[0] - ($time_start[1] + $time_start[0])), 3);
    error_log(strftime(STORE_PARSE_DATE_TIME_FORMAT) . ' - ' . getenv('REQUEST_URI') . ' (' . $parse_time . 's)' . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);

    if (DISPLAY_PAGE_PARSE_TIME == 'true') {
      echo '<span class="smallText">Parse Time: ' . $parse_time . 's</span>';
    }
  }

  if ( (GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded == true) && ($ini_zlib_output_compression < 1) ) {
    if ( (PHP_VERSION < '4.0.4') && (PHP_VERSION >= '4') ) {
      tep_gzip_output(GZIP_LEVEL);
    }
  }
?>
