function newXMLHttpRequest() { var xmlHttp = null; try { xmlHttp = new XMLHttpRequest(); } catch (e) { try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } function cancelRequest() { var formName = document.getElementById("newCertForm"); if (confirm('Are you sure you want to cancel the request?')) { formName.action = 'cancelCertificateRequest.html'; formName.submit(); return true; } else { return false; } } function nextTest() { var formName = document.getElementById("newCertForm"); formName.action = 'nextView.html'; formName.submit(); } function getShipperStates(stateValue) { setTimeout(function () { getShipperStates1(stateValue) }, 1000); } function getShipperStates1(stateValue) { var req = newXMLHttpRequest(); if (req == null) { alert("Your browser does not support AJAX!"); return; } var table; var select; var ROW; var CELL; var url; var INX = document.getElementById("shippercountry").options.selectedIndex; var code = document.getElementById("shippercountry").options[INX].innerText; var zip = document.getElementById("shipperZip"); //zip.value=""; if (code == "US" || code == "United States") { table = document.getElementById("shipperTable"); zip.onkeyup = new Function("ZIPMASK_USCAN(event,this);"); select = document.createElement('select'); select.name = "shipperstate"; select.id = "shipperstate"; select.className = "question_style"; ROW = table.rows.item(0); ROW.deleteCell(0); CELL = ROW.insertCell(0); CELL.appendChild(select); ROW.appendChild(CELL); document.getElementById("disStateReq").style.visibility = "visible"; req.onreadystatechange = getShipperStatesHandler(req, stateValue); url = "states.html"; url = url + "?code=" + code; url = url + '&' + new Date().getTime(); req.open("GET", url, true); req.send(null); } else if (code == "Canada") { table = document.getElementById('shipperTable'); zip = document.getElementById("shipperZip"); zip.onkeypress = new Function(""); zip.onkeyup = new Function("ZIPMASK_CAN(event,this)"); select = document.createElement('select'); select.name = "shipperstate"; select.id = "shipperstate"; select.className = "question_style"; document.getElementById("disStateReq").style.visibility = "visible"; ROW = table.rows.item(0); ROW.deleteCell(0); CELL = ROW.insertCell(0); CELL.appendChild(select); ROW.appendChild(CELL); req.onreadystatechange = getShipperStatesHandler(req, stateValue); url = "canada.html"; url = url + "?code=" + code; url = url + '&' + new Date().getTime(); req.open("GET", url, true); req.send(null); } else { table = document.getElementById('shipperTable'); zip.onkeypress = new Function(""); zip.onkeyup = new Function(""); var input = document.createElement('input'); input.name = "shipperstate"; input.id = "shipperstate"; input.className = "question_style"; input.size = "30"; document.getElementById("disStateReq").style.visibility = "hidden"; if (stateValue != null) input.value = stateValue; else document.getElementById("shipperzip").value = ""; ROW = table.rows.item(0); ROW.deleteCell(0); CELL = ROW.insertCell(0); CELL.appendChild(input); ROW.appendChild(CELL); document.getElementById("shipperstate").maxLength = 30; } } function getShipperStatesHandler(req, stateValue) { return function () { if (req.readyState == 4) { if (req.status == 200) { var array = new Array() var TXT = req.responseText; array = TXT.split(","); INSERT_SHIPPER_STATES(array, stateValue); } else { alert("HTTP error: " + req.status); } } } } function INSERT_SHIPPER_STATES(array, stateValue) { document.getElementById("shipperstate").options.length = 0; var SELECT = document.getElementById("shipperstate"); for (var i = 0;i < array.length;i++) { if (array[i] != "") { var ELEMENT = array[i]; var elementarray = new Array() elementarray = ELEMENT.split("|"); if (elementarray[1] != " " || elementarray[0] != " ") { SELECT.options[SELECT.length] = new Option(elementarray[1], elementarray[0]); } } } SELECT.style.width = "200px"; var str = ""; if (stateValue != null) str = stateValue.replace(/^\s+/, ''); if (str != null && stateValue != null) SELECT.value = str; else document.getElementById("shipperZip").value = ""; } function saveRequest() { var formName = document.getElementById("newCertForm"); formName.action = 'saveCertificateValues.html'; formName.submit(); return true; } function datesValidate() { if (!(checkEffExpDates())) { alert("Season start date cannot be after season end date."); document.all.SS.focus(); return false; } else { return true; } } function checkEffExpDates() { var value1 = document.all.SS.value; var value2 = document.all.ES.value; if (value2 != "") { if (compareDates1(value1, value2)) { return true; } else { return false; } } else { return true; } } function compareDates1(value1, value2) { var date1, date2; var month1, month2; var year1, year2; month1 = value1.substring(0, value1.indexOf("/")); day1 = value1.substring(value1.indexOf("/") + 1, value1.lastIndexOf("/")); year1 = value1.substring(value1.lastIndexOf("/") + 1, value1.length); month2 = value2.substring(0, value2.indexOf("/")); day2 = value2.substring(value2.indexOf("/") + 1, value2.lastIndexOf("/")); year2 = value2.substring(value2.lastIndexOf("/") + 1, value2.length); date1 = year1 + month1 + day1; date2 = year2 + month2 + day2; if (date1 > date2) { return false; } else { return true; } } function getLocStates() { var req = newXMLHttpRequest(); if (req == null) { alert("Your browser does not support AJAX!"); return; } var table; var select; var ROW; var CELL; var url; var INX = document.getElementById("loccountry").options.selectedIndex; var code = document.getElementById("loccountry").options[INX].innerText; var zip = document.getElementById("loczip"); zip.value = ""; if (code == "US" || code == "United States") { table = document.getElementById("paymentTable"); zip.onkeypress = new Function("ZIPMASK_USCAN(event,this)"); select = document.createElement('select'); select.name = "locstate"; select.id = "locstate"; select.className = "select"; ROW = table.rows.item(1); ROW.deleteCell(1); CELL = ROW.insertCell(1); CELL.appendChild(select); ROW.appendChild(CELL); req.onreadystatechange = getLocStatesHandler(req); url = "states.html"; url = url + "?code=" + code; url = url + "&tt=" + new Date().getTime(); req.open("GET", url, true); req.send(null); } else if (code == "Canada") { table = document.getElementById('paymentTable'); zip = document.getElementById("loczip"); zip.onkeypress = new Function(""); zip.onkeyup = new Function("ZIPMASK_CAN(event,this)"); select = document.createElement('select'); select.name = "locstate"; select.id = "locstate"; select.className = "select"; ROW = table.rows.item(1); ROW.deleteCell(1); CELL = ROW.insertCell(1); CELL.appendChild(select); ROW.appendChild(CELL); req.onreadystatechange = getLocStatesHandler(req); url = "canada.html"; url = url + "?code=" + code; req.open("GET", url, true); req.send(null); } else { table = document.getElementById('paymentTable'); zip.onkeyup = new Function(""); var input = document.createElement('input'); input.name = "locstate"; input.id = "locstate"; input.className = "form_field"; input.size = "25"; ROW = table.rows.item(1); ROW.deleteCell(1); CELL = ROW.insertCell(1); CELL.appendChild(input); ROW.appendChild(CELL); } } function getLocStatesHandler(req) { return function () { if (req.readyState == 4) { if (req.status == 200) { var array = new Array() var TXT = req.responseText; array = TXT.split(","); INSERT_LOC_STATES(array); } else { alert("HTTP error: " + req.status); } } } } function INSERT_LOC_STATES(array) { var SELECT = document.getElementById("locstate"); for (var i = 0;i < array.length;i++) { if (array[i] != "") { var ELEMENT = array[i]; var elementarray = new Array() elementarray = ELEMENT.split("|"); if (elementarray[1] != " " || elementarray[0] != " ") { SELECT.options[SELECT.length] = new Option(elementarray[1], elementarray[0]); } } } SELECT.style.width = "220px"; } function setStorage() { var req = newXMLHttpRequest(); if (req == null) { alert("Your browser does not support AJAX!"); return; } req.onreadystatechange = getStorageHandler(req); var locname = document.getElementById("locname").value; var locaddress1 = document.getElementById("locaddress1").value; var locaddress2 = document.getElementById("locaddress2").value; var loccity = document.getElementById("loccity").value; var loczip = document.getElementById("loczip").value; var INX = document.getElementById("loccountry").options.selectedIndex; var loccountry = document.getElementById("loccountry").options[INX].value; var locstate = ""; if (document.getElementById("locstate").options == null) { locstate = document.getElementById("locstate").value; } else { INX = document.getElementById("locstate").options.selectedIndex; locstate = document.getElementById("locstate").options[INX].value; } var PROD = document.getElementById("PROD").value; if (locname == "" || locaddress1 == "" || loccity == "" || loczip == "" || loccountry == "" || locstate == "") { alert("please enter all information of your storage location"); return; } else if (PROD == "") { alert("please enter your storage product"); return; } //var LOC = document.getElementById("locname").value; // var PROD = document.getElementById("PROD").value; var url = "storage.html"; url = url + "?locname=" + locname; url = url + "&locaddress1=" + locaddress1; url = url + "&locaddress2=" + locaddress2; url = url + "&loccity=" + loccity; url = url + "&locstate=" + locstate; url = url + "&loczip=" + loczip; url = url + "&loccountry=" + loccountry; url = url + "&prod=" + PROD; url = url + '&' + Math.random(); req.open("GET", url, true); req.send(null); } function getStorageHandler(req) { return function () { if (req.readyState == 4) { if (req.status == 200) { var array = new Array(); var TXT = req.responseText; array = TXT.split("|"); INSERT_PRODUCTS(array); } else { alert("HTTP error: " + req.status); } } } } function INSERT_PRODUCTS(array) { var ID = array[0]; var locname = array[1]; var locaddress1 = array[2]; var locaddress2 = array[3]; var loccity = array[4]; var locstate = array[5]; var loczip = array[6]; var loccountry = array[7]; var loccountry_id = array[8]; var PROD = array[9]; var LOC = "Name: " + locname; var address = "Address: " + locaddress1 + " " + locaddress2 + ", "; var address2 = loccity + ", " + locstate + "-" + loczip + ", " + loccountry; var STR = LOC + " " + address; //var PROD = array[2]; var productTable = document.getElementById("storageTable"); var count = parseInt(productTable.rows.length); var ROW = productTable.insertRow(count); //ROW.id = id; //WHAT BROWSER var CELL = ROW.insertCell(0); var current_field = document.createElement('p'); current_field.size = "0"; var newtxt = document.createTextNode(ID); current_field.appendChild(newtxt); CELL.appendChild(current_field); CELL.id = ID; CELL.style.visibility = "hidden"; ROW.appendChild(CELL); var browser = navigator.appName; // CREATE TABLE ROWS WITH VALUES // for(var i=1;i < productTable.rows.length;j++) { var ROW = productTable.rows[j]; var CELLS = productTable.rows[j].cells; var ID = CELLS[0].id; if (ID == key) { productTable.deleteRow(j); break; } } } function EDIT_PRODUCTS(key) { //CLEAN_COMMODITY(); var array = new Array(); var productTable = document.getElementById('storageTable'); var LOC = document.getElementById("LOC"); var PROD = document.getElementById("PROD"); //Clean table row for (var j = 0;j < productTable.rows.length;j++) { var ROW = productTable.rows[j]; var CELLS = productTable.rows[j].cells; var ID = CELLS[0].id; if (ID == key) { if (LOC.value != "") { alert("Please submit your selections before starting a new edit") LOC.style.backgroundColor = "InfoBackground"; PROD.style.backgroundColor = "InfoBackground"; } else { LOC.value = CELLS[1].innerText; PROD.value = CELLS[2].innerText; productTable.deleteRow(j); break; } } } } function openOption(key) { var ID = key.id; var CHECK = document.getElementById(ID); if (CHECK.checked == true) { document.getElementById(ID + "Opt").style.display = "block"; } else { document.getElementById(ID + "Opt").style.display = "none"; } } function checkEUCountry(orgValue, mollFlag) { var euCountry = document.getElementById("exportCountry").value; var countryName; var countryID; var orgcountryName; var orgcountryID; countryID = euCountry.substring(0, euCountry.indexOf(' - ')); countryName = euCountry.substring(euCountry.indexOf(' - ') + 2, euCountry.length); orgcountryID = orgValue.substring(0, orgValue.indexOf(' - ')); orgcountryName = orgValue.substring(orgValue.indexOf(' - ') + 2, orgValue.length); //297,786,165,190,305,570,855 if (orgcountryID != '297' && orgcountryID != '786' && orgcountryID != '165' && orgcountryID != '190' && orgcountryID != '305' && orgcountryID != '570' && orgcountryID != '855') { if (mollFlag != null && mollFlag == 'true') { if (countryID == '297' || countryID == '786' || countryID == '165' || countryID == '190' || countryID == '305' || countryID == '570' || countryID == '855') { alert('This EU country cannot be selected. You have currently selected an EU country that offers only the EU Fishery Products certificate type. In order to request only the EU Fishery Products certificate type, please create a new certificate request.'); document.getElementById("exportCountry").value = orgValue; } } } } function disableNoOfCerts() { var sDate = document.getElementById("Today"); var tmDate = document.getElementById("This"); var nmDate = document.getElementById("Next"); var noOfCerts = document.getElementById("batch"); if (sDate != null && tmDate != null && nmDate != null && noOfCerts != null && sDate.checked == false && tmDate.checked == false && nmDate.checked == false) { noOfCerts.disabled = true; noOfCerts.value = "1"; } else if (sDate != null && noOfCerts != null && sDate.checked == true) { noOfCerts.disabled = true; noOfCerts.value = "1"; } else { if (noOfCerts != null) noOfCerts.disabled = false; } } function saveCertCommFieldRequest() { var formName = document.getElementById("newCertForm"); var sDate = document.getElementById("Today"); var tmDate = document.getElementById("This"); var nmDate = document.getElementById("Next"); var Wildcaught = document.getElementById("Wildcaught"); var Aquaculture = document.getElementById("Aquaculture"); var vendor_id_obj = document.getElementById("VEN_ID"); if (vendor_id_obj != null) vendor_id = vendor_id_obj.value; if (Wildcaught != null && Aquaculture != null && Wildcaught.checked == false && Aquaculture.checked == false) { alert("Please select Harvest Information"); return false; } if (sDate != null && tmDate != null && nmDate != null && sDate.checked == false && tmDate.checked == false && nmDate.checked == false) { alert("Please select the date of certificates"); return false; } else { formName.action = 'saveCertificateValues.html?vendor_id=' + vendor_id; formName.submit(); document.getElementById("nextButton").disabled = true; return true; } } function submitReuse() { if (confirm('Are you sure you want to Re-use certificate values?')) { var formName = document.getElementById("newCertForm"); formName.action = "reuseCRValues.html"; formName.submit(); } else { return false; } } function submitSupercede() { if (confirm('Are you sure you want to Supersede this certificate?')) { var formName = document.getElementById("newCertForm"); formName.action = "supersedeThisCertificate.html"; formName.submit(); } else { return false; } } function goTogrid() { var formName = document.getElementById("newCertForm"); formName.action = "completeCertificatePage.html"; formName.submit(); } function setChangeContractStorage() { var req = newXMLHttpRequest(); if (req == null) { alert("Your browser does not support AJAX!"); return; } req.onreadystatechange = getChangeContractStorageHandler(req); var locname = document.getElementById("locname").value; var locaddress1 = document.getElementById("locaddress1").value; var locaddress2 = document.getElementById("locaddress2").value; var loccity = document.getElementById("loccity").value; var loczip = document.getElementById("loczip").value; var INX = document.getElementById("loccountry").options.selectedIndex; var loccountry = document.getElementById("loccountry").options[INX].value; var locstate = ""; if (document.getElementById("locstate").options == null) { locstate = document.getElementById("locstate").value; } else { var INX = document.getElementById("locstate").options.selectedIndex; locstate = document.getElementById("locstate").options[INX].value; } var PROD = document.getElementById("PROD").value; if (locname == "" || locaddress1 == "" || loccity == "" || loczip == "" || loccountry == "" || locstate == "") { alert("please enter all information of your storage location"); return; } else if (PROD == "") { alert("please enter your storage product"); return; } var url = "storage.html"; url = url + "?locname=" + locname; url = url + "&locaddress1=" + locaddress1; url = url + "&locaddress2=" + locaddress2; url = url + "&loccity=" + loccity; url = url + "&locstate=" + locstate; url = url + "&loczip=" + loczip; url = url + "&loccountry=" + loccountry; url = url + "&prod=" + PROD; url = url + '&' + Math.random(); req.open("GET", url, true); req.send(null); } function getChangeContractStorageHandler(req) { return function () { if (req.readyState == 4) { if (req.status == 200) { var array = new Array() var TXT = req.responseText; var array = new Array(); array = TXT.split("|"); INSERT_CHANGE_CONTRACT_PRODUCTS(array); } else { alert("HTTP error: " + req.status); } } } } function INSERT_CHANGE_CONTRACT_PRODUCTS(array) { var ID = array[0]; var locname = array[1]; var locaddress1 = array[2]; var locaddress2 = array[3]; var loccity = array[4]; var locstate = array[5]; var loczip = array[6]; var loccountry = array[7]; var loccountry_id = array[8]; var PROD = array[9]; var STR0 = locname; var STR1 = locaddress1 + " " + locaddress2 + " " + " " + loccity + ""; var STR2 = locstate + " " + loczip + " " + " | Country: " + loccountry + ""; var STR3 = PROD; // creates a element and a element var tbl = document.createElement("table"); var tblBody = document.createElement("tbody"); var row = document.createElement("tr"); //STR0 var cell = document.createElement("td"); var bold_field = document.createTextNode("Name:"); cell.appendChild(bold_field); cell.style.fontWeight = 700; row.appendChild(cell); var cell = document.createElement("td"); var cellText = document.createTextNode(STR0); cell.appendChild(cellText); row.appendChild(cell); tblBody.appendChild(row); var row = document.createElement("tr"); //SR1 var cell = document.createElement("td"); var bold_field = document.createTextNode("Address:"); cell.appendChild(bold_field); cell.style.fontWeight = 700; row.appendChild(cell); var cell = document.createElement("td"); var cellText = document.createTextNode(STR1); cell.appendChild(cellText); row.appendChild(cell); tblBody.appendChild(row); var row = document.createElement("tr"); //SR2 var cell = document.createElement("td"); var bold_field = document.createTextNode(" "); cell.appendChild(bold_field); cell.style.fontWeight = 700; row.appendChild(cell); var cell = document.createElement("td"); var cellText = document.createTextNode(STR2); cell.appendChild(cellText); row.appendChild(cell); tblBody.appendChild(row); var row = document.createElement("tr"); //SR3 var cell = document.createElement("td"); var bold_field = document.createTextNode("Products:"); cell.appendChild(bold_field); cell.style.fontWeight = 700; row.appendChild(cell); var cell = document.createElement("td"); var cellText = document.createTextNode(STR3); cell.appendChild(cellText); row.appendChild(cell); tblBody.appendChild(row); tbl.appendChild(tblBody); var productTable = document.getElementById("storageTable"); var count = parseInt(productTable.rows.length); var ROW = productTable.insertRow(count); //WHAT BROWSER var CELL = ROW.insertCell(0); var current_field = document.createElement('hidden'); current_field.setAttribute('type', 'text'); current_field.setAttribute('value', ID); CELL.appendChild(current_field); CELL.id = ID; CELL.style.visibility = "hidden"; ROW.appendChild(CELL); var CELL = ROW.insertCell(1); current_field.appendChild(tbl); CELL.appendChild(current_field); CELL.style.width = "575px"; ROW.appendChild(CELL); // creates a remove button Node var CELL = ROW.insertCell(2); var remove_button = document.createElement('input'); remove_button.setAttribute('type', 'button'); remove_button.setAttribute('value', 'Remove'); remove_button.onclick = new Function("removeChangeContract('" + ID + "')"); remove_button.className = "removebutton"; CELL.appendChild(remove_button); ROW.appendChild(CELL); ROW.style.width = "605px"; //CLEAN document.getElementById("locname").value = ""; document.getElementById("locaddress1").value = ""; document.getElementById("locaddress2").value = ""; document.getElementById("loccity").value = ""; document.getElementById("loczip").value = ""; var loccountry = document.getElementById("loccountry"); loccountry.options[0].selected = true; if (document.getElementById("locstate").options == null) { var table = document.getElementById('paymentTable'); var input = document.createElement('select'); input.name = "locstate"; input.id = "locstate"; input.className = "select"; input.size = "1"; input.style.width = "221px" var ROW = table.rows.item(1); ROW.deleteCell(1); var CELL = ROW.insertCell(1); CELL.appendChild(input); ROW.appendChild(CELL); var option = new Option(" - state - ", " -- ") document.getElementById("locstate").options[0] = option; } else { document.getElementById("locstate").options.length = 0; var option = new Option(" - state - ", " -- ") document.getElementById("locstate").options[0] = option; } document.getElementById("PROD").value = ""; } function removeChangeContract(key) { var req = newXMLHttpRequest(); if (req == null) { alert("Your browser does not support AJAX!"); return; } req.onreadystatechange = removeChangeContractProductsHandler(req); var url = "removestorage.html"; url = url + "?key=" + key; req.open("GET", url, true); req.send(null); } function removeChangeContractProductsHandler(req) { return function () { if (req.readyState == 4) { if (req.status == 200) { var array = new Array() var TXT = req.responseText; REMOVE_CG_CON_PRODUCTS(TXT); } else { alert("HTTP error: " + req.status); } } } } function REMOVE_CG_CON_PRODUCTS(key) { //CLEAN_COMMODITY(); var array = new Array(); var productTable = document.getElementById('storageTable'); //Clean table row for (var j = 0;j < productTable.rows.length;j++) { var ROW = productTable.rows[j]; var CELLS = productTable.rows[j].cells; var ID = CELLS[0].id; if (ID == key) { productTable.deleteRow(j); break; } } } function changeClass(id, newClass) { identity = document.getElementById(id); identity.className = newClass; } function start() { document.getElementById("user").focus(); return true; } function validateData() { if ((document.all.npwd.value == "") | (document.all.npwd.value.length < 8)) { alert("NewPassword is empty or contains less characters.\nNewPassword should be eight characters or more."); document.all.npwd.focus(); return false; } else if ((document.all.cnfpwd.value == "") | (document.all.cnfpwd.value.length < 8)) { alert("Confirm Password is empty or contains less characters.\nConfirm Password should be eight characters or more."); document.all.cnfpwd.focus(); return false; } else if (!(compPwd())) { alert("Password and Confirm Password are not same.\n Please re-Enter."); document.all.npwd.focus(); return false; } else { return true; } } function compPwd() { var pw = document.all.npwd.value; var cnfpw = document.all.cnfpwd.value; if (pw != cnfpw) { return false; } return true; } function enabledisableProductsOnIUU(val) { var NO = document.getElementById("productOnIUUNO"); var YES = document.getElementById("productOnIUUYES"); var F_NO = document.getElementById("foreignSourcedOrUSNO"); var F_YES = document.getElementById("foreignSourcedOrUSYES"); // var tableheaderid = document.getElementById("harvestTypeTable1"); // var tableid = document.getElementById("harvestTypeTable2"); if (F_YES != null && F_NO != null) { if (val == 'YES') { if (NO != null) { NO.checked = true; NO.disabled = true; } if (YES != null) YES.disabled = true; } if (val == 'NO') { if (NO != null) NO.disabled = false; if (YES != null) YES.disabled = false; } } } function processorTitle(boo) { var processorTitle = document.getElementById("procProdTitle"); var registeredFarmTitle = document.getElementById("regFarmTitle"); var aquaRD = document.getElementById("Aquaculture"); var wildRD = document.getElementById("Wildcaught"); if (boo != null && boo == 'true') { if (aquaRD.checked == true) { if (registeredFarmTitle != null) { registeredFarmTitle.style.display = 'block'; processorTitle.style.display = 'none'; } } if (wildRD.checked == true) { if (processorTitle != null) { registeredFarmTitle.style.display = 'none'; processorTitle.style.display = 'block'; } } } } function enableColdWater() { var latt = document.getElementById("lattitude"); var lon = document.getElementById("longtitude"); var coldWaterRD = document.getElementById("coldWaterExemption"); var lat_lable = document.getElementById("latd"); var long_lable = document.getElementById("lond"); if (coldWaterRD != null && coldWaterRD.checked == true) { latt.style.display = 'block'; lon.style.display = 'block'; lat_lable.style.display = 'block'; long_lable.style.display = 'block'; } if (coldWaterRD != null && coldWaterRD.checked == false) { latt.value = ""; lon.value = ""; latt.style.display = 'none'; lon.style.display = 'none'; lat_lable.style.display = 'none'; long_lable.style.display = 'none'; } } function disableAllMexicanChxBox() { var virusTXT = document.getElementById("virusTestingTXT"); var latt = document.getElementById("lattitude"); var lon = document.getElementById("longtitude"); var virusTestingRD = document.getElementById("virusTesting"); var coldWaterRD = document.getElementById("coldWaterExemption"); var cookedProdRD = document.getElementById("cookedProdExemption"); var noneMexico = document.getElementById("noneMexico"); var lab_lable = document.getElementById("lab"); var lat_lable = document.getElementById("latd"); var long_lable = document.getElementById("lond"); if (noneMexico != null && noneMexico.checked == true) { if (virusTestingRD != null && virusTestingRD.checked == true) { virusTXT.style.display = 'none'; lab_lable.style.display = 'none'; } if (coldWaterRD != null && coldWaterRD.checked == true) { latt.style.display = 'none'; lon.style.display = 'none'; lat_lable.style.display = 'none'; long_lable.style.display = 'none'; } if (virusTestingRD != null) { virusTestingRD.checked = false; virusTestingRD.disabled = true; } if (coldWaterRD != null) { coldWaterRD.checked = false; coldWaterRD.disabled = true; } if (cookedProdRD != null) { cookedProdRD.checked = false; cookedProdRD.disabled = true; } } else { if (virusTestingRD != null && coldWaterRD != null && cookedProdRD != null) { virusTestingRD.disabled = false; coldWaterRD.disabled = false; cookedProdRD.disabled = false; } } } function enableVirusTesting() { var virusTXT = document.getElementById("virusTestingTXT"); var virusTestingRD = document.getElementById("virusTesting"); var lab_lable = document.getElementById("lab"); if (virusTestingRD != null && virusTestingRD.checked == true) { virusTXT.style.display = 'block'; lab_lable.style.display = 'block'; } if (virusTestingRD != null && virusTestingRD.checked == false) { virusTXT.value = ""; virusTXT.style.display = 'none'; lab_lable.value = ""; lab_lable.style.display = 'none'; } } function backRequest_IC() { var formName = document.getElementById("newCertForm"); formName.action = 'saveCountryToExport.html'; document.getElementById("export").value = 'YES'; formName.submit(); } function saveRequest_IC() { var formName = document.getElementById("newCertForm"); formName.action = 'saveProductsForExportQ.html'; formName.submit(); return true; } function validateLogin() { var userName = document.getElementById("user"); var psd = document.getElementById("pwd"); if (userName.value == "") { alert("User Name is required"); userName.style.backgroundColor = "rgb(245,134,134)"; userName.focus(); return false; } else if (psd.value == "") { alert("Password is required"); psd.style.backgroundColor = "rgb(245,134,134)"; psd.focus(); return false; } else { return true; } } function start() { if (document.getElementById("user") != null) document.getElementById("user").focus(); return true; } function setFocus() { var strEmail = new String(document.loginform.email.value); if (strEmail.length > 0) { document.loginform.password.focus(); } else { document.loginform.email.focus(); } } function openIUUPage2() { window.open("pdf/EU_IUU_CatchCertificate_Page2.pdf"); } function confirmCancel() { var theForm = document.getElementById("theForm"); if (confirm("Do you want to cancel this contract?")) { theForm.action = "cancelcontract.html"; theForm.submit(); return true; } else { return false; } } function hidetype(val) { //alert("hidden"); var delay_hide = 6000; // var divID = document.getElementById("certType"); // var divID2 = document.getElementById("certType2"); // var divID3 = document.getElementById("certType3"); // var divID4 = document.getElementById("certType4"); if (val == '1') { // divID.style.display='block'; // divID2.style.display='block'; // divID3.style.display='block'; // divID4.style.display='block'; document.getElementById("IR_FORM").style.display = 'none'; document.getElementById("IR_SAVE").style.display = 'none'; document.getElementById("IR_SUBMIT").style.display = 'none'; } else if (val == '2') { setTimeout("delayT()", delay_hide) } } function delayT() { var divID = document.getElementById("IR_FORM"); // var divID1 = document.getElementById("certType"); // var divID2 = document.getElementById("certType2"); // var divID3 = document.getElementById("certType3"); // var divID4 = document.getElementById("certType4"); // divID1.style.display='none'; // divID2.style.display='none'; // divID3.style.display='none'; // divID4.style.display='none'; divID.style.display = 'none'; divID.style.display = 'none'; document.getElementById("IR_SAVE").style.display = 'none'; document.getElementById("IR_SUBMIT").style.display = 'none'; } function hideIR(val) { var delay_hide = 6000; var divID = document.getElementById("IR_FORM"); if (val == '1') { divID.style.display = 'block'; document.getElementById("IR_SAVE").style.display = 'block'; document.getElementById("IR_SUBMIT").style.display = 'block'; } else if (val == '2') { setTimeout("delayIR()", delay_hide) } } function delayIR() { var divID = document.getElementById("IR_FORM"); divID.style.display = 'none'; document.getElementById("IR_SAVE").style.display = 'none'; document.getElementById("IR_SUBMIT").style.display = 'none'; } //function openCertWindow(iid) //{ //window.open("bicertificate.html?rowid="+iid+"&certificatetype=3") //} function getStateByCountry(name, userID) { //alert("123456-->"+userID); if (name == "926 - United States") { document.getElementById("taxidTable").style.visibility = 'visible'; document.getElementById("taxidTable1").style.visibility = 'visible'; } else { document.getElementById("taxidTable").style.visibility = 'hidden'; document.getElementById("taxidTable1").style.visibility = 'hidden'; } var newForm = document.getElementById("customerform"); newForm.action = "getNewCustomerStates.html?id=" + name + "&Bhu87YgV=" + userID; newForm.submit(); } function showSSN() { var table = document.getElementById('taxidTable'); var input = document.createElement('input'); input.setAttribute('type', 'password'); input.name = "ssn"; input.id = "ssn"; input.className = "question_style"; input.size = "20"; var ROW = table.rows.item(1); ROW.deleteCell(1); var CELL = ROW.insertCell(0); CELL.appendChild(input); ROW.appendChild(CELL); } function showSSNforCFN() { //alert("hello") //alert(document.getElementById('taxIdRadioButVal1').value) var taxIdRadioButVal1 = document.getElementById('taxIdRadioButVal1').value var taxIdNo1 = document.getElementById('taxIdNo1').value //alert(document.getElementById('taxIdNo1').value) if (taxIdRadioButVal1 == "YES") { var table = document.getElementById('taxidTable'); var input = document.createElement('input'); input.setAttribute('type', 'password'); input.name = "ssn"; input.id = "ssn"; input.className = "form_field_gray"; input.size = "20"; input.value = taxIdNo1; var ROW = table.rows.item(1); ROW.deleteCell(1); var CELL = ROW.insertCell(0); CELL.appendChild(input); ROW.appendChild(CELL); } } function showforCFN() { var taxIdRadioButVal1 = document.getElementById('taxIdRadioButVal1').value var taxIdNo1 = document.getElementById('taxIdNo1').value //alert(document.getElementById('taxIdNo1').value) if (taxIdRadioButVal1 == "NO") { var table = document.getElementById('taxidTable'); var input = document.createElement('input'); input.setAttribute('type', 'text'); input.name = "taxID"; input.id = "taxID"; input.className = "form_field_gray"; input.size = "20"; input.value = taxIdNo1; input.setAttribute('maxLength', '10'); input.onkeypress = new Function("return enterDigit(event);"); input.onkeyup = new Function("javascript:TAXID_MASK(this)"); var ROW = table.rows.item(1); ROW.deleteCell(1); var CELL = ROW.insertCell(0); CELL.appendChild(input); ROW.appendChild(CELL); } } function show() { var table = document.getElementById('taxidTable'); var input = document.createElement('input'); input.setAttribute('type', 'text'); input.name = "taxID"; input.id = "taxID"; input.className = "question_style"; input.size = "20"; input.setAttribute('maxLength', '10'); input.onkeypress = new Function("return enterDigit(event);"); input.onkeyup = new Function("javascript:TAXID_MASK(this)"); var ROW = table.rows.item(1); ROW.deleteCell(1); var CELL = ROW.insertCell(0); CELL.appendChild(input); ROW.appendChild(CELL); } function showHide() { var countryName = document.customerform.country; ////alert("**countryName**"+countryName); if (countryName.value == "926 - United States") { ////alert("IF"); document.getElementById("taxidTable").style.visibility = 'visible'; document.getElementById("taxidTable1").style.visibility = 'visible'; } else { ////alert("ELSE"); document.getElementById("taxidTable").style.visibility = 'hidden'; document.getElementById("taxidTable1").style.visibility = 'hidden'; } } function saveProdForExpQRequest() { var radYES = document.getElementById("exportYes").checked; var radNO = document.getElementById("exportNo").checked; if (radYES == false && radNO == false) { alert("Please select an option"); return false; } else { var formName = document.getElementById("newCertForm"); formName.action = 'saveProductsForExportQ.html'; formName.submit(); return true; } } function checkBalance(vendorID) { var req = newXMLHttpRequest(); if (req == null) { alert("Your browser does not support AJAX!"); return; } req.onreadystatechange = getcheckBalanceReadyStateHandler(req); var url = "checkBalance.html"; url = url + "?code=" + vendorID; url = url + '&' + Math.random(); req.open("GET", url, true); req.send(null); } function getcheckBalanceReadyStateHandler(req) { return function () { if (req.readyState == 4) { if (req.status == 200) { var TXT = req.responseText; if (TXT == "true") { alert("You do not have enough balance to make a Refund Request.\nPlease contact your local Seafood Inspection Program Office for further details"); return false; } else { return true; } } else { alert("HTTP error: " + req.status); } } } } function cancelRequest_reuseCertCommFld() { var formName = document.getElementById("newCertForm"); if (confirm('Are you sure you want to cancel the request?')) { formName.action = 'mycertificates.html'; document.getElementById("certificateName").value = ""; formName.submit(); return true; } else { return false; } } function saveRequest_reuseCertCommFld() { var formName = document.getElementById("newCertForm"); var sDate = document.getElementById("Today"); var tmDate = document.getElementById("This"); var nmDate = document.getElementById("Next"); var Wildcaught = document.getElementById("Wildcaught"); var Aquaculture = document.getElementById("Aquaculture"); if (Wildcaught != null && Aquaculture != null && Wildcaught.checked == false && Aquaculture.checked == false) { alert("Please select Harvest Information"); return false; } if (sDate != null && tmDate != null && nmDate != null && sDate.checked == false && tmDate.checked == false && nmDate.checked == false) { alert("Please select the date of certificates"); return false; } else { formName.action = 'saveReuseCertificateValues.html'; formName.submit(); document.getElementById("nextButton").disabled = true; return true; } } function fisheryOrMollusc(cValue) { var ONE = document.getElementById("1"); var TWO = document.getElementById("2"); if (TWO != null) { if (ONE.checked == true || TWO.checked == true) { if (cValue != '1') { ONE.checked == false; ONE.disabled = true; } if (cValue != '2') { TWO.checked == false; TWO.disabled = true; } } else if (ONE.checked == false || TWO.checked == false) { ONE.disabled = false; TWO.disabled = false; } } } function disableAustraliaRest(cValue) { var french_dutch_eng = document.getElementById("13"); var menhaden = document.getElementById("14"); var gelatin = document.getElementById("15"); var uncanned = document.getElementById("30"); var evisc = document.getElementById("16"); var non_evisc = document.getElementById("17"); if (french_dutch_eng != null && menhaden != null && gelatin != null && uncanned != null && evisc != null && non_evisc != null) { if (french_dutch_eng.checked == true || menhaden.checked == true || gelatin.checked == true || uncanned.checked == true || evisc.checked == true || non_evisc.checked == true) { if (cValue != '13') { french_dutch_eng.checked == false; french_dutch_eng.disabled = true; } if (cValue != '14') { menhaden.checked == false; menhaden.disabled = true; } if (cValue != '15') { gelatin.checked == false; gelatin.disabled = true; } if (cValue != '30') { uncanned.checked == false; uncanned.disabled = true; } if (cValue != '16') { evisc.checked == false; evisc.disabled = true; } if (cValue != '17') { non_evisc.checked == false; non_evisc.disabled = true; } } else if (french_dutch_eng.checked == false || menhaden.checked == false || gelatin.checked == false || uncanned.checked == false || evisc.checked == false || non_evisc.checked == false) { french_dutch_eng.disabled = false; menhaden.disabled = false; gelatin.disabled = false; uncanned.disabled = false; evisc.disabled = false; non_evisc.disabled = false; } } } function disableNewZealandRest(cValue) { var french_dutch_eng = document.getElementById("13"); var salmon = document.getElementById("23"); if (french_dutch_eng != null && salmon != null) { if (french_dutch_eng.checked == true || salmon.checked == true) { if (cValue != '13') { if (french_dutch_eng != null) { french_dutch_eng.checked = false; french_dutch_eng.disabled = true; } } if (cValue != '23') { if (salmon != null) { salmon.checked = false; salmon.disabled = true; } } } else if (french_dutch_eng.checked == false || salmon.checked == false) { french_dutch_eng.disabled = false; salmon.disabled = false; } } } function backRequest_selCertTypes() { var formName = document.getElementById("newCertForm"); formName.action = 'saveProductsForExportQ.html'; document.getElementById("export").value = 'YES'; formName.submit(); } function cancelRequest_selCertTypes() { var formName = document.getElementById("newCertForm"); if (confirm('Are you sure you want to cancel the request?')) { formName.action = 'account.html'; formName.submit(); return true; } else { return false; } } function saveRequest_selCertTypes(countryID) { count = 0; for (x = 0;x < document.getElementsByTagName("input").length;x++) { if (document.getElementsByTagName("input")[x].type == "checkbox") { if (document.getElementsByTagName("input")[x].checked == true) { count++; } } } if (count == 0) { alert("You must choose at least one Certificate"); return false; } else { if (confirm("Warning: Please verify that the certificate types chosen are accurate.\nModifications to certificate type cannot be made once the Next button is selected.")) { var formName = document.getElementById("newCertForm"); var ONE = document.getElementById("1"); var TWO = document.getElementById("2"); var THREE = document.getElementById("3"); var SIX = document.getElementById("6"); var SEVEN = document.getElementById("7"); var EIGHT = document.getElementById("8"); var THIRTEEN = document.getElementById("13"); var NINE = document.getElementById("9"); var TWENTY_FIVE = document.getElementById("25"); var onlyEU = document.getElementById("onlyEU"); if (countryID != null && (countryID == "165" || countryID == "190" || countryID == "297" || countryID == "305" || countryID == "570" || countryID == "786" || countryID == "855")) { TWO = document.getElementById("1"); } else { TWO = document.getElementById("2"); } if (ONE != null && TWO != null && THREE != null && SIX != null) { if (ONE.checked == false && TWO.checked == false && THREE.checked == false && SIX.checked == false) { onlyEU.value = 'NO'; } else if (SEVEN.checked == true || EIGHT.checked == true || THIRTEEN.checked == true || NINE.checked == true || TWENTY_FIVE.checked == true) { onlyEU.value = 'NO'; } else { onlyEU.value = 'YES'; } } formName.action = 'submitNewCertificateRequest.html'; formName.submit(); return true; } else { return false; } } } function backRequest_selExpCountry() { var formName = document.getElementById("newCertForm"); formName.action = 'productsForExportQ.html'; formName.submit(); } function cancelRequest_selExpCountry() { var formName = document.getElementById("newCertForm"); if (confirm('Are you sure you want to cancel the request?')) { formName.action = 'account.html'; formName.submit(); return true; } else { return false; } } function saveRequest_selExpCountry() { var selCountry = document.getElementById("exportCountry").value; if (selCountry == "-1") { alert("Please select a Country"); return false; } else { var formName = document.getElementById("newCertForm"); formName.action = 'saveCountryToExport.html'; document.getElementById("COUNTRY_ID").value = selCountry; formName.submit(); return true; } } function editThisUser(userID, catID) { var Eid = userID + "id"; var EfirstName = userID + "firstname"; var ElastName = userID + "lastname"; var Eemail = userID + "email"; var Ephone = userID + "phone"; var Efax = userID + "fax"; var USER_ID = document.getElementById("USER_ID"); USER_ID.value = userID; Eid = document.getElementById(Eid).innerText; EfirstName = document.getElementById(EfirstName).innerText; ElastName = document.getElementById(ElastName).innerText; Eemail = document.getElementById(Eemail).innerText; Ephone = document.getElementById(Ephone).innerText; Efax = document.getElementById(Efax).innerText; var firstname = document.getElementById("firstname"); var lastname = document.getElementById("lastname"); var phone = document.getElementById("phone"); var fax = document.getElementById("fax"); var email = document.getElementById("email"); firstname.value = EfirstName; lastname.value = ElastName; phone.value = Ephone; fax.value = Efax; email.value = Eemail; firstname.disabled = true; lastname.disabled = true; phone.disabled = true; fax.disabled = true; email.disabled = true; var SAVE = document.getElementById("addUser"); var EDIT = document.getElementById("saveButton"); var ENABLE = document.getElementById("EditButton"); var DELETE = document.getElementById("DeleteButton"); var DELETE_TD = document.getElementById("deleteTD"); EDIT.style.display = "none"; ENABLE.style.display = "block"; DELETE.style.display = "block"; SAVE.style.display = "none"; DELETE_TD.style.display = "block"; document.getElementById("CAT_ID").value = catID; } function deleteThisUser() { var thisForm = document.getElementById("setAccountForm"); if (confirm("Are you sure you want to Delete this User?")) { thisForm.action = "editdeleteuser.html"; thisForm.submit(); } else { thisForm.action = "setaccount.html"; thisForm.submit(); } } function ENABLEFILEDS() { var thisForm = document.getElementById("setAccountForm"); var firstname = document.getElementById("firstname"); var lastname = document.getElementById("lastname"); var phone = document.getElementById("phone"); var fax = document.getElementById("fax"); var email = document.getElementById("email"); firstname.disabled = false; lastname.disabled = false; phone.disabled = false; fax.disabled = false; email.disabled = false; var SAVE = document.getElementById("addUser"); var EDIT = document.getElementById("saveButton"); var ENABLE = document.getElementById("EditButton"); var DELETE = document.getElementById("DeleteButton"); var DELETE_TD = document.getElementById("deleteTD"); EDIT.style.display = "block"; ENABLE.style.display = "none"; DELETE.style.display = "none"; SAVE.style.display = "none"; DELETE_TD.style.display = "none"; } function cancelRequestFromSummary() { var myForm1 = document.getElementById("summaryForm"); myForm1.action = 'cancelCertificateRequest.html'; if (!confirm('Are you sure you want to cancel the request?')) { return false; } else { myForm1.submit(); return true; } } function submitCertificateRequest(newCert) { document.getElementById("submitButton").disabled = true; var annexFlag = document.getElementById("hannexFlag").value; var fisheryFlag = document.getElementById("hfisheryFlag").value; var iuuFlag = document.getElementById("hiuuFlag").value; var batchDate = document.getElementById("hbatchDate").value; var requiredField = document.getElementById("hrequiredFlag").value; var id = document.getElementById("hrow_id").value; var onlyEU = document.getElementById("hOnlyEU").value; var depDate = document.getElementById("depDate").value; var req = newXMLHttpRequest(); if (req == null) { alert("Your browser does not support AJAX!"); document.getElementById("submitButton").disabled = false; return; } req.onreadystatechange = getHandler(req, id, requiredField, newCert); var url = "checkProductsCountAndShipmentDateValidation.html?Bhu89ijNmkoP=" + id; url = url + "&af=" + annexFlag; url = url + "&ff=" + fisheryFlag; url = url + "&if=" + iuuFlag; url = url + "&bd=" + batchDate; url = url + "&nr=" + requiredField; url = url + "&onlyEU=" + onlyEU; url = url + "&depDate=" + depDate; url = url + "&tt=" + new Date().getTime(); document.getElementById("submitButton").disabled = true; req.open("GET", url, false); req.send(null); } function getHandler(req, id, requiredFlag, newCert) { return function () { document.getElementById("submitButton").disabled = true; if (req.readyState == 4) { if (req.status == 200) { var array = new Array(); var TXT = req.responseText; array = TXT.split("|"); if (array[0] == 'ISSUED') { alert("Please populate all the required product details"); document.getElementById("submitButton").disabled = false; return false; } else if (array[1] == 'NO') { alert("Please Enter a Valid Shipment/Departure Date."); document.getElementById("submitButton").disabled = false; return false; } else if (newCert == 'YES') { if (confirm("I certify that the information contained in this request is complete, true, and correct to the best of my knowledge and belief and that the product(s) covered by this certificate application were legally harvested in the United States or by a U.S. flagged vessel if so stated in the request.\n\nDo you want to submit your Certficate Request?")) { var formName = document.getElementById("summaryForm"); formName.action = 'submitCertificateRequest.html'; formName.submit(); return true; } else { document.getElementById("submitButton").disabled = false; return false; } } else { alert("You have issued certificates. Please complete or void prior to entering new requests"); document.getElementById("submitButton").disabled = false; return false; } } else { alert("There was an error in submitting your Certificate Request.\nPlease try again later. "); document.getElementById("submitButton").disabled = false; } } } } function checkEUCountry_supCertCommFlds(orgValue) { var euCountry = document.getElementById("exportCountry").value; var countryName; var countryID; var orgcountryName; var orgcountryID; countryID = euCountry.substring(0, euCountry.indexOf(' - ')); countryName = euCountry.substring(euCountry.indexOf(' - ') + 2, euCountry.length); orgcountryID = orgValue.substring(0, orgValue.indexOf(' - ')); orgcountryName = orgValue.substring(orgValue.indexOf(' - ') + 2, orgValue.length); //297,786,165,190,305,570,855 if (orgcountryID != '297' && orgcountryID != '786' && orgcountryID != '165' && orgcountryID != '190' && orgcountryID != '305' && orgcountryID != '570' && orgcountryID != '855') { if (countryID == '297' || countryID == '786' || countryID == '165' || countryID == '190' || countryID == '305' || countryID == '570' || countryID == '855') { alert('This EU country cannot be selected. You have currently selected an EU country that offers only the EU Fishery Products certificate type. In order to request only the EU Fishery Products certificate type, please create a new certificate request.'); document.getElementById("exportCountry").value = orgValue; } } } function cancelRequest_supCertCommFlds() { var formName = document.getElementById("newCertForm"); if (confirm('Are you sure you want to cancel the request?')) { formName.action = 'mycertificates.html'; document.getElementById("certificateName").value = ""; formName.submit(); return true; } else { return false; } } function saveRequest_supCertCommFlds() { var formName = document.getElementById("newCertForm"); var sDate = document.getElementById("Today"); var tmDate = document.getElementById("This"); var nmDate = document.getElementById("Next"); var Wildcaught = document.getElementById("Wildcaught"); var Aquaculture = document.getElementById("Aquaculture"); if (Wildcaught != null && Aquaculture != null && Wildcaught.checked == false && Aquaculture.checked == false) { alert("Please select Harvest Information"); return false; } if (sDate != null && tmDate != null && nmDate != null && sDate.checked == false && tmDate.checked == false && nmDate.checked == false) { alert("Please select the date of certificates"); return false; } else { formName.action = 'saveSupersedeCertificateValues.html'; formName.submit(); document.getElementById("nextButton").disabled = true; return true; } } function CheckGracePeriodForNewCert(VENDOR_ID) { var url = "checkGracePeriodForNewCert.html?VENDOR_ID=" + VENDOR_ID + '&' + Math.random(); var req = newXMLHttpRequest(); if (req == null) { alert("Your browser does not support AJAX!"); return; } req.onreadystatechange = getReadyStateCheckGPforNewCert(req); req.open("GET", url, true); req.send(null); } function getReadyStateCheckGPforNewCert(req) { return function () { var TXT; if (req.readyState == 4) { if (req.status == 200) { var TXT = req.responseText; if (TXT == 'YES') { var formName = document.getElementById("theForm"); formName.action = "newCertificateRequest.html"; formName.submit(); return true; } else { alert("You have issued certificates. Please complete or void prior to entering new requests"); return false; } } } } } function Valid_DateOfDep_Ship(isSubmit, currentUrl) { var depDate = document.getElementById("depDate").value; var url = "checkValidDateOfDepShip.html?depDate=" + depDate + "&" + Math.random(); var req = newXMLHttpRequest(); if (req == null) { alert("Your browser does not support AJAX!"); return; } req.onreadystatechange = getReadyStateValid_DateOfDep_Ship(req, isSubmit, currentUrl); req.open("GET", url, true); req.send(null); } function getReadyStateValid_DateOfDep_Ship(req, isSubmit, currentUrl) { return function () { var TXT; if (req.readyState == 4) { if (req.status == 200) { TXT = req.responseText; if (TXT == 'YES') { var formName = document.getElementById("newCertForm"); formName.action = currentUrl; if (isSubmit == 'submit') formName.submit(); return true; } else { alert("Please Enter a Valid Shipment/Departure Date.") document.getElementById("depDate").value = ""; document.getElementById("depDate").focus(); return false; } } } } } function CheckGracePeriod(VENDOR_ID, button) { var url = "checkGracePeriodForNewCert.html?VENDOR_ID=" + VENDOR_ID + '&tt=' + Math.random(); var req = newXMLHttpRequest(); if (req == null) { alert("Your browser does not support AJAX!"); return; } req.onreadystatechange = getReadyStateCheckGP(req, button); req.open("GET", url, true); req.send(null); } function getReadyStateCheckGP(req, button) { return function () { var TXT; if (req.readyState == 4) { if (req.status == 200) { TXT = req.responseText; if (TXT == null) { TXT = ""; } if (TXT == 'YES') { if (button == 'REUSE') { if (confirm('Are you sure you want to Re-use certificate values?')) { var formName = document.getElementById("newCertForm"); formName.action = "reuseCRValues.html"; formName.submit(); } else { return false; } } if (button == 'SUPERSEDE') { if (confirm('Are you sure you want to Supersede this certificate?')) { document.getElementById("newCertForm").action = "supersedeThisCertificate.html"; document.getElementById("newCertForm").submit(); } else { return false; } } if (button == 'New') { var newForm = document.getElementById("theForm"); if (newForm != null) { newForm.action = "newCertificateRequest.html"; newForm.submit(); } } } else if (TXT == 'NO') { alert("You have issued certificates. Please complete or void prior to entering new requests"); return false; } else { document.getElementById("theForm").action = "sessionend.html"; document.getElementById("theForm").submit(); } } } } } function enableDisableIUU(harvestVal) { var IUU_NO = document.getElementById("productOnIUUNO"); var IUU_YES = document.getElementById("productOnIUUYES"); var nameOfCultureFarm = document.getElementById("nameOfCultureFarm"); var cultureFarmApprovalNumber = document.getElementById("cultureFarmApprovalNumber"); var catchArea = document.getElementById("catchArea"); var catchDtRange = document.getElementById("catchDtRange"); var china_Flag = document.getElementById("china_Flag"); if (china_Flag == null) { china_Flag = ""; } var INX3; var cArea; if (catchArea != null) { INX3 = catchArea.options.selectedIndex;// Catch Area cArea = catchArea.options[INX3].value;// Catch Area } if (harvestVal == 'Aquaculture') { if (IUU_NO != null) { IUU_NO.checked = true; IUU_NO.disabled = true; } if (IUU_YES != null) IUU_YES.disabled = true; if (nameOfCultureFarm != null) { if (nameOfCultureFarm.value == 'N/A') { nameOfCultureFarm.value = ''; } nameOfCultureFarm.disabled = false; } if (cultureFarmApprovalNumber != null) { if (cultureFarmApprovalNumber.value == 'N/A') { cultureFarmApprovalNumber.value = ''; } cultureFarmApprovalNumber.disabled = false; } // Diasable Catch Area but not for Chinese Certs if (china_Flag != null && china_Flag.value != 'true') { if (catchArea != null) { catchArea.options.selectedIndex = 1; catchArea.disabled = true; } } // Disable Catch Date if (catchDtRange != null) { catchDtRange.value = "N/A"; catchDtRange.disabled = true; } } if (harvestVal == 'Wildcaught') { if (IUU_NO != null) { IUU_NO.disabled = false; } if (IUU_YES != null) { IUU_YES.disabled = false; } if (nameOfCultureFarm != null) { nameOfCultureFarm.value = 'N/A'; nameOfCultureFarm.disabled = true; } if (cultureFarmApprovalNumber != null) { cultureFarmApprovalNumber.value = 'N/A'; cultureFarmApprovalNumber.disabled = true; } if (china_Flag != null && china_Flag.value == 'true') { if (catchArea != null) { catchArea.disabled = false; } } } } function chinaHideCerts() { var chinaLive = document.getElementById("20"); var chinaFish = document.getElementById("19"); var chinaFMeal = document.getElementById("32"); var artemia = document.getElementById("13"); var lotInspection = document.getElementById("8"); var memoOfInsp = document.getElementById("9"); var fishCertOrg = document.getElementById("25"); var certOfInsp = document.getElementById("7"); if (chinaLive != null && chinaFish != null && artemia != null && chinaFMeal != null) { if (chinaLive.checked) { chinaFish.checked = false; chinaFish.disabled = true; artemia.checked = false; artemia.disabled = true; chinaFMeal.checked = false; chinaFMeal.disabled = true; } else if (chinaFish.checked) { chinaLive.checked = false; chinaLive.disabled = true; artemia.checked = false; artemia.disabled = true; chinaFMeal.checked = false; chinaFMeal.disabled = true; } else if (artemia.checked) { chinaLive.checked = false; chinaLive.disabled = true; chinaFish.checked = false; chinaFish.disabled = true; chinaFMeal.checked = false; chinaFMeal.disabled = true; } else if (chinaFMeal.checked) { chinaLive.checked = false; chinaLive.disabled = true; chinaFish.checked = false; chinaFish.disabled = true; artemia.checked = false; artemia.disabled = true; lotInspection.checked = false; lotInspection.disabled = true; memoOfInsp.checked = false; memoOfInsp.disabled = true; fishCertOrg.checked = false; fishCertOrg.disabled = true; certOfInsp.checked = false; certOfInsp.disabled = true; } else { chinaLive.checked = false; chinaFish.checked = false; artemia.checked = false; chinaFish.checked = false; lotInspection.checked = false; memoOfInsp.checked = false; fishCertOrg.checked = false; certOfInsp.checked = false; chinaFish.disabled = false; chinaLive.disabled = false; artemia.disabled = false; chinaFMeal.disabled = false; lotInspection.disabled = false; memoOfInsp.disabled = false; fishCertOrg.disabled = false; certOfInsp.disabled = false; } } } /** HIGHLIGHT MISSING FIELDS ON EDIT **/ function highlightMissingFields() { /** GET FORM NAME **/ var forms = document.getElementById("newCertForm"); /** SUMMARY FLAG IS NOT NULL IF YOU CLICK EDIT LINK FROM THE SUMMARY PAGE. * HIGHLIGHT THE FIELDS ONLY IF SELECTED EDIT LINK IN SUMMARY PAGE * **/ var summaryFlag = document.getElementById("summaryFlag"); if (summaryFlag != null && summaryFlag.value != '') { for (var i = 0;i < forms.elements.length;i++) { /** GET ALL ELEMENTS IN THE FORM **/ var elementType = forms.elements[i].type; /** IGNORE HIDDEN FIELDS **/ if (elementType != null && elementType != "hidden") { /** IGNORE COMMENTS FIELDS AS IT IS NOT REQUIRED **/ if (forms.elements[i].value == '' && forms.elements[i].id != 'certComments') { // alert("class--->"+forms.elements[i].getAttribute("className")); if (forms.elements[i].getAttribute("className") != 'question_style_not_required') forms.elements[i].style.backgroundColor = "#CC9999"; } /** SELECT BOX **/ if (elementType == "select-one") { if (forms.elements[i].value == '-1' || forms.elements[i].value == '0') { if (forms.elements[i].id != 'template' && forms.elements[i].id != 'consigneeLocations') { if (forms.elements[i].getAttribute("className") != 'question_style_not_required') forms.elements[i].style.backgroundColor = "#CC9999"; } } } /** RADIO BUTTONS **/ if (elementType == "radio") { var deliveryType = document.getElementsByName("certificatepost"); var temparature = document.getElementsByName("tempunit"); var m1 = 0; var n1 = 0; for (var m = 0;m < deliveryType.length;m++) { if (deliveryType[m].checked == true) { m1++; } } //END FOR if (m1 == 0) { for (var m2 = 0;m2 < deliveryType.length;m2++) { document.getElementById(deliveryType[m2].id).style.backgroundColor = "#CC9999"; } } // END IF for (var n = 0;n < temparature.length;n++) { if (temparature[n].checked == true) { n1++; } } //END FOR if (n1 == 0) { for (var n2 = 0;n2 < temparature.length;n2++) { document.getElementById(temparature[n2].id).style.backgroundColor = "#CC9999"; } } // END IF } // END IF RADIO } } } } function validateIUUAnnexFields() { var foreignSourcedOrUSYES = document.getElementById("foreignSourcedOrUSYES"); var foreignSourcedOrUSNO = document.getElementById("foreignSourcedOrUSNO"); var productOnIUUYES = document.getElementById("productOnIUUYES"); var productOnIUUNO = document.getElementById("productOnIUUNO"); var catchCertNumber = document.getElementById("catchCertNumber"); var vesselNamesAndFlags = document.getElementById("vesselNamesAndFlags"); var validationDate = document.getElementById("validationDate"); var validationDatesCal = document.getElementById("validationDatesCal"); var catchDescription = document.getElementById("catchDescription"); var totalLandedWt = document.getElementById("totalLandedWt"); var catchProcessed = document.getElementById("catchProcessed"); var processedFisheryProds = document.getElementById("processedFisheryProds"); var hCatchNumber = document.getElementById("hCatchNumber"); var hVesselNames = document.getElementById("hVesselNames"); var hValidationDate = document.getElementById("hValidationDate"); var hCatchDescription = document.getElementById("hCatchDescription"); var hTotalLandedWt = document.getElementById("hTotalLandedWt"); var hCatchProcessed = document.getElementById("hCatchProcessed"); var hProcessedFisheryProds = document.getElementById("hProcessedFisheryProds"); var hCatchArea = document.getElementById("hCatchArea"); var hCatchDate = document.getElementById("hCatchDate"); var INX3; var cArea; if (document.getElementById("catchArea") != null) { INX3 = document.getElementById("catchArea").options.selectedIndex;// Catch Area cArea = document.getElementById("catchArea").options[INX3].value;// Catch Area } var cDtRange = document.getElementById("catchDtRange");// Catch Date if (foreignSourcedOrUSYES != null && foreignSourcedOrUSNO != null && productOnIUUYES != null && productOnIUUNO != null) { if (foreignSourcedOrUSNO.checked == true && productOnIUUYES.checked == true) { catchCertNumber.value = "N/A"; vesselNamesAndFlags.value = "N/A"; validationDate.value = "N/A"; catchDescription.value = "N/A"; totalLandedWt.value = "0"; catchProcessed.value = "0"; processedFisheryProds.value = "0"; if (hCatchDate != null && hCatchDate.value == "") cDtRange.value = ""; if (hCatchArea != null && hCatchArea.value == "") document.getElementById("catchArea").options.selectedIndex = 0; catchCertNumber.disabled = true; vesselNamesAndFlags.disabled = true; validationDate.disabled = true; validationDatesCal.style.visibility = 'hidden'; catchDescription.disabled = true; totalLandedWt.disabled = true; catchProcessed.disabled = true; processedFisheryProds.disabled = true; cDtRange.disabled = false; document.getElementById("catchArea").disabled = false; } if (foreignSourcedOrUSNO.checked == true && productOnIUUNO.checked == true) { cDtRange.value = "N/A"; if (hCatchArea != null && hCatchArea.value == "") document.getElementById("catchArea").options.selectedIndex = 1; catchCertNumber.value = "N/A"; vesselNamesAndFlags.value = "N/A"; validationDate.value = "N/A"; catchDescription.value = "N/A"; totalLandedWt.value = "0"; catchProcessed.value = "0"; processedFisheryProds.value = "0"; catchCertNumber.disabled = true; vesselNamesAndFlags.disabled = true; validationDate.disabled = true; validationDatesCal.style.visibility = 'hidden'; catchDescription.disabled = true; totalLandedWt.disabled = true; catchProcessed.disabled = true; processedFisheryProds.disabled = true; cDtRange.disabled = true; document.getElementById("catchArea").disabled = true; } if (foreignSourcedOrUSYES.checked == true) { cDtRange.value = "N/A"; document.getElementById("catchArea").options.selectedIndex = 1; if (hCatchNumber != null && (hCatchNumber.value == "" || hCatchNumber.value == "N/A")) catchCertNumber.value = ""; if (hVesselNames != null && (hVesselNames.value == "" || hVesselNames.value == "N/A")) vesselNamesAndFlags.value = ""; if (hValidationDate != null && (hValidationDate.value == "" || hValidationDate.value == "N/A")) validationDate.value = ""; if (hCatchDescription != null && (hCatchDescription.value == "" || hCatchDescription.value == "N/A")) catchDescription.value = ""; if (hTotalLandedWt != null && (hTotalLandedWt.value == "" || hTotalLandedWt.value == "0")) totalLandedWt.value = ""; if (hCatchProcessed != null && (hCatchProcessed.value == "" || hCatchProcessed.value == "0")) catchProcessed.value = ""; if (hProcessedFisheryProds != null && (hProcessedFisheryProds.value == "" || hProcessedFisheryProds.value == "0")) processedFisheryProds.value = ""; catchCertNumber.disabled = false; vesselNamesAndFlags.disabled = false; validationDate.disabled = false; validationDatesCal.style.visibility = 'visible'; catchDescription.disabled = false; totalLandedWt.disabled = false; catchProcessed.disabled = false; processedFisheryProds.disabled = false; cDtRange.disabled = true; document.getElementById("catchArea").disabled = true; } } } function disableCatchDate(val) { var harvestType = document.getElementById("Wildcaught"); var cDtRange = document.getElementById("catchDtRange"); var china_Flag = document.getElementById("china_Flag"); if (china_Flag == null) { china_Flag = ""; } var INX3; var cArea; if (document.getElementById("catchArea") != null) { INX3 = document.getElementById("catchArea").options.selectedIndex;// Catch Area cArea = document.getElementById("catchArea").options[INX3].value;// Catch Area } if (val == 'NO') { cDtRange.disabled = true; cDtRange.value = 'N/A'; if (china_Flag != null && china_Flag.value != "true") { document.getElementById("catchArea").options.selectedIndex = 1; document.getElementById("catchArea").disabled = true; } } if (val == 'YES') { cDtRange.disabled = false; cDtRange.value = ''; if (china_Flag != null && china_Flag.value != "true") { document.getElementById("catchArea").options.selectedIndex = 0; document.getElementById("catchArea").disabled = false; } } } function getNewCustomerStates() { setTimeout(function () { getNewCustomerStates1() }, 1000); } function getNewCustomerStates1() { var req = newXMLHttpRequest(); if (req == null) { alert("Your browser does not support AJAX!"); return; } var table = document.getElementById("consigneeTable"); var select; var ROW; var CELL; var INX = document.getElementById("newCustomerCountry").options.selectedIndex; var code = document.getElementById("newCustomerCountry").options[INX].innerText; var zip = document.getElementById("zipcode"); zip.value = ""; if (code == "US" || code == "United States") { zip.onkeyup = new Function("ZIPMASK_USCAN(event,this);"); select = document.createElement('select'); select.name = "state"; select.id = "state"; select.className = "question_style"; document.getElementById("conStateReq").style.visibility = "visible"; ROW = table.rows.item(0); ROW.deleteCell(0); CELL = ROW.insertCell(0); CELL.appendChild(select); ROW.appendChild(CELL); req.onreadystatechange = getNewCustomerStatesHandler(req); var url = "states.html"; url = url + "?code=" + code; url = url + '&' + new Date().getTime(); req.open("GET", url, true); req.send(null); } else if (code == "Canada") { zip = document.getElementById("zipcode"); zip.onkeypress = new Function(""); zip.onkeyup = new Function("ZIPMASK_CAN(event,this)"); select = document.createElement('select'); select.name = "state"; select.id = "state"; select.className = "question_style"; document.getElementById("conStateReq").style.visibility = "visible"; ROW = table.rows.item(0); ROW.deleteCell(0); CELL = ROW.insertCell(0); CELL.appendChild(select); ROW.appendChild(CELL); req.onreadystatechange = getNewCustomerStatesHandler(req); var url = "canada.html"; url = url + "?code=" + code; url = url + '&' + new Date().getTime(); req.open("GET", url, true); req.send(null); } else { zip.onkeypress = new Function(""); zip.onkeyup = new Function(""); var input = document.createElement('input'); input.name = "state"; input.id = "state"; input.className = "question_style"; input.size = "30"; document.getElementById("conStateReq").style.visibility = "hidden"; ROW = table.rows.item(0); ROW.deleteCell(0); CELL = ROW.insertCell(0); CELL.appendChild(input); ROW.appendChild(CELL); document.getElementById("state").maxLength = 30; input.value = ""; } } function getNewCustomerStatesHandler(req) { return function () { if (req.readyState == 4) { if (req.status == 200) { var array = new Array() var TXT = req.responseText; array = TXT.split(","); INSERT_NEW_CUSTOMER_STATES(array); } else { alert("HTTP error: " + req.status); } } } } function INSERT_NEW_CUSTOMER_STATES(array) { document.getElementById("state").options.length = 0; document.getElementById("state").options.length = 0; var SELECT = document.getElementById("state"); for (var i = 0;i < array.length;i++) { if (array[i] != "") { var ELEMENT = array[i]; var elementarray = new Array() elementarray = ELEMENT.split("|"); if (elementarray[1] != " " || elementarray[0] != " ") { SELECT.options[SELECT.length] = new Option(elementarray[1], elementarray[0]); } } } SELECT.style.width = "200px"; } function disableAquaArea(){ document.getElementById("aquaArea").value="********"; document.getElementById("aquaArea").disabled = true; } function enableAquaArea(){ if(document.getElementById("aquaArea").disabled){ document.getElementById("aquaArea").value=""; document.getElementById("aquaArea").disabled = false; } }