<?php 
session_start(); 
include ("config_code.php");
$title = 'CommunicatorBase Supply Chain Management System for overstockArt.com';
//'overstockArt.com Communicator -- Supply Chain Management System';
if (isset($_SESSION['s_username'])) {
ini_set('session.gc_maxlifetime', 3600);
/*echo "<center><b><font color=\"#293b74\" style=\"text-align:left\">Welcome to the Communicator! Your are logged in as </FONT><font color=\"#AE0011\"> " . $_SESSION['s_username'] . " </FONT><a href='logout.php'>click here</a>  <font color=\"#293b74\"> to log out</FONT></b></center>";*/
//<form><input align=\"right\" type=\"button\" value=\"Make Backup\" onclick=window.location.replace(\"https://www.amityaari.com/backup/index.php\")></form>
}else{
//$redirect = $_SERVER['REQUEST_URI'];
$_SESSION['redirect'] = $_SERVER['REQUEST_URI'];
//header("Location: login.php?redirect=$redirect");
header("Location: login.php");
//echo "You are not logged in you can log in <a href='login.php'>here</a>.";
//echo $_SESSION['s_username'];
}
$user = $_SESSION['s_username'];
$query = "SELECT * FROM `users` WHERE `username` = '$user' LIMIT 1;";
//echo $query;
$result = mysqli_query($db,$query);
while($myrow = mysqli_fetch_array($result, MYSQLI_ASSOC))
{
$organization = $myrow['organization'];
}
//echo "The user organization is " . $organization . "<br>";
/*echo "highlightDevId: " . $_SESSION["highlightDevId"] . "<br>";
echo "highlightIdQuote: " . $_SESSION["highlightIdQuote"] . "<br>";
echo "highlightIdMsgOrder: " . $_SESSION["highlightIdMsgOrder"] . "<br>";
echo "highlightId: " . $_SESSION["highlightId"] . "<br>";
echo "highlightIdQuote: " . $_SESSION["highlightIdQuote"] . "<br>";
echo "highlightIdSpecial: " . $_SESSION["highlightIdSpecial"] . "<br>";
echo "highlightIdMsgSpecial: " . $_SESSION["highlightIdMsgSpecial"] . "<br>";*/
// show errors
//error_reporting(E_ALL);
?>
<html>
<head>
	<meta http-equiv="expires" content="0">
	<meta http-equiv="pragma" content="no-cache">
	<title> <?php echo $title; ?> </title>
      <link href='https://fonts.googleapis.com/css?family=Roboto:400,500,700,300' rel='stylesheet' type='text/css'>
     <style>
      .logo
{
  display: block;
  margin: 1px 7px 0 0;
}
.logo > img
{
  display: block;
}
.search-btn, .help, .frequently-section > ul li span > em, a.mobile-menu, .mobile-search,   .mobile-menu > span
{
  background: url(../images/sprite-img.png) no-repeat;
}
ul li
{
  list-style: none;
}
.header-wrapper
{
  margin: 0 auto 21px;
  border: 1px solid #ececec;
  width: 100%;
  border-bottom:none;
}
.ie9 .header-wrapper
{
  margin: 0 auto;
}
.ie8 .header-wrapper
{
  margin: 0 auto;
}
.header-section, .header-section tr td, .footer, .DropDownSubText, .dashboard-left, .dashboard-right, .DropDownHeader a
{
  font-family: 'Roboto',sans-serif;
}
.DropDownHeader A:link{
color: #fff;
}
.header-section
{
  width: 100%;
}
.header-section > tbody > tr:nth-child(2) td
{
  border: none;
}
.header-section > tbody > tr:nth-child(1) td
{
  border: none;
}
.header-section > tbody > tr:nth-child(1) td:nth-child(1)
{
  width: 10%;
}
.header-section > tbody > tr:nth-child(1) td:nth-child(2)
{
  width: 30%;
}
.header-section > tbody > tr:nth-child(1) td:nth-child(3)
{
  width: 60%;
}
.company-name
{
  float: left;
  font-size: 18px;
  line-height: 4;
  margin-top: 12px;
  text-transform: uppercase;
}
.search-section
{
  float: right;
  margin-right: 8px;
}
.search-section > span
{
  color: #686060;
  float: left;
  font-size: 14px;
  line-height: 31px;
  padding-right: 15px;
  width: auto;
}
.search
{
  border: 1px solid #bcbcbc;
  border-radius: 5px;
  display: inline-block;
  float: left;
  height: 33px;
  overflow:hidden;
  min-width: 404px;
}
.search select
{
  background: #f4f4f4;
  border: none;
  float: left;
  height: 33px;
  line-height: 29px;
  padding: 6px 2px;
  width: 115px;
}
.search input[type="text"]
{
  border: none;
  float: left;
  height: 33px;
  width: 50%;
}
.search-btn
{
  background-color: #f0f0f0;
  background-position: 8px -13px;
  float: right;
  font-size: 0;
  height: 33px;
  width: 34px;
  border:none !important;
}
.help
{
  background-color: #f4f4f4;
  background-position: 5px -58px;
  border: 1px solid #dedede;
  border-radius: 5px;
  float: right;
  font-size: 0;
  height: 35px;
  margin-right: 10px;
  width: 35px;
}
.header-section > li.sec-help
{
  height: 0;
}
.user-section
{
  border: 1px solid #cccccc;
  border-radius: 5px;
  float: right;
  height: 35px;
  position: relative;
  width: 35px;
  z-index: 1;
}
.user-section:hover .user-setting
{
  display: block;
}
.user-setting
{
  background: #f4f4f4;
  border: 1px solid #ccc;
  display: none;
  padding: 5px;
  position: absolute;
  right: 0;
  text-align: center;
  top: 36px;
  width: 60px;
}
.user-setting li
{
}
.user-setting li a
{
  color: #686060;
  font-size: 11px;
  text-transform: capitalize;
  white-space: nowrap;
}
.user-setting li a:hover
{
  color: #c11010;
}
.user
{
  border-radius: 5px;
  height: 35px;
  width: 35px;
}
.nav
{
  display: block;
  display: table;
  padding: 0;
  width: 100%;
}
.nav > li:first-child{
  border-left:none !important;
}
.nav > li
{
  background: #084d75;
  border-left: 19px solid #fff;
  color: #fff;
  display: table-cell;
  font-size: 15px;
  height: 36px;
  border-right: 0px;
  list-style: none;
  position: relative;
  text-align: center;
  vertical-align: middle;
}
.nav > li.active
{
  background: #c11010;
}
.nav > li:first-child
{
  border-left: 0;
}
.nav > li:hover
{
  background: #c11010;
}
.nav > li > div > ul
{
  border: 1px solid #fff;
  display: none;
  left: -1px;
  min-width: 113px;
  position: absolute;
  top: 8px;
  width: 100%;
  z-index: 10;
}
.nav > li > div > ul > li
{
  border-bottom: 1px solid #fff;
}
.nav > li > div > ul > li > a
{
  color: #fff;
  display: block;
  font-size: 12px;
  padding: 5px;
}
.nav > li:hover ul
{
  background: #084d75;
  display: block;
}
.nav > li > div
{
  position: relative;
}
.nav > li > div > ul > li > a:hover
{
  background: #c11010;
}
.logo > img{
  width:100%;
  height:auto;
}
.mobile-menu
{
  display: none;
}
.header-section
{
  margin-top:0px !important;
  border-bottom: none;
  padding-left:0px !important;
}
.nav > li:hover ul{
  padding:0 !important;
}
.header-section > li
{
  display: inline-block;
  position: relative;
  width: 100%;
}
.DropDownHeader a
{
  color: #fff !important;
  font-size: 14px;
  font-weight: normal;
}
.header-section > li:nth-child(1)
{
  height: 98px;
}
.header-section > li > div
{
  float: left;
}
.logo-sec
{
  width: 15%;
}
.tagline
{
  line-height: 4;
  width: 32%;
}
.header-section > li > div.help-sec
{
  float: right;
  position: relative;
  right: 97px;
  top: -101px;
  width: 49%;
}
.header-section > li > div.help-sec.none
{
  top: -63px;
}
.message-section > table tr th:nth-child(1), .message-section > table tr td:nth-child(1)
{
  width: 20%;
}
.message-section > table tr th:nth-child(2), .message-section > table tr td:nth-child(2)
{
  width: 80%;
}
.ie9 .header-section > li > div.help-sec
{
  top: -127px !important;
}
.ie8 .header-section > li > div.help-sec
{
  top: -127px !important;
}
.mobile-search
{
  display: none;
}
.header-section > li > div.user-help-sec
{
  float: right;
  margin: 33px 10px 0 0;
}

     </style>

		<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<script>
