<?php
function cmp($a, $b)
{
    return strlen($b) - strlen($a);
}

function sprintf2($str, $vars, $char = '%')
{
    if(is_array($vars))
    {
        uksort($vars, "cmp");

        foreach($vars as $k => $v)
        {
            $str = str_replace($char . $k, $v, $str);
        }
    }

    return $str;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
	<title>YES4CARRIER</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />

<?php include( DIR_WS_INCLUDES.'global_js_language_vars.inc.php'); ?>




<link rel="stylesheet" type="text/css" href="includes/qmstyle.css" />

<?php if(strstr(yes_get_php_self(),'notiz') and $_GET['action'] == 'calendar'){ ?>
<link rel="StyleSheet" href="templates/calendar_style.css" />
<?php } ?>

<style type="text/css">
<!--
/* The "clearFix" class is used for clearing the main menu items because they
   are left-floated for horizontal main menus and we have to clear them if our main
   menu is relatively positioned (as in this example) so that the main menu box
   takes its place correctly on the page. We have to apply this class to the parent
   DIV of the root UL of our menu tree. Please take a look at section 6.1 in the
   SmartMenus User's Manual for a detailed explanation if you like. */

.clearFix:after { /* for modern browsers */
    content:".";
    display:block;
    height:0;
    clear:both;
    visibility:hidden;
}
.clearFix { /* for IE7/Win */
    min-height:1px;
}
* html .clearFix { /* for IE5-6/Win */
    height:1px;
}
* html>body .clearFix { /* for IE5/Mac */
    height:auto;
    display:inline-block;
}
-->
</style>
<script type="text/javascript" src="includes/javascript/c_config.js"></script>
<script type="text/javascript" src="includes/javascript/c_smartmenus.js"></script>


<link rel="stylesheet" type="text/css" href="includes/stylesheet.css" />

<script type="text/javascript" src="includes/general.js"></script>
<script type="text/javascript" src="includes/prototype.js"></script>

<script type="text/javascript" src="includes/javascript/ajax-dynamic-content.js"></script>
<script type="text/javascript" src="includes/javascript/ajax.js"></script>
<script type="text/javascript" src="includes/javascript/ajax-tooltip.js">
/************************************************************************************************************
(C) www.dhtmlgoodies.com, June 2006

This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.

Terms of use:
You are free to use this script as long as the copyright message is kept intact. However, you may not
redistribute, sell or repost it without our permission.

Thank you!

www.dhtmlgoodies.com
Alf Magne Kalleland

************************************************************************************************************/
</script>


<!-- LIGHTBOX START //-->
<script type="text/javascript" src="includes/javascript/lightbox/scripts/lightbox.js"></script>
<link rel="stylesheet" type="text/css" href="includes/javascript/lightbox/css/lightbox.css" />
<!-- LIGHTBOX END //-->

<!-- TINYMCE START -->
<script type="text/javascript" src="includes/javascript/tinymce/tiny_mce.js"></script>
<!-- TINYMCE ENDE -->

<script type="text/javascript" src="includes/javascript/yes_alertbox.js"></script>
<script type="text/javascript" src="includes/javascript/yes_confirmbox.js"></script>
<script type="text/javascript" src="includes/javascript/scw.js"></script>
<script type="text/javascript" src="includes/javascript/notiz.js"></script>

<script type="text/javascript" language="javascript">
<!--
var POSTRequestTargetScript = '<?php echo xtc_href_link(FILENAME_NOTIZ,'action=quicknoteadd'); ?>';
var POSTRequestForm = 'quicknoteform';
var POSTRequestAfterFunction = true;
function makePOSTRequestAfterFunction(res){
	res_error = res.match(/error/);
	if(!res_error){
		toggleBox('addquicknote');
	}
	toggleBox('myspan');
}

function quickfind(target){
	params = "mode="+target;
	var myAjax = new Ajax.Request(
		'ajax_quickfind.php',
	    {
			method: 'get',
			parameters: params,
			onComplete: show_quickfind
	    }
	);
}
function show_quickfind(originalRequest){
	$('quickfind_input').innerHTML = originalRequest.responseText;
	$('quickfind_input').toggle();
	dom = document.forms['quickfindform'];
	dom.elements['search'].focus();
}

//-->
</script>

</head>

<?php
if($page_body_params){
	echo $page_body_params;
}else{
	echo '<body>';
}
?>


<noscript>
	<span style="font-size:13px;font-family:arial;"><span style="color:#dd3300">Warning!</span>&nbsp&nbsp; QuickMenu may have been blocked by IE-SP2's active content option. This browser feature blocks JavaScript from running locally on your computer.<br><br>This warning will not display once the menu is on-line.  To enable the menu locally, click the yellow bar above, and select <span style="color:#0033dd;">"Allow Blocked Content"</span>.<br><br>To permanently enable active content locally...<div style="padding:0px 0px 30px 10px;color:#0033dd;"><br>1: Select 'Tools' --> 'Internet Options' from the IE menu.<br>2: Click the 'Advanced' tab.<br>3: Check the 2nd option under 'Security' in the tree (Allow active content to run in files on my computer.)</div></span>
</noscript>

<?php
  if ($messageStack->size > 0) {
    echo $messageStack->output();
  }
?>

<table border="0" cellpadding="0" cellspacing="0" class="logotable">
<tr>
	<td><img src="images/logo.gif" alt="YES4Carrier" /></td>
	<td align="right">
		<div id="header_info">
			<?php echo substr($_SESSION['customer_first_name'] . ' ' . $_SESSION['customer_last_name'],0,40); ?>
			&nbsp;&nbsp;
			<a class="header_info" href="<?php echo xtc_href_link(DIR_WS_CATALOG.'account.php'); ?>">[<?php echo ACCOUNT; ?>]</a>
			&nbsp;&nbsp;
			<a class="header_info" href="<?php echo xtc_href_link(DIR_WS_CATALOG.'logoff.php'); ?>">[<?php echo LOGOFF; ?>]</a>
			<table border="0" cellpadding="2" cellspacing="0">
			<tr>
				<td><?php echo yes_draw_href_image('images/notiz_add.gif',NEW_NOTE,xtc_href_link(FILENAME_NOTIZ,xtc_get_all_get_params(array('action')).'action=change'),'notiz','lbOn'); ?></td>
				<td valign="middle"><?php
	if( !strstr(yes_get_php_self(),FILENAME_NOTIZ)) {
		$unread = 0;
		$query_raw = sprintf("select count(n.id) as anzahl from Notice_notes n LEFT JOIN Notice_status s ON (n.id=s.notes_id) where n.usr !='%s' and s.usr='%s' and s.read_status=0",$_SESSION['customer_id'],$_SESSION['customer_id']);
		$com = xtc_db_query($query_raw);
		$row = xtc_db_fetch_array($com);
		if( $row['anzahl'] > 0){
			$unread = $row['anzahl'];
		}
		$reminder = 0; 
		$com= xtc_db_query(sprintf("select count(n.id) as anzahl from Notice_notes n LEFT JOIN Notice_status s ON (n.id=s.notes_id) where s.date_termin<now() and s.date_termin>0 and s.usr='%s'",$_SESSION['customer_id']));
		$row = xtc_db_fetch_array($com);
		if( $row['anzahl'] > 0){
			$reminder = $row['anzahl'];
		}
		if( $unread>0 or $reminder>0 ){
			$unread = ($unread > 0) ? '<b>'.$unread.'</b>' : $unread;
			$reminder = ($reminder > 0) ? '<b>'.$reminder.'</b>' : $reminder;
			echo '<a class="header_info" href="'.xtc_href_link(FILENAME_NOTIZ).'">'.sprintf(HEADER_MESSAGE_NOTICE,$unread,$reminder).'</a>';
		}
	}
				?></td>
			</tr>
			</table>
		</div>
	</td>
</tr>
</table>

<div id="contentdiv">
<?php include('includes/menu.php'); ?>
	<div id="heading_title"><?php
	$heading_title_constant = 'HEADING_TITLE';
	if(xtc_not_null($heading_variable)){
		$heading_title_constant = $heading_variable;
	}
	if(is_array($heading_title_param)){
		echo sprintf2(constant($heading_title_constant),$heading_title_param);
	}else{
		echo sprintf(HEADING_TITLE,$heading_title_param);
	}
?></div>
<div id="quickfind_list">
	<div id="quickfind_item"><?php echo yes_draw_href_button(ENTRY_SHIP,'javascript:quickfind(\'ship\');','ships','','button','quickfind_button'); ?></div>
	<div id="quickfind_item"><?php echo yes_draw_href_button(ENTRY_EXPORT,'javascript:quickfind(\'export\');','exports','','button','quickfind_button'); ?></div>
	<div id="quickfind_item"><?php echo yes_draw_href_button(ENTRY_IMPORT,'javascript:quickfind(\'import\');','imports','','button','quickfind_button'); ?></div>
</div>
<div id="quickfind_input"></div>
<script type="text/javascript" language="javascript">
<!--
$('quickfind_input').hide();
//-->
</script>