<?php
/*=======================================================================
 *
 * get_couriers.php
 *
 * Autor: Carsten Annacker
 *
 =======================================================================*/

//require_once("HTML/IT.php");
include_once("../include/caglobal.inc.php");
include_once("../include/global.inc.php");

list ($zipcode, $jb_id, $hq_id_string) = getHttpVars(array("zipcode", "jb_id", "hq_id_string"));

//$cr_id_order_list = "var cr_id_order_list = new Array();\n";
//$cr_id_order_list2 = "var cr_id_order_list2 = new Array();\n";
include_once("../jobs/job_courier.inc.php");
$cr_id_order_list = str_replace("var cr_id_order_list", "opener.cr_id_order_list", $cr_id_order_list);
$cr_id_order_list2 = str_replace("var cr_id_order_list2", "opener.cr_id_order_list2", $cr_id_order_list2);
$vht_id_str_js = str_replace("vht_id_str", "opener.vht_id_str", $vht_id_str_js);
$vht_id_str_js = str_replace("var opener.vht_id_str", "opener.vht_id_str", $vht_id_str_js);

$js_args = "";
if (isset($jb_id) && $jb_id != "")
  $js_args = $jb_id . ", '" . $zipcode . "'" . ", '" . $hq_id_string . "'";
$javascript =
  "opener.MASK_COURIER_SORT_BY_OCCUPIED =\"" . MASK_COURIER_SORT_BY_OCCUPIED . "\";\n" .
  $cr_id_order_list .
  $cr_id_order_list2 .
  $vht_id_str_js .
  "//opener.isCurrentlySubmitting = false;\n" .
  "opener.mk_cr_id_list(" . $js_args . ");\n" .
  "self.close();\n";

//echo $javascript;
// Inhalt des temporären Fensters erzeugen und ausgeben
//$tpl = new IntegratedTemplate();
//$tpl->loadTemplatefile(GETDATAHTMLTPL, true, true);
//$tpl->setCurrentBlock("javascript");
//$tpl->setVariable("_javascript_", $javascript);
//$tpl->parseCurrentBlock("javascript");
//$tpl->show();
$output = file_get_contents(GETDATAHTMLTPL);
$output = str_replace("{_javascript_}", $javascript, $output);
echo $output;

?>