window.jQuery || document.write('<script src="js/jquery-1.11.1.min.js"><\/script>')


</script>

      <script>
        jQuery(document).ready(function() {
//main_search_form
          jQuery('#main_search_form select[name="opstatus"]').change(function(){
            e = jQuery(this).find(':selected');
            jQuery(this).closest('form').attr('action',e.attr('data-action'));
            jQuery(this).closest('form').find('#main_search').attr('name',e.attr('data-name'));
          });
          jQuery(".mobile-menu").click(function() {
            //alert(222)
            jQuery(".nav").slideToggle("slow");
          });
        }); 
        
        jQuery(document).ready(function() {
          jQuery(".mobile-search").click(function() {
            
            if(jQuery(".help-sec").css('visibility')=='hidden')
            {
                jQuery(".help-sec").css('visibility','visible');  
            }
            else{
              jQuery(".help-sec").css('visibility','hidden');
            }
            
          });
          
          
          jQuery('.nav li a').click(function(){
            
            var txt=jQuery(this).text();
            jQuery('.mobile-menu').find('span').fadeIn().text(txt);
          });
          
          
        }); 
    </script>
<SCRIPT LANGUAGE="javascript">
function changePicture()
{
var selection = document.orderline.partid.selectedIndex; //grabs what user selected
document.pic.src = document.orderline.partid.options[selection].id; //adds 'selection' to grab 'id'
}
function changePicture2()
{
var selection = document.orderline.partno.selectedIndex; //grabs what user selected
document.pic.src = document.orderline.partno.options[selection].id; //adds 'selection' to grab 'id'
} 
function changeDiv(the_div,the_change)
{
  var the_style = getStyleObject(the_div);
  if (the_style != false)
  {
    the_style.display = the_change;
  }
}
function hideAll()
{
  changeDiv("fix_request","none");
  changeDiv("approved","none");
}
function getStyleObject(objectId) {
  if (document.getElementById && document.getElementById(objectId)) {
    return document.getElementById(objectId).style;
  } else if (document.all && document.all(objectId)) {
    return document.all(objectId).style;
  } else {
    return false;
  }
}
// adding rows to quotes - Last updated 2009-10-21
function addRowToTable()
{
  var tbl = document.getElementById('tblQuote');
  var lastRow = tbl.rows.length;
  // if there's no header row in the table, then iteration = lastRow + 1
  var iteration = lastRow - 1;
  var row = tbl.insertRow(lastRow);
  
  // left cell
  var cellLeft = row.insertCell(0);
  var textNode = document.createTextNode(iteration);
  cellLeft.appendChild(textNode);
  
  // SIZE cell
  var cellRight = row.insertCell(1);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'size' + iteration;
  el.id = 'size' + iteration;
  el.size = 10;
  //el.onkeypress = keyPressTest;
  cellRight.appendChild(el);
  
   // QUOTE HAND cell
  var cellRight2 = row.insertCell(2);
  var el2 = document.createElement('input');
  el2.type = 'text';
  el2.name = 'quoteHand' + iteration;
  el2.id = 'quoteHand' + iteration;
  el2.size =  10;
  //el.onkeypress = keyPressTest;
  cellRight2.appendChild(el2);
  
   // QUOTE PRINT cell
  var cellRight3 = row.insertCell(3);
  var el3 = document.createElement('input');
  el3.type = 'text';
  el3.name = 'quotePrint' + iteration;
  el3.id = 'quotePrint' + iteration;
  el3.size =  10;
  //el.onkeypress = keyPressTest;
  cellRight3.appendChild(el3);
}
function addRowToTableShip()
{
  var tbl = document.getElementById('tblQuote');
  var lastRow = tbl.rows.length;
  // if there's no header row in the table, then iteration = lastRow + 1
  var iteration = lastRow - 1;
  var row = tbl.insertRow(lastRow);
  
  // left cell
  var cellLeft = row.insertCell(0);
  var textNode = document.createTextNode(iteration);
  cellLeft.appendChild(textNode);
  
  // WEIGHT cell
  var cellRight = row.insertCell(1);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'weight' + iteration;
  el.id = 'weight' + iteration;
  el.size = 10;
  //el.onkeypress = keyPressTest;
  cellRight.appendChild(el);
  // CARRIER cell
  var cellRight2 = row.insertCell(2);
  var el2 = document.createElement('input');
  el2.type = 'text';
  el2.name = 'carrier' + iteration;
  el2.id = 'carrier' + iteration;
  el2.size = 10;
  //el.onkeypress = keyPressTest;
  cellRight2.appendChild(el2);
  
   // QUOTE AIR cell
  var cellRight3 = row.insertCell(3);
  var el3 = document.createElement('input');
  el3.type = 'text';
  el3.name = 'quoteAir' + iteration;
  el3.id = 'quoteAir' + iteration;
  el3.size =  10;
  //el.onkeypress = keyPressTest;
  cellRight3.appendChild(el3);
  
   // QUOTE SEA cell
  var cellRight4 = row.insertCell(4);
  var el4 = document.createElement('input');
  el4.type = 'text';
  el4.name = 'quoteSea' + iteration;
  el4.id = 'quoteSea' + iteration;
  el4.size =  10;
  //el.onkeypress = keyPressTest;
  cellRight4.appendChild(el4); 
}
function addRowToTablePayment()
{
  var tbl = document.getElementById('tblpayment');
  var lastRow = tbl.rows.length;
  // if there's no header row in the table, then iteration = lastRow + 1
  var iteration = lastRow - 1;
  var row = tbl.insertRow(lastRow);
  
  // left cell
  var cellLeft = row.insertCell(0);
  var textNode = document.createTextNode(iteration);
  cellLeft.appendChild(textNode);
  
  // paymentamt cell
  var cellRight = row.insertCell(1);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'paymentamt' + iteration;
  el.id = 'paymentamt' + iteration;
  el.size = 10;
  //el.onkeypress = keyPressTest;
  cellRight.appendChild(el);
  // paymentdate cell
  var cellRight2 = row.insertCell(2);
  var el2 = document.createElement('input');
  el2.type = 'text';
  el2.name = 'paymentdate' + iteration;
  el2.id = 'paymentdate' + iteration;
  el2.size = 10;
  //el.onkeypress = keyPressTest;
  cellRight2.appendChild(el2);
  
   // paypalid cell
  var cellRight3 = row.insertCell(3);
  var el3 = document.createElement('input');
  el3.type = 'text';
  el3.name = 'paypalid' + iteration;
  el3.id = 'paypalid' + iteration;
  el3.size =  10;
  //el.onkeypress = keyPressTest;
  cellRight3.appendChild(el3);
}
function addRowToTableBox()
{
  var tbl = document.getElementById('tblBox');
  var lastRow = tbl.rows.length;
  // if there's no header row in the table, then iteration = lastRow + 1
  var iteration = lastRow - 1;
  var row = tbl.insertRow(lastRow);
  
  // left cell
  var cellLeft = row.insertCell(0);
  var textNode = document.createTextNode(iteration);
  cellLeft.appendChild(textNode);
  
  // Carton cnt cell
  var cellRight = row.insertCell(1);
  //var el = document.createElement('input');
  var selector = document.createElement('select');
  //selector.type = 'text';
  selector.name = 'carton_id' + iteration;
  selector.id = 'carton_id' + iteration;
  //selector.size = 10;
  //el.onkeypress = keyPressTest;
  //cellRight.appendChild(el);
  cellRight.appendChild(selector);
for (i=1; i<100; i++)
  {
var option = document.createElement('option');
option.value = i;
option.appendChild(document.createTextNode(i));
selector.appendChild(option);
}
  // Qty cell
  var cellRight2 = row.insertCell(2);
  var el2 = document.createElement('input');
  el2.type = 'text';
  el2.name = 'qty' + iteration;
  el2.id = 'qty' + iteration;
  el2.size = 10;
  //el.onkeypress = keyPressTest;
  cellRight2.appendChild(el2);
}
function removeRowFromTable()
{
  var tbl = document.getElementById('tblQuote');
  var lastRow = tbl.rows.length;
  if (lastRow > 2) tbl.deleteRow(lastRow - 1);
}
function removeRowFromTableShip()
{
  var tbl = document.getElementById('tblQuote');
  var lastRow = tbl.rows.length;
  if (lastRow > 2) tbl.deleteRow(lastRow - 1);
}
function removeRowFromTablePayment()
{
  var tbl = document.getElementById('tblpayment');
  var lastRow = tbl.rows.length;
  if (lastRow > 2) tbl.deleteRow(lastRow - 1);
}
function removeRowFromTableBox()
{
  var tbl = document.getElementById('tblBox');
  var lastRow = tbl.rows.length;
  if (lastRow > 2) tbl.deleteRow(lastRow - 1);
}
function openInNewWindow(frm)
{
  // open a blank window
  var aWindow = window.open('', 'TableAddRowNewWindow',
   'scrollbars=yes,menubar=yes,resizable=yes,toolbar=no,width=400,height=400');
   
  // set the target to the blank window
  frm.target = 'TableAddRowNewWindow';
  
  // submit
  frm.submit();
}
function validateRow(frm)
{
    var tbl = document.getElementById('tblQuote');
    var lastRow = tbl.rows.length - 2;
    var i;
    for (i=1; i<=lastRow; i++) {
      var aRow = document.getElementById('size' + i);
      if (aRow.value.length <= 0) {
        alert('Size ' + i + ' is empty');
        return;
      }
	  
	  var aRow2 = document.getElementById('quoteHand' + i);
      if (aRow2.value.length <= 0) {
        alert('Quote Hand ' + i + ' is empty');
        return;
      }
	  
	  var aRow3 = document.getElementById('quotePrint' + i);
      if (aRow3.value.length <= 0) {
        alert('Quote Print ' + i + ' is empty');
        return;
      }
    }
	
   frm.submit();
}
function validateRowShip(frm)
{
    var tbl = document.getElementById('tblQuote');
    var lastRow = tbl.rows.length - 2;
    var i;
    for (i=1; i<=lastRow; i++) {
      var aRow = document.getElementById('weight' + i);
      if (aRow.value.length <= 0) {
        alert('Weight ' + i + ' is empty');
        return;
      }
      var aRow2 = document.getElementById('carrier' + i);
      if (aRow2.value.length <= 0) {
        alert('Carrier ' + i + ' is empty');
        return;
      }
	  
	  var aRow3 = document.getElementById('quoteAir' + i);
      if (aRow3.value.length <= 0) {
        alert('Quote Air ' + i + ' is empty');
        return;
      }
	  
	  var aRow4 = document.getElementById('quoteSea' + i);
      if (aRow4.value.length <= 0) {
        alert('Quote Sea ' + i + ' is empty');
        return;
      }
    }
	
   frm.submit();
}
function validateRowPayment(frm)
{
    var tbl = document.getElementById('tblpayment');
    var lastRow = tbl.rows.length - 2;
    var i;
    for (i=1; i<=lastRow; i++) {
      var aRow = document.getElementById('paymentamt' + i);
      if (aRow.value.length <= 0) {
        alert('Payment Amount ' + i + ' is empty');
        return;
      }
	  
	}
	
   frm.submit();
}
function validateRowBox(frm)
{
    var tbl = document.getElementById('tblBox');
    var lastRow = tbl.rows.length - 2;
    var i;
    for (i=1; i<=lastRow; i++) {
      var aRow = document.getElementById('carton_id' + i);
      if (aRow.value.length <= 0) {
        alert('Carton # ' + i + ' is empty');
        return;
      }
      var aRow2 = document.getElementById('qty' + i);
      if (aRow2.value.length <= 0) {
        alert('Qty ' + i + ' is empty');
        return;
      }
    }
	
   frm.submit();
}
 function removeComm(id){
 if(!confirm('are you sure you want to discontinue ' +  id + '?')) return false;
 new Ajax.Request('deletePart.php', {
 method: 'get',
 /*onCreate: function(){ confirm('are you sure you want to discontinue ' +  id + '?') }, */
 parameters: 'comm_id=' + id,
 onSuccess: function(){ alert('part has been marked discontinued!') }
 });
 }
 function setNotToOrder(id){
 if(!confirm('are you sure you want to set as Not to Order ' +  id + '?')) return false;
 new Ajax.Request('setNotToOrder.php', {
 method: 'get',
 /*onCreate: function(){ confirm('are you sure you want to Set as Not to Order ' +  id + '?') }, */
 parameters: 'comm_id=' + id,
 onSuccess: function(){ alert('part has been marked Not to Order!') }
 });
 }
 function reAddComm(id){
 if(!confirm('are you sure you want to add this item back from Discontinued ' +  id + '?')) return false;
 new Ajax.Request('reAddPart.php', {
 method: 'get',
 /*onCreate: function(){ confirm('are you sure you want to add this item back from Discontinued ' +  id + '?') }, */
 parameters: 'comm_id=' + id,
 onSuccess: function(){ alert('part has been Un-discontinued from the system!') }
 });
 }
 function reToOrder(id){
 if(!confirm('are you sure you want to add this item back to order ' +  id + '?')) return false;
 new Ajax.Request('reToOrder.php', {
 method: 'get',
 /*onCreate: function(){ confirm('are you sure you want to add this item back ' +  id + '?') }, */
 parameters: 'comm_id=' + id,
 onSuccess: function(){ alert('part has been re-added to be ordered!') }
 });
 }
 
 function markBad(id,bad){
var txtBad = ''
if (bad == 1) 
{txtBad = 'bad'}
else {txtBad = 'good'}
 if(!confirm('are you sure you want to mark this image as ' + txtBad + '?')) return false;
 new Ajax.Request('markImageBad.php', {
 method: 'get',
 parameters: 'comm_id=' + id + '&bad=' + bad,
 onSuccess: function(){ alert('image has been marked ' + txtBad + '!') }
 });
 }
 function markBadOrder(id,bad){
var txtBad = ''
if (bad == 1) 
{txtBad = 'bad'}
else {txtBad = 'good'}
 
 if(!confirm('are you sure you want to mark this image as ' + txtBad + '?')) return false;
 new Ajax.Request('markImageBadOrder.php', {
 method: 'get',
 parameters: 'comm_id=' + id + '&bad=' + bad,
 onSuccess: function(){ alert('image has been marked ' + txtBad + '!') }
 });
 }
 
 function markOut(id,out){
var txtOut = ''
if (out == 1) 
{txtOut = 'out of'}
else {txtOut = 'back in'} 
 if(!confirm('are you sure you want to mark this item as ' + txtOut + ' stock at supplier?')) return false;
 new Ajax.Request('markItemOut.php', {
 method: 'get',
 parameters: 'comm_id=' + id + '&out=' + out,
 onSuccess: function(){ alert('item is marked ' + txtOut + ' stock at supplier\'s facility!') }
 });
 }
 
