<?php 


// Check to ensure this file is included in Freeway!
defined('_FEXEC') or die();
require(DIR_WS_JAVASCRIPT . "general.js");
require(DIR_WS_JAVASCRIPT . "popup.js");
?> 
<?php echo tep_draw_form('advanced_search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get', 'onSubmit="return check_form(this);"') . tep_hide_session_id(); ?><table border="0" width="100%" cellspacing="0" cellpadding="<?php echo CELLPADDING_SUB; ?>">
<?php 
//get service category
	$service_array=array();
	$service_array[]=array('id' => '', 'text' => TEXT_ALL_CATEGORIES);
//get events category
	$event_array=array();
	$event_array[]=array('id' => '', 'text' => TEXT_ALL_CATEGORIES);
    $event_query = tep_db_query("select c.events_categories_id, cd.events_categories_name from " . TABLE_EVENTS_CATEGORIES . " c, " . TABLE_EVENTS_CATEGORIES_DESCRIPTION . " cd where parent_id = 0 and c.events_categories_id = cd.events_categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.events_categories_name");
    while ($events = tep_db_fetch_array($event_query)) {
      $event_array[] = array('id' => $events['events_categories_id'],
                             'text' => $events['events_categories_name']);
    }
//get subscription category
	$subscription_array=array();
	$subscription_array[]=array('id' => '', 'text' => TEXT_ALL_CATEGORIES);
    $subscription_query = tep_db_query("select c.subscription_categories_id, cd.subscription_categories_name from " . TABLE_SUBSCRIPTION_CATEGORIES . " c, " . TABLE_SUBSCRIPTION_CATEGORIES_DESCRIPTION . " cd where parent_id = 0 and c.subscription_categories_id = cd.subscription_categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.subscription_categories_name");
    while ($subscription = tep_db_fetch_array($subscription_query)) {
      $subscription_array[] = array('id' => $subscription['subscription_categories_id'],
                             'text' => $subscription['subscription_categories_name']);
    }
// BOF: Lango Added for template MOD
if (SHOW_HEADING_TITLE_ORIGINAL == 'yes') {
$header_text = '&nbsp;'
//EOF: Lango Added for template MOD
?>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo HEADING_TITLE_1; ?></td>
            <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_browse.gif', HEADING_TITLE_1, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
          </tr>
        </table></td>
      </tr>
<?php
}else{
$header_text = HEADING_TITLE_1;
}
	if(!isset($hide_row_top)) {
?>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php
	}
// BOF: Lango Added for template MOD
if (MAIN_TABLE_BORDER == 'yes'){
table_image_border_top(false, false, $header_text);
}
// EOF: Lango Added for template MOD
?>
<?php
  if ($messageStack->size('search') > 0) {
?>
      <tr>
        <td><?php echo $messageStack->output('search'); ?></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php
  }
