// JavaScript Document function echeck(str) { var firstchar = str.substr(0,1); if(!isNaN(firstchar)){ return false; } if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(str)){ return (true); } return (false); /*var at="@" var dot="." var lat=str.indexOf(at) var lstr=str.length var ldot=str.indexOf(dot) var firstchar = str.substr(0,1) if(!isNaN(firstchar)){ return false; } if (str.indexOf(at)==-1){ return false } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ return false } if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ return false } if (str.indexOf(at,(lat+1))!=-1){ return false } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ return false } if (str.indexOf(dot,(lat+2))==-1){ return false } if (str.indexOf(" ")!=-1){ return false } return true*/ } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function validateSignup(){ with (document.signupfrm){ if(name.value == ""){ //document.getElementById('error').innerHTML = 'Enter Company Name.'; //document.getElementById('error').style.display = 'block'; alert("Enter company name."); name.focus(); return false; } if(contact.value == ""){ //document.getElementById('error').innerHTML = 'Enter Shipping contact.'; //document.getElementById('error').style.display = 'block'; alert("Enter Shipping contact."); contact.focus(); return false; } if(ph_no.value == ""){ //document.getElementById('error').innerHTML = 'Enter phone number.'; //document.getElementById('error').style.display = 'block'; alert("Enter phone number."); ph_no.focus(); return false; } if(address.value == ""){ //document.getElementById('error').innerHTML = 'Enter company address.'; //document.getElementById('error').style.display = 'block'; alert("Enter company address."); address.focus(); return false; } if(city.value == ""){ //document.getElementById('error').innerHTML = 'Enter city.'; //document.getElementById('error').style.display = 'block'; alert("Enter city."); city.focus(); return false; } if(state.value == ""){ document.getElementById('error').innerHTML = 'Enter state.'; document.getElementById('error').style.display = 'block'; //alert("Enter state."); state.focus(); return false; } if(zip.value == ""){ //document.getElementById('error').innerHTML = 'Enter zip code.'; //document.getElementById('error').style.display = 'block'; alert("Enter zip code."); zip.focus(); return false; } if(!validateZip(zip.value)){ alert("Enter 5 digit valid zip code."); zip.focus(); return false; } if(!document.getElementById('bill_info_no').checked){ if(bill_name.value == ""){ //document.getElementById('error').innerHTML = 'Enter bill company name.'; //document.getElementById('error').style.display = 'block'; alert("Enter bill company name."); bill_name.focus(); return false; } if(bill_contact.value == ""){ //document.getElementById('error').innerHTML = 'Enter bill company contact name.'; //document.getElementById('error').style.display = 'block'; alert("Enter bill company contact name."); bill_contact.focus(); return false; } if(bill_ph_no.value == ""){ //document.getElementById('error').innerHTML = 'Enter bill phone number.'; //document.getElementById('error').style.display = 'block'; alert("Enter bill phone number."); bill_ph_no.focus(); return false; } if(bill_email.value != "" && echeck(bill_email.value) == false){ //document.getElementById('error').innerHTML = 'Enter Valid bill email address.'; //document.getElementById('error').style.display = 'block'; alert("Enter Valid bill email address."); bill_email.focus(); return false; } if(bill_address.value == ""){ //document.getElementById('error').innerHTML = 'Enter bill company address.'; //document.getElementById('error').style.display = 'block'; alert("Enter bill company address."); bill_address.focus(); return false; } if(bill_city.value == ""){ //document.getElementById('error').innerHTML = 'Enter bill city.'; //document.getElementById('error').style.display = 'block'; alert("Enter bill city."); bill_city.focus(); return false; } if(bill_state.value == ""){ //document.getElementById('error').innerHTML = 'Select bill state.'; //document.getElementById('error').style.display = 'block'; alert("Select bill state."); bill_state.focus(); return false; } if(bill_zip.value == ""){ //document.getElementById('error').innerHTML = 'Enter bill zip code.'; //document.getElementById('error').style.display = 'block'; alert("Enter bill zip code."); bill_zip.focus(); return false; } if(!validateZip(bill_zip.value)){ alert("Enter 5 digit valid zip code."); bill_zip.focus(); return false; } } //////////////////////////////// if(email.value == ""){ //document.getElementById('error').innerHTML = 'Enter email.'; //document.getElementById('error').style.display = 'block'; alert("Enter email."); email.focus(); return false; } if(email.value != "" && echeck(email.value) == false){ //document.getElementById('error').innerHTML = 'Enter Valid email address.'; //document.getElementById('error').style.display = 'block'; alert("Enter Valid email address."); email.focus(); return false; } if(comp_pass.value == ""){ //document.getElementById('error').innerHTML = 'Enter password.'; //document.getElementById('error').style.display = 'block'; alert("Enter password."); comp_pass.focus(); return false; } if(comp_pass.value != re_comp_pass.value){ //document.getElementById('error').innerHTML = 'Password and Confirm password does not match.'; //document.getElementById('error').style.display = 'block'; alert("Password and Confirm password does not match."); comp_pass.focus(); return false; } /////////////////////////////////////////// if(!document.getElementById('terms').checked){ alert("You must agree terms and conditions"); document.getElementById('terms').focus(); return false; } } } function validateZip(zip){ if (zip.match(/^[0-9]{5}$/)) { return true; } zip=zip.toUpperCase(); if (zip.match(/^[A-Z][0-9][A-Z][0-9][A-Z][0-9]$/)) { return true; } if (zip.match(/^[A-Z][0-9][A-Z].[0-9][A-Z][0-9]$/)) { return true; } //alert('*** Bad ZIP.'); return false; /* if(zip.length!=5 || isNaN(zip)){ return false; }else{ return true; }*/ } function validateWeight(weight){ if(isNaN(weight)){ return false; }else{ return true; } } /////////////////////////////////////////////////////////////////////////////////// function validateForm(){ if(document.getElementById('s_zip').value == ''){ alert("Enter Origin Zip Code"); document.getElementById('s_zip').focus(); return false; } if(!validateZip(document.getElementById('s_zip').value)){ alert("Enter a valid 5 digit zipcode"); document.getElementById('s_zip').focus(); return false; } if(document.getElementById('d_zip').value == ''){ alert("Enter Destination Zip Code"); document.getElementById('d_zip').focus(); return false; } if(!validateZip(document.getElementById('d_zip').value)){ alert("Enter a valid 5 digit zipcode"); document.getElementById('d_zip').focus(); return false; } if(document.getElementById('pick_date').value == ''){ alert("Enter Pickup date"); document.getElementById('pick_date').focus(); return false; } if(document.getElementById('total_weight_1').value == ''){ alert("Enter weight"); document.getElementById('total_weight_1').focus(); return false; } if(document.getElementById('total_weight_1').value == 0){ alert("Enter valid weight"); document.getElementById('total_weight_1').focus(); return false; } if(!validateWeight(document.getElementById('total_weight_1').value)){ alert("Enter valid weight"); document.getElementById('total_weight_1').focus(); return false; } for(var i = 2 ; i <= maxItems ; i++){ if(document.getElementById('item_'+i).style.display == ""){ if(document.getElementById('total_weight_'+i).value == ''){ alert("Enter Item " + i + " weight"); document.getElementById('total_weight_'+i).focus(); return false; } if(!validateWeight(document.getElementById('total_weight_'+i).value)){ alert("Enter Item " + i + " valid weight"); document.getElementById('total_weight_'+i).focus(); return false; } if(document.getElementById('total_weight_'+i).value == 0){ alert("Enter Item " + i + " valid weight"); document.getElementById('total_weight_'+i).focus(); return false; } } } } function addItem(no){ if(document.getElementById('item_'+no).style.display == "none"){ document.getElementById('item_'+no).style.display = ""; document.getElementById('add_'+no).style.display = "none"; if(no == maxItems){ document.getElementById('del_'+no).style.display = ""; }else{ document.getElementById('add_'+(no+1)).style.display = ""; } }else if(document.getElementById('item_'+no).style.display == ""){ document.getElementById('total_weight_'+no).value = ""; document.getElementById('quantity_'+no).value = ""; document.getElementById('hazardous_'+no).checked = false; var packing_type = document.getElementById('packing_type_'+no); for (var intLoop=0; intLoop < packing_type.length; intLoop++) { packing_type[intLoop].selected = false; } var type = document.getElementById('type_'+no); for (var intLoop=0; intLoop < type.length; intLoop++) { type[intLoop].selected = false; } var freight_class = document.getElementById('freight_class_'+no); for (var intLoop=0; intLoop < freight_class.length; intLoop++) { freight_class[intLoop].selected = false; } var weight_unit = document.getElementById('weight_unit_'+no); for (var intLoop=0; intLoop < weight_unit.length; intLoop++) { weight_unit[intLoop].selected = false; } document.getElementById('item_'+no).style.display = "none"; document.getElementById('add_'+no).style.display = ""; if(no == maxItems){ document.getElementById('del_'+no).style.display = "none"; }else{ document.getElementById('add_'+(no+1)).style.display = "none"; } } } ///////////////////////////////////// function validateAddVendor(){ with (document.addvendorfrm){ if(name.value == ""){ document.getElementById('error').innerHTML = 'Enter Name.'; document.getElementById('error').style.display = 'block'; //alert("Enter company name."); name.focus(); return false; } if(address.value == ""){ document.getElementById('error').innerHTML = 'Enter shipping address.'; document.getElementById('error').style.display = 'block'; //alert("Enter company address."); address.focus(); return false; } if(city.value == ""){ document.getElementById('error').innerHTML = 'Enter city.'; document.getElementById('error').style.display = 'block'; //alert("Enter city."); city.focus(); return false; } if(state.value == ""){ document.getElementById('error').innerHTML = 'Select state.'; document.getElementById('error').style.display = 'block'; //alert("Enter state."); state.focus(); return false; } if(zip.value == ""){ document.getElementById('error').innerHTML = 'Enter zip code.'; document.getElementById('error').style.display = 'block'; //alert("Enter zip code."); zip.focus(); return false; } if(!validateZip(zip.value)){ document.getElementById('error').innerHTML = 'Enter a valid 5 digit zipcode.'; document.getElementById('error').style.display = 'block'; zip.focus(); return false; } if(bill_address.value == ""){ document.getElementById('error').innerHTML = 'Enter billing address.'; document.getElementById('error').style.display = 'block'; //alert("Enter bill company address."); bill_address.focus(); return false; } if(bill_city.value == ""){ document.getElementById('error').innerHTML = 'Enter billing city.'; document.getElementById('error').style.display = 'block'; //alert("Enter bill city."); bill_city.focus(); return false; } if(bill_state.value == ""){ document.getElementById('error').innerHTML = 'Select billing state.'; document.getElementById('error').style.display = 'block'; //alert("Select bill state."); bill_state.focus(); return false; } if(bill_zip.value == ""){ document.getElementById('error').innerHTML = 'Enter billing zip code.'; document.getElementById('error').style.display = 'block'; //alert("Enter bill zip code."); bill_zip.focus(); return false; } if(!validateZip(bill_zip.value)){ document.getElementById('error').innerHTML = 'Enter a valid 5 digit zipcode.'; document.getElementById('error').style.display = 'block'; //alert("Enter bill zip code."); bill_zip.focus(); return false; } if(ph_no.value == ""){ document.getElementById('error').innerHTML = 'Enter phone number.'; document.getElementById('error').style.display = 'block'; //alert("Enter phone number."); ph_no.focus(); return false; } if(contact.value == ""){ document.getElementById('error').innerHTML = 'Enter Shipping contact.'; document.getElementById('error').style.display = 'block'; //alert("Enter company name."); contact.focus(); return false; } if(email.value == ""){ document.getElementById('error').innerHTML = 'Enter email.'; document.getElementById('error').style.display = 'block'; //alert("Enter email."); email.focus(); return false; } if(email.value != "" && echeck(email.value) == false){ document.getElementById('error').innerHTML = 'Enter Valid email address.'; document.getElementById('error').style.display = 'block'; //alert("Enter Valid email address."); email.focus(); return false; } if(document.getElementById('action').value == 'addvendor'){ if(comp_pass.value == ""){ document.getElementById('error').innerHTML = 'Enter password.'; document.getElementById('error').style.display = 'block'; //alert("Enter password."); comp_pass.focus(); return false; } } } } function setPickInterval(){ var val = document.getElementById('pickup_from_time').value; var from_am = document.getElementById('pickup_from_time_am').value; var to_am = document.getElementById('pickup_to_time_am').value; var opt = document.getElementById('pickup_to_time'); var opt_am = document.getElementById('pickup_to_time_am'); var arr = val.split(":"); var ntime = eval(arr[0])+2; if(ntime >= 12 && from_am == 'am'){ var a = eval(ntime) - 12; var b = 0+a; if(ntime == 12){ var nntime = ntime+":"+arr[1]; }else{ var nntime = b+":"+arr[1]; } for (var intLoop=0; intLoop < opt.length; intLoop++) { if (opt[intLoop].value == nntime) { opt[intLoop].selected = true; } } for (var intLoop1=0; intLoop1 < opt_am.length; intLoop1++) { if (opt_am[intLoop1].value == 'pm'){ opt_am[intLoop1].selected = true; } } } if(ntime >= 12 && from_am == 'pm'){ var a = eval(ntime) - 12; var b = 0+a; if(ntime == 12){ var nntime = ntime+":"+arr[1]; }else{ var nntime = b+":"+arr[1]; } for (var intLoop=0; intLoop < opt.length; intLoop++) { if (opt[intLoop].value == nntime) { opt[intLoop].selected = true; } } for (var intLoop1=0; intLoop1 < opt_am.length; intLoop1++) { if (opt_am[intLoop1].value == 'am'){ opt_am[intLoop1].selected = true; } } } if(ntime < 12){ var nntime = ntime+":"+arr[1]; for (var intLoop=0; intLoop < opt.length; intLoop++) { if (opt[intLoop].value == nntime) { opt[intLoop].selected = true; } } for (var intLoop1=0; intLoop1 < opt_am.length; intLoop1++) { if (opt_am[intLoop1].value == from_am){ opt_am[intLoop1].selected = true; } } } } function setPickIntervalBack(){ var val = document.getElementById('pickup_to_time').value; var from_am = document.getElementById('pickup_to_time_am').value; var to_am = document.getElementById('pickup_from_time_am').value; var opt = document.getElementById('pickup_from_time'); var opt_am = document.getElementById('pickup_from_time_am'); var arr = val.split(":"); var ntime = eval(arr[0])-2; if(ntime >= 12 && from_am == 'am'){ var a = eval(ntime) - 12; var b = 0+a; if(ntime == 12){ var nntime = ntime+":"+arr[1]; }else{ var nntime = b+":"+arr[1]; } for (var intLoop=0; intLoop < opt.length; intLoop++) { if (opt[intLoop].value == nntime) { opt[intLoop].selected = true; } } for (var intLoop1=0; intLoop1 < opt_am.length; intLoop1++) { if (opt_am[intLoop1].value == 'pm'){ opt_am[intLoop1].selected = true; } } } if(ntime >= 12 && from_am == 'pm'){ var a = eval(ntime) - 12; var b = 0+a; if(ntime == 12){ var nntime = ntime+":"+arr[1]; }else{ var nntime = b+":"+arr[1]; } for (var intLoop=0; intLoop < opt.length; intLoop++) { if (opt[intLoop].value == nntime) { opt[intLoop].selected = true; } } for (var intLoop1=0; intLoop1 < opt_am.length; intLoop1++) { if (opt_am[intLoop1].value == 'am'){ opt_am[intLoop1].selected = true; } } } if(ntime < 12){ var nntime = ntime+":"+arr[1]; for (var intLoop=0; intLoop < opt.length; intLoop++) { if (opt[intLoop].value == nntime) { opt[intLoop].selected = true; } } for (var intLoop1=0; intLoop1 < opt_am.length; intLoop1++) { if (opt_am[intLoop1].value == from_am){ opt_am[intLoop1].selected = true; } } } } function setDropInterval(){ var val = document.getElementById('drop_from_time').value; var from_am = document.getElementById('drop_from_time_am').value; var to_am = document.getElementById('drop_to_time_am').value; var opt = document.getElementById('drop_to_time'); var opt_am = document.getElementById('drop_to_time_am'); var arr = val.split(":"); var ntime = eval(arr[0])+4; if(ntime >= 12 && from_am == 'am'){ var a = eval(ntime) - 12; var b = 0+a; if(ntime == 12){ var nntime = ntime+":"+arr[1]; }else{ var nntime = b+":"+arr[1]; } for (var intLoop=0; intLoop < opt.length; intLoop++) { if (opt[intLoop].value == nntime) { opt[intLoop].selected = true; } } for (var intLoop1=0; intLoop1 < opt_am.length; intLoop1++) { if (opt_am[intLoop1].value == 'pm'){ opt_am[intLoop1].selected = true; } } } if(ntime >= 12 && from_am == 'pm'){ var a = eval(ntime) - 12; var b = 0+a; if(ntime == 12){ var nntime = ntime+":"+arr[1]; }else{ var nntime = b+":"+arr[1]; } for (var intLoop=0; intLoop < opt.length; intLoop++) { if (opt[intLoop].value == nntime) { opt[intLoop].selected = true; } } for (var intLoop1=0; intLoop1 < opt_am.length; intLoop1++) { if (opt_am[intLoop1].value == 'am'){ opt_am[intLoop1].selected = true; } } } if(ntime < 12){ var nntime = ntime+":"+arr[1]; for (var intLoop=0; intLoop < opt.length; intLoop++) { if (opt[intLoop].value == nntime) { opt[intLoop].selected = true; } } for (var intLoop1=0; intLoop1 < opt_am.length; intLoop1++) { if (opt_am[intLoop1].value == from_am){ opt_am[intLoop1].selected = true; } } } } function validateProvideDetails(){ with (document.providedetailsfrm){ /* alert ('aaaaa'); var drop_from = drop_from_time.value; var drop_from_am = drop_from_time_am.value; var drop_to = drop_to_time.value; var drop_to_am = drop_to_time_am.value; alert ('bbbb '+drop_from); var drop_from_arr = drop_from.split(":"); var drop_from_hr = drop_from_arr[0]; var drop_from_min = drop_from_arr[1]; alert ('cccc '+ drop_from_am); if(drop_from_am == 'pm'){ drop_from_hr = eval(drop_from_hr)+12; if(drop_from_hr == 24){ drop_from_hr = 00; } } var drop_to_arr = drop_to.split(":"); var drop_to_hr = drop_to_arr[0]; var drop_to_min = drop_to_arr[1]; if(drop_to_am == 'pm'){ drop_to_hr = eval(drop_to_hr)+12; if(drop_to_hr == 24){ drop_to_hr == 00; } } var drop_hr_difference = eval(drop_to_hr) - eval(drop_from_hr); var drop_min_difference = eval(drop_to_min) - eval(drop_from_min); alert (drop_hr_difference); if((drop_hr_difference < 2) || (drop_hr_difference == 2 && drop_min_difference < 0)){ alert("Drop Time interval must be more than four hour."); } return false; */ if(pickup_name.value == ""){ alert("Emter pickup company Name."); pickup_name.focus(); return false; } if(pickup_address.value == ""){ alert("Emter pickup Address."); pickup_address.focus(); return false; } if(pickup_city.value == ""){ alert("Emter pickup city."); pickup_city.focus(); return false; } if(pickup_phone.value == ""){ alert("Emter pickup phone"); pickup_phone.focus(); return false; } if(pickup_email.value != "" && echeck(pickup_email.value) == false){ alert("Emter valid pickup email."); pickup_email.focus(); return false; } if(drop_name.value == ""){ alert("Emter drop company name."); drop_name.focus(); return false; } if(drop_address.value == ""){ alert("Emter drop Address"); drop_address.focus(); return false; } if(drop_city.value == ""){ alert("Emter drop city."); drop_city.focus(); return false; } /*if(drop_phone.value == ""){ alert("Emter drop phone"); drop_phone.focus(); return false; }*/ if(drop_email.value != "" && echeck(drop_email.value) == false){ alert("Emter valid drop email."); drop_email.focus(); return false; } for(var j = 1 ; j <= maxItems ; j++){ if(document.getElementById("material_description_"+j)){ if(document.getElementById("material_description_"+j).value == ""){ alert("Emter Item " + j +" material description."); document.getElementById("material_description_"+j).focus(); return false; } if(document.getElementById("nmfc_"+j).value == ""){ alert("Enter Item " + j +" NMFC number."); document.getElementById("nmfc_"+j).focus(); return false; } if(document.getElementById("hazardous_class_"+j)){ if(document.getElementById("hazardous_class_"+j).value == ""){ alert("Select Item " + j +" hazardous class."); document.getElementById("hazardous_class_"+j).focus(); return false; } if(document.getElementById("emergency_contact_"+j).value == ""){ alert("Enter Item " + j +" emergency contact name."); document.getElementById("emergency_contact_"+j).focus(); return false; } if(document.getElementById("emergency_phone_"+j).value == ""){ alert("Enter Item " + j +" emergency phone."); document.getElementById("emergency_phone_"+j).focus(); return false; } } } } } } function displayDropbill(){ with (document.providedetailsfrm){ if(drop_bill.checked){ document.getElementById('drop_bill_div').style.display = 'block'; }else{ document.getElementById('drop_bill_div').style.display = 'none'; } } } function validateContactInfo(){ with (document.contactinfofrm){ if(name.value == ""){ document.getElementById('error').innerHTML = 'Enter Company Name.'; document.getElementById('error').style.display = 'block'; //alert("Enter company name."); name.focus(); return false; } if(contact.value == ""){ document.getElementById('error').innerHTML = 'Enter Shipping contact.'; document.getElementById('error').style.display = 'block'; //alert("Enter company name."); contact.focus(); return false; } if(ph_no.value == ""){ document.getElementById('error').innerHTML = 'Enter phone number.'; document.getElementById('error').style.display = 'block'; //alert("Enter phone number."); ph_no.focus(); return false; } if(address.value == ""){ document.getElementById('error').innerHTML = 'Enter company address.'; document.getElementById('error').style.display = 'block'; //alert("Enter company address."); address.focus(); return false; } if(city.value == ""){ document.getElementById('error').innerHTML = 'Enter city.'; document.getElementById('error').style.display = 'block'; //alert("Enter city."); city.focus(); return false; } if(state.value == ""){ document.getElementById('error').innerHTML = 'Enter state.'; document.getElementById('error').style.display = 'block'; //alert("Enter state."); state.focus(); return false; } if(zip.value == ""){ document.getElementById('error').innerHTML = 'Enter zip code.'; document.getElementById('error').style.display = 'block'; //alert("Enter zip code."); zip.focus(); return false; } if(!validateZip(zip.value)){ document.getElementById('error').innerHTML = 'Enter 5 digit valid zip code.'; document.getElementById('error').style.display = 'block'; //alert("Enter zip code."); zip.focus(); return false; } if(!document.getElementById('bill_info_no').checked){ if(bill_name.value == ""){ document.getElementById('error').innerHTML = 'Enter bill company name.'; document.getElementById('error').style.display = 'block'; //alert("Enter bill company name."); bill_name.focus(); return false; } if(bill_contact.value == ""){ document.getElementById('error').innerHTML = 'Enter bill company contact name.'; document.getElementById('error').style.display = 'block'; //alert("Enter bill company contact name."); bill_contact.focus(); return false; } if(bill_ph_no.value == ""){ document.getElementById('error').innerHTML = 'Enter bill phone number.'; document.getElementById('error').style.display = 'block'; //alert("Enter bill phone number."); bill_ph_no.focus(); return false; } if(bill_email.value != "" && echeck(bill_email.value) == false){ document.getElementById('error').innerHTML = 'Enter Valid bill email address.'; document.getElementById('error').style.display = 'block'; //alert("Enter Valid bill email address."); bill_email.focus(); return false; } if(bill_address.value == ""){ document.getElementById('error').innerHTML = 'Enter bill company address.'; document.getElementById('error').style.display = 'block'; //alert("Enter bill company address."); bill_address.focus(); return false; } if(bill_city.value == ""){ document.getElementById('error').innerHTML = 'Enter bill city.'; document.getElementById('error').style.display = 'block'; //alert("Enter bill city."); bill_city.focus(); return false; } if(bill_state.value == ""){ document.getElementById('error').innerHTML = 'Select bill state.'; document.getElementById('error').style.display = 'block'; //alert("Select bill state."); bill_state.focus(); return false; } if(bill_zip.value == ""){ document.getElementById('error').innerHTML = 'Enter bill zip code.'; document.getElementById('error').style.display = 'block'; //alert("Enter bill zip code."); bill_zip.focus(); return false; } if(!validateZip(bill_zip.value)){ document.getElementById('error').innerHTML = 'Enter 5 digit valid zip code.'; document.getElementById('error').style.display = 'block'; //alert("Enter zip code."); bill_zip.focus(); return false; } } //////////////////////////////// if(email.value == ""){ document.getElementById('error').innerHTML = 'Enter email.'; document.getElementById('error').style.display = 'block'; //alert("Enter email."); email.focus(); return false; } if(email.value != "" && echeck(email.value) == false){ document.getElementById('error').innerHTML = 'Enter Valid email address.'; document.getElementById('error').style.display = 'block'; //alert("Enter Valid email address."); email.focus(); return false; } if(comp_pass.value == ""){ document.getElementById('error').innerHTML = 'Enter password.'; document.getElementById('error').style.display = 'block'; //alert("Enter password."); comp_pass.focus(); return false; } if(comp_pass.value != re_comp_pass.value){ document.getElementById('error').innerHTML = 'Password and Confirm password does not match.'; document.getElementById('error').style.display = 'block'; //alert("Password and Confirm password does not match."); comp_pass.focus(); return false; } /////////////////////////////////////////// } } function checkProductJS(id){ var melement = "material_description_"+id; var save_item = "save_item_"+id; var desc = document.getElementById(melement).value; if(document.getElementById(save_item).checked){ if(desc == ''){ alert("Enter Product Description to Save it."); document.getElementById(melement).focus(); document.getElementById(save_item).checked = false; }else{ xajax_checkProduct(desc, id); } } } function confirmReplaceProduct(id){ var save_item = "save_item_"+id; if(confirm('This product already in catalog are you want to replace?')){ document.getElementById(save_item).checked = true; }else{ document.getElementById(save_item).checked = false; } } ///////////////////////////////////////////////////////////// function addAddressValidate(){ with (document.addaddressfrm){ if(company.value == ""){ alert("Enter Company Name."); company.focus(); return false; } if(address.value == ""){ alert("Enter Address."); address.focus(); return false; } if(city.value == ""){ alert("Enter City."); city.focus(); return false; } if(zip.value == ""){ alert("Enter Zip code."); zip.focus(); return false; } if(!validateZip(zip.value) ){ alert("Enter valid 5 digit Zip code."); zip.focus(); return false; } if(country.value == ""){ alert("Enter Country."); country.focus(); return false; } if(state.value == ""){ alert("Enter State."); state.focus(); return false; } if(phone.value == ""){ alert("Enter Phone Number."); phone.focus(); return false; } if(email.value != "" && echeck(email.value) == false){ alert("Enter Valid email address."); email.focus(); return false; } } } //////////////////////////////////////////////////////// function checkHazardous(){ if(document.getElementById("hazardous").checked){ document.getElementById("hazadours_div").style.display = 'block'; }else{ document.getElementById("hazadours_div").style.display = 'none'; document.getElementById("hazardous_class")[0].selected = true; document.getElementById("packing_group")[0].selected = true; document.getElementById("emergency_contact").value = ""; document.getElementById("emergency_phone").value = ""; } } ///////////////////////////////////////////////////////// function addProductValidate(){ with (document.addproductfrm){ if(desc.value == ""){ alert("Enter Product Description."); desc.focus(); return false; } if(!validateWeight(weight.value) && weight.value != ''){ alert("Enter valid weight"); weight.focus(); return false; } if(freight_class.value == ""){ alert("Select Freight Class."); freight_class.focus(); return false; } if(nmfc.value == ""){ alert("Enter NMFC Number."); nmfc.focus(); return false; } if(packing_type.value == ""){ alert("Select Packing Type."); packing_type.focus(); return false; } if(hazardous.checked){ if(hazardous_class.value == ""){ alert("Select Hazard Class."); hazardous_class.focus(); return false; } if(packing_group.value == ""){ alert("Select Packing Group."); packing_group.focus(); return false; } if(emergency_contact.value == ""){ alert("Enter Emergency Contact Name."); emergency_contact.focus(); return false; } if(emergency_phone.value == ""){ alert("Enter Emergency Phone Number."); emergency_phone.focus(); return false; } } } } //////////////////////////////////// function cancelShipmentJS(id){ xajax_cancelShipment(id); } function confirmCancelShipment(id){ var status = 'status_div_'+id; var cancel = 'cancel_div_'+id; document.getElementById("xajax_info").innerHTML = 'Shipment has been Canceled.'; document.getElementById("xajax_info").style.display = "block"; document.getElementById(status).innerHTML = '