function checkAll(formname, checktoggle)
{
  var checkboxes = new Array(); 
  checkboxes = document[formname].getElementsByTagName('input');
 
  for (var i=0; i<checkboxes.length; i++)  {
    if (checkboxes[i].type == 'checkbox')   {
      checkboxes[i].checked = checktoggle;
    }
  }
}
</SCRIPT>
<script language="JavaScript">
<!--
//////////////////////////////////////////////////////////////////////////////////////////////////
// Misc Variables
	var timer;       			// holds the current timer value
	Menu_Over = null 			// Menu currently highlighted 
	MouseOver_bgColor ="#99B3CC"// Color of the cell when mouse is over it
	OffsetMenuTop = 15 			// Offset Menu Top the height of the cell so it's top is at the cell bottom
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
// This is the bit that does it all.
function ShowMenu(elem,HTML){
	if(Menu_Over!=null){if(!document.layers){Menu_Over.className='DropDownHeader'}}
	Menu_Over = elem
	if(!document.layers){elem.className='DropDownHeaderOver'}
	var HTMLCode = ''
	HTMLelem = eval(HTML)
	if(HTMLelem.length>0){
		HTMLCode += '<table cellpadding="0" cellspacing="0" border="0" class="DropDownOutBox"><tr><td>'
		HTMLCode += '<table cellpadding="0" cellspacing="0" border="0" class="DropDownSubBox">'
				for(i=0;i<HTMLelem.length;i++){
						//if(i!=0){HTMLCode += '</td>'}
						clearTimeout(timer)
						HTMLCode += '<tr><td class="DropDownSubText" onmouseover="javascript:style.background=\'' +
						    MouseOver_bgColor + '\'\;  clearTimeout(timer); " onclick="self.location.href=\'' +
						    HTMLelem[i][1] + '\'" onmouseout=\"javascript:style.background=\'transparent\'; timer=setTimeout(\'HideDiv()\',500); ">'
						HTMLCode += '<nobr>'+ HTMLelem[i][0] +'</nobr><br></td></tr>'
				}
		HTMLCode += '</table></td></tr></table>'
	}
		if(document.layers){
			document.OptionListDiv.left = findPosX(elem) 
			document.OptionListDiv.top = findPosY(elem)  + OffsetMenuTop 
			document.OptionListDiv.document.write(HTMLCode); document.layers['OptionListDiv'].document.close();
		}
		if(document.all){
			OptionListDiv.style.left = findPosX(elem)
			OptionListDiv.style.top = findPosY(elem) + OffsetMenuTop 
			OptionListDiv.innerHTML = HTMLCode
		}
		if(!document.all && document.getElementById){
			document.getElementById('OptionListDiv').style.left = findPosX(elem)
			document.getElementById('OptionListDiv').style.top = findPosY(elem) + OffsetMenuTop 
			document.getElementById('OptionListDiv').innerHTML = HTMLCode
		}
}
//////////////////////////////////////////////////////////////////////////////////////////////////
// find the Left position
function findPosX(obj){
	var curleft=0;
		if(document.getElementById||document.all){while(obj.offsetParent){curleft+=obj.offsetLeft;obj=obj.offsetParent;}}
		else if(document.layers){curleft+=obj.x;}
	return curleft;
}
//////////////////////////////////////////////////////////////////////////////////////////////////
// find the top position
function findPosY(obj){
	var curtop=0;
		if(document.getElementById||document.all){while(obj.offsetParent){curtop+=obj.offsetTop;obj=obj.offsetParent;}}
		else if(document.layers){curtop+=obj.y;}
	return curtop;
}
//////////////////////////////////////////////////////////////////////////////////////////////////
// set the mouse click mouseup event
if(document.layers)document.captureEvents(Event.MOUSEMOVE);document.onmouseup=HideDiv;
//////////////////////////////////////////////////////////////////////////////////////////////////
// hide the menu
function HideDiv(){
	if(Menu_Over!=null){
		if(!document.layers){Menu_Over.className='DropDownHeader'}
	}
	if(document.layers){document.OptionListDiv.top = -999}
	if(document.all){OptionListDiv.style.top = -999}
	if(!document.all && document.getElementById){document.getElementById('OptionListDiv').style.top = -999}
}
function go_there()
{
 var where_to= confirm("Do you really want to delete this order?");
 if (where_to == true)
 {
   window.location="delete.php?op=deleteorder&orderid=<? echo $myrow["orderid"]; ?>";
 }
}
function initdt(mf) {
var startDate = new Date();
var Month = startDate.getMonth() + 1;
if(Month <12)
var MonthEnd = startDate.getMonth() + 2;
else
var MonthEnd = 1;
var Day = startDate.getDate();
if (Month < 10)
Month = "0" + Month;
if (MonthEnd < 10)
MonthEnd = "0" + MonthEnd;
if (Day < 10)
Day = "0" + Day;
mf.startdate.value = Month + "/" + Day + "/" + startDate.getFullYear();
mf.enddate.value = MonthEnd + "/" + Day + "/" + startDate.getFullYear();
}
function currdt(mf) {
var startDate = new Date();
mf.current_date.value = (startDate.getMonth() + 1) + "/" + startDate.getDate() + "/" + startDate.getFullYear();
}
function GlobalPopUp(url, w, h){
var popUpWin=0;
screenW = screen.availWidth;
screenH = screen.availHeight;
screenW = (screenW-w)/2
screenH = (screenH-h)/2
	if(popUpWin){
		if(!popUpWin.closed) popUpWin.close();
	}
	popUpWin = open(url, '', 'scrollbars=yes,resizable=yes,width='+w+',height='+h+',left='+screenW+',top='+screenH);
	popUpWin.focus();
}
var popUpWin=0;
function popUpWindow(URLStr){
  if(popUpWin){
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'scrollbars=yes, resizable=no, width=400, height=400, left=0, top=0');
  popUpWin.focus();
}
function popUpBigWindow(URLStr){
  if(popUpWin){
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'scrollbars=yes, resizable=no, width=600, height=600, left=0, top=0');
  popUpWin.focus();
}
function clearContents(element) {
  element.value = '';
}
//-->
</script>
<script type="text/javascript" src="prototype.js"></script>
</head>
<body>
<div class="header-wrapper">
<?php if (isset($_SESSION['s_username'])) {
  echo "<center style='margin-top:5px;'><b><font color=\"#293b74\" style=\"font-family: 'Roboto',sans-serif;text-align:left\">Welcome to the Communicator! Your are logged in as </FONT><font style='font-family: Roboto,sans-serif;' color=\"#AE0011\"> " . $_SESSION['s_username'] . " </FONT><a style='font-family: Roboto,sans-serif;' href='logout.php'>click here</a>  <font style='font-family: Roboto,sans-serif;' color=\"#293b74\"> to log out</FONT></b></center>";
} 
?>
                                        <ul class="header-section">
                                            <li>
                                                <div class="logo-sec">
                                                    <a href="index.php" class="logo">
                                                        <img align="left" src="images/logo.jpg" border="0" />
                                                    </a>
                                                </div>
                                                <div class="tagline">
                                                <span class="company-name">overstockArt supply chain - <?php echo $organization ?> </span>
                                                </div>
                                                <div class="user-help-sec">
                                                    <div class="user-section">
                                                        <a href="#" class="user">
                                                            <img align="left" src="images/user.jpg" />
                                                        </a>
                                                        <!--user-->
                                                        <ul class="user-setting">
                                                            <li>
                                                                <a href="#">setting </a>
                                                            </li>
                                                            <li>
                                                                <a href="logout.php">log out</a>
                                                            </li>
                                                        </ul>
                                                    </div>
                  <a href="https://overstockart.freshdesk.com/solution/categories/1000068290" class="help" target="_blank">help</a>
                                                </div>
                                                <!--USuser-help-sec-->
                                            </li>
                                            <li>
                                                <div class="mobile-menu-sec">
                                                    <a href="#" class="mobile-menu">Menu 
                                                        <span></span>
                                                    </a>
                                                    <a href="#" class="mobile-search">search</a>
                                                </div>
                                                <ul class="nav">
                                                    <!--mobile-menu-sec-->
                                                    <li nowrap class="DropDownHeader active" align="center">
                                                        <a href="index.php">Home</a>
                                                    </li>
                                                    <li nowrap class="DropDownHeader " >
                                                        <a href="#">New</a>
                                                           <?php 