?>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr height="40">
            <td width="50%" height="14" class="mediumTitle" ><?php echo "&nbsp;&nbsp;" . HEADING_SEARCH_CRITERIA; ?></td>
       	    <td width="50%" class="main" align="right" ><?php echo TEXT_SEARCH_HELP_LINK . '<span onMouseOver="javascript:popupWindow()" onMouseOut="javascript:kill();">' .tep_image(DIR_WS_IMAGES.'setting_notice.gif','','','', 'align=absmiddle').'&nbsp;&nbsp;</span>';?><?php //echo '<a href="javascript:popupWindow(\'' . tep_href_link(FILENAME_POPUP_SEARCH_HELP) . '\')">' . TEXT_SEARCH_HELP_LINK . '</a>'. '<span onMouseOver="javascript:popupWindow()" onMouseOut="javascript:kill();">' .tep_image(DIR_WS_IMAGES.'setting_notice.gif','','','', 'align=absmiddle').'&nbsp;&nbsp;</span>'; ?></td>
          </tr>
        </table>
        <table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox">
          <tr>
            <td><table border="0" width="100%" cellspacing="0" cellpadding="3" class="infoBoxContents">
              <tr>
                <td colspan="2"><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="1"></td>
              </tr>
              <tr>
                <td class="boxText" width="50%"><?php echo tep_draw_input_field('keywords', '', 'style="width: 100%"'); ?></td>
                <td class="smallText"><?php echo tep_draw_checkbox_field('search_in_description', '1') . ' ' . TEXT_SEARCH_IN_DESCRIPTION; ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '30'); ?></td>
      </tr>
      <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
          <tr class="infoBoxContents">
            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
			<?php if(HIDE_FROM_BACKEND_MENU_SERVICES=='false') { ?>
              <tr>
                <td class="fieldKey"><?php echo tep_draw_checkbox_field('inc_service', '1', true,'onClick=javascript:do_change(\'S\',this.checked)') . TEXT_SERVICES; ?></td>
                <td class="fieldValue"><?php echo tep_draw_pull_down_menu('service_category_id', $service_array); ?></td>
                <td class="smallText"><?php echo tep_draw_checkbox_field('inc_subcat_service', '1', true,' id="inc_subcat_service"') . ' ' . ENTRY_INCLUDE_SUBCATEGORIES; ?></td>
              </tr>
              <tr>
                <td colspan="3"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td>
              </tr>
			 <?php } 
			 if(HIDE_FROM_BACKEND_MENU_EVENTS=='false') { ?> 
			  <tr>
                <td class="fieldKey"><?php echo tep_draw_checkbox_field('inc_event', '1', true,'onClick=javascript:do_change(\'E\',this.checked)') . TEXT_EVENTS; ?></td>
                <td class="fieldValue"><?php echo tep_draw_pull_down_menu('event_category_id',  $event_array); ?></td>
                <td class="smallText"><?php echo tep_draw_checkbox_field('inc_subcat_event', '1', true,'id="inc_subcat_event"') . ' ' . ENTRY_INCLUDE_SUBCATEGORIES; ?></td>
              </tr>
              <tr>
                <td colspan="3"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td>
              </tr>
			<?php }
			if(HIDE_FROM_BACKEND_MENU_SUBSCRIPTIONS=='false') {  ?>
              <tr>
                <td class="fieldKey"><?php echo tep_draw_checkbox_field('inc_subscription', '1', true,'onClick=javascript:do_change(\'U\',this.checked)') . TEXT_SUBSCRIPTIONS; ?></td>
                <td class="fieldValue"><?php echo tep_draw_pull_down_menu('subscription_category_id', $subscription_array); ?></td>
                <td class="smallText"><?php echo tep_draw_checkbox_field('inc_subcat_subcription', '1', true,'id="inc_subcat_subcription"') . ' ' . ENTRY_INCLUDE_SUBCATEGORIES; ?></td>
              </tr>
              <tr>
                <td colspan="3"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td>
              </tr>
			 <?php } 
			 if(HIDE_FROM_BACKEND_MENU_PRODUCTS=='false') { ?> 
              <tr>
                <td class="fieldKey"><?php echo tep_draw_checkbox_field('inc_product', '1', true,'onClick=javascript:do_change(\'P\',this.checked)') . TEXT_PRODUCTS_1; ?></td>
                <td class="fieldValue"><?php echo tep_draw_pull_down_menu('product_category_id', tep_get_categories(array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES)))); ?></td>
                <td class="smallText"><?php echo tep_draw_checkbox_field('inc_subcat_product', '1', true,'id="inc_subcat_product"') . ' ' . ENTRY_INCLUDE_SUBCATEGORIES; ?></td>
              </tr>
              <tr>
                <td colspan="3"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td>
              </tr>
			  <?php } ?>
              <tr>
                <td class="fieldKey"><?php echo ENTRY_PRICE_FROM; ?></td>
                <td class="fieldValue" colspan=2><?php echo tep_draw_input_field('pfrom'); ?></td>
              </tr>
              <tr>
                <td class="fieldKey"><?php echo ENTRY_PRICE_TO; ?></td>
                <td class="fieldValue" colspan=2><?php echo tep_draw_input_field('pto'); ?></td>
              </tr>
              <tr>
                <td colspan="3"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
              </tr>
              <tr>
                <td class="fieldKey"><?php echo ENTRY_DATE_FROM; ?></td>
                <td class="fieldValue" colspan="2"><?php echo tep_draw_input_field('dfrom', DOB_FORMAT_STRING, 'onFocus="RemoveFormatString(this, \'' . DOB_FORMAT_STRING . '\')"'); ?></td>
              </tr>
              <tr>
                <td class="fieldKey"><?php echo ENTRY_DATE_TO; ?></td>
                <td class="fieldValue" colspan="2"><?php echo tep_draw_input_field('dto', DOB_FORMAT_STRING, 'onFocus="RemoveFormatString(this, \'' . DOB_FORMAT_STRING . '\')"'); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
	  <tr>
            <td class="smallText" align="right"><?php echo tep_template_image_submit('button_search.gif', IMAGE_BUTTON_SEARCH) . "&nbsp;&nbsp;"; ?></td>
	</tr>		
<?php
// BOF: Lango Added for template MOD
if (MAIN_TABLE_BORDER == 'yes'){
table_image_border_bottom();
}
// EOF: Lango Added for template MOD
?>
    </table></form>
<script language="javascript" type="text/javascript">
do_change('S',document.advanced_search.inc_service.checked);
do_change('E',document.advanced_search.inc_event.checked);
do_change('U',document.advanced_search.inc_subscription.checked);
do_change('P',document.advanced_search.inc_product.checked);
function do_change(type,obj){
	if(type=='S'){
		if(obj)
			document.getElementById('inc_subcat_service').disabled=!obj;
		else
			document.getElementById('inc_subcat_service').disabled=!obj;
	} else if(type =='E'){
		if(obj)
			document.getElementById('inc_subcat_event').disabled=!obj;
		else
			document.getElementById('inc_subcat_event').disabled=!obj;
	} else if(type=='U'){
		if(obj)
			document.getElementById('inc_subcat_subcription').disabled=!obj;
		else
			document.getElementById('inc_subcat_subcription').disabled=!obj;
	} else if(type == 'P'){
		if(obj)
			document.getElementById('inc_subcat_product').disabled=!obj;
		else
			document.getElementById('inc_subcat_product').disabled=!obj;
	}
}
</script>	

<script language="javascript">
				var baby=new Array();
				baby[1]="";
		function popupWindow(){
		content='<table border="0" cellspacing="0" cellpadding="4" class="formArea" width="100%"><tr><td class=smallText>';
				content+='<?php echo TEXT_SEARCH_HELP ; ?>';
				 content+='</td></tr></table>';
				 popwidth=250;
				 baby[1]=content;
				 if (baby[1]!="")
				 {
				 popup("1","#ffffff");
				}	
			

         }

</script>
