<?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 
*/
// FILE: meta_tags.php
// USE : This file controls the title, meta description,
//       and meta keywords of every page on your web site.
//       See the install docs for instructions.

// Check to ensure this file is included in Freeway!
defined('_FEXEC') or die();

// Define Primary Section Output
	
  define('PRIMARY_SECTION', ' : ');

// Define Secondary Section Output
  define('SECONDARY_SECTION', ' - ');

// Define Tertiary Section Output
  define('TERTIARY_SECTION', ', ');

  // Optional customization options for each language
  switch ($languages_id) {
  // English language
  case '1':
    //Extra keywords that will be outputted on every page
    $mt_extra_keywords = '';
	//Descriptive tagline of your web site
	$web_site_tagline = TERTIARY_SECTION . '';
	break;
  // German language
  case '2':
    //Extra keywords that will be outputted on every page
    $mt_extra_keywords = '';
	//Descriptive tagline of your web site
	$web_site_tagline = TERTIARY_SECTION . '';
	break;
  // Spanish language
  case '3':
    //Extra keywords that will be outputted on every page
    $mt_extra_keywords = '';
	//Descriptive tagline of your web site
	$web_site_tagline = TERTIARY_SECTION . '';
	break;
  }
  // Clear web site tagline if not customized
  if ($web_site_tagline == TERTIARY_SECTION) {
    $web_site_tagline = '';
  }
  // Get all top category names for use with web site keywords

	if (isset($current_events_category_id) && $current_events_category_id>0){
	  $mt_categories_query = tep_db_query("select ecd.events_categories_name from " . TABLE_EVENTS_CATEGORIES . " ec, " . TABLE_EVENTS_CATEGORIES_DESCRIPTION . " ecd where ec.parent_id = '0' and ec.events_categories_id = ecd.events_categories_id and ecd.language_id='" . (int)$languages_id ."'");
	  while ($mt_categories = tep_db_fetch_array($mt_categories_query))  {
		$mt_keywords_string .= $mt_categories['events_categories_name'] . ' ';
	  }
	 } else if (isset($current_subscription_category_id) && $current_subscription_category_id>0){
	  $mt_categories_query = tep_db_query("select scd.subscription_categories_name from " . TABLE_SUBSCRIPTION_CATEGORIES . " sc, " . TABLE_SUBSCRIPTION_CATEGORIES_DESCRIPTION . " scd where sc.parent_id = '0' and sc.subscription_categories_id = scd.subscription_categories_id and scd.language_id='" . (int)$languages_id ."'");
	  while ($mt_categories = tep_db_fetch_array($mt_categories_query))  {
		$mt_keywords_string .= $mt_categories['subscription_categories_name'] . ' ';
	  }
	 } else {
	  $mt_categories_query = tep_db_query("select cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."'");
	  while ($mt_categories = tep_db_fetch_array($mt_categories_query))  {
		$mt_keywords_string .= $mt_categories['categories_name'] . ' ';
	  }	 
	 }

  $replace_array=array("Categories_Name"=>$mt_keywords_string);
  $content_query=tep_db_query("SELECT title,description,keywords from " . TABLE_META_TAGS . " where filename='" . $content . "'");
  if (tep_db_num_rows($content_query)>0){
  	// load events_categories if needed;
	  $content_result=tep_db_fetch_array($content_query);
	  switch($content){
		  case CONTENT_INDEX_NESTED:
				$mt_category_query = tep_db_query("select categories_name,categories_description from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$current_category_id . "' and language_id = '" . (int)$languages_id . "'");
				$mt_category = tep_db_fetch_array($mt_category_query);
				$replace_array["Category_Name"]=$mt_category["categories_name"];
				$replace_array["Category_Description"]=$mt_category["categories_description"];
				break;
		  case CONTENT_INDEX_PRODUCTS:
		  case CONTENT_INDEX_PRODUCTS_ALL:
			if (isset($HTTP_GET_VARS['manufacturers_id'])) {
			  $mt_manufacturer_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
			  $mt_manufacturer = tep_db_fetch_array($mt_manufacturer_query);
			  $replace_array["Category_Name"]=$mt_manufacturer['manufacturers_name'];
			  $replace_array["Category_Description"]="";
			} else {
				$mt_category_query = tep_db_query("select categories_name,categories_description from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$current_category_id . "' and language_id = '" . (int)$languages_id . "'");
				$mt_category = tep_db_fetch_array($mt_category_query);
				$replace_array["Category_Name"]=$mt_category["categories_name"];
				$replace_array["Category_Description"]=$mt_category["categories_description"];
			}
			break;
		  case CONTENT_INDEX_EVENTS:
		  case CONTENT_EVENTS_DAY_VIEW:
		  case CONTENT_EVENTS_MONTH_VIEW:
		  case CONTENT_EVENTS_WEEK_VIEW:
		  case CONTENT_EVENTS_VIEW1:
		  case CONTENT_EVENTS_VIEW2:
		  case CONTENT_EVENTS_VIEW3:
			  $mt_category_query = tep_db_query("select events_categories_name,events_categories_description from " . TABLE_EVENTS_CATEGORIES_DESCRIPTION . " where events_categories_id = '" . (int)$current_events_category_id . "' and language_id = '" . (int)$languages_id . "'");
			  $mt_category = tep_db_fetch_array($mt_category_query);
			  $replace_array["Category_Name"]=$mt_category['events_categories_name'];
			  $replace_array["Category_Description"]=$mt_category['events_categories_description'];
			  break;
		  case CONTENT_PRODUCT_INFO:
			$mt_product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_price, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
			$mt_product_info = tep_db_fetch_array($mt_product_info_query);
		
			if ($mt_new_price = tep_get_products_special_price($mt_product_info['products_id'])) {
			  $mt_products_price = $currencies->display_price($mt_product_info['products_price'], tep_get_tax_rate($mt_product_info['products_tax_class_id']),1,true) . $currencies->display_price($mt_new_price, tep_get_tax_rate($mt_product_info['products_tax_class_id']));
			} else {
			  $mt_products_price = $currencies->display_price($mt_product_info['products_price'], tep_get_tax_rate($mt_product_info['products_tax_class_id']),1,true);
			}
		
			if (tep_not_null($mt_product_info['products_model'])) {
			  $mt_products_name = $mt_product_info['products_name'] . ' [' . $mt_product_info['products_model'] . ']';
			} else {
			  $mt_products_name = $mt_product_info['products_name'];
			}
		
			$mt_products_description = substr(strip_tags(stripslashes($mt_product_info['products_description'])), 0, 100);
		
			$replace_array["Item_Name"]=$mt_products_name;
			$replace_array["Item_Price"]=$mt_products_price;
			$replace_array["Item_Description"]=$mt_products_description;
			break;
		  case CONTENT_SESSION_DETAILS:
			$mt_event_info_query = tep_db_query("select e.events_id, ed.events_name, ed.events_description, e.events_fees, e.events_tax_class_id from " . TABLE_EVENTS . " e, " . TABLE_EVENTS_DESCRIPTION . " ed where e.events_id = '" . (int)$HTTP_GET_VARS['events_id'] . "' " . EVENTS_CONDITION_STATUS . " and ed.events_id = e.events_id and ed.language_id = '" . (int)$languages_id . "'");
			$mt_event_info = tep_db_fetch_array($mt_event_info_query);
		
			$mt_events_price = $currencies->display_price($mt_event_info['events_fees'], tep_get_tax_rate($mt_event_info['events_tax_class_id']));
		
			$mt_events_name = $mt_event_info['events_name'];
			
			$mt_events_description = substr(strip_tags(stripslashes($mt_event_info['events_description'])), 0, 100);
			
			$replace_array["Item_Name"]=$mt_events_name;
			$replace_array["Item_Price"]=$mt_events_price;
			$replace_array["Item_Description"]=$mt_events_description;
			break;
	  	case CONTENT_PRODUCT_REVIEWS:
			$mt_review_query = tep_db_query("select p.products_id, pd.products_name,pd.products_description,p.products_model, p.products_price, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
			$mt_review = tep_db_fetch_array($mt_review_query);
		
			if ($mt_new_price = tep_get_products_special_price($mt_review['products_id'])) {
			  $mt_products_price = $currencies->display_price($mt_review['products_price'], tep_get_tax_rate($mt_review['products_tax_class_id']),1,true) . $currencies->display_price($mt_new_price, tep_get_tax_rate($mt_review['products_tax_class_id']));
			} else {
			  $mt_products_price = $currencies->display_price($mt_review['products_price'], tep_get_tax_rate($mt_review['products_tax_class_id']),1,true);
			}
		
			if (tep_not_null($mt_review['products_model'])) {
			  $mt_products_name = $mt_review['products_name'] . ' [' . $mt_review['products_model'] . ']';
			} else {
			  $mt_products_name = $mt_review['products_name'];
			}
	
			$replace_array["Item_Name"]=$mt_products_name;
			$replace_array["Item_Price"]=$mt_products_price;
			$replace_array["Item_Description"]=substr(strip_tags(stripslashes($mt_review['products_description'])), 0, 100);
			
			break;
		case CONTENT_PRODUCT_REVIEWS_INFO:
			$mt_review_query = tep_db_query("select rd.reviews_text, r.reviews_rating, r.reviews_id, r.customers_name, p.products_id, p.products_price, p.products_tax_class_id, p.products_model, pd.products_name,pd.products_description from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where r.reviews_id = '" . (int)$HTTP_GET_VARS['reviews_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and r.products_id = p.products_id and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '". (int)$languages_id . "'");
			$mt_review = tep_db_fetch_array($mt_review_query);
			
			if ($mt_new_price = tep_get_products_special_price($mt_review['products_id'])) {
			  $mt_products_price = $currencies->display_price($mt_review['products_price'], tep_get_tax_rate($mt_review['products_tax_class_id']),1,true) . $currencies->display_price($mt_new_price, tep_get_tax_rate($mt_review['products_tax_class_id']));
			} else {
			  $mt_products_price = $currencies->display_price($mt_review['products_price'], tep_get_tax_rate($mt_review['products_tax_class_id']),1,true);
			}
			
			if (tep_not_null($mt_review['products_model'])) {
			  $mt_products_name = $mt_review['products_name'] . ' [' . $mt_review['products_model'] . ']';
			} else {
			  $mt_products_name = $mt_review['products_name'];
			}
			
			$mt_review_text = substr(strip_tags(stripslashes($mt_review['reviews_text'])), 0, 60);
			$mt_reviews_rating = SUB_TITLE_RATING . ' ' . sprintf(TEXT_OF_5_STARS, $mt_review['reviews_rating']);
			
			$replace_array["Item_Name"]=$mt_products_name;
			$replace_array["Item_Price"]=$mt_products_price;
			$replace_array["Customer_Name"]=$mt_review['customers_name'];
			$replace_array["Reviews_Text"]=$mt_review_text;
			$replace_array["Reviews_Ratings"]=$mt_reviews_rating;
			$replace_array["Item_Description"]=substr(strip_tags(stripslashes($mt_review['products_description'])), 0, 100);
			break;
	   case CONTENT_INDEX_SUBSCRIPTIONS:
			$subscription_category_query = tep_db_query("select subscription_categories_name,subscription_categories_description from " . TABLE_SUBSCRIPTION_CATEGORIES_DESCRIPTION . " where subscription_categories_id = '" . (int)$current_subscription_category_id . "' and language_id = '" . (int)$languages_id . "'");
			$subscription_category = tep_db_fetch_array($subscription_category_query);
			
			$replace_array["Category_Name"]=$subscription_category['subscription_categories_name'];
			$replace_array["Category_Description"]=$subscription_category['subscription_categories_description'];
			break;
	   case CONTENT_SUBSCRIPTION_INFO:
	   case CONTENT_SUBSCRIPTION_TRIAL_CONFIRM:
			 $subscription_info_query = tep_db_query("select s.subscription_id, sd.subscription_name, sd.subscription_description, s.subscription_costs, s.subscription_tax_class_id from " . TABLE_SUBSCRIPTIONS . " s, " . TABLE_SUBSCRIPTIONS_DESCRIPTION . " sd where s.subscription_status = '1' and s.subscription_id = '" . (int)$HTTP_GET_VARS['subscription_id'] . "' and sd.subscription_id = s.subscription_id and sd.language_id = '" . (int)$languages_id . "'");
			 $subscription_info = tep_db_fetch_array($subscription_info_query);
			 
			 $replace_array["Item_Name"] = $subscription_info['subscription_name'];
			 $replace_array["Item_Price"]=$currencies->display_price($subscription_info['subscription_costs'], tep_get_tax_rate($subscription_info['subscription_tax_class_id']),1,true);
			 $replace_array["Item_Description"] = substr(strip_tags(stripslashes($subscription_info['subscription_description'])), 0, 100);
			 break;
			 
	  }
		$title=replace_details($replace_array,$content_result["title"]);
		$description=replace_details($replace_array,$content_result["description"]);
		$keywords=replace_details($replace_array,$content_result["title"]);
		$title=preg_replace("/(%%([^%%]+)%%)/","",$title);
		$description=preg_replace("/(%%([^%%]+)%%)/","",$description);
		$keywords=preg_replace("/(%%([^%%]+)%%)/","",$keywords);
		
		define('META_TAG_TITLE', $title);
		define('META_TAG_DESCRIPTION', $description);
		define('META_TAG_KEYWORDS', $keywords);
		return;
  }
  
  function replace_details($replace_array,$content){
  	if (count($replace_array)<=0) return;
	reset($replace_array);
	while(list($key,$value)=each($replace_array)){
		$content=eregi_replace("%%" . $key . "%%",$value,$content);
	}
	return $content;
  }
  
   define('WEB_SITE_KEYWORDS', $mt_keywords_string . $mt_extra_keywords);
  
  switch ($content) {
  case CONTENT_ADVANCED_SEARCH:

    define('META_TAG_TITLE', NAVBAR_TITLE_1 . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . NAVBAR_TITLE_1 . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . NAVBAR_TITLE_1);
	break;
  case CONTENT_ADVANCED_SEARCH_RESULT:
    define('META_TAG_TITLE', NAVBAR_TITLE_2 . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . NAVBAR_TITLE_2 . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . NAVBAR_TITLE_2);
	break;
//START UPDATE
  case CONTENT_AFFILIATE_DETAILS:
    define('META_TAG_TITLE', NAVBAR_TITLE_1 . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . NAVBAR_TITLE_1 . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . NAVBAR_TITLE_1);
	break;
  case CONTENT_ACCOUNT_EDIT:
    define('META_TAG_TITLE', HEADING_TITLE . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . NAVBAR_TITLE_1 . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . NAVBAR_TITLE_1);
	break;
  case CONTENT_ACCOUNT_HISTORY:
    define('META_TAG_TITLE', HEADING_TITLE . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . NAVBAR_TITLE_1 . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . NAVBAR_TITLE_1);
	break;
  case CONTENT_ACCOUNT_HISTORY_INFO:
    define('META_TAG_TITLE', HEADING_TITLE . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . NAVBAR_TITLE_1 . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . NAVBAR_TITLE_1);
	break;
  case CONTENT_ACCOUNT_NEWSLETTERS:
    define('META_TAG_TITLE', HEADING_TITLE . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . NAVBAR_TITLE_1 . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . NAVBAR_TITLE_1);
	break;
  case CONTENT_ACCOUNT_NOTIFICATIONS:
    define('META_TAG_TITLE', HEADING_TITLE . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . NAVBAR_TITLE_1 . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . NAVBAR_TITLE_1);
	break;
  case CONTENT_ACCOUNT_PASSWORD:
    define('META_TAG_TITLE', HEADING_TITLE . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . NAVBAR_TITLE_1 . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . NAVBAR_TITLE_1);
	break;
  case CONTENT_ADDRESS_BOOK:
    define('META_TAG_TITLE', HEADING_TITLE . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . NAVBAR_TITLE_1 . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . NAVBAR_TITLE_1);
	break;
  case CONTENT_ADDRESS_BOOK_PROCESS:
    define('META_TAG_TITLE', HEADING_TITLE . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . NAVBAR_TITLE_1 . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . NAVBAR_TITLE_1);
	break;
  case CONTENT_ADDRESS_BOOK_PROCESS:
    define('META_TAG_TITLE', HEADING_TITLE . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . NAVBAR_TITLE_1 . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . NAVBAR_TITLE_1);
	break;

// END UPDATE	
  case CONTENT_CHECKOUT_CONFIRMATION:
    define('META_TAG_TITLE', HEADING_TITLE . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . HEADING_TITLE . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . HEADING_TITLE);
	break;
  case CONTENT_CHECKOUT_PAYMENT:
    define('META_TAG_TITLE', HEADING_TITLE . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . HEADING_TITLE . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . HEADING_TITLE);
	break;
  case CONTENT_CHECKOUT_PAYMENT_ADDRESS:
    define('META_TAG_TITLE', HEADING_TITLE . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . HEADING_TITLE . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . HEADING_TITLE);
	break;
  case CONTENT_CHECKOUT_SHIPPING:
    define('META_TAG_TITLE', HEADING_TITLE . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . HEADING_TITLE . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . HEADING_TITLE);
	break;
  case CONTENT_CHECKOUT_SUCCESS:
    define('META_TAG_TITLE', HEADING_TITLE . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . HEADING_TITLE . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . HEADING_TITLE);
	break;
  case CONTENT_CREATE_ACCOUNT_SUCCESS:
    define('META_TAG_TITLE', HEADING_TITLE . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . HEADING_TITLE . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . HEADING_TITLE);
	break;
  case CONTENT_INDEX_DEFAULT:
    define('META_TAG_TITLE', HEADING_TITLE . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . HEADING_TITLE . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . HEADING_TITLE);
    break;
  case CONTENT_PASSWORD_FORGOTTEN:
    define('META_TAG_TITLE', HEADING_TITLE . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
    define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . HEADING_TITLE . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
    define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . HEADING_TITLE);
    break;
  case CONTENT_INDEX_NESTED:
    $mt_category_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$current_category_id . "' and language_id = '" . (int)$languages_id . "'");
    $mt_category = tep_db_fetch_array($mt_category_query);
    
    define('META_TAG_TITLE', $mt_category['categories_name'] . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . $mt_category['categories_name']) . SECONDARY_SECTION . WEB_SITE_KEYWORDS;
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . $mt_category['categories_name']);
    break;
  case FILENAME_FAQDESK_INDEX:
    define('META_TAG_TITLE', HEADING_TITLE . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . HEADING_TITLE . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . HEADING_TITLE);
    break;
  case CONTENT_INDEX_PRODUCTS:
  case CONTENT_INDEX_PRODUCTS_ALL:
    if (isset($HTTP_GET_VARS['manufacturers_id'])) {
	  $mt_manufacturer_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
      $mt_manufacturer = tep_db_fetch_array($mt_manufacturer_query);
	  
	  define('META_TAG_TITLE', $mt_manufacturer['manufacturers_name'] . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	  define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . $mt_manufacturer['manufacturers_name']) . SECONDARY_SECTION . WEB_SITE_KEYWORDS;
	  define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . $mt_manufacturer['manufacturers_name']);
	} else {
      $mt_category_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$current_category_id . "' and language_id = '" . (int)$languages_id . "'");
      $mt_category = tep_db_fetch_array($mt_category_query);
	  
	  define('META_TAG_TITLE', $mt_category['categories_name'] . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	  define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . $mt_category['categories_name']) . SECONDARY_SECTION . WEB_SITE_KEYWORDS;
	  define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . $mt_category['categories_name']);
    }
    break;
  case CONTENT_INDEX_EVENTS:
  case CONTENT_EVENTS_DAY_VIEW:
  case CONTENT_EVENTS_MONTH_VIEW:
  case CONTENT_EVENTS_WEEK_VIEW:
      $mt_category_query = tep_db_query("select events_categories_name from " . TABLE_EVENTS_CATEGORIES_DESCRIPTION . " where events_categories_id = '" . (int)$current_events_category_id . "' and language_id = '" . (int)$languages_id . "'");
      $mt_category = tep_db_fetch_array($mt_category_query);
	  
	  define('META_TAG_TITLE', $mt_category['events_categories_name'] . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	  define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . $mt_category['events_categories_name']) . SECONDARY_SECTION . WEB_SITE_KEYWORDS;
	  define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . $mt_category['events_categories_name']);

    break;
  case CONTENT_POPUP_IMAGE:
    define('META_TAG_TITLE', $products['products_name'] . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . $products['products_name'] . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . $products['products_name']);
    break;
  case CONTENT_POPUP_SEARCH_HELP:
    define('META_TAG_TITLE', HEADING_SEARCH_HELP . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . HEADING_SEARCH_HELP . SECONDARY_SECTION . WEB_SITE_KEYWORDS);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . HEADING_SEARCH_HELP);
    break;
  case CONTENT_PRODUCT_INFO:
    $mt_product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_price, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
    $mt_product_info = tep_db_fetch_array($mt_product_info_query);

    if ($mt_new_price = tep_get_products_special_price($mt_product_info['products_id'])) {
      $mt_products_price = $currencies->display_price($mt_product_info['products_price'], tep_get_tax_rate($mt_product_info['products_tax_class_id']),1,true) . $currencies->display_price($mt_new_price, tep_get_tax_rate($mt_product_info['products_tax_class_id']));
    } else {
      $mt_products_price = $currencies->display_price($mt_product_info['products_price'], tep_get_tax_rate($mt_product_info['products_tax_class_id']),1,true);
    }

    if (tep_not_null($mt_product_info['products_model'])) {
      $mt_products_name = $mt_product_info['products_name'] . ' [' . $mt_product_info['products_model'] . ']';
    } else {
      $mt_products_name = $mt_product_info['products_name'];
    }

	$mt_products_description = substr(strip_tags(stripslashes($mt_product_info['products_description'])), 0, 100);

    define('META_TAG_TITLE', $mt_products_name . SECONDARY_SECTION . $mt_products_price . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . $mt_products_name . SECONDARY_SECTION . $mt_products_description . '...');
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . $mt_products_name);
    break;
  case CONTENT_SESSION_DETAILS:
    $mt_event_info_query = tep_db_query("select e.events_id, ed.events_name, ed.events_description, e.events_fees, e.events_tax_class_id from " . TABLE_EVENTS . " e, " . TABLE_EVENTS_DESCRIPTION . " ed where e.events_id = '" . (int)$HTTP_GET_VARS['events_id'] . "' " . EVENTS_CONDITION_STATUS . " and ed.events_id = e.events_id and ed.language_id = '" . (int)$languages_id . "'");
    $mt_event_info = tep_db_fetch_array($mt_event_info_query);

    $mt_events_fees = $currencies->display_price($mt_event_info['events_fees'], tep_get_tax_rate($mt_event_info['events_tax_class_id']));

	$mt_events_name = $mt_event_info['events_name'];
    

	$mt_events_description = substr(strip_tags(stripslashes($mt_event_info['events_description'])), 0, 100);

    define('META_TAG_TITLE', $mt_events_name . SECONDARY_SECTION . $mt_events_fees . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . $mt_events_name . SECONDARY_SECTION . $mt_events_description . '...');
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . $mt_events_name);
    break;
  case CONTENT_PRODUCT_REVIEWS:
    $mt_review_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_price, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
    $mt_review = tep_db_fetch_array($mt_review_query);

    if ($mt_new_price = tep_get_products_special_price($mt_review['products_id'])) {
      $mt_products_price = $currencies->display_price($mt_review['products_price'], tep_get_tax_rate($mt_review['products_tax_class_id']),1,true) . $currencies->display_price($mt_new_price, tep_get_tax_rate($mt_review['products_tax_class_id']));
    } else {
      $mt_products_price = $currencies->display_price($mt_review['products_price'], tep_get_tax_rate($mt_review['products_tax_class_id']),1,true);
    }

    if (tep_not_null($mt_review['products_model'])) {
      $mt_products_name = $mt_review['products_name'] . ' [' . $mt_review['products_model'] . ']';
    } else {
      $mt_products_name = $mt_review['products_name'];
    }

    define('META_TAG_TITLE', $mt_products_name . SECONDARY_SECTION . $mt_products_price . PRIMARY_SECTION . TITLE_NEW . TERTIARY_SECTION . NAVBAR_TITLE);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . NAVBAR_TITLE . SECONDARY_SECTION . $mt_products_name . SECONDARY_SECTION . $mt_products_price);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . $mt_products_name);
    break;
  case CONTENT_PRODUCT_REVIEWS_INFO:
    $mt_review_query = tep_db_query("select rd.reviews_text, r.reviews_rating, r.reviews_id, r.customers_name, p.products_id, p.products_price, p.products_tax_class_id, p.products_model, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where r.reviews_id = '" . (int)$HTTP_GET_VARS['reviews_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and r.products_id = p.products_id and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '". (int)$languages_id . "'");
    $mt_review = tep_db_fetch_array($mt_review_query);

    if ($mt_new_price = tep_get_products_special_price($mt_review['products_id'])) {
      $mt_products_price = $currencies->display_price($mt_review['products_price'], tep_get_tax_rate($mt_review['products_tax_class_id']),1,true) . $currencies->display_price($mt_new_price, tep_get_tax_rate($mt_review['products_tax_class_id']));
    } else {
      $mt_products_price = $currencies->display_price($mt_review['products_price'], tep_get_tax_rate($mt_review['products_tax_class_id']),1,true);
    }

    if (tep_not_null($mt_review['products_model'])) {
      $mt_products_name = $mt_review['products_name'] . ' [' . $mt_review['products_model'] . ']';
    } else {
      $mt_products_name = $mt_review['products_name'];
    }

	$mt_review_text = substr(strip_tags(stripslashes($mt_review['reviews_text'])), 0, 60);
    $mt_reviews_rating = SUB_TITLE_RATING . ' ' . sprintf(TEXT_OF_5_STARS, $mt_review['reviews_rating']);

    define('META_TAG_TITLE', $mt_products_name . SECONDARY_SECTION . $mt_products_price . PRIMARY_SECTION . TITLE_NEW . TERTIARY_SECTION . NAVBAR_TITLE);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . NAVBAR_TITLE . SECONDARY_SECTION . $mt_products_name . SECONDARY_SECTION . $mt_review['customers_name'] . SECONDARY_SECTION . $mt_review_text . '...' . SECONDARY_SECTION . $mt_reviews_rating);
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . $mt_products_name . ' ' . $mt_products_price . ' ' . $mt_review['customers_name'] . ' ' . $mt_reviews_rating);
    break;
   case CONTENT_INDEX_SUBSCRIPTIONS:
     $subscription_category_query = tep_db_query("select subscription_categories_name from " . TABLE_SUBSCRIPTION_CATEGORIES_DESCRIPTION . " where subscription_categories_id = '" . (int)$current_subscription_category_id . "' and language_id = '" . (int)$languages_id . "'");
	 $subscription_category = tep_db_fetch_array($subscription_category_query);
     define('META_TAG_TITLE', $subscription_category['subscription_categories_name'] . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	  define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . $subscription_category['subscription_categories_name']) . SECONDARY_SECTION . WEB_SITE_KEYWORDS;
	  define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . $subscription_category['subscription_categories_name']);
   break;
   case CONTENT_SUBSCRIPTION_INFO:
     $subscription_info_query = tep_db_query("select s.subscription_id, sd.subscription_name, sd.subscription_description, s.subscription_costs, s.subscription_tax_class_id from " . TABLE_SUBSCRIPTIONS . " s, " . TABLE_SUBSCRIPTIONS_DESCRIPTION . " sd where s.subscription_status = '1' and s.subscription_id = '" . (int)$HTTP_GET_VARS['subscription_id'] . "' and sd.subscription_id = s.subscription_id and sd.language_id = '" . (int)$languages_id . "'");
	 $subscription_info = tep_db_fetch_array($subscription_info_query);
	 
	 $subscription_name = $subscription_info['subscription_name'];
	 $subscription_price = $currencies->display_price($subscription_info['subscription_costs'], tep_get_tax_rate($subscription_info['subscription_tax_class_id']),1,true);
	 $subscription_description = substr(strip_tags(stripslashes($subscription_info['subscription_description'])), 0, 100);

    define('META_TAG_TITLE', $subscription_name . SECONDARY_SECTION . $subscription_price . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . $subscription_name . SECONDARY_SECTION . $subscription_description . '...');
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . $subscription_name);
   break;
   case CONTENT_SUBSCRIPTION_TRIAL_CONFIRM:
     $subscription_info_query = tep_db_query("select s.subscription_id, sd.subscription_name, sd.subscription_description, s.subscription_costs, s.subscription_tax_class_id from " . TABLE_SUBSCRIPTIONS . " s, " . TABLE_SUBSCRIPTIONS_DESCRIPTION . " sd where s.subscription_status = '1' and s.subscription_id = '" . (int)$HTTP_GET_VARS['subscription_id'] . "' and sd.subscription_id = s.subscription_id and sd.language_id = '" . (int)$languages_id . "'");
	 $subscription_info = tep_db_fetch_array($subscription_info_query);
	 
	 $subscription_name = $subscription_info['subscription_name'];
	 $subscription_description = substr(strip_tags(stripslashes($subscription_info['subscription_description'])), 0, 100);

    define('META_TAG_TITLE', $subscription_name . SECONDARY_SECTION . 'Free Trail Confirm' . PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . $subscription_name . SECONDARY_SECTION . $subscription_description . '...');
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . $subscription_name);
   break;
   case CONTENT_WALLET_UPLOADS:
   case CONTENT_WALLET_CHECKOUT_PAYMENT:
   case CONTENT_WALLET_CHECKOUT_CONFIRMATION: 
   case CONTENT_WALLET_CHECKOUT_PROCESS:
   case CONTENT_WALLET_CHECKOUT_SUCCESS:
    define('META_TAG_TITLE', 'My Wallet' . SECONDARY_SECTION .  PRIMARY_SECTION . TITLE_NEW . $web_site_tagline);
	define('META_TAG_DESCRIPTION', TITLE_NEW . PRIMARY_SECTION . 'My Wallet' . SECONDARY_SECTION . 'My Wallet' . '...');
	define('META_TAG_KEYWORDS', WEB_SITE_KEYWORDS . 'My Wallet');
   break;
  default:
     define('NAVBAR_TITLE','Shop');
	 $title=NAVBAR_TITLE .  PRIMARY_SECTION . TITLE_NEW . $web_site_tagline;
	 $description=TITLE_NEW . PRIMARY_SECTION . NAVBAR_TITLE . SECONDARY_SECTION . WEB_SITE_KEYWORDS;
	 $keyword=WEB_SITE_KEYWORDS . NAVBAR_TITLE;
     if(defined("FRONT_END_PAGE_TITLE") && FRONT_END_PAGE_TITLE!='' )  $title=FRONT_END_PAGE_TITLE;
	 if(defined("FRONT_END_PAGE_DESCRIPTION") && FRONT_END_PAGE_DESCRIPTION!='')  $description=FRONT_END_PAGE_DESCRIPTION;
	 if(defined("FRONT_END_PAGE_KEYWORD") && FRONT_END_PAGE_KEYWORD!='')  $keyword=FRONT_END_PAGE_KEYWORD;
  	 
    define('META_TAG_TITLE',$title);
	define('META_TAG_DESCRIPTION', $description);
	define('META_TAG_KEYWORDS',$keyword);
  }
?>