if ($organization == "US")
{
?>
                                                        <div >
                                                            <ul>
                                                                <li>
                                                                    <a href="add.php?op=addorder">New Order</a>
                                                                </li>
                                                                <li>
                                                                    <a href="add.php?op=addpart">New Item</a>
                                                                </li>
                                                                <li>
                                                                    <a href="add.php?op=addacces">New Accessory</a>
                                                                </li>
                                                                <li>
                                                                    <a href="add.php?op=addspecialorder">New Special Order</a>
                                                                </li>
                                                                <li>
                                                                    <a href="newProducts.php">New Art Order</a>
                                                                </li>
                                                                <li>
                                                                    <a href="add.php?op=addvendor">New Vendor</a>
                                                                </li>
                                                                <li>
                                                                    <a href="add.php?op=adddev">New Development</a>
                                                                </li>
                                                            </ul>
                                                        </div>
                                                         <?php } ?>
                                                    </li>
                                                    <li nowrap class="DropDownHeader ">
                                                        <a href="#">Orders
   </a>
                                                        <div >
                                                            <ul>
                                                                <li>
                                                                    <a href="ordermanager.php">Open Orders</a>
                                                                </li>
                                                                <li>
                                                                    <a href="ordermanager.php?showOnly=Closed&showOnlyPart=all&org1=all&orderType=all&submitShow=Show">Closed Orders</a>
                                                                </li>
                                                                <li>
                                                                    <a href="ordermanager.php">All Orders</a>
                                                                </li>
                                                                <li>
                                                                    <a href="index.php?opstatus=Special">Open Special Orders</a>
                                                                </li>
                                                                <li>
                                                                    <a href="index.php?opstatus=SCompleted">Closed Special Orders</a>
                                                                </li>
                                                            </ul>
                                                        </div>
                                                    </li>
                                                    <li nowrap class="DropDownHeader " >
                                                        <a href="#">Inventory
   </a>
      <?php 
