<?php

/**
* Implementation of hook_help
*/
function pngbehave_help($path = '', $arg = NULL) {
  $output = '';
  switch ($path) {
    case 'admin/help#pngbehave':
    case 'admin/settings/pngbehave':
      $output = '<p>'.  t("Uses CSS Class Selectors to fix PNG Alpha Transparency through Windows IE 5.5+ behaviors."). '</p>';
      break;
  }
  return $output;
} // function pngbehave_help

function pngbehave_init() {
  $pngbehaveclasses = variable_get('pngbehave_css_classes', '');
  if (!empty($pngbehaveclasses)) {
	  // Chris Paul (mrjeeves): added check for specific exclusion option
    $pngbehaveexclude = variable_get('pngbehave_css_exclude', '');
    if (!empty($pngbehaveexclude)) {
      $pngbehaveexclude .= ' { behavior: none; } ';
    }
    // global $base_path;
		// Chris Paul (mrjeeves): added backgroundimagecache option to speed up
		// rendering times.
    drupal_set_html_head('<!--[if lt IE 7]>
            <script type="text/javascript">document.execCommand("BackgroundImageCache", false, true);
              var BlankImgPath = "'. base_path() . drupal_get_path('module', 'pngbehave') .'";
 	    </script>
        <style type="text/css">' . $pngbehaveclasses . ' { behavior: url('. base_path() . drupal_get_path('module', 'pngbehave') . '/iepngfix.htc)} ' . $pngbehaveexclude . '</style>
        <script type="text/javascript" src="'. base_path() . drupal_get_path('module', 'pngbehave') . '/iepngfix_tilebg.js"></script>
    <![endif]-->');
  }
} // function pngbehave_init
  

/**
 * Implementation of hook_menu
 */ 
function pngbehave_menu() {
  $items = array();
  $items['admin/settings/pngbehave'] = array(
    'title' => 'PNG Behave',
    'description' => 'Configure PNG Behave.',
    'access arguments' => array('administer site configuration'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('pngbehave_admin'),
    'file' => 'pngbehave.admin.inc',
  );
  return $items;
} // function pngbehave_menu
