<?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

  Released under the GNU General Public License
*/
// Check to ensure this file is included in Freeway!
defined('_FEXEC') or die();
// WebMakers.com Added: Down for Maintenance
// Hide header if not to show
if (DOWN_FOR_MAINTENANCE_HEADER_OFF =='false') { ?>
<?php
	$current_table_box_count=0;
if (SITE_WIDTH!='100%') {
?>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr>
 	<td height="109">
      <table CELLSPACING="0" CELLPADDING="0" BORDER="0" width="<?php echo SITE_WIDTH;?>" align="center">
		<tr>
			<td >
<?php
}
?>				<script language="javascript">
					function image_over(element,img){
						var setSrc;
						if (element.oSrc){
							setSrc=element.oSrc;
						} else {
							setSrc="<?php echo DIR_WS_TEMPLATES . TEMPLATE_NAME . "/images/buttons/" . $language . "/";?>"+img+"_over.gif";
						}
					
						element.oSrc=element.src;
						element.src=setSrc;
					}
				</script> 
				  	<table class="mainbkg" CELLSPACING="0" CELLPADDING="0" BORDER="0" width="<?php echo SITE_WIDTH;?>" align="center">
				        <tr>
				         <td height="110" align="left"><?php //echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_TEMPLATES.DEFAULT_TEMPLATE.'/'.DIR_WS_IMAGES . COMPANY_LOGO,  STORE_NAME) . '</a>'; 
						 $url='<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_TEMPLATES.DEFAULT_TEMPLATE.'/'.DIR_WS_IMAGES . COMPANY_LOGO,  STORE_NAME,'','') . '</a>';
						echo $url;
						 ?></td>
						<td align="right" valign="top" width="250">
						<table cellspacing="0" cellpadding="0" border="0" width="100%" id="title_search">
							<tr>
								<td valign="top">
								<table cellspacing="0" cellpadding="0" border="0" class="cell_background_small" width="270">
									<tr height="20">
										<td width="10">&nbsp;</td>
										<td valign="top">
										<?php echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') ;?>
										<table width="100%" cellspacing="0" cellpadding="0" border="0">
											<tr>
												<td height="25" valign="middle" class="title_search"><?php echo $greet;?></td>
												<td headers="25" valign="middle" class="title_search" align="center"><?php echo $log_page;?></td>
											</tr>
											<tr>
												<td valign="middle" colspan="2">
												<?php
													echo tep_draw_input_field('keywords',"","size='27'") .'&nbsp;'; 
													echo tep_draw_hidden_field('inc_service', '1').tep_draw_hidden_field('inc_event', '1').tep_draw_hidden_field('inc_subscription', '1').tep_draw_hidden_field('inc_product', '1');
													echo tep_template_image_submit('button_search_small.gif',IMAGE_SEARCH,'align=absmiddle');
												?>
											</td>
											</tr>
											<tr>
												<td height="25" valign="middle" colspan="2"><?php echo tep_template_image('arrow_browse.gif','','align=absmiddle') . '&nbsp;<a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '">' .  HEADER_ADVANCED_SEARCH . '</a>';?>
												<?php
		echo "<div id='pop_common_sort_display' style='position:absolute;display:none;width:290px;height:200px;z-index:999;border:1px solid;border-color:#CCCCCC;background-color:#FFFFFF;padding:3px;'>
		<table border='0' cellspacing='0' cellpadding='0' width='100%'>
			<tr height='30'>
				<td align='middle'>Returning Customer</td>
				<td align='right' valign='top'><a href='javascript:do_expand(1);'>X</a></td>
			</tr>
			<tr height='30'>
				<td align='middle'>User Name:</td>
				<td>".tep_draw_input_field('user')."</td>
			</tr>	
			<tr height='30'>
				<td align='middle'>Password:</td>
				<td>".tep_draw_password_field('pass')."</td>
			</tr>
			<tr height='30' id='login_failed' style='display:none'>
				<td colspan='2'>".TEXT_LOGIN_ERROR."</td>
			</tr>
			<tr height='40'>
				<td colspan='2' align='middle' class='smallText'>".'<a href="' . tep_href_link(FILENAME_PASSWORD_FORGOTTEN, '', 'SSL') . '">' . TEXT_PASSWORD_FORGOTTEN . '</a>'."</td>
			</tr>
			<tr height='30'>
				<td colspan='2' align='right'><a href='javascript:do_submit();'>".tep_template_image_button('button_login.gif','Sign In','align=absmiddle')."</a>".tep_draw_separator('pixel_trans.gif',20,1)."</td>
			</tr>
		</table>
				</div>";
		?></form></td>
											</tr>
										</table>
										
										</td>
										<td width="10">&nbsp;</td>
									</tr>
								</table>
								</td>
							</tr>
							<tr>
								<td valign="top">
								<table width="100%" cellspacing="0" cellpadding="0" border="0" class="cell_background_small">
									<tr height="50">
										<td width="10">
										<td>
										<table width="100%" cellspacing="0" cellpadding="1" border="0">
											<tr>
												<td>
												<table border="0" cellpadding="1" cellspacing="0" width="100%">
													<tr>
														<td width="100" style="font-size:10pt"><?php echo HEADER_SHOPPING_CART . '</a>';?></font></td>
													</tr>
												</table>
												</td>
											</tr>
											<tr>
												<td>
												<table border="0" cellpadding="1" cellspacing="0" width="100%">
													<tr>
														<td width="100" nowrap="nowrap"><?php echo "<a href=" . tep_href_link(FILENAME_SHOPPING_CART) . ">" . HEADER_VIEW_CART . '</a>';?></td>
														<td width="100" nowrap="nowrap"><?php echo "<a href=" . tep_href_link(FILENAME_CHECKOUT_SHIPPING,'','SSL') . ">" . HEADER_CHECKOUT . '</a>';?></td>
														<td align="right" nowrap="nowrap"><?php  
														$cart_count_elements=$cart->count_contents();
													     //Hide the Store Membership subscription in the front end. ans show the item number without store membership
														if(basename($PHP_SELF)==FILENAME_SHOPPING_CART || basename($PHP_SELF)==FILENAME_CHECKOUT_PAYMENT || basename($PHP_SELF)==FILENAME_LOGIN || basename($PHP_SELF)==FILENAME_CHECKOUT_CONFIRMATION || basename($PHP_SELF)==FILENAME_DEFAULT ){
														$subs_query=tep_db_query("select sc.subscription_categories_id as cat_id,s.subscription_id as id,s.subscription_costs,s.subscription_type from " .TABLE_SUBSCRIPTIONS ." s," . TABLE_SUBSCRIPTION_TO_SUBSCRIPTION_CATEGORIES . " sc where s.subscription_id=sc.subscription_id and  s.subscription_type='M'");
		   												$row=tep_db_fetch_array($subs_query);
														$sub_id=$row['id'];
		   												$subscription_type=$row['subscription_type'];
														if($cart->in_cart('S'.$sub_id))
														{
														 $cart_count_elements=$cart_count_elements-1;
														 }else{
														 $cart_count_elements=$cart->count_contents();
														 }
														echo "<a href=" . tep_href_link(FILENAME_SHOPPING_CART) . ">" . sprintf("%s Item(s)",$cart_count_elements) . "</a>";?></td>
														<?php } else { 
														echo "<a href=" . tep_href_link(FILENAME_SHOPPING_CART) . ">" . sprintf("%s Item(s)",$cart_count_elements) . "</a>";?></td>
														<?php }?>
														<td></td>
													</tr>
												</table>
												</td>
											</tr>
										</table>
										</td>
									</tr>
								</table>
								</td>
							</tr>
			          </table>
					</td>
					</tr>
				    </table>
				    <?php
				}
				if (SITE_WIDTH!='100%') {
				?>
			 </td>
	   	 </tr>
		</table>
	   </td>
	</tr>
	<tr><td>
		<table width="100%" cellpadding="0" cellspacing="0" border="0">
		  <tr>
		  	<td>
				<table CELLSPACING="0" CELLPADDING="0" BORDER="0" width="<?php echo SITE_WIDTH;?>" align="center">
					<tr>
						<td>
<?php } ?>					<table width="100%" border="0" cellspacing="0" cellpadding="0"  id="headerNavigation">
								<tr height="25">
									<td width="4" valign="middle" class="cell_background_navig_left">&nbsp;</td>
									<td valign="middle" class="cell_background_navig">
									<table width="100%" border="0" cellspacing="0" cellpadding="0">
										<tr> 
											<td valign="middle"> 
											&nbsp;<?php echo $breadcrumb->trail(sprintf('&nbsp;&nbsp;%s&nbsp;&nbsp;',tep_template_image("icon_navig.gif",'','align=absmiddle'))); ?>
											</td>
										</tr>
									</table>
									</td>
									<td width="4" valign="middle" class="cell_background_navig_right">&nbsp;</td>
								</tr>
							</table>
					<?php if (SITE_WIDTH!='100%') { ?>
						</td>
					</tr>
					<tr>
						<td valign="top">
				<?php } ?>