if ($organization == "US")
{
?>
                                                        <div >
                                                            <ul>															<li>                                                                    <a href="inventory-report_setup.php">Inventory Analyzer</a>                                                                </li>
                                                                <li>
                                                                    <a href="parts-setup.php">Existing Inventory</a>
                                                                </li>
                                                                <li>
                                                                    <a href="productBulkUpdate.php">Bulk Product Update</a>
                                                                </li>
                                                                <li>
                                                                    <a href="productImageUpload.php">Bulk Image Upload</a>
                                                                </li>
                                                                <li>
                                                                    <a href="viewdetail-dev-all.php">Development Queue</a>
                                                                </li>
                                                                <li>
                                                                    <a href="demand_moldings.php">Load Moulding Qty</a>
                                                                </li>
                                                                <li>
                                                                    <a href="part_timeline.php">Load Part Timeline</a>
                                                                </li>
                                                                <li>
                                                                    <a href="us-china-update.php">Update US/China Part Numbers</a>
                                                                </li>
																 <li>
                                                                    <a href="top-50-upload.php">Bulk Update Top 50</a>
                                                                </li>
                                                                <li>
                                                                    <a href="not-to-order-upload.php">Bulk Set Not to Order</a>
                                                                </li>
                                                                 <li>
                                                                    <a href="manufacturing-days-upload.php">Update Manuafacturing Days</a>
                                                                </li>
                                                              <li>
                                                                    <a href="productBulkSiteBinsUpdate.php">Site/Bins Bulk Update</a>
                                                                </li>
                                                                <li>
                                                                    <a href="closeoutids.php">Load Closeout Lookup</a>
                                                                </li>
                                                                <li>
                                                                    <a href="preframed-upload.php">Load Preframed from Site</a>
                                                                </li>

																</ul>
                                                        </div>
                                                         <?php } ?>
                                                    </li>
                                                     <li nowrap class="DropDownHeader " >
                                                        <a href="#">Demand
   </a>
      <?php 