Cancled
'; document.getElementById(cancel).innerHTML = ' '; } function getProductInfo(val){ var packing_type; var weight; var weight_unit; var hazardous; if(document.getElementById('packing_type_'+val).value == ''){ alert('Select Packing Type.'); document.getElementById('packing_type_'+val).focus(); return false; }else{ packing_type = document.getElementById('packing_type_'+val).value; } if(document.getElementById('total_weight_'+val).value == ''){ alert('Enter weight.'); document.getElementById('total_weight_'+val).focus(); return false; }else{ weight = document.getElementById('total_weight_'+val).value; } weight_unit = document.getElementById('weight_unit_'+val).value; if(document.getElementById('hazardous_'+val).checked){ hazardous = 'Yes'; }else{ hazardous = 'No'; } popUp('freight_class_email.php?action=freighthelp&packing_type='+packing_type+'&weight='+weight+'&weight_unit='+weight_unit+'&hazardous='+hazardous+''); } function URLEncode (clearString) { var output = ''; var x = 0; clearString = clearString.toString(); var regex = /(^[a-zA-Z0-9_.]*)/; while (x < clearString.length) { var match = regex.exec(clearString.substr(x)); if (match != null && match.length > 1 && match[1] != '') { output += match[1]; x += match[1].length; } else { if (clearString[x] == ' ') output += '+'; else { var charCode = clearString.charCodeAt(x); var hexVal = charCode.toString(16); output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase(); } x++; } } return output; } function getMeterialDesc(no){ var desc; var weight; var weight_unit; var freight_class; var packing_type; var hazardous; if(no == ''){ if(document.getElementById('desc').value == ''){ alert('Enter product description.'); document.getElementById('desc').focus(); return false; }else{ desc = document.getElementById('desc').value; } weight = document.getElementById('weight').value; weight_unit = document.getElementById('weight_unit').value; freight_class = document.getElementById('freight_class').value; packing_type = document.getElementById('packing_type').value; hazardous = document.getElementById('hazardous').value; popUp('nmfc_email.php?action=fromdetailfrm&nmfc=1&packing_type_1='+packing_type+'&weight_1='+weight+'&weight_unit_1='+weight_unit+'&hazardous_1='+hazardous+'&freight_class_1='+freight_class+'&desc_1='+URLEncode(desc)+''); //nmfc_email.php //document.nmfcemailfrm.submit(); }else{ if(document.getElementById('material_description_'+no).value == ''){ alert('Enter product description.'); document.getElementById('material_description_'+no).focus(); return false; }else{ desc = document.getElementById('material_description_'+no).value; } /*weight = document.getElementById('weight_'+no).value; weight_unit = document.getElementById('weight_unit_'+no).value; freight_class = document.getElementById('freight_class_'+no).value; packing_type = document.getElementById('packing_type_'+no).value; hazardous = document.getElementById('hazardous_'+no).value; popUp('nmfc_email.php?action=fromdetailfrm&nmfc='+no+'&packing_type_'+no+'='+packing_type+'&weight_'+no+'='+weight+'&weight_unit_'+no+'='+weight_unit+'&hazardous_'+no+'='+hazardous+'&freight_class_'+no+'='+freight_class+'&desc_'+no+'='+URLEncode(desc)+'');*/ popUp('nmfc_email.php?action=fromdetailfrm&nmfc='+no+'&desc_'+no+'='+URLEncode(desc)+''); } } function nmfcMailValidate(){ with (document.nmfcfrm){ if(name.value == ''){ alert("Enter Your Name."); name.focus(); return false; } if(email.value == ''){ alert("Enter Your Email."); email.focus(); return false; } if(desc.value == ''){ alert("Enter Product Description."); desc.focus(); return false; } } } function validateForGotPass(){ with (document.forgotpassfrm){ if(email.value == ''){ alert("Enter your email address."); email.focus(); return false; } if(!echeck(email.value)){ alert("Enter valid email address."); email.focus(); return false; } } } function inquiryValidate(){ with (document.inquiryfrm){ if(subject.value == ''){ alert("Enter subject."); subject.focus(); return false; } } } function contactUsValidate(){ with (document.contactusfrm){ if(name.value == ''){ alert("Enter name."); name.focus(); return false; } if(company.value == ''){ alert("Enter Company."); company.focus(); return false; } if(address.value == ''){ alert("Enter address."); address.focus(); return false; } if(state.value == ''){ alert("Select State."); state.focus(); return false; } if(zip.value == ''){ alert("Enter zip code."); zip.focus(); return false; } if(country.value == ''){ alert("Select Country."); country.focus(); return false; } if(email.value == ''){ alert("Enter email address."); email.focus(); return false; } if(!echeck(email.value)){ alert("Enter valid email address."); email.focus(); return false; } if(phone.value == ''){ alert("Enter phone number."); phone.focus(); return false; } if(comments.value == ''){ alert("Enter comments."); comments.focus(); return false; } } } /////////////////////////////////////////////// function LTrim(str) { var whitespace = new String(" \t\n\r"); var s = new String(str); if (whitespace.indexOf(s.charAt(0)) != -1) { var j=0, i = s.length; while (j < i && whitespace.indexOf(s.charAt(j)) != -1) j++; s = s.substring(j, i); } return s; } function RTrim(str) { var whitespace = new String(" \t\n\r"); var s = new String(str); if (whitespace.indexOf(s.charAt(s.length-1)) != -1) { var i = s.length - 1; // Get length of string while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1) i--; s = s.substring(0, i+1); } return s; } function Trim(str) { return RTrim(LTrim(str)); } function validateLogin(){ with (document.frmlogin){ if(Trim(usr_email_login.value) == ""){ alert("Enter email address."); usr_email_login.focus(); return false; } if(!echeck(usr_email_login.value)){ alert("Enter valid email address."); usr_email_login.focus(); return false; } if(pwd_login.value == ""){ alert("Enter Password."); pwd_login.focus(); return false; } } } function validateLoginLeft(){ with (document.lgnfrm){ if(Trim(usr_email.value) == ""){ alert("Enter email address."); usr_email.focus(); return false; } if(!echeck(usr_email.value)){ alert("Enter valid email address."); usr_email.focus(); return false; } if(pwd.value == ""){ alert("Enter Password."); pwd.focus(); return false; } } } function validateLoginAdmin(){ with(document.frmloginadmin){ if(user_name.value == ""){ alert("Enter Username."); user_name.focus(); return false; } if(password.value == ""){ alert("Enter Password."); password.focus(); return false; } } } function validateCredit(){ with(document.frmCredit){ if(legal_bus_name.value == ""){ alert("Enter Legal Business Name."); legal_bus_name.focus(); return false; } if(phy_address.value == ""){ alert("Enter Physical Address."); phy_address.focus(); return false; } if(phy_city.value == ""){ alert("Enter City."); phy_city.focus(); return false; } if(phy_state.value == ""){ alert("Enter State."); phy_state.focus(); return false; } if(phy_zip.value == ""){ alert("Enter Zip."); phy_zip.focus(); return false; } if(!validateZip(phy_zip.value) ){ alert("Enter valid 5 digit Zip code."); phy_zip.focus(); return false; } if(phy_phone.value == ""){ alert("Enter Phone."); phy_phone.focus(); return false; } if(billing_address.value == ""){ alert("Enter Billing Address."); billing_address.focus(); return false; } if(billing_city.value == ""){ alert("Enter Billing City."); billing_city.focus(); return false; } if(billing_state.value == ""){ alert("Enter Billing State."); billing_state.focus(); return false; } if(billing_zip.value == ""){ alert("Enter Billing Zip."); billing_zip.focus(); return false; } if(!validateZip(billing_zip.value) ){ alert("Enter valid 5 digit Zip code."); billing_zip.focus(); return false; } if(accounts_email.value != "" && echeck(accounts_email.value) == false){ alert("Enter Valid email address."); accounts_email.focus(); return false; } if(TR_name_1.value == ""){ alert("Enter TRADE REFERENCES Name."); TR_name_1.focus(); return false; } if(TR_address_1.value == ""){ alert("Enter TRADE REFERENCES Address."); TR_address_1.focus(); return false; } if(TR_city_1.value == ""){ alert("Enter TRADE REFERENCES City."); TR_city_1.focus(); return false; } if(TR_state_1.value == ""){ alert("Enter TRADE REFERENCES State."); TR_state_1.focus(); return false; } if(TR_zip_1.value == ""){ alert("Enter TRADE REFERENCES Zip."); TR_zip_1.focus(); return false; } if(!validateZip(TR_zip_1.value) ){ alert("Enter valid 5 digit Zip code."); TR_zip_1.focus(); return false; } if(TR_zip_2.value != "" && !validateZip(TR_zip_2.value) ){ alert("Enter valid 5 digit Zip code."); TR_zip_2.focus(); return false; } if(TR_zip_3.value != "" && !validateZip(TR_zip_3.value) ){ alert("Enter valid 5 digit Zip code."); TR_zip_3.focus(); return false; } if(TR_teleph_1.value == ""){ alert("Enter TRADE REFERENCES TelePhone."); TR_teleph_1.focus(); return false; } if(FCR_name_1.value == ""){ alert("Enter FREIGHT CARRIER REFERENCES Name."); FCR_name_1.focus(); return false; } if(FCR_address_1.value == ""){ alert("Enter FREIGHT CARRIER REFERENCES Address."); FCR_address_1.focus(); return false; } if(FCR_city_1.value == ""){ alert("Enter FREIGHT CARRIER REFERENCES City."); FCR_city_1.focus(); return false; } if(FCR_state_1.value == ""){ alert("Enter FREIGHT CARRIER REFERENCES State."); FCR_state_1.focus(); return false; } if(FCR_zip_1.value == ""){ alert("Enter FREIGHT CARRIER REFERENCES Zip."); FCR_zip_1.focus(); return false; } if(!validateZip(FCR_zip_1.value) ){ alert("Enter valid 5 digit Zip code."); FCR_zip_1.focus(); return false; } if(FCR_teleph_1.value == ""){ alert("Enter FREIGHT CARRIER REFERENCES TelePhone."); FCR_teleph_1.focus(); return false; } if(FCR_zip_2.value != "" && !validateZip(FCR_zip_2.value) ){ alert("Enter valid 5 digit Zip code."); FCR_zip_2.focus(); return false; } if(FCR_zip_3.value != "" && !validateZip(FCR_zip_3.value) ){ alert("Enter valid 5 digit Zip code."); FCR_zip_3.focus(); return false; } if(BR_name_1.value == ""){ alert("Enter BANK REFERENCES Name."); BR_name_1.focus(); return false; } if(BR_address_1.value == ""){ alert("Enter BANK REFERENCES Address."); BR_address_1.focus(); return false; } if(BR_city_1.value == ""){ alert("Enter BANK REFERENCES City."); BR_city_1.focus(); return false; } if(BR_state_1.value == ""){ alert("Enter BANK REFERENCES State."); BR_state_1.focus(); return false; } if(BR_zip_1.value == ""){ alert("Enter BANK REFERENCES Zip."); BR_zip_1.focus(); return false; } if(!validateZip(BR_zip_1.value) ){ alert("Enter valid 5 digit Zip code."); BR_zip_1.focus(); return false; } if(BR_teleph_1.value == ""){ alert("Enter BANK REFERENCES TelePhone."); BR_teleph_1.focus(); return false; } if(BR_zip_2.value != "" && !validateZip(BR_zip_2.value) ){ alert("Enter valid 5 digit Zip code."); BR_zip_2.focus(); return false; } if(BR_zip_3.value != "" && !validateZip(BR_zip_3.value) ){ alert("Enter valid 5 digit Zip code."); BR_zip_3.focus(); return false; } } } function claimValidate(){ with(document.frmClaim){ if(comments.value == ''){ alert("Enter Comments."); comments.focus(); return false; } } }