// build js file var calpop = new CalendarPopup("caldiv"); calpop.showNavigationDropdowns(); calpop.setCssPrefix("CAL"); calpop.addDisabledDates(null,"2010-09-05"); womOn(); if(_craandesigns_domain == "movingorbit.com"){ INTERNATIONAL_LINK = "http://movingorbit.com/International_Movers.html"; TRUCKING_LINK = "http://movingorbit.com/Truck_Rental.html"; SELF_SERVICE = "http://www.movingorbit.com/self_moving_services.html"; STORAGE ="http://www.movingorbit.com/Storage.html"; }else{ STORAGE = ""; } function storeZip(item, item2){ if(document.MovingForm.zip_hidden.value == "from") document.MovingForm.zip.value = item; else document.MovingForm.movingZip.value = item; } var auto = false; function setAuto(){ auto = !auto; } function toggleAuto(item){ var d = document.getElementById('auto_shipping'); if(item == 'yes'){ d.style.display = 'block'; auto = true; } else { d.style.display = 'none'; auto = false; } } function toggleInsurance(item){ var d = document.getElementById('insurance_box_declare'); if(item == 'yes'){ d.style.display = 'block'; insurance = true; } else { d.style.display = 'none'; insurance = false; } } var insurance = false; function setInsurance(){ insurance = !insurance; } function doMoveType(item){ if(item == "international" ){ window.location = INTERNATIONAL_LINK; doFullService(); doHideAutoshipping(); doHideStorage(); doInternational(); } if(item == "auto_shipping" ){ doHideAutoshipping(); doHideStorage(); doHideInternational(); doAutoshipping(); } if(item == "residential" || item == "office" || item == "small" || item == "last_minute"){ doHideAutoshipping(); doHideStorage(); doHideInternational(); doFullService(); } if(item == "uload" ){ window.location = SELF_SERVICE; } if(item == "storage"){ if(STORAGE != ""){ window.location = STORAGE; }else{ doHideAutoshipping(); doHideFullService(); doHideInternational(); doStorage(); } } if(item == "truck_rental"){ window.location = TRUCKING_LINK; } } function radioValid(field, radios, text) { radios=radios-1; var varChecked=false; for(i=0;i<=radios;i++) { if(field[i].checked) { varChecked=true; } } if (varChecked==false){ field[0].focus(); return "Please select " + text + ".\n"; }else{ return ""; } } function selectValid(field, text) { if (field[0].selected){ field.focus(); return "Please select a " + text + ".\n"; }else{ return ""; } } function emailValid(mailfield, len) { if(mailfield.value.length < len || mailfield.value.indexOf("@") < 1 || mailfield.value.indexOf(".") < 2){ mailfield.focus(); return "Please enter a valid Email.\n"; }else{ return ""; } } function lengthValid(field, len, text) { if (field.value.length < len) { field.focus(); return "Please enter a valid " + text + ".\n"; }else{ return ""; } } function getSelectValue(field){ var item = field.selectedIndex; if (item == -1) return ""; else return (field.options[item].value == "") ? field.options[item].text : field.options[item].value; } function doValidate(form){ valid = ""; validtype = selectValid(form.type,"Type of move"); var item = form.type.value; if( validtype.length > 0){ alert(validtype); return false; } if(item == "international" ){ valid += selectValid(form.access,"Size of move"); var field = getObject("mcountry"); valid += selectValid(field,"Moving to Country"); if(getSelectValue(field) == "USA"){ valid += lengthValid(form.movingZip, 5,"Moving to zip"); } field = getObject("fromcountry"); valid += selectValid(field,"Moving from Country"); if(getSelectValue(field) == "USA"){ valid += lengthValid(form.zip, 5,"Moving from zip"); } } if(item == "auto_shipping" || auto){ valid += lengthValid(form.zip, 5,"Moving from zip"); valid += lengthValid(form.movingZip, 5,"Moving to zip"); valid += lengthValid(form.model, 2, "Make of the car"); valid += lengthValid(form.modelType,5,"Model Type"); valid += selectValid(form.carType,"Car type"); valid += lengthValid(form.year,4,"Year (YYYY)"); valid += radioValid(form.modelStatus,2,"Is the vehicle in running condition?"); } if(insurance && form.insuranceValue.value == ''){ valid += "Insurance Value is required \n"; } if(item == "residential" || item == "office" || item == "uload" || item == "small" || item == "last_minute"){ valid += selectValid(form.access,"Size of move"); valid += lengthValid(form.zip, 5,"Moving from zip"); valid += lengthValid(form.movingZip, 5,"Moving to zip"); valid += radioValid(form.want_auto,2,"Would you like an auto shipping Quote is required"); valid += radioValid(form.insurance,2,"Would you like a Moving Insurance Quote is required"); } if(item == "storage"){ valid += selectValid(form.storageType,"Storage Type"); valid += lengthValid(form.zip, 5,"Zip Code"); valid += selectValid(form.estimatedTime, "Estimated Time"); valid += selectValid(form.storageReason, "Storage Reason"); var st = getSelectValue(form.storageType); if(st == "storage"){ valid += selectValid(form.estimateSize, "Size Needed"); }else{ valid += selectValid(form.storageContainer, "Container Location"); } } valid += emailValid(form.email, 2); // valid += lengthValid(form.name, 5,"Full Name"); var fullname = form.name.value.split(" "); if(fullname.length < 2) valid += "Please enter a Full Name (e.g.: John Doe)\n"; valid += lengthValid(form.phone, 10,"Phone") valid += checkdate(document.MovingForm.datestr); if(calculateFutureDate()) valid += "Please enter a Future date, your move needs to be at least 3 days in advance\n"; if(valid.length > 0){ alert(valid); return false; } return true; } function doCountry(){ var field = getObject("fromcountry"); if(getSelectValue(field) == "USA") doZipFrom(); else doHideZipFrom(); } function doToCountry(){ var field = getObject("mcountry"); if(getSelectValue(field) == "USA") doZipTo(); else doHideZipTo(); } function doZipFrom(){ z = getObject("zipbox"); z.style.display = "block"; } function doHideZipFrom(){ z = getObject("zipbox"); z.style.display = "none"; } function doZipTo(){ z = getObject("ziptobox"); z.style.display = "block"; } function doHideZipTo(){ z = getObject("ziptobox"); z.style.display = "none"; } function doInternational(){ i = getObject("country_box"); i.style.display = "block"; i = getObject("country_box_to"); i.style.display = "block"; doToCountry(); doCountry(); } function doHideInternational(){ i = getObject("country_box"); i.style.display = "none"; i = getObject("country_box_to"); i.style.display = "none"; } function doAutoshipping(){ w = getObject("auto_shipping"); w.style.display = "block"; al = getObject("auto_shipping_link_box"); al.style.display = "none"; doZipFrom(); doZipTo(); } function doHideAutoshipping(){ w = getObject("auto_shipping"); w.style.display = "none"; al = getObject("auto_shipping_link_box"); al.style.display = "block"; doHideZipFrom(); doHideZipTo(); } function doInsurance(){ w = getObject("insurance_box"); w.style.display = "block"; al = getObject("insurance_box_declare"); al.style.display = "none"; doZipFrom(); doZipTo(); } function doHideInsurance(){ w = getObject("insurance_box"); w.style.display = "none"; al = getObject("insurance_box_declare"); al.style.display = "block"; doHideZipFrom(); doHideZipTo(); } function doFullService(){ w = getObject("weightbox"); w.style.display = "block"; doHideAutoshipping(); doZipFrom(); doZipTo(); } function doHideFullService(){ w = getObject("weightbox"); w.style.display = "none"; al = getObject("auto_shipping_link_box"); al.style.display = "none"; doHideZipFrom(); doHideZipTo(); } function doStorage(){ w = getObject("storage_type"); w.style.display = "block"; doZipFrom(); doHideZipTo(); doStorageType(); } function doHideStorage(){ w = getObject("storage_type"); w.style.display = "none"; doHideZipFrom(); doHideZipTo(); } function doStorageType(){ if(getSelectValue(document.MovingForm.storageType) == "mobile_storage"){ getObject("location_box").style.display = "block"; getObject("estimate_size_box").style.display = "none"; }else if(getSelectValue(document.MovingForm.storageType) == "storage"){ getObject("estimate_size_box").style.display = "block"; getObject("location_box").style.display = "none"; } } function calculateFutureDate(){ var input = document.MovingForm.datestr; //Set the two dates today=new Date(); var yearfield=input.value.split("-")[0]; var monthfield=input.value.split("-")[1]; var dayfield=input.value.split("-")[2]; var furture = new Date(yearfield, monthfield-1, dayfield); //Month is 0-11 in JavaScript //Set 1 day in milliseconds var one_day=1000*60*60*24; //Calculate difference btw the two dates, and convert to days if(Math.ceil(( furture.getTime() - today.getTime() )/(one_day)) > 3) return false; return true; } function checkdate(input){ var validformat=/^\d{4}-\d{2}-\d{2}$/ //Basic check for format validity var returnval=false if (!validformat.test(input.value)) return "Invalid Date Format (yyyy-MM-dd).\n"; else{ //Detailed check for valid date ranges var yearfield=input.value.split("-")[0]; var monthfield=input.value.split("-")[1]; var dayfield=input.value.split("-")[2]; var dayobj = new Date(yearfield, monthfield-1, dayfield) if ((dayobj.getMonth()+1!=monthfield)||(dayobj.getDate()!=dayfield)||(dayobj.getFullYear()!=yearfield)) return "Invalid date (yyyy-MM-dd)\n"; else returnval=true } if (returnval==false) input.select() return ""; } function doNifty(){ if(!NiftyCheck()) return; RoundedTop("div.quickQuoteBox","#FFF",_craandesigns_color); RoundedBottom("div.quickQuoteBox","#FFF",_craandesigns_color); } document.write(''); document.write('