if ($organization == "US")
{
?>
                                                        <div >
                                                            <ul>
                                                                <li>
                                                                    <a href="demand1_new.php">Demand Planning</a>
                                                                </li>
                                                                <li>
                                                                    <a href="demand1_weekly.php">Demand Weekly Sales</a>
                                                                </li>
                                                                <li>
                                                                    <a href="demand1_daily.php">Demand Daily Sales</a>
                                                                </li>
                                                                <!--<li>
                                                                    <a href="demand-current-frame.php">Demand Planning Frames</a>
                                                                </li>-->
                                                                <li>
                                                                    <a href="demand-frames-setup.php">Demand Planning Frames</a>
                                                                </li>
                                                                <li>
                                                                    <a href="demand_moldings.php">Demand Planning Mouldings</a>
                                                                </li>
                                                                <li>
                                                                    <a href="pn-monthly.php">Demand by Month</a>
                                                                </li>
                                                            </ul>
                                                        </div>
                                                         <?php } ?>
                                                    </li>
                                                    <li nowrap class="DropDownHeader ">
                                                        <a href="#">Reports</a>
                                                           <?php 
if ($organization == "US")
{
?>
                                                        <div >
                                                            <ul>
                                                               
                                                                <li>
                                                                    <a href="report_booked.php">Booked Report</a>
                                                                </li>
                                                                <li>
                                                                    <a href="notonsite-inv-excel.php">Not on Site Report</a>
                                                                </li>
                                                                <li>
                                                                    <a href="notonsite-qb-inv-excel.php">Not on Site QB Report</a>
                                                                </li>
                                                                <li>
                                                                    <a href="backorder-report.php">Backorder Report</a>
                                                                </li>
                                                                 <li>
                                                                    <a href="preorder-move-std.php">Pre Order Move</a>
                                                                </li>
                                                                
                                                                 <li>
                                                                    <a href="preorder-remove-std.php">Pre Order Remove</a>
                                                                </li>
                                                                
                                                                <li>
                                                                    <a href="eventItems.php">On Event Report</a>
                                                                </li>
                                                                <li>
                                                                    <a href="clipedReport.php">Clipped Report</a>
                                                                </li>
                                                                 <li>
                                                                    <a href="closeout_move_report.php">Move to Closeout Report</a>
                                                                </li>
                                                                <li>
                                                                    <a href="report_closeout.php">Discontinued Report</a>
                                                                </li>
                                                                 <li>
                                                                    <a href="report_not_to_order.php">Not To Order Report</a>
                                                                </li>
                                                                <li>
                                                                    <a href="aging.php">Aging Report</a>
                                                                </li>
                                                                <li>
                                                                    <a href="status-report.php">Status Report</a>
                                                                </li>
                                                                <li>
                                                                    <a href="status-report-special.php">Status Report Special</a>
                                                                </li>
                                                                <li>
                                                                    <a href="vendor-report.php">Vendor Report</a>
                                                                </li>
                                                                <li>
                                                                    <a href="vendor-report-special.php">Vendor Report Special</a>
                                                                </li>
                                                                <li>
                                                                    <a href="best-seller.php">Best Sellers by Title</a>
                                                                </li>
                                                                <li>
                                                                    <a href="slow_moving_setup.php">Slow Moving Inventory</a>
                                                                </li>
                                                                <li>
                                                                    <a href="event_ready_setup.php">Event Ready & In Route Inventory</a>
                                                                </li>
                                                                <li>
                                                                    <a href="inventory_timeline.php">Inventory over Time</a>
                                                                </li>
                                                                <li>
                                                                    <a href="urgent-report.php">Urgent Report</a>
                                                                </li>
                                                                <li>
                                                                    <a href="special-order-time-report.php">Time to Deliver Report</a>
                                                                </li>
                                                            </ul>
                                                        </div>
								  <?php }
                                  else
                                  {
                                  ?>	
                                       <div >
                                                            <ul>
                                                                <li>
                                                                    <a href="status-report.php">Status Report</a>
                                                                </li>
                                                       
                                                                <li>
                                                                    <a href="urgent-report.php">Urgent Report</a>
                                                                </li>
                                                               
                                                            </ul>
                                                        </div>
                                      
                                    <?
                                  }
                                   ?>
                                                    </li>
                                                    <li nowrap class="DropDownHeader ">
                                                        <a href="#">Shipping
   </a>
                                                        <div >
                                                            <ul>
                                                                <li>
                                                                    <a href="shipmanager.php?complete=NO">Ship Manager</a>
                                                                </li>
                                                                <li>
                                                                    <a href="shipmanager.php?complete=YES">Completed Shipments</a>
                                                                </li>
                                                                   <?php if ($organization == "US") { ?>
                                                                <li>
                                                                    <a href="packinglist-setup.php">Create Shipment</a>
                                                                </li>
																<li>
                                                                    <a href="shipmanager2.php?complete=NO">Budget Tool</a>
                                                                </li>
                                                                <?php } else { ?>
                                                                <li>
                                                                    <a href="packinglist.php">Create Shipment</a>
                                                                </li>
                                                                <?php } ?>
                                                                <?php if ($organization == "US") { ?>                                                   
                                                                <li>
                                                                    <a href="index.php?opstatus=returnmanager">Returns to CN</a>
                                                                </li>
                                                                <li>
                                                                    <a href="index.php?opstatus=returnmanagerc">Completed Returns</a>
                                                                </li>
                                                                <li>
                                                                    <a href="packinglist-return.php">Create Return</a>
                                                                </li>
                                                                <?php } ?>
                                                            </ul>
                                                        </div>
                                                    </li>
                                                    <?php if($_SESSION['s_username'] == "asasson" || $_SESSION['s_username'] == "David" || $_SESSION['s_username'] == "dholmes" || $_SESSION['s_username'] == "tberry"){ ?>
                                                    <li nowrap class="DropDownHeader ">
                                                        <a href="#">Account Settings
   </a>
                                                        <div >
                                                            <ul>
                                                                <li>
                                                                    <a href="register.php">Add New User</a>
                                                                </li>
                                                                <li>
                                                                    <a href="allSupplier.php">All Suppliers</a>
                                                                </li>
                                                                <li>
                                                                    <a href="registerSupplier.php">Add New Supplier</a>
                                                                </li>
                                                                <li>
                                                                    <a href="#">Invite Suppliers</a>
                                                                </li> 
                                                            </ul>
                                                        </div>
                                                    </li>
                                                    <?php } ?>
                                                </ul>
                                            </li>
                                            <li class="sec-help">
                                                <div class="help-sec ">
