<?php
  function Font($Font, $Size, $Text, $Color)
  {
    if ($Color != "")
    {
      $Color = " COLOR=\"".$Color."\"";
    }
    return "<FONT FACE=\"$Font\" SIZE=\"$Size\"$Color>$Text</FONT>";
  }
  
  function nbsp($Text)
  {
    return "&nbsp;$Text&nbsp;";
  }
  
  function Line($Text)
  {
    return "<SPAN STYLE=\"text-decoration: line-through\">".$Text."</SPAN>";
  }

  function Table($HTML)
  {
    return "<TABLE>$HTML</TABLE>";
  }
  
  function TableW($HTML, $Width)
  {
    return "<TABLE WIDTH=\"$Width\">$HTML</TABLE>";
  }
  
  function href($HTML, $URL)
  {
    return "<A HREF=\"$URL\">$HTML</A>";
  }

  function hreft($HTML, $URL, $Target)
  {
    return "<A HREF=\"$URL\" TARGET=\"$Target\">$HTML</A>";
  }
  
  function Img($Text)
  {
    if ($Text != "")
    {
      return "<IMG SRC=\"$Text\" BORDER=\"0\">";     
    }
    else
    {
      return "";
    }
  }
  
  function TRTDW($Text, $Width)
  {
    return TR(TDW(Center($Text),$Width));
  }
  
  function TRTDC($Text)
  {
    return TR(TD(Center($Text)));
  }
  
  function Center($Text)
  {
    return "<CENTER>$Text</CENTER>";
  }
  
  function TRTD($Text)
  {
    return TR(TD($Text));
  }
  
  function TR($Text)
  {
    return "<TR>$Text</TR>";
  }

  function TDC($Text)
  {
    return TD(Center($Text));
  }
  
  function TD($Text)
  {
    return "<TD VALIGN=\"top\">$Text</TD>";
  }  

  function TDWC($Text, $Width)
  {
    return TDW(Center($Text), $Width);
  } 
  
  function TDW($Text, $Width)
  {
    return "<TD  VALIGN=\"top\" WIDTH=\"$Width\">$Text</TD>";
  } 
  
  //Returns the string "selected" if $Type1 and $Type2 are the same (Not case sensitive).
  function Selected($Type1, $Type2)
  {
    $Result = "";  
    if (strtoupper($Type1) == strtoupper($Type2))
    {
      $Result = "selected";
    }
    return $Result;
  }
  
  function PopUp($Page,$Name,$W,$H,$Caption)
  {
    $Result = "<a HREF=\"javascript:void window.open('$Page','$Name','top=0, left=0, toolbar=0,location=1,directories=0,status=1,menubar=0,resizable=1,scrollbars=1,width=$W,height=$H')\">$Caption</a>";
    return $Result;
  }  

  //GetParam checks against POST, GET and then Cookies.  If they don't exist
  // then $Default is used.
  function GetParam($Param, $Default)
  {
    $Result = "";  

    //Get the parameter if has been past in via POST
    if(isset($_POST[$Param]))
    {
      $Result = rawurldecode($_POST[$Param]);
    }
    else
    {
      //Get the parameter if has been past in via GET
      if(isset($_GET[$Param]))
      {
        $Result = rawurldecode($_GET[$Param]);
      }
      else
      {
        //Get the paramenter if a cookie exists for it.
        if (isset($_COOKIE[strtoupper($Param)]))
        {
          $Result = rawurldecode($_COOKIE[strtoupper($Param)]);
        }
        else
        {
          //The parameter hasn't been set.
          $Result = $Default;
        }
      }
    }
    return $Result;
  }
?>