function dropDown(action) {
  document.getElementById("div_company_menu").style.visibility = action;
}

function viewTeam(nb) {
  var form = document.getElementById("teamForm");
  
  form.salesOnly.value = nb;
  form.submit();
}

function showEmployee(eId) {
  var form = document.getElementById("employeeInfoForm");
  
  form.empId.value = eId;
  form.submit();
}

function showInfo(mo) {
  var vidForm = document.getElementById("movieInfoForm");
  vidForm.movId.value = mo;
  vidForm.submit();
}

function showCatalog(typ,gnr) {
  var typForm = document.getElementById("showCatalogForm");
  typForm.catT.value = typ;
  typForm.catG.value = gnr;
  typForm.submit();
}

function goToCatalogPage(cNum, cType, cGenre, cSearch) {
  var catForm = document.getElementById("catalogForm");
  catForm.catP.value = cNum;
  catForm.catT.value = cType;
  catForm.catG.value = cGenre;
  catForm.catS.value = cSearch;
  catForm.submit();
}

function goToPage(catPage) {
  var selType = document.getElementById("selectType");
  var selGenre = document.getElementById("selectGenre");
  var search = document.getElementById('searchbox').value;
  if(search == "") { 
    search = "0";
  }
  goToCatalogPage(catPage, selType.value, selGenre.value, search);
}

function displayCatalogChoice() {
  var selType = document.getElementById("selectType");
  var selGenre = document.getElementById("selectGenre");
  goToCatalogPage(1, selType.value, selGenre.value, "0");
}

function showContactInfo() {
  var contactForm = document.getElementById("contactForm");
  var selTerritory = document.getElementById("selectTerritory");
  contactForm.terId.value = selTerritory.value;
  contactForm.submit();
}

function searchCatalog(e) {
  var s = document.getElementById('searchbox').value;
  if(e.keyCode == 13) {
    doSearch();
  }
}

function doSearch() {
  var s = document.getElementById('searchbox').value;
  var catForm = document.getElementById("catalogForm");
  if(s.length > 0) {
    goToCatalogPage(1,-1,-1, s);
  }
  else {
    goToCatalogPage(1,-1,-1, "0");
  }
}

function showBorder(obj) {
  obj.style.borderColor = '#5370FF';
}

function hideBorder(obj) {
  obj.style.borderColor = 'transparent';
}

function highlightTitle(obj) {
  obj.style.color = '#5370FF';
}

function normalTitle(obj) {
  obj.style.color = 'black';
}

function highlightCategory(obj) {
  obj.style.color = '#5370FF';
}

function normalCategory(obj) {
  obj.style.color = 'white';
}

function highlightName(obj) {
  obj.style.color = '#88DAF8';
  obj.style.fontWeight = 'bold';
}

function normalName(obj) {
  obj.style.color = 'black';
  obj.style.fontWeight = 'normal';
}