<?php 
if (TRUE) //$organization == "US")
{
$search_term = '';
$search_key = "partno";
if($_GET["opstatus"] == 'partnosearch')
{
$search_term = $_GET["partno"];
$search_key = "partno";
}
else if($_GET["opstatus"] == 'ordernosearch')
{
$search_term = $_GET["ordernumber"];
$search_key = "ordernumber";
}
else if($_GET["opstatus"] == 'specialordersearch')
{
$search_term = $_GET["specialorderno"];
$search_key = "specialorderno";
}
else if($_GET["opstatus"] == 'pnchinasearch')
{
$search_term = $_GET["pnchina"];
$search_key = "pnchina";
}
else if($_GET["opstatus"] == 'paintingsearch')
{
$search_term = $_GET["paintingname"];
$search_key = "paintingname";
}
else if($_GET["opstatus"] == 'artistsearch')
{
$search_term = $_GET["artist"];
$search_key = "artist";
}
else if($_GET["opstatus"] == 'shipsearch')
{
$search_term =  $_GET["shipkeyword"];
$search_key = "paintingname";
}
?>
                                                    <div class="search-section">
                                                        <span>Search by </span>
                                                        <div class="search">
  <form method="get" action="index.php" id="main_search_form">
   <select name="opstatus">
  <option value="partnosearch" data-action="index.php" data-name="partno" <?=$_GET["opstatus"] == 'partnosearch' ? ' selected="selected"' : '';?> >Part Number</option>
 <option value="pnchinasearch" data-action="index.php" data-name="pnchina" <?=$_GET["opstatus"] == 'pnchinasearch' ? ' selected="selected"' : '';?>>Part China</option>
<option value="paintingsearch" data-action="index.php" data-name="paintingname" <?=$_GET["opstatus"] == 'paintingsearch' ? ' selected="selected"' : '';?>>Painting Name</option>
<option value="ordernosearch" data-action="index.php" data-name="ordernumber" <?=$_GET["opstatus"] == 'ordernosearch' ? ' selected="selected"' : '';?>>Order Number</option>
<option value="specialordersearch" data-action="index.php" data-name="specialorderno" <?=$_GET["opstatus"] == 'specialordersearch' ? ' selected="selected"' : '';?>>Special Order Number</option>
<option value="shipsearch" data-action="index.php" data-name="shipkeyword" <?=$_GET["opstatus"] == 'shipsearch' ? ' selected="selected"' : '';?>>Shipment Number</option>
<option value="artistsearch" data-action="index.php" data-name="artist" <?=$_GET["opstatus"] == 'artistsearch' ? ' selected="selected"' : '';?>>Artist Name</option>
                                                            </select>
                                       <input type="text" value="<?=$search_term;?>" id="main_search" name="<?=$search_key;?>"/>
                                                            <input class="search-btn" type="submit"/>
                                                            </form>
                                                        </div>
                                                        <!--search-->
                                                    </div>
                                                    <?php
                                                    }
                                                    ?>
                                                    <!--search-section-->
                                                </div>
                                            </li>
                                        </ul>
                                    </ul>
                                </div>
                                <!--header-wrapper-->
<div id="OptionListDiv" style="position:absolute; top:0; left:-500; z-index:65535; visibility:visible;">&nbsp;</div>
<div id="main_table">
<div class="dashboard-wrapper"></div>