var MM_contentVersion = 6; var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0; if ( plugin ) { var words = navigator.plugins["Shockwave Flash"].description.split(" "); for (var i = 0; i < words.length; ++i) { if (isNaN(parseInt(words[i]))) { continue; } var MM_PluginVersion = words[i]; } var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion; } else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) { document.write(' \n'); //FS hide this from IE4.5 Mac by splitting the tag document.write('on error resume next \n'); document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n'); document.write(' \n'); } var submitcount = 0; //-------------------------------------------------------------------------- function showInsurance(doc) { window.open(doc,'insuranceWin','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=850, height=400'); } //----------------------------------------------------------------------------- // Toggles the right-hand side panels on or off // function togglePanel(oHide, oShow) { oHide.style.display = "none"; oShow.style.display = "inline"; } //----------------------------------------------------------------------------- // performs a form submission function Submit_OnClick(action) { document.ActionForm.ACTION.value = action; document.ActionForm.submit(); } //----------------------------------------------------------------------------- // creates a popup information notice before paypal or worldpay payment function popup_notice(action) { window.open("popup.php","pop","menubar=no,width=400,height=300,toolbar=no,location=no,screenX=600,screenY=384"); } //----------------------------------------------------------------------------- // performs a tracking lookup // defaults for following couriers are: // TNT uses 9 digit awb (<10) // DHL uses 10 digit awb (>9) // Citylink uses 8 mixed vars (<9) function Tracking_OnClick(form) { /* if (form.AWBNO.value.length <10){ window.open('http://www.tnt.com/webtracker/tracking.do?requestType=GEN&searchType=CON&navigation=1&respLang=en&respCountry=GB&genericSiteIdent=&cons='+form.AWBNO.value, 'Tracking', 'menubar=no,directories=no,location=no,scrollbars=yes,resizable=yes,width=800,height=600'); } if (form.AWBNO.value.length >9) { window.open('http://www.dhl.co.uk/publish/gb/en/eshipping/international_air.high.html?pageToInclude=RESULTS&AWB='+form.AWBNO.value+'&type=fasttrack&awb_hidden='+form.AWBNO.value+''); } if (form.AWBNO.value.length <9) { window.open('http://www.city-link.co.uk/pod/podfrm.php?JobNo='+form.AWBNO.value+'&hidebanners=', 'Tracking', 'menubar=no,directories=no,location=no,scrollbars=yes,resizable=yes,width=800,height=600'); } if (form.AWBNO.value.length >16) { window.open('http://www.dhl.co.uk/publish/gb/en/eshipping/international_air.high.html?pageToInclude=RESULTS&AWB='+form.AWBNO.value+'&type=fasttrack&awb_hidden='+form.AWBNO.value+''); } */ // DHL if ((form.AWBNO.value.length ==10) || (form.AWBNO.value.length ==19) || ((form.AWBNO.value.length ==18) && (form.AWBNO.value.charAt(0) =="J"))) { window.open('http://www.dhl.co.uk/publish/gb/en/eshipping/international_air.high.html?pageToInclude=RESULTS&AWB='+form.AWBNO.value+'&type=fasttrack&awb_hidden='+form.AWBNO.value+''); } // TNT if ((form.AWBNO.value.length ==13) || (form.AWBNO.value.length ==9)){ window.open('http://www.tnt.com/webtracker/tracking.do?requestType=GEN&searchType=CON&navigation=1&respLang=en&respCountry=GB&genericSiteIdent=&cons='+form.AWBNO.value, 'Tracking', 'menubar=no,directories=no,location=no,scrollbars=yes,resizable=yes,width=800,height=600'); } //CityLink if (form.AWBNO.value.length ==8) { window.open('http://www.city-link.co.uk/pod/podfrm.php?JobNo='+form.AWBNO.value+'&hidebanners=', 'Tracking', 'menubar=no,directories=no,location=no,scrollbars=yes,resizable=yes,width=800,height=600'); } //UK Mail if (form.AWBNO.value.length ==14) { window.open('http://www.business-post.com/scripts/wsisa.dll/ws_quickpod.html?lc_SearchValue='+form.AWBNO.value); } //UPS if (form.AWBNO.value.length ==18 && (form.AWBNO.value.charAt(0) !="J")) { window.open('http://wwwapps.ups.com/WebTracking/track?HTMLVersion=5.0&loc=en_GB&trackNums='+form.AWBNO.value+'&track.y=10&Requester=TRK_MOD&showMultipiece=N&detailNumber=undefined&WBPM_lid=homepage%2Fct1.html_pnl_trk'); } } //----------------------------------------------------------------------------- // performs a system form submission function System_OnClick(system) { switch (system) { case 'Login': document.LoginForm.PWD.value = hex_md5(document.LoginForm.PWD.value); break; } document.LoginForm.SYSTEM.value = system; document.LoginForm.submit(); } //----------------------------------------------------------------------------- // mutes or unmutes the talking head function onclick_MuteHead(mute, form) { //stopSpeech(); form.SYSTEM.value = 'muteHead'; form.submit(); } //----------------------------------------------------------------------------- // actions proxy account impersonation function onclick_Impersonate(system, form) { form.PROXY_NAME.value = form.PROXY_ACCOUNT_ID.options[form.PROXY_ACCOUNT_ID.selectedIndex].text; form.SYSTEM.value = system; form.submit(); } //----------------------------------------------------------------------------- // shows or hide the postocde and collection country based on the service type function onChangeService(os, cc) { // get the service selection 1:export, 2:Import, 3:Domestic, 4:3rdCountry var service = os.value; //os.options[os.selectedIndex].value; if (service == 4) { cc.style.display = "inline"; } else { cc.style.display = "none"; } } //----------------------------------------------------------------------------- // populates the countries drop list on the shipment details page based // on the service type selected. // function populateCountry(oc, ocl, os, ca) { // oc - country drop list // ocl - country drop list label // os - imexport_id // ca - array of countries // get the service selection 1:export, 2:Import, 3:Domestic; 4:3rdCountry var service = os.value; //os.options[os.selectedIndex].value; // store the existing country selection if appropriate var existing_country_select = 0; if (oc.length>0) { existing_country_select = oc.options[oc.selectedIndex].value; } // clear country drop list oc.length = 0; if (service == 3) { option = document.createElement('OPTION'); option.text = 'United Kingdom'; option.value = 1; try { oc.add(option, null); // standards compliant; doesn't work in IE } catch(ex) { oc.add(option); // IE only } if (ocl != null) ocl.value = "Country:" // as it is domestic just add UK and finish return; } else if (service == 1) { if (ocl != null) ocl.value = "Destination Country:" } else if (service == 2) { if (ocl != null) ocl.value = "Collection Country:" } else if (service == 4) { if (ocl != null) ocl.value = "Destination Country:" } option = document.createElement('OPTION'); option.text = "-- select country --"; option.value = 0; try { oc.add(option, null); // standards compliant; doesn't work in IE } catch(ex) { oc.add(option); // IE only } option = document.createElement('OPTION'); option.text = "USA"; option.value = 215; try { oc.add(option, null); // standards compliant; doesn't work in IE } catch(ex) { oc.add(option); // IE only } if (option.value == existing_country_select) { oc.selectedIndex = 1; } var i=1; for(x=0;x< ca.length;x++) { if ((ca[x][0] != 1)) // don't add UK { option = document.createElement('OPTION'); option.text = ca[x][1]; option.value = ca[x][0]; try { oc.add(option, null); // standards compliant; doesn't work in IE } catch(ex) { oc.add(option); // IE only } if (option.value == existing_country_select) { //oc.selectedIndex = existing_country_select; oc.selectedIndex = i+1; //existing_country_select; } i++; } } } //----------------------------------------------------------------------------- // sets the postcode label based // on the service type selected. // function setPostcodeLbl(opl, op, os) { // opl - postcode label // os - service drop list // get the service selection 1:export, 2:Import, 3:Domestic var service = os.value; //os.options[os.selectedIndex].value; if ((service == 3) || (service == 1)) { opl.value = "Collection Postcode:"; return; } else if (service == 2) { opl.value = "Destination Postcode:"; } //op.value=""; // clear since would be invalid as service has changed } //----------------------------------------------------------------------------- // sets the selected item in a list box based on the passed value // function setListBoxValue(o, value) { if (o == null) return; var i; for (i=0; i< o.length ; i++) { if (o.options[i].value == value) { o.selectedIndex = i; break; } } } //----------------------------------------------------------------------------- // sets the selected item in a list box based on the passed integer value // function setListBoxIntValue(o, value) { setListBoxValue(o,parseInt(value)); } //----------------------------------------------------------------------------- // sets the selected item in a list box based on the passed value // function setListBoxText(o, text) { if (o == null) return; var i; for (i=0; i s) { o.style.color = 'red'; alert('There are ' + str.length + ' characters of text in this field.\nThe maximum allowed is ' + s + ' characters, please edit the text to make it shorter.'); o.focus(); } else { if (o.readOnly) { o.style.color = 'gray'; } else { o.style.color = 'black'; } } } //----------------------------------------------------------------------------- // calculates the insurance cost // function calcInsurance(oIns, oVal, oPct, oLab, oPerEff, oMobLap, oAudioLcd) { var goodsVal = parseFloat(oVal.value); if (isNaN(goodsVal)) { goodsVal = 0; } var insPct = parseFloat(oPct.value); if (isNaN(insPct) || (insPct == 0)) { oLab.value = ""; return; } if (oIns.checked && (goodsVal<=20000)) { var cost = Math.max(10, (goodsVal * insPct)); if (oPerEff != null && oPerEff.checked) { cost += 20.0; } if (oMobLap != null && oMobLap.checked) { cost += 5.0; } if (oAudioLcd != null && oAudioLcd.checked) { cost += 10.0; } var fee = 0; // calculate insurance admin fee if (goodsVal <= 1000) { fee = 3.00; } else if (goodsVal <= 2000) { fee = 4.00; } else if (goodsVal <= 5000) { fee = 7.50; } else { fee = 10.00; } cost = (parseInt((cost+0.005)*100)/100) + fee; oLab.value = "Your insurance premium is £"+cost.toFixed(2)+" (includes £"+fee.toFixed(2)+" administration fee)"; } else { if(goodsVal>1000) { oLab.value = "We strongly recommend taking out full insurance coverage for shipment values over £1000"; } else { oLab.value = ""; } } } //----------------------------------------------------------------------------- // calculates the volumetric weight // function calcVMW(form){ form.VMWRESULT.value = "Calculating..."; var id = 0; sLength = parseFloat(form.VMWLENGTH.value); sWidth = parseFloat(form.VMWWIDTH.value); sDepth = parseFloat(form.VMWHEIGHT.value); sId = $("#idVMWSERVICE").val(); sUnit = $("#idVMWUnits").val(); $.post('ajax_vol_weight.php', { 'id': sId, 'length': sLength, 'width': sWidth, 'height': sDepth, "unit": sUnit }, function(data) { form.VMWRESULT.value = data; }); } function calcVMW1(form){ convert = 1.0; //div = 6000.0; if (form.VMWUNITS.options[form.VMWUNITS.selectedIndex].text == 'Inch') { convert = 2.54; } if (form.VMWSERVICE.options[form.VMWSERVICE.selectedIndex].text == 'DHL Express') { div=5000.0; } if (form.VMWSERVICE.options[form.VMWSERVICE.selectedIndex].text == 'DHL Economy Europe') { div=4000.0; } if (form.VMWSERVICE.options[form.VMWSERVICE.selectedIndex].text == 'Global Saver') { div=4000.0; } sWidth = parseFloat(form.VMWLENGTH.value); sLength = parseFloat(form.VMWWIDTH.value); sDepth = parseFloat(form.VMWHEIGHT.value); if (sWidth&&sLength&&sDepth) { vmw = ((sWidth*convert) * (sLength*convert) * (sDepth*convert)) / div; form.VMWRESULT.value = (parseInt(vmw*100))/100; } else { form.VMWRESULT.value = ""; } } //----------------------------------------------------------------------------- // rounds a number to a specified decimal place // function roundNumber(num, dec) { var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec); return result; } //----------------------------------------------------------------------------- // converts between Inches and CMs // function convInchCMs(oInches, oCMs) { sLenInches = parseFloat(oInches.value); if (sLenInches) { oCMs.value = roundNumber((sLenInches * 2.54), 2); } } //----------------------------------------------------------------------------- // converts between CMs and Inches // function convCMsInches(oInches, oCMs) { sLenCMs = parseFloat(oCMs.value); if (sLenCMs) { oInches.value = roundNumber((sLenCMs / 2.54), 2); } } //----------------------------------------------------------------------------- // converts between pounds and Kgs // function convPoundsKgs(oPounds, oKgs) { sWeight = parseFloat(oPounds.value); if (sWeight) { oKgs.value = roundNumber((sWeight / 2.2), 2); } } //----------------------------------------------------------------------------- // converts between Kgs and pounds // function convKgsPounds(oPounds, oKgs) { sWeight = parseFloat(oKgs.value); if (sWeight) { oPounds.value = roundNumber((sWeight * 2.2), 2); } } //----------------------------------------------------------------------------- // populates the collection to times based on the selected collection from time // function populateCollectTime(of, ot, dt, et, minHours){ var timeFr var timeTo = ot.options[ot.selectedIndex].value; var bookDt = dt.options[dt.selectedIndex].value; var td = new Date(); var dtArry = bookDt.split('-'); // erase the time to listbox ot.length = 0; // coll time can't be before now if today. if (td.getDate() == dtArry[2]) { // find time list after now. for (var i = of.selectedIndex; i < of.options.length; i++) { // timeFr = of.options[i].value; h = parseFloat(timeFr.substring(0, 2)); // extract hours m = parseFloat(timeFr.substring(3, 5)); // extract mins // time after now, use this time. if ((td.getHours() < h) || ((td.getHours() == h) && (td.getMinutes() < m))) { of.selectedIndex = i; break; } } } else { timeFr = of.options[of.selectedIndex].value; // h = parseFloat(timeFr.substring(0, 2)); // extract hours m = parseFloat(timeFr.substring(3, 5)); // extract mins } newTime = (((h+minHours)*60*60) + (m*60))*1000; // convert to ms today var i = 0; do { option = document.createElement('OPTION'); d = new Date(newTime); option.text = ((d.getHours()<10)?"0":"")+d.getHours()+":"+((d.getMinutes()<10)?"0":"")+d.getMinutes()+ ((d.getHours()<12)?" AM":" PM"); option.value = ((d.getHours()<10)?"0":"")+d.getHours()+":"+((d.getMinutes()<10)?"0":"")+d.getMinutes(); try { ot.add(option, null); // standards compliant; doesn't work in IE } catch(ex) { ot.add(option); // IE only } // reset selected ready to time if (timeTo == option.value) { ot.selectedIndex = i; } newTime += 1800000; // add 30 minutes in ms i++; } while (newTime <= et) // finish when end time (in ms) is reached } //----------------------------------------------------------------------------- // Toggles US state drop list on/off // function toggleUSState(o, div) { if (div == null) return; if (o.options[o.selectedIndex].value == '215') { div.style.display = "inline"; } else { div.style.display = "none"; } } //----------------------------------------------------------------------------- // auto populates the contact and address fields // function populateAddressDetails(form, a) { hash = form.COPY.options[form.COPY.selectedIndex].value; // value stored as index#location_id // we want the index value i = hash.substring(0,(hash.indexOf('#', 0))); // get the location id of the 'cloned' address form.CLONE_LOCATION_ID.value = hash.substring(hash.indexOf('#', 0)+1); form.COMPANY_NAME.value = string_html_decode(a[i][0]); form.CONTACT_NAME.value = string_html_decode(a[i][1]); form.TELEPHONE.value = string_html_decode(a[i][2]); form.EMAIL.value = string_html_decode(a[i][3]); form.ADDRESS.value = string_html_decode(a[i][4]); form.CITY.value = string_html_decode(a[i][5]); setListBoxValue(form.STATE_ID,a[i][6]); form.POSTCODE.value = string_html_decode(a[i][7]); setListBoxIntValue(form.COUNTRY_ID, parseInt(a[i][8])); toggleUSState(form.COUNTRY_ID, document.all.idStatePanel); if (i==0) { form.COPY.options[0].text = "-- copy address details --"; } else { form.COPY.options[0].text = "-- new address details --"; } // a copy shouldn't be edited //enableAddressDetails(form, (i==0)); } //----------------------------------------------------------------------------- // auto populates the contact and address fields // function enableAddressDetails(form, enable) { form.COMPANY_NAME.disabled = !enable; form.CONTACT_NAME.disabled = !enable; form.TELEPHONE.disabled = !enable; form.EMAIL.disabled = !enable; form.ADDRESS.disabled = !enable; form.STATE_ID.disabled = !enable; form.POSTCODE.disabled = !enable; form.COUNTRY_ID.disabled = !enable; } //----------------------------------------------------------------------------- // decodes HTML encoding // function string_html_decode(str) { var r = new String(str); r = r.replace(/</g, "<"); r = r.replace(/>/g, ">"); r = r.replace(/'/g, "'"); r = r.replace(/"/g, "\""); return r; } //----------------------------------------------------------------------------- // strips away CR/LF and replaces with supplied string // /* function string_crlf_replace(str) { var r = new String(str); r = r.replace(/\r\n/g, "\\r"); r = r.replace(/'/g, "\\'"); r = r.replace(/"/g, '\\"'); return r; } */ //----------------------------------------------------------------------------- // deletes a specified booking // function deleteBooking(id) { document.BookingsForm.QUOTE_ID.value = id; document.BookingsForm.SYSTEM.value = 'Delete'; document.BookingsForm.submit(); } //----------------------------------------------------------------------------- // post process a postcode - removes spaces and capitalizes // function postProcessPostCode(o) { var r = new String(o.value); r = r.replace(/ /g, ''); o.value = r.toUpperCase(); } //----------------------------------------------------------------------------- // creates a popup window // function popupWindow(href) { window.open(href, null, 'toolbar=no,status=yes,scrollbars=yes,resizable=yes,location=no,menubar=no'); } //----------------------------------------------------------------------------- // creates a specified sized popup window // function popupWindowSize(href, name, w, h) { window.open(href, name, 'toolbar=no,status=yes,scrollbars=yes,resizable=yes,location=no,menubar=no,width='+w+',height='+h); } //----------------------------------------------------------------------------- // creates a PDF booking summary popup window // function pdfBookingSummary(encrypt, proforma, bo) { popupWindow('http://www.wedelivertheworld.co.uk/docs/booking_summary.php?id='+encrypt+(proforma?'&pf=1':'')+(bo?'&bo=1':'')); } //----------------------------------------------------------------------------- // creates a PDF Label popup window // function pdfLabel(encrypt, proforma, bo) { popupWindow('http://www.wedelivertheworld.co.uk/docs/label.php?id='+encrypt+(proforma?'&pf=1':'')+(bo?'&bo=1':'')); } //----------------------------------------------------------------------------- // creates an HTML booking summary popup window // function htmlBookingSummary(encrypt, proforma) { popupWindowSize('http://www.wedelivertheworld.co.uk/docs/print_booking_summary.php?id='+encrypt+(proforma?'&pf=1':''), 'BookingSummary', 600, 800); } //----------------------------------------------------------------------------- // creates an HTML order summary popup window // function htmlOrderSummary(encrypt) { popupWindowSize('http://www.wedelivertheworld.co.uk/docs/print_order_summary.php?id='+encrypt, 'OrderSummary', 600, 800); } //----------------------------------------------------------------------------- // creates an HTML standard proforma popup window // function htmlProformaStandard(encrypt) { popupWindowSize('http://www.wedelivertheworld.co.uk/docs/print_proforma_std.php?id='+encrypt, 'ProformaStd', 800, 800); } //----------------------------------------------------------------------------- // creates a popup window // function pdfOrderSummary(encrypt, proforma) { popupWindow('http://www.wedelivertheworld.co.uk/docs/order_summary.php?id='+encrypt+(proforma?'&pf=1&awb=1':'')); } //----------------------------------------------------------------------------- // creates a popup window // function pdfAirwaysBill(encrypt, proforma) { popupWindow('http://www.wedelivertheworld.co.uk/docs/airwaysbill_pdf.php?id='+encrypt+(proforma?'&pf=1':'')); } //----------------------------------------------------------------------------- // creates a proforma PDF popup window // function pdfProformaSummary(encrypt) { popupWindow('http://www.wedelivertheworld.co.uk/docs/proforma.php?id='+encrypt); } //----------------------------------------------------------------------------- // creates a proforma PDF popup window // function htmlProformaEnhanced(encrypt) { popupWindowSize('http://www.wedelivertheworld.co.uk/docs/print_proforma_ext.php?id='+encrypt, 'ProformaExt', 800, 800); } imgFadeObjects = new Object(); imgFadeTimers = new Object(); //----------------------------------------------------------------------------- // fades images // function imgFade(object, destOp, rate, delta) { if (!document.all) return; if (object != "[object]") { setTimeout("imgFade("+object+","+destOp+","+rate+","+delta+")",0); return; } clearTimeout(imgFadeTimers[object.sourceIndex]); diff = destOp-object.filters.alpha.opacity; direction = 1; if (object.filters.alpha.opacity > destOp) { direction = -1; } delta=Math.min(direction*diff,delta); object.filters.alpha.opacity+=direction*delta; if (object.filters.alpha.opacity != destOp) { imgFadeObjects[object.sourceIndex]=object; imgFadeTimers[object.sourceIndex]=setTimeout("imgFade(imgFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate); } } //----------------------------------------------------------------------------- // // if ( document.images ) { image_got_a_question = new Image(461, 75); image_got_a_question.src = 'images/got_a_question.gif'; image_got_a_question_o = new Image(461, 75); image_got_a_question_o.src = 'images/got_a_question_o.gif'; } else { image_got_a_question = "" image_got_a_question_o = "" } //----------------------------------------------------------------------------- // // function di(id,name) { if (document.images) { document.images[id].src=eval(name+".src"); } } //----------------------------------------------------------------------------- // // function dm(msgStr) { document.returnValue = false; if (document.images) { window.status = msgStr; document.returnValue = true; } } //----------------------------------------------------------------------------- // // var showMsg = navigator.userAgent != "Mozilla/4.0 (compatible; MSIE 4.0; Mac_PowerPC)"; function dmim(msgStr) { document.returnValue = false; if (showMsg) { window.status = msgStr; document.returnValue = true; } } //add bookmark function bookmarksite(title,url){ // KONQUER,SAFARI,FIREFOX,IE,OPERA,NETSCAPE ARE WORKING... // var ua=navigator.userAgent.toLowerCase(); var isKonq=(ua.indexOf('konqueror')!=-1); var isSafari=(ua.indexOf('webkit')!=-1); var isMac=(ua.indexOf('mac')!=-1); var buttonStr=isMac?'Command/Cmd':'CTRL'; if(window.external && (!document.createTextNode || (typeof(window.external.AddFavorite)=='unknown'))) { window.external.AddFavorite(url, title); // IE/Win } else if(isKonq) { alert('Please press CTRL + B to add our site to your favorites (bookmark our site)');//KONQUER LINUX } else if(window.opera) { alert('Please press CTRL + D to add our site to your favorites (bookmark our site)');//OPERA } else if(window.home || isSafari) { alert('Please press '+buttonStr+' + D to add our site to your favorites (bookmark our site)');// Firefox, Netscape, Safari, } else if(!window.print || isMac) { alert('Please press Command/Cmd + D add our site to your favorites (bookmark our site)');// IE5/Mac and Safari 1.0 } else { alert('In order to bookmark this site you need to do so manually '+ 'through your browser.'); } }