/*=======================================================================
 *
 * sortContainer.js
 *
 * Autor: Marc Vollmann
 *
 =======================================================================*/


// **** ITEM SORT START ****
var itemSortIsDisplayed = false;

function callItemSort() {
	if (itemSortIsDisplayed) {
		 myhide('itemsortcontainer');
		 itemSortIsDisplayed = false;
		 // Remove all appended items !!!!
		 $("#itemsort_sortable li").remove();
  } else {
     myshow('itemsortcontainer');
     itemSortIsDisplayed = true;
  }
}

function finishPageItemSort() {
	// Get current vehicle to be sorted
	var crvhId = $("#itemsort_crvh").val();
	// Serialize sorted cartage note
	var sorted = $("#itemsort_sortable").sortable("serialize", { key: "content[]" });
  ajaxRequestGet('../include/ajaxReqDisposition.php', 'mode=sortVehicleTimeline&csId=<?php echo $csId ?>&crvhId=' + crvhId + '&currDay=<?php echo $currentSelectedDay ?>&hourTimeUnits=<?php echo $hourTimeUnits ?>&' + sorted);
  if (isSorted == '1') {
     // ....
  }
  finishPage('');
}

$(function() {
  $( "#itemsort_sortable" ).sortable();
  $( "#itemsort_sortable" ).disableSelection();
});
// **** ITEM SORT END ****

/*
function searchAddress(mode) {
  var f_street = document.forms[0].f_ad_street.value;
  var f_zipcode = document.forms[0].f_ad_zipcode.value;
  var f_city = document.forms[0].f_ad_city.value;
  
  if (mode == 'cs') {
     var customerId = document.forms[0].customerId.value;
     var cscIdRoot = document.forms[0].cscIdRoot.value;
     var cscIdActual = document.forms[0].cscIdActual.value;  
  } else {
     var customerId = '';
     var cscIdRoot = '';
     var cscIdActual = '';
  }
  
  var f_act = 'search';

  var widthPopupWin = 800;
  var heightPopupWin = 600;
  var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
  var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
  var popupWin;
  popupWin = window.open("../admin/ad_list.php?f_act=" + f_act + "&f_street=" + f_street + "&f_zipcode=" + f_zipcode + "&f_city=" + f_city + "&customerId=" + customerId + "&cscIdRoot=" + cscIdRoot + "&cscIdActual=" + cscIdActual, "","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
};
*/


/*
        	 if (confirm('<?php echo getLngt("Möchten Sie die Rollkarte umsortieren?") ?>')) {
              // crvhEco[" . $crvhId . "][" . $i . "]
              $("#itemsort_crvh").val(actionObjId);
              var numOfEcosOfVehicle = crvhEco[actionObjId].length;
              var itemSortEco;
              for(i=0; i<numOfEcosOfVehicle; ++i) {
              	 itemSortEco = 'is_' + padl(i.toString(),2,'0');
              	 $("#itemsort_sortable").append('<li id="' + itemSortEco + '"></li>');
                 $('#' + itemSortEco).html(ecoTextDefaultArray[crvhEco[actionObjId][i]]);
              }
              myhide('actioncontainer');
              callItemSort();
           }
*/


