Tampilkan postingan dengan label Insurance Quote Vehicle. Tampilkan semua postingan
Tampilkan postingan dengan label Insurance Quote Vehicle. Tampilkan semua postingan

Jumat, 01 Januari 2010

Business vehicle insurance - Private Commercial - Aviva

Insure your business cars and vans

Whats the difference?

Sole trader, company and personal, whats the difference?

Sole trader: A business where there is no legal difference between the owner(s) and the business.

Company: We class a company as any business which is not a sole trader.

Personal: If you are the registered keeper of your vehicle and use it purely for social purposes or commuting to and from work then you need personal cover. Cover is available for yourself as the policyholder and up to four additional drivers on each vehicle.

Insure a second car or van on our Defaqto 5 Star rated MultiCar policy and get up to 1/3 off.

We expect 20% of our customers to achieve the maximum saving.* Not only could you be making some great savings, we hope youll find that the cover provides you with the flexibility and convenience you need to fit with your lifestyle.

Great reasons to buy our business vehicle insurance:

  • Discount if you buy online.
  • Up to £500 tool cover as standard (comprehensive cover only).
  • 3 year guarantee on all repairs made by our approved repairers.
  • Replacement car and van options available to keep your business on the road.
  • More than one vehicle? Get up to 1/3* off with our MultiCar policy and choose different levels of cover and excesses on each vehicle. Add your second vehicle when it suits you. We can give you a guaranteed quote now even if youd like to add your second vehicle at a later date.
  • You can insure up to two vehicles (cars and/or vans) online, if you want to insure more than two vehicles and a maximum of five, call us on 0800 056 2063.
  • Our Defaqto 5 Star Rating provides you with independent expert reassurance about the quality of cover we provide as standard, as well as options to tailor your cover.

* Get up to 1/3 off applied to the cheaper of the two vehicle insurance premiums. Both vehicles must be registered at the same address. Discount does not apply to optional extras. Where you are eligible for more than one discount, these will be applied one after the other.

Contact us

0800 056 2063

Monday to Friday
8.00am 8.00pm
Saturday
9.00am 5.00pm
Sunday
10.00am 4.00pm

For our joint protection, telephone calls may be recorded and/or monitored

Back to top

Kamis, 31 Desember 2009

Mercury Insurance Group - Auto Insurance & Car Insurance

Southern California Wildfires

Mercury Insurance is ready to help victims of multiple Southern California wildfires.

Learn More

Announcing Mercurys Customer Portal

New Customer PortalMake payments, view auto policy information, download ID cards to your smartphoneand much more!

Learn More

Low Rates & Incredible Service

Mercury Special AgentsOur highly skilled agents are on a mission to save you money while delivering superior, personalized service.

Learn More

Pledge to Not Text and Drive

Mercury Insurance OpenJoin LA Kings Captain, Dustin Brown, by signing the pledge to not text while driving.

Learn More

10 Reasons to Choose Mercury

Rest easy knowing your family is protected by one of America's most trusted insurance companies.

Learn More

Report a Claim (800) 503-3724

You can report a claim 24 hours a day, seven days a week.

Learn More

Rabu, 30 Desember 2009

Mobile Home Insurance Quote Foremost Insurance

Insurance product quote options are based on state and availability. Select a product and state to determine your options for a free insurance quote.


Talk with an Agent Near You

Thousands of agents across the country represent Foremost and are ready to talk to you about your Mobile Home insurance quote questions. It's likely more than a couple are in your area. We are proud to work with local agents because they offer a valuable service in consulting with you about insurance coverage for your property.


Work Directly with Foremost Insurance Service Center

1-800-237-2060
1-800-767-1430 (Commercial)

Submit Online Quote Request

Complete and submit an online form for a no-obligation insurance premium estimate.

AARP Members

Get an estimate through the Foremost AARP Mobile Home Insurance Program

Selasa, 29 Desember 2009

Premierline - Get a Commercial and Business Insurance

As the first direct business insurance provider, Premierline Direct helped transform the way commercial insurance was bought in the UK.  We set new standards for speed, service and value.  Today we continue to pride ourselves as being a responsive and reliable team who really understands small businesses.  We provide tailored commercial insurance and van insurance policies, underwritten by Allianz Insurance plc, so we can make sure you get the right cover you need, no more, no less. In fact, our customers have saved an average of £139* when they switch to us.  Get an online quote in minutes today and start saving on your business insurance.

Senin, 28 Desember 2009

Vehicle Insurance Cheap Rates - Affordable Auto Insurance

Get Insured Today

If you are in the market for auto insurance, you may be aware of just how competitive the industry is. There are literally dozens of different companies that are interested in obtaining your business. While sorting through all of these different companies can be confusing and even a bit overwhelming, the competition is actually good for you because it helps to drive down the prices. With the help of American Car Quotes, you can streamline this process and obtain the very best deals possible.

Let the Insurance Companies Come to You

When you take advantage of the services being offered by American Car Quotes, you also do not have to worry about hunting down the insurance companies. We have already taken care of that for you! We have determined which companies are leaders in the industry and have narrowed down your choices accordingly. Then, with the information you provide us with, we can determine which are best suited to you and we pass your contact information along. That way, all you need to do is sit back and wait for them to contact you.

Don't worry, you aren't going to be contacted by these companies with their mass marketing campaigns - no one needs more junk mail to throw away. Rather, they will take the information that you provided in order to send you a quote that is specific to your needs. As the quotes start to pour in, you can compare each of them and determine which one is right for you.

It's Fast and Easy

Fill Out Just One Form

Many years ago, the only way to compare the prices of various insurance companies was to complete a separate form for each company and to answer all of their personal questions. This process was quite time consuming and could be frustrating when all of this time spent resulted in being told the company could not cover you or in finding out that they wanted way too much money.

When you take advantage of the services offered by American Car Quotes, you will only need to fill out one form and you will only have to do it one time. We then take the information that you provide and send it to those companies that match your needs. Therefore, you dont have to worry about filling out multiple forms and you dont have to worry about wasting your time with insurance companies that can't meet your needs.

Learn More

Of course, our site isnt all about trying to match drivers up with different insurance companies. Rather, we want you to make the best decisions possible and, the only way you can do that is to be informed. Therefore, as you browse through our site, you will find that we offer a great deal of information and advice that will help you choose the type of coverage you need and who you will purchase it from that is just our way of providing you with the best service we can.

Get Started Now

If you are ready to start learning more about the great insurance companies that are available to you and about the rates these companies can offer, take a moment to fill out our simple online form. This form asks a few simple questions that will take you less than 15 minutes to complete and, you only have to fill it out once!

After you have completed the form, we will gather you information and forward it to the appropriate insurance agencies. They will then form a quote for you and contact you through various methods including email, standard mail, fax, telephone, or whatever you prefer. It really is that easy!

Sabtu, 26 Desember 2009

Cheap Car Insurance Quote in just 2 mins - Budget Direct

Finding cheap car insurance in Australia that gives you cover you need isnt easy, especially with so many car insurance companies around. They may tell you theirs is the cheapest car insurance around, but it is the best car insurance for you?

At Budget Direct, you could get the cover you need for a lot less than youd expect to pay. And dont just take our word for it. You can quickly see what our customers said they saved by switching to Simply Smarter Budget Direct Car Insurance.

Now, compare car insurance quotes online with Budget Direct (we can give you an insurance quote online in just three minutes) and see just how much you could save.

If youre serious about getting a cheap car insurance quote with some great policy options, get an online car insurance quote from us today.

Jumat, 25 Desember 2009

Car Insurance Quotes, Auto Insurance Rates - Compare at

Easily and quickly save on your car insurance by comparison shopping at Kanetix.ca.

Since 1999, we've been helping Canadians save on their auto insurance:

Introduction to auto insurance quotes in Canada


Your automobile insurance is there to protect you against losses in the event of an accident, theft, vandalism, or some other incident that involves your vehicle and causes damage, liability or injury. Your policy is, essentially, a contract between you and your insurance company. You pay a premium, and in return, the insurer agrees to pay for any losses as they are defined in policy.

Read more >>

Auto insurance and the law

In Canada, it is law that you have vehicle insurance. It is valid anywhere in Canada and the United States and you should keep proof of your car insurance with you whenever you drive because you must produce it upon the request of a police officer. If you are found driving without valid insurance, you can have your driver's licence suspended and your vehicle impounded.

In Canada, each province and territory establishes their own required minimum insurance coverage. However, you can often get options that go beyond the basics; you can personalize your policy to make certain that you've got the exact protection you require, without paying for extra insurance you may not need.

The law does not require that you get insurance to cover physical damages to your car. However, if you have a newer automobile you'll want to protect your investment and consider purchasing Collision and Comprehensive coverage. In some cases, if you are financing or leasing you may be required to have both.

What does auto insurance cover?

Your insurance generally provides property, liability and medical coverage:

  • Property coverage pays for damage or theft of your car.
  • Liability coverage pays for your legal responsibility to others for bodily injury or property damage.
  • Medical coverage pays for the cost of treating injuries, rehabilitation and sometimes lost wages and funeral expenses.
  • For more information on auto insurance, please visit the Financial Services Commission of Ontario website.

*52.0% of Kanetix customers in Ontario who participated in the survey said Kanetix helped them identify an average savings amount of $752.82 (November 1, 2013 - January 31, 2014) on their car insurance. The cited amount represents the average difference between the best quote obtained at www.kanetix.ca and the current premium amount of participants in the survey. The savings amount varies by individual and does not constitute a guarantee; in each individual case, the difference may be smaller or greater than the savings amount cited.

Hide


Every season, no matter the season, has its own set of driving hazards. Whether it's spring, summer, fall or winter, these driving tips will help you get to where you want to go, safely.

Spring may be in the air, but there are often storms that are reminiscent of winter. Check out the 'Snow, Ice and Winter Storms' section for in-depth coverage in how to drive in winter weather, plus:

Day or night turn on your headlights. Spring temperatures can change in the blink of an eye resulting in misty, foggy conditions that can reduce your visibility. And while foggy conditions are common in spring, so too is the occasional spring blizzard; don't be too quick to ditch the winter car safety kit in your car, or switch from your winter tires to your summer set.

April showers, may bring May flowers, but it also often brings wet slippery roads. Drive to the conditions and you'll get to where you want to go safely. As you would in winter, slow down and leave extra distance between your vehicle and the one ahead of you. It takes longer to stop when conditions are wet and slippery. Also, where possible, drive in the middle lanes; water tends to pool in the curb lanes and could lead to hydroplaning.

Foul weather isn't the only factor to watch for; warm weather means there will be more motorcyclists, cyclists and pedestrians out and about. Watch for pedestrians and share the road with all users.

Lastly, your car has been through a lot in the winter and is probably in need of some attention. Take it in for a spring tune up to your risk of driving problems this spring.

After a long bitter winter and a slow wet spring, you may be ready to hit the road again, but be careful: according to the Canada Safety Council, more fatalities occur on Canadian roads during the summer months than at any other time of year. Whether you're heading out for the day, going to the cottage or taking a road trip with the family, remember to put safety first.

You'd think that summer driving would be the safest, when in fact the reverse is true. Summer brings increased traffic to the roads and highways. With more drivers on the road, construction, motorcyclists, cyclists, and pedestrians to watch for, don't let the clear weather fool you into thinking that summer driving is easy driving.

Stay safer this summer and: don't drink and drive; always wear your seatbelt; don't drive when fatigued; and tune out the distractions.

The dog days of summer are over, and there's a chill in the air. Weather conditions in the fall, like spring, can be unpredictable. A warm, sunny day can turn dark, cold and rainy in no time. Mist and fog can reduce your visibility, and the first snow of the winter isn't unlikely. Give yourself plenty of space between you and the cars around you and remember to drive to the conditions.

The leaves may be changing colour and are beautiful to admire, but keep your eyes on the road and your attention focused. Fall brings the first frost of the season so beware of slippery conditions. And, if the temperature is hovering around freezing, then approach bridges and overpasses with caution as these tend to ice up quicker than the road.

When the leaves fall remember that they are a hazard on their own; they can hide potholes or other road hazards, and when they're wet, can be as slippery as any ice-covered road.

Ice is a major concern for anyone driving in extreme cold weather conditions. Not only does it create a smooth surfacing that can lead to sliding and loss of vehicular control, but it can also be difficult to detect. When faced with this type of road condition, drive carefully and reduce your speed and allow as much as three car lengths more than normal between yourself and the car ahead of you.

In general, drive slowly and refrain from stepping too heavily on the brakes to avoid skidding. Watch out in particular for black ice. In areas that experience extremely cold weather, melted snow and puddles of water can quickly freeze, particularly when in the shade or on a bridge or overpass. It is called black ice because it can be nearly impossible to see until you're upon it.

Heavy snow creates a driving situation that is a mixed bag of dangerous driving conditions. It diminishes your ability to see, and creates slippery road conditions. At the beginning of snow season, invest in winter or snow tires. This will give the best traction possible for the conditions.

During heavy snowfall, it is safest to avoid driving. If staying off the road is not an option, first clear the car's windows of snow and ice to improve visibility. As with driving in icy conditions, it is important that the distance between cars is at least three car lengths more than normal. When other cars follow too closely, allowed them to pass.

Sleet and freezing rain can affect a your ability to safely manoeuvre your vehicle, and often officials will advise you to avoid driving under these conditions. When driving in these conditions is absolutely necessary, follow safe driving protocols: reduce speed and allow more following distance. Drivers often encounter freezing rain and sleet on bridges and overpasses first and should always exercise extreme caution when driving across them.

If you become stranded during winter storm conditions such as a blizzard, remain in the vehicle until help arrives. To make the car more visible, a brightly coloured ribbon, piece of cloth or towel should be tied to an antenna or outside mirror. An emergency kit that contains water, blankets, rope, a flashlight, and non-perishable foods should be kept in the car for emergencies. Use the additional clothing and blankets to keep warm. If there are no blankets in the car use items such as floor mats or even the seat covers to help keep warm. The car's heater may be used, but it should only be run for ten minutes every hour. When running the heater, keep a window slightly open to help with ventilation. Additionally, the vehicle's exhaust pipe should be kept clear to prevent poisonous gases from entering the car.

Whether it is freezing rain or blizzard-like snowfall, it is important that people drive safely when getting behind the wheel. While it is often best to stay indoors during extreme weather conditions, knowing how to drive for the specific condition goes a long way in keeping one safe while on the road.

The Kanetix Car Insurance Quick Quote App

Buying a car? Quickly compare how much it costs to insure 1, 2, 3 or more cars in a matter of seconds right from your iPhone or Android Smartphone. In one simple step get up to 3 car insurance estimates:

  • Save on your auto insurance; the Quick Quote will tell you which cars cost more to insure and which cost less!
  • Use the VIN scanner to read the bar codes on your car to quickly load in necessary details for a quote
  • Rates ranked low, medium and high for easy comparison
  • One tap to connect to Kanetix
  • Save quote details right to your smartphone device
  • Get renewal reminders delivered directly to your phone
Download the FREE Kanetix Comparison App for your iPhone or Android Smartphone!

Download the App

What's in it for you?

A first of its kind in Canada, The Kanetix Car Insurance Quick Quote app makes buying a car easier than ever. Knowing how much a vehicle could end up costing to insure prior to buying or leasing could sway your decision and save you thousands of dollars in the process.

Of course, the app isn't only for those purchasing new rides! Off the assembly line or used, the Kanetix Car Insurance Quick Quote can help you compare rates in no time:

  • Tell us about yourself and use the app's VIN scanner to tell us about your vehicle with ease
  • Compare rates that are ranked low, medium or high for easy evaluation
  • One tap to connect to Kanetix

Finding the best deal on your car insurance is no longer a matter of waiting until you have access to a desktop or lap top - all you need is your phone! With the free to download Kanetix Car Insurance Quick Quote app, you can compare the rates of many of Canada's top insurance providers simply by scanning your ride's VIN, or selecting it from our easy drop-down format.

How do I get it?

Downloading the free app is as simple as a click of a button.

You can also search for "Kanetix" in the Apple App Store and Google Play Store on your phone.

What else can I do with the app?

The Kanetix Car Insurance Quick Quote app can get you car insurance quotes in seconds, and much more:

  • Easily compare quotes between vehicles
  • Save your quote details for easy repeat visits
  • Subscribe to policy renewal reminders

And, most of all, you'll never have to worry again about overpaying for your auto insurance.

How easy is it to use the Kanetix Car Insurance Quick Quote app?

In one simple step tell us about:

  • Yourself (your postal code, age, gender and how many tickets and accidents you have)
  • Your car (year, make and model)

That's it, because once we have these tidbits of information we'll show you up to 3 car insurance estimates. It couldn't be easier and will take you less time than it did to read all about the Kanetix Car Insurance Quick Quote app.

Kamis, 24 Desember 2009

Car Insurance Quotes Online 24/7/365 MiWay.co.za

Car Insurance Quotes Online 24/7/365 | MiWay.co.za

Car Insurance QuotesAre you looking for car insurance to suit your budget, with benefits like free roadside assistance and rewards even if you claimed? MiWay offers flexible and affordable motor insurance, we even allow you to fix your premiums for a period of 36 months!*

MiWay will reward you if you prefer doing things online! By simply applying for and taking out your car insurance policy online, MiWay will pay you an average full month's premium after 3 months full premiums are received.*

*Terms & conditions apply

Why choose MiWay's standard Car Insurance?

  • Affordable premiums, low flat excess
  • Apply and buy your car insurance online to earn extra rewards
  • Great Service, hassle free claims process
  • Earn rewards whether you claim or not
  • Free Roadside emergency assistance
  • Earn rewards and save on joining fees by buying your car insurance online
  • Fix your premiums for a period of 36 months!*

*Terms & conditions apply

Types of Car Insurance

MiWay offers three types of car insurance Comprehensive, Third Party Fire and Theft, and Third Party only.

Comprehensive car insurance provides the widest cover and covers for theft and hijacking, damages due to an accident, fire or explosion and natural disasters like hail and floods. Comprehensive cover also includes damage to the vehicles glass and liability to other parties as a result of an accident.

Third Party Fire and Theft insurance provides insurance cover for any damage you may cause to the vehicle of another person, and the accidental death or injuries of third parties involved in the same accident. You will also be compensated for the loss of your vehicle due to attempted theft, theft or hijacking, as well as any damage to your vehicle that was caused by fire, lightning or explosions.The main difference between 'Comprehensive' and 'Third Party Fire and Theft' is that your car is not covered against accidental damage.

Third Party Only insurance is the cheapest car insurance and provides insurance cover for any damage you may cause to the vehicle of another person as well as the accidental death or injuries of third parties involved in the same accident. You have no cover under this insurance type against the loss of, or damage to your own vehicle.

Car Insurance Options

In addition to accident or theft, comprehensive car insurance in South Africa covers losses due to fire and explosion, natural disasters like hail and floods and damage to the vehicles glass.

Additional options such as car hire and cover for non-standard sound systems and car accessories can also be added to your motor insurance policy.

MiWay can cover your car for either private, professional or business use:

Private or social purposes, including driving between your home and regular place of work will be classified as private use.

Professional use is where the car forms an essential part of the performance of any work or function as a Lawyer, Doctor, Actuary, Accountant, Architect or an Engineer and it also includes private use.

Business use is where the car forms an essential part of the performance of any work or function and it also includes private use.

Scenario: If you utilise your car for business purposes, your car is on the road more often than if you only use it for private purposes. The chance of it being stolen or involved in an accident is therefore much greater. The premium for a car being used for business purposes is higher compared to the same car being used only for private purposes. If you insure your car for the incorrect use you will not have cover on your car in the event of a claim as the premium paid will be incorrect.

Your vehicle can be insured for one of the following values:

  • Retail value
  • Market value (the average between the vehicles retail and trade values)
  • Trade value
  • Specially agreed value (which applies to unlisted, collectors and vintage vehicles where a valuation is given by an appropriate approved source)

Your policy coversheet reflects the value that you chose. The amount to this value will be determined at the time of loss taking into account the age, mileage and condition of the vehicle.

What process is involved in getting your vehicle insured?

The car insurance process starts with you, the car owner, completing an insurance quote from MiWay online or telephonically. Assuming you find the premium affordable, which we are sure you will, you agree to a start date for your new cover. MiWay will send you your documentation including a Coversheet (Policy schedule), which spells out the terms of your insurance policy and explains everything you need to know regarding your policy and car insurance in general. If necessary, MiWay will also help you to find an inspection centre which is convenient for you to visit. Your vehicle insurance cover will be fully activated once MiWay has received your premium. Please remember to comply with any requirements, i.e. have your car inspected, install additional security devices (like a tracking device, immobilizer etc), as this will influence whether you would enjoy insurance cover or not.

Get a SpeedQuote* and sign up online in minutes!

'); // and refer to this reference number: '+(retData.ref || 'ERROR')+' $('html, body').animate({ scrollTop: $('div.thank_you:first').offset().top - 50 }, 200); Miway.Tracking.pixelTrack(312984, retData.ref); trackPageview('/gagoal/request-a-call/product-success/' +(this.form.find('input[name="callmeback_product"]').val() || 'err')); } else if (parseInt(retData.errors.length) > 0) { html = ''; $.each(retData.errors, function (index, value) { html += '

' + value + '

'; }); $.alert({ alertHtml:html, alertType: 'warn'}); } }.bind(this), error: function (request, status, error) { this.unload(); $.alert({ alertHtml:'

Sorry, an unknown error has occured. Please try again.

', alertType:'warn'}); this.ajaxErrors += (error.toString() + '|||'); $('html, body').animate({ scrollTop: this.form.offset().top - 50 }, 200); }.bind(this) }); } else { this.validation = this.validate(); $('form#callbackForm1020 input, form#callbackForm1020 textarea').setDefaultValue(); } }, load: function () { this.formSubmitBtn.text('sending...').addClass('disabled').unbind('click'); $(this.loaderImg).insertAfter(this.formSubmitBtn); }, unload: function () { this.formSubmitBtn.text(this.defaultSubmitText).removeClass('disabled'); $('.loader').remove(); this.addSubmit(); }, addSubmit: function () { // attach submit this.formSubmitBtn.unbind('click').click(function (e) { if (this.debug) log(this.formSubmitBtn.text() + ' - click'); e.preventDefault(); this.submit(); }.bind(this)); }}); var btnHtml = ''; $('#callback1020 .plugin.vertical').append(btnHtml);
',TEMPLATES:{npForm:'',npInput:'',assist:'

{body}

', licenseSelect: '',selectEl:'',optionEl:'',button:'{text}'// address:''},initialize: function(options){var switches,loadScreenImage;this.opt = Object.extend({helpTimeout:300,formSubmitBtn:$('.form_submit'),product_id:'',app_id:0,miwy_np:0,cur_step:2, isMixpress: false,miwy_fa:'', form_type:'',getFormData:ProtoBits.emptyFunction,onInit:ProtoBits.emptyFunction, submitUrl: "/misc/xhr/form_actions.php", validationSelect: '.form.tab-container:visible form.validate', formValuesSelect: '#content'}, options || {});// if (this.opt.isMixpress == true) { loadScreenImage = '/images/generic-loader-pink-big.gif';// } else if (/*$('input[name="product_id"]').size() > 0 && */this.opt.product_id.length > 0){// loadScreenImage = '/images/' + this.opt.product_id.toLowerCase().strip() + '-loader.gif';// } this.loadScreen = new LoadScreen({ 'image':loadScreenImage, 'message':"Please wait...", 'disableClose':true, 'disableCloseTimeout':0, 'extraTopOffset': (-100), 'extraMessageTop': 120 }); this.loadScreen.show({image:false,color:"transparent",opacity:0,message:''});this.helpTimer = setTimeout(this.pageAssist.bind(this), (this.opt.helpTimeout*1000));this.getFormData = this.opt.getFormData.bind(this);this.oninit = this.opt.onInit.bind(this); this.validate();$('body').append(this.loader);this.loader = $("#ajax_loader");this.loader.remove(); shortSwitches = $('.form-column.full .yesno-switch:not(.switch-active)');longSwitches = $('.form-column:not(.full) .yesno-switch:not(.switch-active)'); sideSwitches = $('.form_top_right .yesno-switch:not(.switch-active), .insurance_quotes .yesno-switch:not(.switch-active)'); shortSwitches.parents('div.field-input').find('.question').addClass('yesno'); longSwitches.parents('div.field-input').find('.question').addClass('yesno');sideSwitches.parents('div.field-input').find('.question').addClass('yesno');setTimeout(function(){ longSwitches.createInputSwitch({ handleOnPosition:0, customClass:'long', checkedLabel:'YES', uncheckedLabel:'NO' }); setTimeout(function () { shortSwitches.createInputSwitch({ handleOnPosition:0, //customClass:'long', checkedLabel:'YES', uncheckedLabel:'NO', customClass: 'short' }); setTimeout(function () { sideSwitches.createInputSwitch({ handleOnPosition:0, customClass:'short', checkedLabel:'YES', uncheckedLabel:'NO' }); }, 50); }, 50);}, 50); $('div.field .yesno-radio').createYesNoInput();this.formValues = $(this.opt.formValuesSelect).serializeElement(); if ($('#form_help_bar').size() > 0) { this.sidebarStartTop = $('#form_help_bar').offset().top; }this.oninit(); setTimeout(function () { this.loadScreen.close(); $("input[name='fullnames'], input[name='surname'], input[name='fullnames_regulardriver'], input[name='surname_regulardriver'], input[name='preferredname'], input[name='preferredname_regulardriver']").on("keyup", function(){ try{ $(this).val($(this).val().split(" ").invoke("capitalize").join(" ")); }catch(e){} }); }.bind(this), 500); this.validate(); if (!Object.isUndefined(this.opt.isMixpress) && this.opt.isMixpress == true) { $('.prefer_story').hide().remove(); } $('input.number').each(function(){var el = $(this),validInputs=['insured_value','sum_insured','building_value','insured','jewellery_insurance'];if(validInputs.hasVal(el.attr('name'))){el.insert({'before':'

R

'});}}); //temp fix for insured_value if($("input[name='insured_value']").val() != null){$("input[name='insured_value']").insert({'before':'

R

'});} // make/model/year and brand new or used $AR('beforeSubmit', this.preSubmit, 0, this); $(document).ready(function () { window.lastYearVal = 0; if (typeof $FD('year') != 'undefined') { window.checkYearInterval = setInterval(function () { var yearVal = $FD('year').tiaValue; if (yearVal.length == 4 && yearVal != window.lastYearVal) { var el = $('select[name="brand_new__used__rebuild"]') || []; if (el.size() > 0) { if (parseInt(yearVal) Brand new'}); el.createSelect(); } } else { clearInterval(window.checkYearInterval); } } window.lastYearVal = yearVal; }, 1000); } }); var fields = $('.container').find('[name="make_model"],[name="property_address"],[name="building_address"],[name="night_time_suburb"],[name="day_time_suburb"]'); fields.on('mouseup', function (ev) { this.select(); });// if (!Object.isUndefined(globals.global_ssl_enabled) && parseInt(globals.global_ssl_enabled) == 1) {// var sUrl = this.opt.submitUrl;// if (!Object.isUndefined(sUrl) && sUrl != null && sUrl != '') {// var hname = document.location.hostname;// if (sUrl.substr(0,1) == '/') {// sUrl = 'https://'+hname+sUrl;// }// }// this.opt.submitUrl = sUrl;// delete sUrl;// }}, switchToForm: function(){ trackEvent('form preference', 'switch form', 'to form'); window.onbeforeunload = ProtoBits.emptyFunction; var ls = new LoadScreen({ 'image': '/images/generic-loader-pink-big.gif', 'message': '', 'disableClose':true, 'disableCloseTimeout':0, 'extraTopOffset': (-100), 'extraMessageTop': 120 }); ls.show('Please wait while we load a normal form for you...'); setTimeout(function () { $("#normal_form").submit(); }, 1000); }, switchToStory: function(){ trackEvent('form preference', 'switch form', 'to story'); window.onbeforeunload = ProtoBits.emptyFunction; var ls = new LoadScreen({ 'image': '/images/generic-loader-pink-big.gif', 'message': '', 'disableClose':true, 'disableCloseTimeout':0, 'extraTopOffset': (-100), 'extraMessageTop': 120 }); ls.show('Please wait while we load the story version...'); setTimeout(function () { $("#story_form").submit(); }, 1000); },setupSidebar:function(el, anchor){$('body').append(this.help_arrow);this.help_arrow = $('div.form_help_arrow');this.help_arrow.hide(); if ($('#form_help_bar').size() > 0 || $(el).size() > 0) { this.sideBar = Object.isUndefined(el) ? $('#form_help_bar') : $(el);if(this.sideBar !== null && this.sideBar.size() > 0){ this.innerSideBar = this.sideBar.find('div.plugin'); this.sideBarComplete = this.sideBar.find('div.percent_complete');this.sideBarTitle = this.sideBar.find('div#percent_complete h2'); this.scrollAnchor = Object.isUndefined(anchor) ? $("#tabs_container") : $(anchor); this.sidebarOffsetTop = this.sideBar.offset().top;this.sideBarTitle.hide(); this.help_arrow.css({'left':(this.sideBar.offset().left-30)+'px'}); this.sideBar.css("position", "relative"); this.scrolling = false;}// $(document)._on('mousewheel','',this.scrollSidebar.bind(this));// $(document).bind('scroll', this.scrollSidebar.bind(this)); }}, updateSidebar: function (id) { this.help_arrow = $('div.form_help_arrow'); if (typeof id == 'string' && typeof this.sidebarStartTop != 'undefined') { var el = $('#'+id), helpDiv = $('div.help_text');; if (el.size() > 0) {// log('updateSidebar');// log(el.parents('div.field').offset());// log(this.sidebarStartTop); var arrowTop = ((el.parents('div.field').offset().top)-40), fieldTop = el.parents('div.field').offset().top, newmargin,contentDiv = el.parents('.tab-container'),contentMax = (contentDiv.offset() != null ? contentDiv.offset().top : 0) + contentDiv.height(),newmargin = fieldTop - this.sidebarStartTop - 158;// 58 is to center the center of the arrow with the heading in the "compliance copy"// log(newmargin);// log(newmargin+this.sideBar.height()+this.sidebarStartTop+$('div#form_help_bar .form_top_right').height());// log(contentMax); //$('div.form_help_arrow').css({'top': arrowTop+'px'}).show('fade',200);(newmargin+this.sideBar.height()+this.sidebarStartTop+$('div#form_help_bar .form_top_right').height()) > contentMax ? newmargin = (contentMax -this.sidebarOffsetTop- this.sideBar.height()-$('div#form_help_bar .form_top_right').height()): 0;// log("margin-top:"+newmargin);this.sideBarTitle.show(); this.sideBar.animate({'margin-top':newmargin+'px'}, 250); this.help_arrow.show().animate({'top': (el.parents('div.field').offset().top-34)+'px'}, 250); if(typeof this.helpText != 'undefined' && this.helpText != "" && this.helpText != helpDiv.html()){ helpDiv.html(this.helpText); helpDiv.show('fade'); //helpDiv.fadeIn(); this.helpText = "" } } } if ($('#form_help_bar').size() > 0) { this.help_arrow.css({'left':($('#form_help_bar').offset().left-30)+'px'}); //log(this.help_arrow.css('left')); } },scrollSidebar: function(e){var top,padding,limit,wh,ih;top = ($(document).scrollTop()-this.sidebarOffsetTop)+10;padding = $('.form_top_right').cssUnit('padding')[0];Object.isUndefined(padding) ? padding = 0 : 0;limit = ((this.scrollAnchor.offset().top-this.sidebarOffsetTop)+this.scrollAnchor.realHeight())-this.sideBar.realHeight()/*+(padding*2)))-5*/;wh = ($(window).height()-20);ih = wh-(this.sideBarComplete.height()+this.innerSideBar.cssUnit('paddingTop')[0]+this.innerSideBar.cssUnit('paddingBottom')[0]+this.innerSideBar.cssUnit('marginTop')[0]+this.innerSideBar.cssUnit('marginBottom')[0]+90); this.scrolling = false;//if(top > -1){//if(top 0) {// Object.isFunction(this.setRowActive) ? this.setRowActive($(el)) : 0;// }if (!this.helpLocked) {var elId,field;el = $(el);elId = el.find('input,select').identify(); if (Object.isFunction(elId.gsub)) { elId = elId.gsub('_hiddeninput',''); }field = $FD(elId); if (Object.isFunction(e.stop)) e.stop();if(this.arrowTimer){clearTimeout(this.arrowTimer);this.arrowTimer = false;this.pageY = (el.offset().top);this.helpText = !Object.isUndefined(field) ? (field.long_help_txt || field.fieldDisplayName) : "";}if(!this.arrowTimer){this.arrowTimer = setTimeout(function(e){ this.updateSidebar(elId);this.arrowTimer = false}.bind(this), 250)}}},activateLicenseField: function() {this.licenses = $('.do_licenses');if (this.licenses.size() > 0) { var date = new Date(); var currentMonth = date.getMonth(); var currentDate = date.getDate(); var currentYear = date.getFullYear(); this.licenses.each(function () { var fieldId = $(this).identify(),fieldName=$(this).attr('name'),c,data,textValue;data = (typeof $FD(fieldName).tiaValue == 'object' && !Object.isUndefined($FD(fieldName).tiaValue.array) ? $FD(fieldName).tiaValue.array : $FD(fieldName).tiaValue)|| [];c = data.size();if(c > 0){textValue = c+(c == 1 ? ' licence' : ' licences');FieldData.setFieldVal(fieldName, data, textValue);$('#'+fieldId).text(textValue);} $(this).customField({ columns: { licenseType: { title:"Licence Type", className:'name', type:'content', content:'' }, licenseDate: { title:"Issue Date", className:'data', type:'input', inputClass:'date required' } }, onvalidate : function(value){ for (var i = 0; i 0) { var currentMil = parseInt(new Date().getFullYear().toString().slice(0,2)); var currentYear = parseInt(new Date().getFullYear().toString().slice(2,4)); y = parseInt(idnum.slice(0,2)); if (y > currentYear && y.toString() != '0') { y = parseInt(((currentMil - 1).toString() + y.toString())); } else { y = parseInt(((currentMil).toString() + y.toString())); } m=parseInt(idnum.slice(2,4))-1; d=parseInt(idnum.slice(4,6)); dob = new Date(y,m,d); eighteen = parseInt(dob.getFullYear()) + 18; var currentFullYear = parseInt(currentMil.toString() + currentYear.toString()); var diff = (new Date().getFullYear()) - eighteen; } else { var diff = 30; } function checkDisabledMonths(y, ui) { //log(eighteen); //log(ui); setTimeout(function () { $('[data-month]').find('a').removeClass('ui-state-disabled'); var d = new Date()/*, months = {'January':0, 'February':1, 'March':2, 'April':3, 'May':4, 'June':5, 'July':6, 'August':7, 'September':8, 'October':9, 'November':10, 'December':11}*/; if (ui.selectedYear == eighteen) { d.setFullYear(eighteen); d.setMonth((parseInt(idnum.slice(2,4)))-1); //log(d.getMonth()); for (i = 0;i 0) { var d = new Date(); d.setFullYear(eighteen); sett.defaultDate = d; } //} date.monthpicker(sett); $('.ui-monthpicker-trigger').remove(); date.attr('readonly','readonly'); $('#licenseType').createSelect(); }, showEvent: ['click','focus'],// hideEvent: 'blur', tooltipTitle: $FD('licenses').help_txt, fieldName: $FD('licenses').fieldName, onsave: function(data) { var c = data.size(),textValue; textValue = c+(c == 1 ? ' licence' : ' licences');// console.log(data); FieldData.setFieldVal(fieldName, data, textValue); $('#'+fieldId).text(textValue); if ($('#'+fieldId+'_hiddeninput').size() > 0) { $('#'+fieldId+'_hiddeninput').val(textValue).blur().valid(); } }, saveText: 'Save Licences', data: data }); });}},createVehicleAutocomplete: function(el){var type = this.opt.product_id;this.vs = $(el).autoComplete({ showAlternateCar: true, keywordType: this.opt.product_id,dataUrl:"/misc/xhr/vehicle_search.php",addFilter: function(obj){var data = {};data[obj.makeModelCode] = obj;return data;},keywordFilter: function(keyword){keyword.match('vw') ? keyword = keyword.gsub("vw", 'volkswagen') : 0return keyword;},dataFilter: function(o){ //if (!Object.isUndefined(o[0]) && o[0] != 'null') { if (Object.isString(o[1].name)) { var matchString = (o[1].name.toLowerCase()).match(this.keyword) != null ? (o[1].name.toLowerCase()).match(this.keyword) : (o[1].tags.toLowerCase()).match(this.keyword); if(matchString == null){ var arrSearchTerm = this.keyword.split(' '); for (var i = 0; i '+years+''; } d[o[0]] = vname; return d; } } //}},clickResult:function(e, el){el = $(el);if(el.identify() != "no_select"){var code,data,name;name = this.getText(el);code = el.identify(); switch(code) { case 'carcantfind': // Can't find your car? //log('-11 !'); $(this.el).removeClass('error').parents('.error').removeClass('error'); $(this.el).parents('div.field').find('.message').text(''); this.carTooltip = $(this.el).customCarField({ onsave: function (data, id) { var code = $('#model :selected').val(); var textValue = $('select[name="custom"]#make :selected').val() + ' ' + $('select[name="custom"]#name :selected').val() + ' ' + $('select[name="custom"]#model :selected').text();var year =$('#carYear :selected').text(); $('#'+id).val(year + ' ' + textValue);// this.hiddenInput.val(code);// this.hiddenYearInput.val(year); FieldData.setFieldVal('make_model', code, textValue); FieldData.setFieldVal('year', year, year); try { $('#'+id).valid();$('#'+id).blur(); } catch (err) { } } }, type); this.carTooltip.showTooltip(); this.removeContainer(); setTimeout(function () { var make = $('select[name="custom"]#make'); var name = $('select[name="custom"]#name'); var year = $('select[name="custom"]#carYear'); var model = $('select[name="custom"]#model'); make.unbind('change').createSelect({colMax: 1, optionsClass: 'custom-car', colWidth: 200, colMinWidth: 200}); name.createSelect({colMax: 1, optionsClass: 'custom-car', colWidth: 200, colMinWidth: 200}).attr('disabled', true); year.createSelect({colMax: 1, optionsClass: 'custom-car', colWidth: 200, colMinWidth: 200}).attr('disabled', true); model.createSelect({colMax: 1, optionsClass: 'custom-car', colWidth: 200, colMinWidth: 200}).attr('disabled', true); this.blueLoader = ''; $.ajax({ url: '/misc/xhr/vehicle_search.php', type: 'POST', data: 'type='+type+'&get=make', dataType: 'json', success: function (retHtml) { $('.blue-loader').remove(); $('select[name="custom"]#make').html(''+(retHtml.list || '')); $('select[name="custom"]#make').createSelect({colMax: 1, optionsClass: 'custom-car', colWidth: 200, colMinWidth: 200}); $('select[name="custom"]#make').val('').removeAttr('disabled'); name.val('').attr('disabled', true); year.val('').attr('disabled', true); model.val('').attr('disabled', true); setTimeout(function () { $('select[name="custom"]#make').createSelect({colMax: 1, optionsClass: 'custom-car', colWidth: 200, colMinWidth: 200}); }, 500); }, error: function (jqXhr, status, text) { $('.blue-loader').remove(); $.alert({alertHtml: status, alertType: 'warn'}); } }); make.change(function () { this.selectedMake = $('select[name="custom"]#make').val(); $('#edit_custom').append(this.blueLoader); $.ajax({ url: '/misc/xhr/vehicle_search.php', type: 'POST', data: 'type='+type+'&get=name&make='+encodeURIComponent(this.selectedMake), dataType: 'json', success: function (retHtml) { $('.blue-loader').remove(); $('select[name="custom"]#name').html(''+retHtml.list || '').createSelect({colMax: 1, optionsClass: 'custom-car', colWidth: 200, colMinWidth: 200}); $('select[name="custom"]#name').val('').removeAttr('disabled'); year.val('').attr('disabled', true); model.val('').attr('disabled', true); }.bind(this), error: function (jqXhr, status, text) { $('.blue-loader').remove(); $.alert({alertHtml: status, alertType: 'warn'}); } }); }.bind(this)); new Image().src = '/images/ajax-loader-snake-blue.gif'; name.unbind('change').change(function () { this.selectedName = $('select[name="custom"]#name :selected').val(); $('#edit_custom').append(this.blueLoader); $.ajax({ url: '/misc/xhr/vehicle_search.php', type: 'POST', data: 'type='+type+'&get=years&make='+encodeURIComponent(this.selectedMake) + '&name='+encodeURIComponent(this.selectedName), dataType: 'json', success: function (retHtml) { $('.blue-loader').remove(); year.html(''+retHtml.list || '').createSelect({colMax: 1, optionsClass: 'custom-car', colWidth: 200, colMinWidth: 200}); year.val('').removeAttr('disabled'); model.val('').attr('disabled', true); }, error: function (jqXhr, status, text) { $('.blue-loader').remove(); $.alert({alertHtml: status, alertType: 'warn'}); } }); }.bind(this)); year.unbind('change').change(function () { this.selectedYear = $('select[name="custom"]#carYear :selected').val(); $('#edit_custom').append(this.blueLoader); $.ajax({ url: '/misc/xhr/vehicle_search.php', type: 'POST', data: 'type='+type+'&get=models&make='+encodeURIComponent(this.selectedMake) + '&name='+encodeURIComponent(this.selectedName) + '&year='+encodeURIComponent(this.selectedYear), dataType: 'json', success: function (retHtml) { $('.blue-loader').remove(); model.html(''+retHtml.list || '').createSelect({colMax: 1, optionsClass: 'custom-car', colWidth: 200, colMinWidth: 200}); model.val('').removeAttr('disabled'); }, error: function (jqXhr, status, text) { $('.blue-loader').remove(); $.alert({alertHtml: status, alertType: 'warn'}); } }); }.bind(this)); }.bind(this), 250); break; default: //log(code);log(this.nameset); if(!this.nameset){ clearTimeout(this.hideTimer); data = this.dataProvider.get(code); this.textvalue = name; if (typeof FieldData != 'undefined') { FieldData.setFieldVal('make_model', code, this.textvalue); } this.el.val(this.textvalue); if(data.years.size() > 0){ this.resultContainer.empty(); this.rightTopBorder.remove(); this.leftTopBorder.remove(); this.resultContainer.append( this.opt.resultLine.gsub("{code}", "no_select").gsub("{name}", "Select Model Year")) data.years.each(function(yobj){ this.resultContainer.append( this.opt.resultLine.gsub("{code}", yobj.value).gsub("{name}", yobj.value)) }.bind(this)); this.nameset = true; } else { this.resultContainer.remove(); }// this.hiddenInput.val(code); } else { this.el.val(name+' '+this.textvalue);// this.hiddenYearInput.val(code); if(typeof FieldData != 'undefined'){ FieldData.setFieldVal('year', code, name); } this.removeContainer(); try { this.el.valid(); this.el.parents('div.field').removeClass('error').addClass('valid'); } catch (err) { } this.el.fire("c:blur"); } break; }}},onInit: function(){// this.el.after(''); //''// this.hiddenInput = $('#makeModelCode');// this.hiddenYearInput = $('#year');this.nameset = false;}});}, createAddrAutocomplete: function(el, clickAction){ el = $(el); var kType,kLength,elName = el.attr('name'); if(el.hasClass('fulladdress')){ kType = "ag"; kLength = 5; el.removeClass('required').addClass('required-fulladdress-removed'); } else { kType = ""; kLength = 3; } if (Object.isUndefined(clickAction)) { clickAction = function (e, el) { el = $(el); if(el.identify() != "no_select"){ var code,data,name,fieldID,text_data,new_data; this.dataProvider.clearQueue(); name = this.getText(el); code = el.identify(); this.el.val(name); if(typeof FieldData == 'object'){ if(Object.isFunction(FieldData.setFieldVal)){ FieldData.setFieldVal(this.el.identify(), code, name); } } else if(Object.isFunction(nonFieldDataAddrField)){ nonFieldDataAddrField(this.el.identify(), code, name); } this.removeContainer(); this.el.fire("c:blur"); try { this.el.blur(); this.el.parents('div.field').removeClass('error').addClass('valid'); } catch (err) { } } }; } el.autoComplete({ keyLength:kLength, displayNum: 30, keywordType:kType, dataUrl:"/misc/xhr/address_search.php", onShow: function(count){ if(el.hasClass('fulladdress')){ $('.tooltip').remove(); this.showCustomAddressButton(); } }.bind(this), onHide: function(){ if(el.hasClass('fulladdress')){ this.hideCustomAddressButton(); } }.bind(this), addFilter:function(obj){ var data = {},datasets=['AG_STREETS', 'AG_NAD', 'AG_SECTIONAL_SCHEMES'],dhn,hn,sscp; if(this.opt.keywordType === ""){ data[obj.id] = obj.name + ' - ' + obj.province + ' - ' + obj.postalCode; } else { if(datasets.hasVal(obj.dataset)){ hn = obj.description.match(/\d*/); hn = Object.isArray(hn) ? hn[0] : ''; sscp = obj.description.gsub(hn,'').split(','); data[obj.docID] = { description:obj.description, latitude:obj.latitude, longitude:obj.longitude, dataset:obj.dataset, addressData:{ streetNumber:hn, streetName: (!Object.isUndefined(sscp[0])) ? sscp[0].toLowerCase().trim() : '', suburbName: (!Object.isUndefined(sscp[1])) ? sscp[1].toLowerCase().trim() : '', cityName: (!Object.isUndefined(sscp[2])) ? sscp[2].toLowerCase().trim() : '', provinceName: (!Object.isUndefined(sscp[3])) ? sscp[3].toLowerCase().trim() : '' } }; } } return data; }, dataFilter: function(object){ var data = {}, r, sk, k, mv=0, i, l, c, hn, an=false, t=[], keyword = this.keyword.toLowerCase(), keywordArray, province = ['gtg','mpl','kzn','wc','lm','lpo','ec','nc','nw','fs'], provinceMap = {'gtg':'gauteng','mpl':'Mpumalanga','lm':'Limpopo','lpo':'Limpopo','kzn':'Kwazulu-Natal','wc':'Western Cape','nc':'Northern Cape','ec':'Eastern Cape','fs':'Free State','nw':'North West'}; if(Object.isString(object.value)){keywordArray = keyword.split(' ');if(province.hasVal(keywordArray[keywordArray.size()-1])){keywordArray[keywordArray.size()-1] = provinceMap[keywordArray[keywordArray.size()-1]];keyword = keywordArray.join(' ');} if(object.value.toLowerCase().match(keyword)){ data[object.key] = object.value; return data; } } else { sk = Object.isArray(keyword.match(",")) ? "," : " "; k=keyword.split(sk); r=object.value.description.split(sk); hn=keyword.match(/\d*/)[0];// dhn=object.value.description.match(/\data* /);// hn = Object.isArray(dhn) ? dhn[0] : '';// sscp = object.value.description.gsub(hn,'').split(',');// r = {// streetNumber:hn,// streetName:sscp[0].toLowerCase().trim(),// suburbName:sscp[1].toLowerCase().trim(),// cityName:sscp[2].toLowerCase().trim(),// provinceName:sscp[3].toLowerCase().trim()// };// console.dir(r);//method 1// Object.keys(r).each(function(key, i){// k.each(function(keypart){// if(part.toLowerCase().match(keypart.toLowerCase())){// mv++;// } else if(part.toLowerCase().match(keypart.toLowerCase().gsub(/\n/, ""))){// an=true;// mv++;// }// })// Object.isArray(keyword.match(r[key])) ? t.push(key) : 0;// });//method 2// Object.keys(object.value.addressData).each(function(key){// k.each(function(keypart){// if(object.value.addressData[key].match(keypart.toLowerCase())){// mv++;// }// });//// // var match = keyword.match(object.value.addressData[key]);// // Object.isArray(match) ? match = match[0] : 0;// // t.push(match);// });// log(t);//method 3 (in use) r.each(function(part){ k.each(function(keypart){ if(part.toLowerCase().match(keypart.toLowerCase())){ mv++; } else if(part.toLowerCase().match(keypart.toLowerCase().gsub(/\d/, ""))){ an=true; mv++; } }) }); c = k.size() > 1 ? 2 : 1; sk === " " ? c-- : 0; if(mv>c){// if(t.has(r.streetNumber) && t.has(r.streetName)){ data[object.key] = !((object.value.description.slice(0, hn.length)).match(hn)) ? hn+' '+object.value.description : object.value.description;// data[object.key] = object.value.dataset == "AG_SECTIONAL_SCHEMES" ? object.value.addressData.streetNumber+' '+object.value.description : object.value.description; return data; } } return false; }, clickResult: clickAction }); }, showCustomAddressButton: function(){ var position = this.addressFields.offset(),btn; if($('.addr-custom-btn').size() 0){ if(data[0].postalCode.length > 0){ resp.each(function(suburb, i){ if(suburb.postalCode == data[0].postalCode){ respN = i; } }); } else { respN = 0; } if(!Object.isUndefined(respN)){ data[0] = Object.extend(data[0], resp[respN]); streetAddress = data[0].buildingName.length > 0 ? data[0].buildingNo+' '+data[0].buildingName : data[0].streetNumber+' '+data[0].streetName; textvalue = streetAddress+' '+data[0].suburb+', '+data[0].area+', '+data[0].postalCode; FieldData.setFieldVal(fieldId, data, textvalue); $("#"+fieldId).val(textvalue); this.hideCustomAddressButton(); $("#"+fieldId).valid(); } else { $.alert("We could not find your address on our systems, please contact the call centre"); } } else if(Object.isUndefined(attempt)) { this.saveAddress(data, 1); } else { $.alert("We could not find your address on our systems, please contact the call centre"); } }.bind(this) }); },validate: function(){this.validation = $(this.opt.validationSelect).validate({ debug: true,// rules: $AC("validationRules") || {},errorClass: 'error',validClass: 'valid',ignore: '.ignore-element, .hidden, .disabled, .dep-hidden, .is-blank',errorPlacement: function(error, element) { element.parents('div.selector:visible,div.yesno-checking:visible').addClass('error'); element.parents('div.field:visible').addClass('error').find('div.message:visible').text($(error).text());},success: function(label) {var fieldId = label.attr('for'),field;// if (!Object.isUndefined(this.opt.form_type) && this.opt.form_type == 'bare') {// fieldId = fieldId + '_' + this.opt.product_id;// } //log(fieldId);if($P(fieldId) != null){field = $('#'+fieldId);} else {field = $('#'+$('input[name="'+fieldId+'"]').identify());} if (field.size() > 0) { field.parents('div.selector,div.yesno-checking,div.field').removeClass('error').addClass('valid');}}.bind(this)});// $AC("afterValidation");},validateNoError: function(){// log('validateNoError'); if ($(this.opt.validationSelect).size() > 0) { $(this.opt.validationSelect).valid(); }$('.error').removeClass('error');$('.message').text('');},submit: function(tab) {log("submit"); $(this.opt.validationSelect + ' input:not(:checkbox)').clearDefaultValue();// if (typeof this.opt.form_type != 'undefined' && this.opt.form_type != null && this.opt.form_type == 'bare') {// $(this.opt.validationSelect + ' input').trigger('blur');// }// log('before beforeSubmit'); $AC('beforeSubmit', tab);// log('after beforeSubmit'); $('.required-fulladdress-removed').each(function () { $(this).removeClass('required-fulladdress-removed').addClass('required'); }); var valid = true;// var idno = FieldData.getFieldByName('idno');// if (!Object.isUndefined(idno) && idno != null) {// var idnoVal = idno.tiaValue;// if (!Object.isUndefined(idnoVal) && idnoVal != null) {// if (// !Object.isUndefined(window.idnumbers)// && !Object.isUndefined(window.idnumbers[idnoVal])// ) {// if (// Object.isUndefined(window.idnumbers[idnoVal].exists)// || window.idnumbers[idnoVal].exists === true// ) {// valid = false;// if (Object.isUndefined($('#alert_fa_validate_id')) || $('#alert_fa_validate_id') == null || $('#alert_fa_validate_id').size() Hi!

' + msg + '

', alertType: 'warn' });// }// }// }// }// } if ($(this.opt.validationSelect).valid() && valid == true) { //log('extra validation section'); var forms = $(this.opt.validationSelect.replace(':visible', '')); forms.valid(); if (parseInt(forms.find('.error').size()) > 0) { var firstError = forms.find('.error').first(); $('a.step_'+firstError.parents('.form.tab-container').identify().replace('tabs-', '')).first().click(); setTimeout(function () { $(this.opt.validationSelect).valid(); firstError = $(this.opt.validationSelect).find('.error').first(); $('html, body').animate({scrollTop: firstError.offset().top - 100}, 250); }.bind(this), 500); } }if ($(this.opt.validationSelect).valid() && valid == true) { //log('valid submit');window.onbeforeunload = ProtoBits.emptyFunction;// if(!this.opt.app_id && !this.opt.isMixpress){// this.load("We are busy gathering data to calculate your premium. Please wait ...");// } else {this.load();// } var valid = false;// if (Object.isUndefined(this.opt.isMixpress) || this.opt.isMixpress == false && (isNaN(this.opt.app_id) || parseInt(this.opt.app_id) 0 || this.opt.isMixpress) { t = 2000; } var doValidate = 0; if ( ( Object.isUndefined(this.opt.isMixpress) || this.opt.isMixpress == false ) && (isNaN(this.opt.app_id) || parseInt(this.opt.app_id) Profile updated!'; html += '

Thank you for updating your details.

'; if (!Object.isUndefined(retData.oldpremium) && !Object.isUndefined(retData.premium)) { if (retData.premium != retData.oldpremium) { html += '

Your old premium: R ' + retData.oldpremium;// + '

'; html += '
Your new premium: R ' + retData.premium + ''; html += '


Please contact the call center if you have any questions.

'; } var oldPremium = parseFloat(retData.oldpremium || 0), newPremium = parseFloat(retData.premium || 0); if (oldPremium != newPremium) { var diff = 0; if (newPremium > oldPremium) { diff = (newPremium - oldPremium); trackEvent('change premium', 'increase premium', 'updated profile', parseInt(diff)); } else { diff = (oldPremium - newPremium); trackEvent('change premium', 'decrease premium', 'updated profile', parseInt(diff)); } } } $.alert({ alertHtml: html, alertType: 'info', alertButtons: { 'Ok' : function () { this.loadScreen.show('Reloading...'); top.location.href = (retData.redirect || top.location.href); }.bind(this) } }); break; default: if (!Object.isUndefined(retData.postVars)) { // tracking trackPageview('/gagoal/add-quote-success/'+(pId || 'E')); var tmp = ''; if (!Object.isUndefined(retData.postVars.clientId)) { $('#np_form').append(tmp.gsub('{n}', 'clientId').gsub('{v}', retData.postVars.clientId)); } if (!Object.isUndefined(retData.postVars.policyId)) { $('#np_form').append(tmp.gsub('{n}', 'policyId').gsub('{v}', retData.postVars.policyId)); } if (!Object.isUndefined(retData.postVars.policyLineItemId)) { $('#np_form').append(tmp.gsub('{n}', 'policyLineItemId').gsub('{v}', retData.postVars.policyLineItemId)); } if (!Object.isUndefined(retData.postVars.productId)) { $('#np_form').append(tmp.gsub('{n}', 'productId').gsub('{v}', retData.postVars.productId)); } if (!Object.isUndefined(retData.postVars.multi)) { $('#np_form').append(tmp.gsub('{n}', 'multi').gsub('{v}', retData.postVars.multi)); } this.load(); setTimeout(function () { $('#np_form').submit(); }, 500); } else { var e = globals.errors_generic || 'Sorry, and unknown error occurred. Please contact the call center.'; $.alert({alertHtml:e, alertType:"error"}); } break; } } else {$AR("nextPage", function(){$("#np_form").append(this.TEMPLATES.npInput.gsub("{app_id}", retData.app_id)); this.load(); $("#np_form").submit(); }.bind(this), 1);if(!Object.isUndefined(retData.showMessage)){$.alert({alertHtml: '

' + (globals.form_indicative_failed || 'Unfortunately an error occurred while retrieving your insurance information from TransUnion, we apologise for the inconvenience. Please click continue to load our user friendly form in order to complete your quote') + '

',alertType:"info",alertButtons:{ 'Continue': function(){$AC('nextPage');},'Close': function(){ $('input[name="noValidate"]').val(0);return false;} }});} else { if (this.opt.app_id > 0) { // tracking trackPageview('/gagoal/add-quote-success/'+(pId || 'E')); } setTimeout(function () { $AC('nextPage'); }, 1000);} } } else { var html = 'Something may have gone slightly wrong while your last request was being processed. ' + 'Please quote the message below when contacting our call center. ' + '

'; if (typeof retData.debug != 'undefined' && retData.debug != null) { html += retData.debug + '
'; } if (typeof retData.errors == 'object' && !isNaN(retData.errors.length) && retData.errors.length > 0) { retData.errors.each(function(error) { html += error + '
'; }); } if (typeof retData.errors == 'string' && retData.errors != '') { html += retData.errors + '
'; } html += '
'; $.alert({alertHtml:html, alertType:"error"}); } }.bind(this), error: function(request, status, error) { this.unload(); $('

Sorry, an error ('+error+') has occured. Please try again.

').insertAfter(this.opt.formSubmitBtn); $.alert({alertHtml:"

There was an error while trying to complete your request. Please quote the message below when calling the call center about this error.

Sorry, an unknown error has occured. Please try again or call the call center.", alertType:"error"});//("+request.status + '|' + request.statusText+") }.bind(this) }); }.bind(this), t); },checkProgress: function(){ if (Object.isFunction(this.completed.calculate)) { var percentage = this.completed.calculate(); //if(percentage >= 100){ //this.opt.formSubmitBtn.removeClass('disabled'); //this.bindSubmit(); //} }},bindSubmit: function(){// log('bindSubmit');// log(this.opt.formSubmitBtn);// log(this.opt.formSubmitBtn.parents('.form.tab-container'));this.opt.formSubmitBtn.unbind('click').click(this.submit.bind(this));}, load: function() { this.opt.loading = true; $(this.opt.validationSelect + ' input.auto_alt_toggle').clearDefaultValue();var msg = globals['loading_step'+this.opt.cur_step+'_loading_message'];Object.isUndefined(msg) ? msg = "Please wait..." : 0;// if (parseInt(this.opt.app_id) > 0 || this.opt.isMixpress) {// if (parseInt(this.opt.app_id) > 0 || this.opt.isMixpress) { //log('hi'); this.loadScreen.show(msg, globals['loading_step'+this.opt.cur_step+'_loading_block']);//'

'+msg+'

We promise that your premium will not change during a 12 month cycle - even if you have to claim!

Your cover starts from day 1!

We finalise car insurance claims in 4.5 days on average.

');// } else {// this.opt.formSubmitBtn.data('text', this.opt.formSubmitBtn.text());// this.opt.formSubmitBtn.text('Sending...').addClass('disabled').unbind('click');// this.opt.formSubmitBtn.insert({after:this.loader}); //$('div.validation_error').remove();// } }, unload: function() { this.opt.loading = false;// if (parseInt(this.opt.app_id) > 0 || this.opt.isMixpress) { this.loadScreen.close();// } else {// this.opt.formSubmitBtn.text(this.opt.formSubmitBtn.data('text')).removeClass('disabled');// this.loader.remove();// $(this.opt.validationSelect + ' input.auto_alt_toggle').setDefaultValue();// this.bindSubmit();// } try { setTimeout(function () { if ($('div.error:first').offset() != null) { $('body, html').animate({ scrollTop: $('div.error:first').offset().top - 200 }, 200); } }, 250); } catch (err) { } },setStepTimes: function(time, step){$.ajax({type: "POST",url: "/misc/xhr/form_actions.php",data: "fa=step_"+time+"&step="+step+"&app_id="+$('#app_id').val(),dataType: "json",timeout: 25000 });},checkDepends: function(e, el){var field=$(el),fid,value,parentId,depFields;this.tabCheckTimer ? clearTimeout(this.tabCheckTimer):0;fid = field.identify();//log('Checking Depends for '+fid);parentId = fid != null ? fid.gsub('field_','').gsub('_hiddeninput', '') : fid; if (!Object.isUndefined($FD(parentId))) { value = $FD(parentId).tiaValue || "";//this.formValues.getCurrentValues()[field.attr('name')]; depFields = FieldData.getFieldDependencies(parentId) || []; //log(depFields); // log('checkDepends: '+fid); depFields.each(function(v){ if(!Object.isUndefined($FD(v))){ //var depEl=$('.'+fid)[i], var depEl = $('#field_'+($FD(v).fieldId)).parents('.field'), depId= $FD(v).fieldId,dep,condition,checkVal; // depId = depEl.find('input, select, div.noedit-input').attr('id').gsub('field_','');// log("depID: "+depId); // log("parentID: "+parentId); // log(depEl); // log (depEl.find('input, select, div.noedit-input')); // log ('value: ' + value); // log ('dependingCondition: ' + $FD(depId).dependingCondition); // log ('dependingFieldValue: ' + $FD(depId).dependingFieldValue); // log ('hide_dependents: ' + $FD(fid).hide_dependents); //log('depId: '+depId); // dont check same field if (depId != fid) { if(value == "" && (Object.isUndefined($FD(parentId).hide_dependents) || $FD(parentId).hide_dependents == 'Y')) { this.dependentFieldToggle(depEl, 'hide'); } else if (value == "" && $FD(parentId).hide_dependents == 'N') { this.dependentFieldToggle(depEl, 'show'); } else { dep = $FD(depId); if(typeof dep == 'object'){ if(typeof dep.parentFields == 'object' && Object.keys(dep.parentFields).size() > 0){ if(typeof dep.parentFields[parentId] != 'undefined'){ condition = dep.parentFields[parentId].condition; checkVal = dep.parentFields[parentId].value; } else { condition = dep.dependingCondition; checkVal = dep.dependingFieldValue; } //log(condition); //log(value); //log(checkVal); switch(condition) { case '==': if (value == checkVal) { //log('hide'); this.dependentFieldToggle(depEl, 'hide'); } else { //log('show'); this.dependentFieldToggle(depEl, 'show'); } break; case '!=': if (value != checkVal) { //log('hide'); this.dependentFieldToggle(depEl, 'hide'); } else { //log('show'); this.dependentFieldToggle(depEl, 'show'); } break; } } } } } } }.bind(this));this.tabCheckTimer = setTimeout(function(){$AC('checkTabs');}.bind(this),800);// Object.isFunction(this.checkTabs) ? this.checkTabs() : 0; !Object.isUndefined(this.checkRegularDriver) ? this.checkRegularDriver() : 0; }},checkDependsDeep: function(depId){$(depId).find('input,select').each(function(){names.push($(this).attr('name'))})}, dependentFieldToggle: function (depEl, showOrHide) {var inputEl,fieldName,depFields,dep; // expects depEl to be selected div.field if (typeof showOrHide == 'string' && typeof depEl == 'object' && depEl.size() > 0) {// depId = depEl.find('input, select, div.noedit-input').attr('id').gsub('field_','');inputEl = depEl.find('input, select, div.noedit-input');fieldName = inputEl.attr('name');dep = $FD(fieldName);depFields = FieldData.getFieldDependencies(fieldName) || []; switch(showOrHide) { case 'show':if(depFields.size() > 0){depFields.each(function(f){if ($FD(f).fieldName != fieldName) {this.checkDepends(false, $('#field_'+$FD(f).fieldId));}}.bind(this));}setTimeout(function() {!depEl.is(':visible') ? depEl.show('blind').removeClass('hidden') : 0;inputEl.removeClass('dep-hidden');}.bind(this),500); break; case 'hide': !depEl.hasClass('hidden') ? depEl.hide('blind').addClass('hidden') : 0; inputEl.addClass('dep-hidden');// FieldData.resetFieldSaveValues(fieldName);if(depFields.size() > 0){depFields.each(function(f){ if (fieldName != $FD(f).fieldName) { var fIdEl = $('#field_'+$FD(f).fieldId),fIdCel;fIdCel = fIdEl.parents('.field');fIdEl.addClass('dep-hidden'); !fIdCel.hasClass('hidden') ? fIdCel.hide('blind').addClass('hidden') : 0;// FieldData.resetFieldSaveValues(f); this.checkDepends(false, $('#field_'+$FD(f).fieldId)); }}.bind(this));} break; } } }, checkHardcodedDepends: function () { return; //log('checkHardcodedDepends'); // check hardcoded dependencies. // product independent dependencies // uninterruptedcover// var depField = $FD('uninterruptedcover'),// dependents = ['haspreviousinsurance', 'regulardriveronanotherpolicy'],// show = false;//// if (!Object.isUndefined(depField)) {// var depEl = $('#field_'+depField.fieldId).parents('div.field'), depId = depField.fieldId;//// dependents.each(function (v) {// var dependent = $FD(v);// if (!Object.isUndefined(dependent.tiaValue)) {// if (dependent.tiaValue.toString().toUpperCase() == 'Y'/* && !$('#field_'+dependent.fieldId).hasClass('dep-hidden')*/) {// show = true;// }// }// });//// if (show) {// this.dependentFieldToggle(depEl, 'show');// } else {// this.dependentFieldToggle(depEl, 'hide');// }// }//// var depField = $FD('uninterruptedcover_regulardriver'),// dependents = ['haspreviousinsurance_regulardriver', 'regulardriveronanotherpolicy_regulardriver'],// show = false;//// if (!Object.isUndefined(depField)) {// var depEl = $('#field_'+depField.fieldId).parents('div.field'), depId = depField.fieldId;//// dependents.each(function (v) {// var dependent = $FD(v);// if (!Object.isUndefined(dependent.tiaValue)) {// if (dependent.tiaValue.toString().toUpperCase() == 'Y') {// show = true;// }// }// });//// if (show) {// this.dependentFieldToggle(depEl, 'show');// } else {// this.dependentFieldToggle(depEl, 'hide');// }// } // product specific dependencies var pId = this.opt.product_id; if (!Object.isUndefined(pId)) { pId = pId.toString().toUpperCase();// if (pId == 'STUFF') { // lightning conductor// var depField = $FD('lightning_conductor'),// show = false;// if (!Object.isUndefined(depField)) {// var depEl = $('#field_'+depField.fieldId).parents('div.field'), depId = depField.fieldId;// var within5 = $FD('within_5m');// if (!Object.isUndefined(within5.tiaValue) && within5 != null && within5.tiaValue != null) {// if (within5.tiaValue.toString().toUpperCase() == 'Y' && !$('#field_'+within5.fieldId).hasClass('dep-hidden')) {// show = true;// }// }// var thatchRoof = $FD('roof');// if (!Object.isUndefined(thatchRoof.tiaValue) && thatchRoof != null && thatchRoof.tiaValue != null) {// if (thatchRoof.tiaValue.toString().toUpperCase() == 'THA' && !$('#field_'+thatchRoof.fieldId).hasClass('dep-hidden')) {// show = true;// }// }// this.dependentFieldToggle(depEl, (show ? 'show' : 'hide'));// }// } /*if (pId == 'PLACE') { // lightning conductor var depField = $FD('lightning_conductor'), show = false; if (!Object.isUndefined(depField)) { var depEl = $('#field_'+depField.fieldId).parents('div.field'), depId = depField.fieldId; var thatchLapa = $FD('thatch_lapa'); if (!Object.isUndefined(thatchLapa.tiaValue) && thatchLapa != null && thatchLapa.tiaValue != null) { if (thatchLapa.tiaValue.toString().toUpperCase() == ' 0) {// $.alert({// alertId: 'fieldAssist',// alertHtml:this.TEMPLATES.assist.gsub('{body}', '

Chat to us right now by clicking the live chat button below or keep helping yourself.').gsub('{title}', 'Need some help?'),// alertType:'help',// alertButtons:{// 'Live Chat': function () {// $('#LP_DIV_1350916334825').find('a').click();// this.close();// },// 'No Thanks':function () { //this.close();// }// }// });// if(typeof lpMTagStatic === 'undefined'){// $("head").append(new Element("script", {'type':"text/javascript",'charset':"UTF-8",'src':"https://server.iad.liveperson.net/hc/86496974/?cmd=mTagRepstate&site=86496974&buttonID=7&divID=LP_DIV_1350916334825&bt=3&c=1"}));// }// } else { $.alert({ alertId: 'fieldAssist', alertHtml:this.TEMPLATES.assist.gsub('{body}', '

Request a callback and we\'ll call you right back! ... or keep helping yourself.').gsub('{title}', 'Need some help?'), alertType:'help', alertButtons:{ 'Call me back': function () { $('body').append(''); applyCallmeback(); $('a.call-me-back').first().click(); this.close(); }, 'No Thanks':function () { //this.close(); } } });// }},pageAssist: function(){//$.alert({// alertId: 'pageAssist',//alertHtml:this.TEMPLATES.assist.gsub('{body}', 'page idle assistance popup').gsub('{title}', 'Do you need some assistance?'),//alertType:'help',//alertButtons:{//'Yes': function () { //this.close();//},//'No':function () { //this.close();//}// }//});},preventPageLeave: function(e){//log(e);e.preventDefault();return false;}});////function yesnoChanged (id, newValue) {// if (!Object.isUndefined(id)) {// id = parseInt(id.gsub('field_',''));// $FD(id).tiaValue = newValue;// }//}jClass.create('customCarField', { initialize: function(options, vehicle_type){vType = vehicle_type == "BIKE" ? "Bike" : "Car"; this.opt = Object.extend({ columns: {}, rows:{ make: { label: 'Make', className: 'make', type: 'content', inputClass: 'car_make', content: ''// }, name : { label: 'Model', className: 'model_group', type: 'content', inputClass: 'car_model_group', content: ''// }, year : { label: 'Year', className: 'year', type: 'content', inputClass: 'car_year', content: ''// }, model: { label: vType, className: 'model', type: 'content', inputClass: 'car_model', content: ''// } }, onshow:ProtoBits.emptyFunction, onadd:ProtoBits.emptyFunction, showEvent:false, hideEvent:false, tooltipTitle:'Start with the make of your '+vType.toLowerCase(), fieldName:'custom', saveText:'Save', cancelText:'Cancel', onsave:ProtoBits.emptyFunction, oncancel:ProtoBits.emptyFunction, data:[], disallowMultiple: false }, options || {}); this.onshowfunc = this.opt.onshow.bind(this); this.columnList = Object.keys(this.opt.columns); this.rowList = Object.keys(this.opt.rows); this.saveBtn = $(new Element('a', {'class':'blue_btn save', 'href':'javascript:void(0);','onclick':'return false;'})).click(this.saveData.bind(this)); this.cancelBtn = $(new Element('a', {'class':'blue_btn cancel', 'href':'javascript:void(0);','onclick':'return false;'})).click(this.cancelClose.bind(this)); this.saveBtn.text(this.opt.saveText); this.cancelBtn.text(this.opt.cancelText); this.container = $(new Element('div', {'class':"selected-container"})); this.innerTooltip = $(new Element('div', {'id':'edit_'+this.opt.fieldName, 'class':'tooltip-inner'})) .append('

'+this.opt.tooltipTitle+'

').append(this.container).append(this.cancelBtn).append(this.saveBtn); if(this.rowList.size() > 0){ this.addItemRow = ''; this.rowList.each(this.createRowItem.bind(this));// this.addValues = this.container.serializeElement(); } this.items = $(new Element('div',{'class':'items_'+this.opt.fieldName})).append(this.addItemRow); this.container.append(this.titleRow).append(this.items)/*.append(this.addItemRow)*/; this.addValues = this.container.serializeElement(); this.tooltip = $(new Element('span', {'class':'tooltip'})).append(new Element('div', {'class':'tooltip-arrow'})).append(this.innerTooltip); this.tooltip.find("select").createSelect(); if(!Object.isArray(this.opt.data)){ this.opt.data = []; } if(this.opt.showEvent !== false){ this.bind(this.opt.showEvent, this.showTooltip.bind(this)); } if(this.opt.hideEvent !== false){ this.bind(this.opt.hideEvent, this.cancelClose.bind(this)); } this.addAllItems(); return this; }, createTitle: function(col){ if(this.opt.columns[col].title !== false){ this.titleRow.append(new Element('li', {'class':this.opt.columns[col].className}).insert(this.opt.columns[col].title)); } }, createRowItem: function(row){ var label,content; label = ''; switch(this.opt.rows[row].type){ case 'input': content = ''; break; case 'content': content = this.opt.rows[row].content.gsub('{fieldName}',this.opt.fieldName).gsub('{name}',row); break; } this.addItemRow += ''; }, filterVal: function(col, val){ if(typeof this.opt.columns[col].filter == 'function'){ return this.opt.columns[col].filter(val); } return val; }, showTooltip: function(){ var pos = {},parentParagraph,pleft; $('.tooltip').remove(); $('body').append(this.tooltip); this.tooltip.hide(); parentParagraph = $(this).parents('p').size() > 0 ? $(this).parents('p').eq(0) : $(this).parents('div.form'); offset = this.offset(); pos.left = (offset.left+(this.realWidth()/2))-(this.tooltip.realWidth()/2); pos.top = offset.top+this.realHeight()+5; if(parentParagraph.size() > 0){ pleft = parentParagraph.offset().left; pright = pleft+parentParagraph.realWidth()+24; if(pos.left pright){ pos.left = pright-this.tooltip.realWidth()-34; $('.tooltip-arrow').addClass('right').css({'left':(offset.left-pos.left)+(this.realWidth()/2)-10}); } else { $('.tooltip-arrow').removeClass('left').removeClass('right') } } this.tooltip.css({'top':pos.top+"px", 'left':pos.left+"px"}); this.saveBtn.unbind('click').bind("click",this.saveData.bind(this)); this.cancelBtn.unbind('click').bind("click",this.cancelClose.bind(this)); this.tooltip.fadeIn('slow', function () { this.onshowfunc(); this.tooltip.find('select').createSelect(); }.bind(this)); }, removeItem: function(e){ var el = $(e.currentTarget),id; id = el.identify().gsub(this.opt.fieldName+'_', ''); this.opt.data = this.opt.data.without(this.opt.data[id]); this.items.empty(); this.addAllItems(); this.tooltip.find('.remove-item').bind('click', this.removeItem.bind(this)); }, addAllItems: function(){ if(Object.isArray(this.opt.data) && this.opt.data.size() > 0){ this.opt.data.each(function(data, i){ var row=$(new Element('ul', {'class':'list-table'})); this.columnList.each(function(col){ var val = !Object.isUndefined(data[col]) ? data[col] != "" ? data[col] : ' ' : ' '; customClass = val != ' ' ? ' '+col+'-custom-'+val : 0; val = this.filterVal(col, val); val.length > 135 ? customClass+=' overflow' : 0; if (col !== 'removeItem' && col !== 'addBtn') { // for geysers if (col == 'isSolar' || col == 'geyserOutside') { var options = $(this.opt.columns[col].content).find('option'); options.each(function (i,v) { o = $(v); if (o.val() != '' && o.val() == val) { val = o.text(); } }); } $('#'+col).val(''); row.append(new Element('li', {'class':this.opt.columns[col].className+customClass}).insert({'bottom':val})); } else if(col === 'removeItem'){ row.append(new Element('li', {'class':this.opt.columns[col].className}) .insert({'bottom':this.opt.columns[col].content.gsub('{fieldName}',this.opt.fieldName).gsub('{key}',i)})); } }.bind(this)); this.items.append(row); }.bind(this)) } }, checkEmptyValues: function(){ var values = this.addValues.getCurrentValues(),ret=false; Object.keys(values).each(function(key){ if(values[key] != ""){ ret = true } }); return ret; }, saveData: function(e){ e.preventDefault(); e.stopPropagation(); var canClose = false; if ($('#model').size() > 0) { if (parseInt($('#model :selected').val()) > 0) { canClose = true; } } if(canClose !== false){ this.opt.onsave(this.opt.data, this.identify()); this.closeTooltip(); //log(this.identify()); $('#'+this.identify()).blur(); } else { $.alert('Please select your make, model group, year and model.'); } }, cancelClose: function(e){ e.preventDefault(); e.stopPropagation(); this.closeTooltip(); this.opt.oncancel(this.opt.data, this.identify()); }, closeTooltip: function(){ this.tooltip.find('.add-item').unbind('click'); this.tooltip.find('.remove-item').unbind('click'); this.cancelBtn.unbind('click'); this.saveBtn.unbind('click'); this.tooltip.remove(); }, isEmptyFunction: function(func){ if(Object.isFunction(func)){ return func.toString() === "function () { }"; } else { return true; } }});// TO BE MERGED INTO COMMON.JS FOR PRODUCTION/** * This is a clientside Fields "Database". It contains indexed fielddata for the current * pages form along with predefined functions to manipulate and retrieve the data quickly * and easily. */var $FD;var MiFields = Class.create((function(){function initialize(array) {this._object = {};array.each(function(obj, i){this._object[i] = obj;}.bind(this));// this._index = {};updateIndex.apply(this);// this._each(function(f){// if(typeof f.obj == 'object'){// this._index[f.obj.fieldId] = f.key;// this._index[f.obj.fieldName] = f.key;// }// }.bind(this));window.$FD = function(id){return this.getField(id);}.bind(this);}function updateIndex(){var index = {},dfix=[];this._each(function(d){var pdata={},f=d.obj,i=d.key,parentFields,pc;index[f.fieldId] = i;index[f.fieldName] = i;if(f.parentFields !== null && !Object.isUndefined(f.parentFields)){parentFields = Object.keys(f.parentFields);// console.log(parentFields);pc = parentFields.size();if(pc > 0){dfix.push(i);parentFields.each(function(parent){if(typeof index[parent+"_dependents"] == 'undefined')index[parent+"_dependents"] = [];index[parent+"_dependents"].push(f.fieldId);});}}}); dfix.each(function(i){var p,f = this._object[i],parentFields;parentFields = Object.keys(f.parentFields);//parentFields.size() > 1 ? console.log(f) : 0;parentFields.each(function(parent){//console.log(parent);parentFieldName = this._object[index[parent]].fieldName;if(typeof index[parentFieldName+"_dependents"] == 'undefined')index[parentFieldName+"_dependents"] = [];index[parentFieldName+"_dependents"].push(f.fieldName);this._object[i].dependsOnField = parentFieldName;}.bind(this))}.bind(this));this._index = index;this.initialized = true;}function _each(iterator) {for (var key in this._object) {var obj = this._object[key], pair = [key, obj];pair.key = key;pair.obj = obj;iterator(pair);}}function getFieldKey(s){if(Object.isString(s)){if(s.match('field_')){s = s.gsub('field_', '');}}return this._index[s];}function setValue(s, key, value){s = this.getFieldKey(s); if (key == 'displayName') { value = escape(value); } if (key == 'tiaValue') { value = escape(value); }return this._object[s][key] = value;}function resetFieldSaveValues(s){s = this.getFieldKey(s);this._object[s]['displayValue'] = '';this._object[s]['tiaValue'] = '';$('.active', $('#field_'+this._object[s]['fieldId']).parents('.field')).removeClass('active');$('#field_'+this._object[s]['fieldId']).val('');}function setFieldVal(s, tia, display){ //log(s);log(tia);log(display);s = this.getFieldKey(s); //log(s);if (typeof display == 'undefined') { if (typeof this._object[s]['displayValue'] != 'undefined' && this._object[s]['displayValue'] != '') { display = this._object[s]['displayValue']; } else { display = tia; } } if (!Object.isUndefined(this._object[s])) { this._object[s]['displayValue'] = escape(display); this._object[s]['tiaValue'] = (typeof tia == 'string') ? escape(tia) : tia; }return this._object[s];}function getValue(s, key) {s = this.getFieldKey(s); return this._object[s][key];}function getFieldById(s) {return this.getField(s);}function getFieldByName(s) {return this.getField(s);}function getFieldDependencies(s){return this._index[s+'_dependents'];} function getField(s) { var field = this._object[(this.getFieldKey(s))];if(typeof field === 'object' && !Object.isUndefined(field.tiaValue) && !Object.isUndefined(field.displayValue)){field = Object.extend(field, {tiaValue:Object.isString(field.tiaValue) ? unescape(field.tiaValue) : field.tiaValue,displayValue:unescape(field.displayValue)});}return field; }function storyText(fieldId, fieldValue){var fieldObj = this.getField(fieldId), storyText = false, story_text = false;//log(fieldObj);if (!Object.isUndefined(fieldObj)) {if (!Object.isUndefined(fieldObj.storyText)) {if (!Object.isUndefined(fieldObj.storyText[strId])) {storyText = unescape(fieldObj.storyText[strId][fieldValue])}} //log(storyText);if (!storyText) {story_text = fieldObj.story_text_for_field; //log(story_text);if (story_text != null && !Object.isUndefined(story_text)) {storyText = unescape(story_text[fieldValue]/*.base64_decode()*/)} else { //log(fieldObj.fieldValues); //log(fieldValue);if(fieldObj.fieldValues != null){if(Object.isArray(fieldObj.fieldValues.array)){fieldObj.fieldValues.array.each(function(val){if(val.valueId == fieldValue){storyText = val.displayName;}});}}}}return storyText;}return fieldObj;}function extractData(filter){var data = {};this._each(function(f){// if (f.obj.fieldName == 'previouslosses') {// log('1');// log(f.obj.displayValue);// log(f.obj.tiaValue);// log(escape(unescape(f.obj.displayValue)));// } //if ($('#field_' + f.obj.fieldId + ':not(.dep-hidden)').size() > 0) {typeof f.obj.displayValue == 'undefined' ? f.obj.displayValue = '' : 0;typeof f.obj.tiaValue == 'undefined' ? f.obj.tiaValue = '' : 0;//if (f.obj.fieldName == 'previouslosses') {// log('2');// log(f.obj.displayValue);// log(f.obj.tiaValue);// log(typeof f.obj.tiaValue);// log(f.obj.tiaValue != "");//}if (f.obj.displayValue != "" && f.obj.tiaValue !== "" ) {if(Object.isArray(filter)){if(filter.hasVal(f.obj.fieldName) || filter.hasVal(""+f.obj.fieldId)){data[f.obj.fieldName] = {displayValue: escape(unescape(f.obj.displayValue)),tiaValue: (typeof f.obj.tiaValue == 'string') ? escape(unescape(f.obj.tiaValue)) : f.obj.tiaValue}}} else {data[f.obj.fieldName] = {displayValue: escape(unescape(f.obj.displayValue)),tiaValue: (typeof f.obj.tiaValue == 'string') ? escape(unescape(f.obj.tiaValue)) : f.obj.tiaValue}}} else if(f.obj.fieldName.match('password') && $('input[name="'+f.obj.fieldName+'"]').val() != ""){data[f.obj.fieldName] = {displayValue: $('input[name="'+f.obj.fieldName+'"]').val(),tiaValue: $('input[name="'+f.obj.fieldName+'"]').val()}} // }}); //log(data['previouslosses']);return data;}function getQueryString(){return Object.toQueryString(this.extractData());}function getPercentComplete(){var completed=0,total=0;this._each(function(f){if(!Object.isUndefined(f.obj.tiaValue)){if(f.obj.tiaValue != "")completed = completed+1;}total = total+1;});return Math.round((completed/total)*100);}return {initialize: initialize,_each: _each,getFieldKey:getFieldKey,setValue:setValue,setFieldVal:setFieldVal,resetFieldSaveValues:resetFieldSaveValues,getValue:getValue,getField:getField,getFieldById:getFieldById,getFieldByName:getFieldByName,getFieldDependencies:getFieldDependencies,storyText:storyText,extractData:extractData,getQueryString:getQueryString,getPercentComplete:getPercentComplete};})());if(typeof fieldData != 'undefined'){var FieldData = new MiFields(fieldData);//fieldData = false;//delete fieldData;};MiApplication.addMethods({ updateServer: function(e) { var fieldId,el,value; el = $(e.target); fieldId = el.attr('name'); value = this.formValues.getCurrentValues()[fieldId]; if (Object.isUndefined(value)) { try { value = el.val(); } catch (err) { } } if (Object.isUndefined(value)) { try { value = $FD(fieldId).tiaValue; } catch (err) { } } if ($('input[name="'+fieldId+'"]').hasClass('check_insured_value')) { value = value.replace(/\s/, ''); } if (!Object.isUndefined(el.attr('placeholder')) && value == el.attr('placeholder')) { value = ''; } if(!el.hasClass('noupdate')){ FieldData.setFieldVal(fieldId, value); } el.valid && el.valid(); }});// buildingNo: "string",// postalCode: "string",// boxStreet: "string",// area: "string",// buildingName: "string",// suburb: "string",// streetNumber: "string",// streetName: "string",// longitude: "decimal",// latitude: "decimal"var MiForm, dev_test;window.product_id = 'WHEEL';$(document).ready(function() { new Image().src = '/images/ajax-loader-snake.gif'; $('.app-form-callback-cta').unbind('click').click(function (e) { e.preventDefault(); var el = $(this), formCont = $('#'+el.data('form')), callbackCont = $('#'+el.data('callback')), pluginId = el.data('form').gsub('form', ''); if (formCont.is(':visible')) { formCont.css('min-height', formCont.realHeight()); callbackCont.css('min-height', formCont.realHeight()); formCont.fadeOut('fast', function () { callbackCont.fadeIn('fast', function () { formCont.css('min-height', ''); callbackCont.css('min-height', ''); }); }); Miway.Tracking.pixelTrack(312994); try { callbackCont.find('form#callbackForm1020').data('obj').validate(); } catch (err) { } } else { formCont.css('min-height', formCont.realHeight()); callbackCont.css('min-height', formCont.realHeight()); callbackCont.fadeOut('fast', function () { formCont.fadeIn('fast', function () { formCont.css('min-height', ''); callbackCont.css('min-height', ''); }); }); //el.find('a').text('Request a callback!'); } });;MiForm = new MiApplication({ formValuesSelect: '#miwayForm1020_container', helpTimeout:300, app_id:0, product_id:'WHEEL', miwy_fa:'get_initial_quote', miwy_np:'101', cur_step:0, validationSelect: '#miwayForm1020', formSubmitBtn: $('#miwayForm1020 .form_submit'),getFormData:function(){ $('#miwayForm1020 input, #miwayForm1020 select').each(function () { $(this).fire('blur'); }); var postObj={ miwy_fa:this.opt.miwy_fa, app_id:this.opt.app_id, productId:this.opt.product_id, miwy_np:this.opt.miwy_np, noValidate: parseInt($('input[name="noValidate"]').val()), data:Object.toJSON(FieldData.extractData()) } return Object.toQueryString(postObj); },onInit: function(){ // tracking "started" on first field focus $('#miwayForm1020').find('input, select').not('[type="hidden"]').focus(function () { if ($(this).parents('form').data('started') != true) { trackPageview('/gagoal/started-WHEEL-insurance'); $(this).parents('form').data('started', true); } });this.addressFields = $(".address, .fulladdress"); if(this.addressFields.size() > 0){ this.addressFields.each(function(i){ this.createAddrAutocomplete(this.addressFields[i]); }.bind(this)); } this.vehicleSearch = $("input[name='make_model']"); if(this.vehicleSearch.size() > 0){ this.createVehicleAutocomplete(this.vehicleSearch); } if ($(".datepicker").size() > 0) { $(".datepicker").datepicker({ dateFormat: "yy-mm-dd", changeMonth:true, changeYear:true }); } $(".hidden").parents('div.field').hide(); $('#miwayForm1020').find('input:not(:checkbox), select').blur(this.updateServer.bind(this)); $('#miwayForm1020').find('input:checkbox').change(this.updateServer.bind(this));$('#miwayForm1020').find('select').createSelect({colMax:1,limiton:'columns', optionsClass: 'custom-car', colWidth: 210});clearTimeout(this.helpTimer);$('#miwayForm1020').find('input, select').focus(this.resetHelpTimer.bind(this));// $('form.validate input.auto_alt_toggle').setDefaultValue(); this.bindSubmit(); $('#miwayForm1020').find('input, select').not('[type="checkbox"]').blur(function () { $(this).parents('div.field').find('div.question').trigger('mouseleave'); }); $('#miwayForm1020').find('input, select').not('[type="checkbox"]').focus(function () { $(this).parents('div.field').find('div.question').trigger('mouseover'); });}});});

*SpeedQuote
The quoted premium will only be illustrative and not a binding offer.

© 2014 MiWay Insurance Limited

© 2014 MiWay Insurance Limited is an Authorised Financial Services Provider (Licence number:33970).

Car Insurance Quotes Online 24/7/365 | MiWay.co.za

Car Insurance QuotesAre you looking for car insurance to suit your budget, with benefits like free roadside assistance and rewards even if you claimed? MiWay offers flexible and affordable motor insurance, we even allow you to fix your premiums for a period of 36 months!*

MiWay will reward you if you prefer doing things online! By simply applying for and taking out your car insurance policy online, MiWay will pay you an average full month's premium after 3 months full premiums are received.*

*Terms & conditions apply

Why choose MiWay's standard Car Insurance?

  • Affordable premiums, low flat excess
  • Apply and buy your car insurance online to earn extra rewards
  • Great Service, hassle free claims process
  • Earn rewards whether you claim or not
  • Free Roadside emergency assistance
  • Earn rewards and save on joining fees by buying your car insurance online
  • Fix your premiums for a period of 36 months!*

*Terms & conditions apply

Types of Car Insurance

MiWay offers three types of car insurance Comprehensive, Third Party Fire and Theft, and Third Party only.

Comprehensive car insurance provides the widest cover and covers for theft and hijacking, damages due to an accident, fire or explosion and natural disasters like hail and floods. Comprehensive cover also includes damage to the vehicles glass and liability to other parties as a result of an accident.

Third Party Fire and Theft insurance provides insurance cover for any damage you may cause to the vehicle of another person, and the accidental death or injuries of third parties involved in the same accident. You will also be compensated for the loss of your vehicle due to attempted theft, theft or hijacking, as well as any damage to your vehicle that was caused by fire, lightning or explosions.The main difference between 'Comprehensive' and 'Third Party Fire and Theft' is that your car is not covered against accidental damage.

Third Party Only insurance is the cheapest car insurance and provides insurance cover for any damage you may cause to the vehicle of another person as well as the accidental death or injuries of third parties involved in the same accident. You have no cover under this insurance type against the loss of, or damage to your own vehicle.

Car Insurance Options

In addition to accident or theft, comprehensive car insurance in South Africa covers losses due to fire and explosion, natural disasters like hail and floods and damage to the vehicles glass.

Additional options such as car hire and cover for non-standard sound systems and car accessories can also be added to your motor insurance policy.

MiWay can cover your car for either private, professional or business use:

Private or social purposes, including driving between your home and regular place of work will be classified as private use.

Professional use is where the car forms an essential part of the performance of any work or function as a Lawyer, Doctor, Actuary, Accountant, Architect or an Engineer and it also includes private use.

Business use is where the car forms an essential part of the performance of any work or function and it also includes private use.

Scenario: If you utilise your car for business purposes, your car is on the road more often than if you only use it for private purposes. The chance of it being stolen or involved in an accident is therefore much greater. The premium for a car being used for business purposes is higher compared to the same car being used only for private purposes. If you insure your car for the incorrect use you will not have cover on your car in the event of a claim as the premium paid will be incorrect.

Your vehicle can be insured for one of the following values:

  • Retail value
  • Market value (the average between the vehicles retail and trade values)
  • Trade value
  • Specially agreed value (which applies to unlisted, collectors and vintage vehicles where a valuation is given by an appropriate approved source)

Your policy coversheet reflects the value that you chose. The amount to this value will be determined at the time of loss taking into account the age, mileage and condition of the vehicle.

What process is involved in getting your vehicle insured?

The car insurance process starts with you, the car owner, completing an insurance quote from MiWay online or telephonically. Assuming you find the premium affordable, which we are sure you will, you agree to a start date for your new cover. MiWay will send you your documentation including a Coversheet (Policy schedule), which spells out the terms of your insurance policy and explains everything you need to know regarding your policy and car insurance in general. If necessary, MiWay will also help you to find an inspection centre which is convenient for you to visit. Your vehicle insurance cover will be fully activated once MiWay has received your premium. Please remember to comply with any requirements, i.e. have your car inspected, install additional security devices (like a tracking device, immobilizer etc), as this will influence whether you would enjoy insurance cover or not.

'); // and refer to this reference number:

'+(retData.ref || 'ERROR')+'

$('html, body').animate({ scrollTop: $('div.thank_you:first').offset().top - 50 }, 200); Miway.Tracking.pixelTrack(312984, retData.ref); trackPageview('/gagoal/request-a-call/product-success/' +(this.form.find('input[name="callmeback_product"]').val() || 'err')); } else if (parseInt(retData.errors.length) > 0) { html = ''; $.each(retData.errors, function (index, value) { html += '

' + value + '

'; }); $.alert({ alertHtml:html, alertType: 'warn'}); } }.bind(this), error: function (request, status, error) { this.unload(); $.alert({ alertHtml:'

Sorry, an unknown error has occured. Please try again.

', alertType:'warn'}); this.ajaxErrors += (error.toString() + '|||'); $('html, body').animate({ scrollTop: this.form.offset().top - 50 }, 200); }.bind(this) }); } else { this.validation = this.validate(); $('form#callbackForm1020 input, form#callbackForm1020 textarea').setDefaultValue(); } }, load: function () { this.formSubmitBtn.text('sending...').addClass('disabled').unbind('click'); $(this.loaderImg).insertAfter(this.formSubmitBtn); }, unload: function () { this.formSubmitBtn.text(this.defaultSubmitText).removeClass('disabled'); $('.loader').remove(); this.addSubmit(); }, addSubmit: function () { // attach submit this.formSubmitBtn.unbind('click').click(function (e) { if (this.debug) log(this.formSubmitBtn.text() + ' - click'); e.preventDefault(); this.submit(); }.bind(this)); }}); var btnHtml = '

'; $('#callback1020 .plugin.vertical').append(btnHtml);

',TEMPLATES:{npForm:'',npInput:'',assist:'

{body}

', licenseSelect: '',selectEl:'',optionEl:'',button:'{text}'// address:''},initialize: function(options){var switches,loadScreenImage;this.opt = Object.extend({helpTimeout:300,formSubmitBtn:$('.form_submit'),product_id:'',app_id:0,miwy_np:0,cur_step:2, isMixpress: false,miwy_fa:'', form_type:'',getFormData:ProtoBits.emptyFunction,onInit:ProtoBits.emptyFunction, submitUrl: "/misc/xhr/form_actions.php", validationSelect: '.form.tab-container:visible form.validate', formValuesSelect: '#content'}, options || {});// if (this.opt.isMixpress == true) { loadScreenImage = '/images/generic-loader-pink-big.gif';// } else if (/*$('input[name="product_id"]').size() > 0 && */this.opt.product_id.length > 0){// loadScreenImage = '/images/' + this.opt.product_id.toLowerCase().strip() + '-loader.gif';// } this.loadScreen = new LoadScreen({ 'image':loadScreenImage, 'message':"Please wait...", 'disableClose':true, 'disableCloseTimeout':0, 'extraTopOffset': (-100), 'extraMessageTop': 120 }); this.loadScreen.show({image:false,color:"transparent",opacity:0,message:''});this.helpTimer = setTimeout(this.pageAssist.bind(this), (this.opt.helpTimeout*1000));this.getFormData = this.opt.getFormData.bind(this);this.oninit = this.opt.onInit.bind(this); this.validate();$('body').append(this.loader);this.loader = $("#ajax_loader");this.loader.remove(); shortSwitches = $('.form-column.full .yesno-switch:not(.switch-active)');longSwitches = $('.form-column:not(.full) .yesno-switch:not(.switch-active)'); sideSwitches = $('.form_top_right .yesno-switch:not(.switch-active), .insurance_quotes .yesno-switch:not(.switch-active)'); shortSwitches.parents('div.field-input').find('.question').addClass('yesno'); longSwitches.parents('div.field-input').find('.question').addClass('yesno');sideSwitches.parents('div.field-input').find('.question').addClass('yesno');setTimeout(function(){ longSwitches.createInputSwitch({ handleOnPosition:0, customClass:'long', checkedLabel:'YES', uncheckedLabel:'NO' }); setTimeout(function () { shortSwitches.createInputSwitch({ handleOnPosition:0, //customClass:'long', checkedLabel:'YES', uncheckedLabel:'NO', customClass: 'short' }); setTimeout(function () { sideSwitches.createInputSwitch({ handleOnPosition:0, customClass:'short', checkedLabel:'YES', uncheckedLabel:'NO' }); }, 50); }, 50);}, 50); $('div.field .yesno-radio').createYesNoInput();this.formValues = $(this.opt.formValuesSelect).serializeElement(); if ($('#form_help_bar').size() > 0) { this.sidebarStartTop = $('#form_help_bar').offset().top; }this.oninit(); setTimeout(function () { this.loadScreen.close(); $("input[name='fullnames'], input[name='surname'], input[name='fullnames_regulardriver'], input[name='surname_regulardriver'], input[name='preferredname'], input[name='preferredname_regulardriver']").on("keyup", function(){ try{ $(this).val($(this).val().split(" ").invoke("capitalize").join(" ")); }catch(e){} }); }.bind(this), 500); this.validate(); if (!Object.isUndefined(this.opt.isMixpress) && this.opt.isMixpress == true) { $('.prefer_story').hide().remove(); } $('input.number').each(function(){var el = $(this),validInputs=['insured_value','sum_insured','building_value','insured','jewellery_insurance'];if(validInputs.hasVal(el.attr('name'))){el.insert({'before':'

R

'});}}); //temp fix for insured_value if($("input[name='insured_value']").val() != null){$("input[name='insured_value']").insert({'before':'

R

'});} // make/model/year and brand new or used $AR('beforeSubmit', this.preSubmit, 0, this); $(document).ready(function () { window.lastYearVal = 0; if (typeof $FD('year') != 'undefined') { window.checkYearInterval = setInterval(function () { var yearVal = $FD('year').tiaValue; if (yearVal.length == 4 && yearVal != window.lastYearVal) { var el = $('select[name="brand_new__used__rebuild"]') || []; if (el.size() > 0) { if (parseInt(yearVal) Brand new'}); el.createSelect(); } } else { clearInterval(window.checkYearInterval); } } window.lastYearVal = yearVal; }, 1000); } }); var fields = $('.container').find('[name="make_model"],[name="property_address"],[name="building_address"],[name="night_time_suburb"],[name="day_time_suburb"]'); fields.on('mouseup', function (ev) { this.select(); });// if (!Object.isUndefined(globals.global_ssl_enabled) && parseInt(globals.global_ssl_enabled) == 1) {// var sUrl = this.opt.submitUrl;// if (!Object.isUndefined(sUrl) && sUrl != null && sUrl != '') {// var hname = document.location.hostname;// if (sUrl.substr(0,1) == '/') {// sUrl = 'https://'+hname+sUrl;// }// }// this.opt.submitUrl = sUrl;// delete sUrl;// }}, switchToForm: function(){ trackEvent('form preference', 'switch form', 'to form'); window.onbeforeunload = ProtoBits.emptyFunction; var ls = new LoadScreen({ 'image': '/images/generic-loader-pink-big.gif', 'message': '', 'disableClose':true, 'disableCloseTimeout':0, 'extraTopOffset': (-100), 'extraMessageTop': 120 }); ls.show('Please wait while we load a normal form for you...'); setTimeout(function () { $("#normal_form").submit(); }, 1000); }, switchToStory: function(){ trackEvent('form preference', 'switch form', 'to story'); window.onbeforeunload = ProtoBits.emptyFunction; var ls = new LoadScreen({ 'image': '/images/generic-loader-pink-big.gif', 'message': '', 'disableClose':true, 'disableCloseTimeout':0, 'extraTopOffset': (-100), 'extraMessageTop': 120 }); ls.show('Please wait while we load the story version...'); setTimeout(function () { $("#story_form").submit(); }, 1000); },setupSidebar:function(el, anchor){$('body').append(this.help_arrow);this.help_arrow = $('div.form_help_arrow');this.help_arrow.hide(); if ($('#form_help_bar').size() > 0 || $(el).size() > 0) { this.sideBar = Object.isUndefined(el) ? $('#form_help_bar') : $(el);if(this.sideBar !== null && this.sideBar.size() > 0){ this.innerSideBar = this.sideBar.find('div.plugin'); this.sideBarComplete = this.sideBar.find('div.percent_complete');this.sideBarTitle = this.sideBar.find('div#percent_complete h2'); this.scrollAnchor = Object.isUndefined(anchor) ? $("#tabs_container") : $(anchor); this.sidebarOffsetTop = this.sideBar.offset().top;this.sideBarTitle.hide(); this.help_arrow.css({'left':(this.sideBar.offset().left-30)+'px'}); this.sideBar.css("position", "relative"); this.scrolling = false;}// $(document)._on('mousewheel','',this.scrollSidebar.bind(this));// $(document).bind('scroll', this.scrollSidebar.bind(this)); }}, updateSidebar: function (id) { this.help_arrow = $('div.form_help_arrow'); if (typeof id == 'string' && typeof this.sidebarStartTop != 'undefined') { var el = $('#'+id), helpDiv = $('div.help_text');; if (el.size() > 0) {// log('updateSidebar');// log(el.parents('div.field').offset());// log(this.sidebarStartTop); var arrowTop = ((el.parents('div.field').offset().top)-40), fieldTop = el.parents('div.field').offset().top, newmargin,contentDiv = el.parents('.tab-container'),contentMax = (contentDiv.offset() != null ? contentDiv.offset().top : 0) + contentDiv.height(),newmargin = fieldTop - this.sidebarStartTop - 158;// 58 is to center the center of the arrow with the heading in the "compliance copy"// log(newmargin);// log(newmargin+this.sideBar.height()+this.sidebarStartTop+$('div#form_help_bar .form_top_right').height());// log(contentMax); //$('div.form_help_arrow').css({'top': arrowTop+'px'}).show('fade',200);(newmargin+this.sideBar.height()+this.sidebarStartTop+$('div#form_help_bar .form_top_right').height()) > contentMax ? newmargin = (contentMax -this.sidebarOffsetTop- this.sideBar.height()-$('div#form_help_bar .form_top_right').height()): 0;// log("margin-top:"+newmargin);this.sideBarTitle.show(); this.sideBar.animate({'margin-top':newmargin+'px'}, 250); this.help_arrow.show().animate({'top': (el.parents('div.field').offset().top-34)+'px'}, 250); if(typeof this.helpText != 'undefined' && this.helpText != "" && this.helpText != helpDiv.html()){ helpDiv.html(this.helpText); helpDiv.show('fade'); //helpDiv.fadeIn(); this.helpText = "" } } } if ($('#form_help_bar').size() > 0) { this.help_arrow.css({'left':($('#form_help_bar').offset().left-30)+'px'}); //log(this.help_arrow.css('left')); } },scrollSidebar: function(e){var top,padding,limit,wh,ih;top = ($(document).scrollTop()-this.sidebarOffsetTop)+10;padding = $('.form_top_right').cssUnit('padding')[0];Object.isUndefined(padding) ? padding = 0 : 0;limit = ((this.scrollAnchor.offset().top-this.sidebarOffsetTop)+this.scrollAnchor.realHeight())-this.sideBar.realHeight()/*+(padding*2)))-5*/;wh = ($(window).height()-20);ih = wh-(this.sideBarComplete.height()+this.innerSideBar.cssUnit('paddingTop')[0]+this.innerSideBar.cssUnit('paddingBottom')[0]+this.innerSideBar.cssUnit('marginTop')[0]+this.innerSideBar.cssUnit('marginBottom')[0]+90); this.scrolling = false;//if(top > -1){//if(top 0) {// Object.isFunction(this.setRowActive) ? this.setRowActive($(el)) : 0;// }if (!this.helpLocked) {var elId,field;el = $(el);elId = el.find('input,select').identify(); if (Object.isFunction(elId.gsub)) { elId = elId.gsub('_hiddeninput',''); }field = $FD(elId); if (Object.isFunction(e.stop)) e.stop();if(this.arrowTimer){clearTimeout(this.arrowTimer);this.arrowTimer = false;this.pageY = (el.offset().top);this.helpText = !Object.isUndefined(field) ? (field.long_help_txt || field.fieldDisplayName) : "";}if(!this.arrowTimer){this.arrowTimer = setTimeout(function(e){ this.updateSidebar(elId);this.arrowTimer = false}.bind(this), 250)}}},activateLicenseField: function() {this.licenses = $('.do_licenses');if (this.licenses.size() > 0) { var date = new Date(); var currentMonth = date.getMonth(); var currentDate = date.getDate(); var currentYear = date.getFullYear(); this.licenses.each(function () { var fieldId = $(this).identify(),fieldName=$(this).attr('name'),c,data,textValue;data = (typeof $FD(fieldName).tiaValue == 'object' && !Object.isUndefined($FD(fieldName).tiaValue.array) ? $FD(fieldName).tiaValue.array : $FD(fieldName).tiaValue)|| [];c = data.size();if(c > 0){textValue = c+(c == 1 ? ' licence' : ' licences');FieldData.setFieldVal(fieldName, data, textValue);$('#'+fieldId).text(textValue);} $(this).customField({ columns: { licenseType: { title:"Licence Type", className:'name', type:'content', content:'' }, licenseDate: { title:"Issue Date", className:'data', type:'input', inputClass:'date required' } }, onvalidate : function(value){ for (var i = 0; i 0) { var currentMil = parseInt(new Date().getFullYear().toString().slice(0,2)); var currentYear = parseInt(new Date().getFullYear().toString().slice(2,4)); y = parseInt(idnum.slice(0,2)); if (y > currentYear && y.toString() != '0') { y = parseInt(((currentMil - 1).toString() + y.toString())); } else { y = parseInt(((currentMil).toString() + y.toString())); } m=parseInt(idnum.slice(2,4))-1; d=parseInt(idnum.slice(4,6)); dob = new Date(y,m,d); eighteen = parseInt(dob.getFullYear()) + 18; var currentFullYear = parseInt(currentMil.toString() + currentYear.toString()); var diff = (new Date().getFullYear()) - eighteen; } else { var diff = 30; } function checkDisabledMonths(y, ui) { //log(eighteen); //log(ui); setTimeout(function () { $('[data-month]').find('a').removeClass('ui-state-disabled'); var d = new Date()/*, months = {'January':0, 'February':1, 'March':2, 'April':3, 'May':4, 'June':5, 'July':6, 'August':7, 'September':8, 'October':9, 'November':10, 'December':11}*/; if (ui.selectedYear == eighteen) { d.setFullYear(eighteen); d.setMonth((parseInt(idnum.slice(2,4)))-1); //log(d.getMonth()); for (i = 0;i 0) { var d = new Date(); d.setFullYear(eighteen); sett.defaultDate = d; } //} date.monthpicker(sett); $('.ui-monthpicker-trigger').remove(); date.attr('readonly','readonly'); $('#licenseType').createSelect(); }, showEvent: ['click','focus'],// hideEvent: 'blur', tooltipTitle: $FD('licenses').help_txt, fieldName: $FD('licenses').fieldName, onsave: function(data) { var c = data.size(),textValue; textValue = c+(c == 1 ? ' licence' : ' licences');// console.log(data); FieldData.setFieldVal(fieldName, data, textValue); $('#'+fieldId).text(textValue); if ($('#'+fieldId+'_hiddeninput').size() > 0) { $('#'+fieldId+'_hiddeninput').val(textValue).blur().valid(); } }, saveText: 'Save Licences', data: data }); });}},createVehicleAutocomplete: function(el){var type = this.opt.product_id;this.vs = $(el).autoComplete({ showAlternateCar: true, keywordType: this.opt.product_id,dataUrl:"/misc/xhr/vehicle_search.php",addFilter: function(obj){var data = {};data[obj.makeModelCode] = obj;return data;},keywordFilter: function(keyword){keyword.match('vw') ? keyword = keyword.gsub("vw", 'volkswagen') : 0return keyword;},dataFilter: function(o){ //if (!Object.isUndefined(o[0]) && o[0] != 'null') { if (Object.isString(o[1].name)) { var matchString = (o[1].name.toLowerCase()).match(this.keyword) != null ? (o[1].name.toLowerCase()).match(this.keyword) : (o[1].tags.toLowerCase()).match(this.keyword); if(matchString == null){ var arrSearchTerm = this.keyword.split(' '); for (var i = 0; i '+years+''; } d[o[0]] = vname; return d; } } //}},clickResult:function(e, el){el = $(el);if(el.identify() != "no_select"){var code,data,name;name = this.getText(el);code = el.identify(); switch(code) { case 'carcantfind': // Can't find your car? //log('-11 !'); $(this.el).removeClass('error').parents('.error').removeClass('error'); $(this.el).parents('div.field').find('.message').text(''); this.carTooltip = $(this.el).customCarField({ onsave: function (data, id) { var code = $('#model :selected').val(); var textValue = $('select[name="custom"]#make :selected').val() + ' ' + $('select[name="custom"]#name :selected').val() + ' ' + $('select[name="custom"]#model :selected').text();var year =$('#carYear :selected').text(); $('#'+id).val(year + ' ' + textValue);// this.hiddenInput.val(code);// this.hiddenYearInput.val(year); FieldData.setFieldVal('make_model', code, textValue); FieldData.setFieldVal('year', year, year); try { $('#'+id).valid();$('#'+id).blur(); } catch (err) { } } }, type); this.carTooltip.showTooltip(); this.removeContainer(); setTimeout(function () { var make = $('select[name="custom"]#make'); var name = $('select[name="custom"]#name'); var year = $('select[name="custom"]#carYear'); var model = $('select[name="custom"]#model'); make.unbind('change').createSelect({colMax: 1, optionsClass: 'custom-car', colWidth: 200, colMinWidth: 200}); name.createSelect({colMax: 1, optionsClass: 'custom-car', colWidth: 200, colMinWidth: 200}).attr('disabled', true); year.createSelect({colMax: 1, optionsClass: 'custom-car', colWidth: 200, colMinWidth: 200}).attr('disabled', true); model.createSelect({colMax: 1, optionsClass: 'custom-car', colWidth: 200, colMinWidth: 200}).attr('disabled', true); this.blueLoader = ''; $.ajax({ url: '/misc/xhr/vehicle_search.php', type: 'POST', data: 'type='+type+'&get=make', dataType: 'json', success: function (retHtml) { $('.blue-loader').remove(); $('select[name="custom"]#make').html(''+(retHtml.list || '')); $('select[name="custom"]#make').createSelect({colMax: 1, optionsClass: 'custom-car', colWidth: 200, colMinWidth: 200}); $('select[name="custom"]#make').val('').removeAttr('disabled'); name.val('').attr('disabled', true); year.val('').attr('disabled', true); model.val('').attr('disabled', true); setTimeout(function () { $('select[name="custom"]#make').createSelect({colMax: 1, optionsClass: 'custom-car', colWidth: 200, colMinWidth: 200}); }, 500); }, error: function (jqXhr, status, text) { $('.blue-loader').remove(); $.alert({alertHtml: status, alertType: 'warn'}); } }); make.change(function () { this.selectedMake = $('select[name="custom"]#make').val(); $('#edit_custom').append(this.blueLoader); $.ajax({ url: '/misc/xhr/vehicle_search.php', type: 'POST', data: 'type='+type+'&get=name&make='+encodeURIComponent(this.selectedMake), dataType: 'json', success: function (retHtml) { $('.blue-loader').remove(); $('select[name="custom"]#name').html(''+retHtml.list || '').createSelect({colMax: 1, optionsClass: 'custom-car', colWidth: 200, colMinWidth: 200}); $('select[name="custom"]#name').val('').removeAttr('disabled'); year.val('').attr('disabled', true); model.val('').attr('disabled', true); }.bind(this), error: function (jqXhr, status, text) { $('.blue-loader').remove(); $.alert({alertHtml: status, alertType: 'warn'}); } }); }.bind(this)); new Image().src = '/images/ajax-loader-snake-blue.gif'; name.unbind('change').change(function () { this.selectedName = $('select[name="custom"]#name :selected').val(); $('#edit_custom').append(this.blueLoader); $.ajax({ url: '/misc/xhr/vehicle_search.php', type: 'POST', data: 'type='+type+'&get=years&make='+encodeURIComponent(this.selectedMake) + '&name='+encodeURIComponent(this.selectedName), dataType: 'json', success: function (retHtml) { $('.blue-loader').remove(); year.html(''+retHtml.list || '').createSelect({colMax: 1, optionsClass: 'custom-car', colWidth: 200, colMinWidth: 200}); year.val('').removeAttr('disabled'); model.val('').attr('disabled', true); }, error: function (jqXhr, status, text) { $('.blue-loader').remove(); $.alert({alertHtml: status, alertType: 'warn'}); } }); }.bind(this)); year.unbind('change').change(function () { this.selectedYear = $('select[name="custom"]#carYear :selected').val(); $('#edit_custom').append(this.blueLoader); $.ajax({ url: '/misc/xhr/vehicle_search.php', type: 'POST', data: 'type='+type+'&get=models&make='+encodeURIComponent(this.selectedMake) + '&name='+encodeURIComponent(this.selectedName) + '&year='+encodeURIComponent(this.selectedYear), dataType: 'json', success: function (retHtml) { $('.blue-loader').remove(); model.html(''+retHtml.list || '').createSelect({colMax: 1, optionsClass: 'custom-car', colWidth: 200, colMinWidth: 200}); model.val('').removeAttr('disabled'); }, error: function (jqXhr, status, text) { $('.blue-loader').remove(); $.alert({alertHtml: status, alertType: 'warn'}); } }); }.bind(this)); }.bind(this), 250); break; default: //log(code);log(this.nameset); if(!this.nameset){ clearTimeout(this.hideTimer); data = this.dataProvider.get(code); this.textvalue = name; if (typeof FieldData != 'undefined') { FieldData.setFieldVal('make_model', code, this.textvalue); } this.el.val(this.textvalue); if(data.years.size() > 0){ this.resultContainer.empty(); this.rightTopBorder.remove(); this.leftTopBorder.remove(); this.resultContainer.append( this.opt.resultLine.gsub("{code}", "no_select").gsub("{name}", "Select Model Year")) data.years.each(function(yobj){ this.resultContainer.append( this.opt.resultLine.gsub("{code}", yobj.value).gsub("{name}", yobj.value)) }.bind(this)); this.nameset = true; } else { this.resultContainer.remove(); }// this.hiddenInput.val(code); } else { this.el.val(name+' '+this.textvalue);// this.hiddenYearInput.val(code); if(typeof FieldData != 'undefined'){ FieldData.setFieldVal('year', code, name); } this.removeContainer(); try { this.el.valid(); this.el.parents('div.field').removeClass('error').addClass('valid'); } catch (err) { } this.el.fire("c:blur"); } break; }}},onInit: function(){// this.el.after(''); //''// this.hiddenInput = $('#makeModelCode');// this.hiddenYearInput = $('#year');this.nameset = false;}});}, createAddrAutocomplete: function(el, clickAction){ el = $(el); var kType,kLength,elName = el.attr('name'); if(el.hasClass('fulladdress')){ kType = "ag"; kLength = 5; el.removeClass('required').addClass('required-fulladdress-removed'); } else { kType = ""; kLength = 3; } if (Object.isUndefined(clickAction)) { clickAction = function (e, el) { el = $(el); if(el.identify() != "no_select"){ var code,data,name,fieldID,text_data,new_data; this.dataProvider.clearQueue(); name = this.getText(el); code = el.identify(); this.el.val(name); if(typeof FieldData == 'object'){ if(Object.isFunction(FieldData.setFieldVal)){ FieldData.setFieldVal(this.el.identify(), code, name); } } else if(Object.isFunction(nonFieldDataAddrField)){ nonFieldDataAddrField(this.el.identify(), code, name); } this.removeContainer(); this.el.fire("c:blur"); try { this.el.blur(); this.el.parents('div.field').removeClass('error').addClass('valid'); } catch (err) { } } }; } el.autoComplete({ keyLength:kLength, displayNum: 30, keywordType:kType, dataUrl:"/misc/xhr/address_search.php", onShow: function(count){ if(el.hasClass('fulladdress')){ $('.tooltip').remove(); this.showCustomAddressButton(); } }.bind(this), onHide: function(){ if(el.hasClass('fulladdress')){ this.hideCustomAddressButton(); } }.bind(this), addFilter:function(obj){ var data = {},datasets=['AG_STREETS', 'AG_NAD', 'AG_SECTIONAL_SCHEMES'],dhn,hn,sscp; if(this.opt.keywordType === ""){ data[obj.id] = obj.name + ' - ' + obj.province + ' - ' + obj.postalCode; } else { if(datasets.hasVal(obj.dataset)){ hn = obj.description.match(/\d*/); hn = Object.isArray(hn) ? hn[0] : ''; sscp = obj.description.gsub(hn,'').split(','); data[obj.docID] = { description:obj.description, latitude:obj.latitude, longitude:obj.longitude, dataset:obj.dataset, addressData:{ streetNumber:hn, streetName: (!Object.isUndefined(sscp[0])) ? sscp[0].toLowerCase().trim() : '', suburbName: (!Object.isUndefined(sscp[1])) ? sscp[1].toLowerCase().trim() : '', cityName: (!Object.isUndefined(sscp[2])) ? sscp[2].toLowerCase().trim() : '', provinceName: (!Object.isUndefined(sscp[3])) ? sscp[3].toLowerCase().trim() : '' } }; } } return data; }, dataFilter: function(object){ var data = {}, r, sk, k, mv=0, i, l, c, hn, an=false, t=[], keyword = this.keyword.toLowerCase(), keywordArray, province = ['gtg','mpl','kzn','wc','lm','lpo','ec','nc','nw','fs'], provinceMap = {'gtg':'gauteng','mpl':'Mpumalanga','lm':'Limpopo','lpo':'Limpopo','kzn':'Kwazulu-Natal','wc':'Western Cape','nc':'Northern Cape','ec':'Eastern Cape','fs':'Free State','nw':'North West'}; if(Object.isString(object.value)){keywordArray = keyword.split(' ');if(province.hasVal(keywordArray[keywordArray.size()-1])){keywordArray[keywordArray.size()-1] = provinceMap[keywordArray[keywordArray.size()-1]];keyword = keywordArray.join(' ');} if(object.value.toLowerCase().match(keyword)){ data[object.key] = object.value; return data; } } else { sk = Object.isArray(keyword.match(",")) ? "," : " "; k=keyword.split(sk); r=object.value.description.split(sk); hn=keyword.match(/\d*/)[0];// dhn=object.value.description.match(/\data* /);// hn = Object.isArray(dhn) ? dhn[0] : '';// sscp = object.value.description.gsub(hn,'').split(',');// r = {// streetNumber:hn,// streetName:sscp[0].toLowerCase().trim(),// suburbName:sscp[1].toLowerCase().trim(),// cityName:sscp[2].toLowerCase().trim(),// provinceName:sscp[3].toLowerCase().trim()// };// console.dir(r);//method 1// Object.keys(r).each(function(key, i){// k.each(function(keypart){// if(part.toLowerCase().match(keypart.toLowerCase())){// mv++;// } else if(part.toLowerCase().match(keypart.toLowerCase().gsub(/\n/, ""))){// an=true;// mv++;// }// })// Object.isArray(keyword.match(r[key])) ? t.push(key) : 0;// });//method 2// Object.keys(object.value.addressData).each(function(key){// k.each(function(keypart){// if(object.value.addressData[key].match(keypart.toLowerCase())){// mv++;// }// });//// // var match = keyword.match(object.value.addressData[key]);// // Object.isArray(match) ? match = match[0] : 0;// // t.push(match);// });// log(t);//method 3 (in use) r.each(function(part){ k.each(function(keypart){ if(part.toLowerCase().match(keypart.toLowerCase())){ mv++; } else if(part.toLowerCase().match(keypart.toLowerCase().gsub(/\d/, ""))){ an=true; mv++; } }) }); c = k.size() > 1 ? 2 : 1; sk === " " ? c-- : 0; if(mv>c){// if(t.has(r.streetNumber) && t.has(r.streetName)){ data[object.key] = !((object.value.description.slice(0, hn.length)).match(hn)) ? hn+' '+object.value.description : object.value.description;// data[object.key] = object.value.dataset == "AG_SECTIONAL_SCHEMES" ? object.value.addressData.streetNumber+' '+object.value.description : object.value.description; return data; } } return false; }, clickResult: clickAction }); }, showCustomAddressButton: function(){ var position = this.addressFields.offset(),btn; if($('.addr-custom-btn').size() 0){ if(data[0].postalCode.length > 0){ resp.each(function(suburb, i){ if(suburb.postalCode == data[0].postalCode){ respN = i; } }); } else { respN = 0; } if(!Object.isUndefined(respN)){ data[0] = Object.extend(data[0], resp[respN]); streetAddress = data[0].buildingName.length > 0 ? data[0].buildingNo+' '+data[0].buildingName : data[0].streetNumber+' '+data[0].streetName; textvalue = streetAddress+' '+data[0].suburb+', '+data[0].area+', '+data[0].postalCode; FieldData.setFieldVal(fieldId, data, textvalue); $("#"+fieldId).val(textvalue); this.hideCustomAddressButton(); $("#"+fieldId).valid(); } else { $.alert("We could not find your address on our systems, please contact the call centre"); } } else if(Object.isUndefined(attempt)) { this.saveAddress(data, 1); } else { $.alert("We could not find your address on our systems, please contact the call centre"); } }.bind(this) }); },validate: function(){this.validation = $(this.opt.validationSelect).validate({ debug: true,// rules: $AC("validationRules") || {},errorClass: 'error',validClass: 'valid',ignore: '.ignore-element, .hidden, .disabled, .dep-hidden, .is-blank',errorPlacement: function(error, element) { element.parents('div.selector:visible,div.yesno-checking:visible').addClass('error'); element.parents('div.field:visible').addClass('error').find('div.message:visible').text($(error).text());},success: function(label) {var fieldId = label.attr('for'),field;// if (!Object.isUndefined(this.opt.form_type) && this.opt.form_type == 'bare') {// fieldId = fieldId + '_' + this.opt.product_id;// } //log(fieldId);if($P(fieldId) != null){field = $('#'+fieldId);} else {field = $('#'+$('input[name="'+fieldId+'"]').identify());} if (field.size() > 0) { field.parents('div.selector,div.yesno-checking,div.field').removeClass('error').addClass('valid');}}.bind(this)});// $AC("afterValidation");},validateNoError: function(){// log('validateNoError'); if ($(this.opt.validationSelect).size() > 0) { $(this.opt.validationSelect).valid(); }$('.error').removeClass('error');$('.message').text('');},submit: function(tab) {log("submit"); $(this.opt.validationSelect + ' input:not(:checkbox)').clearDefaultValue();// if (typeof this.opt.form_type != 'undefined' && this.opt.form_type != null && this.opt.form_type == 'bare') {// $(this.opt.validationSelect + ' input').trigger('blur');// }// log('before beforeSubmit'); $AC('beforeSubmit', tab);// log('after beforeSubmit'); $('.required-fulladdress-removed').each(function () { $(this).removeClass('required-fulladdress-removed').addClass('required'); }); var valid = true;// var idno = FieldData.getFieldByName('idno');// if (!Object.isUndefined(idno) && idno != null) {// var idnoVal = idno.tiaValue;// if (!Object.isUndefined(idnoVal) && idnoVal != null) {// if (// !Object.isUndefined(window.idnumbers)// && !Object.isUndefined(window.idnumbers[idnoVal])// ) {// if (// Object.isUndefined(window.idnumbers[idnoVal].exists)// || window.idnumbers[idnoVal].exists === true// ) {// valid = false;// if (Object.isUndefined($('#alert_fa_validate_id')) || $('#alert_fa_validate_id') == null || $('#alert_fa_validate_id').size() Hi!

' + msg + '

', alertType: 'warn' });// }// }// }// }// } if ($(this.opt.validationSelect).valid() && valid == true) { //log('extra validation section'); var forms = $(this.opt.validationSelect.replace(':visible', '')); forms.valid(); if (parseInt(forms.find('.error').size()) > 0) { var firstError = forms.find('.error').first(); $('a.step_'+firstError.parents('.form.tab-container').identify().replace('tabs-', '')).first().click(); setTimeout(function () { $(this.opt.validationSelect).valid(); firstError = $(this.opt.validationSelect).find('.error').first(); $('html, body').animate({scrollTop: firstError.offset().top - 100}, 250); }.bind(this), 500); } }if ($(this.opt.validationSelect).valid() && valid == true) { //log('valid submit');window.onbeforeunload = ProtoBits.emptyFunction;// if(!this.opt.app_id && !this.opt.isMixpress){// this.load("We are busy gathering data to calculate your premium. Please wait ...");// } else {this.load();// } var valid = false;// if (Object.isUndefined(this.opt.isMixpress) || this.opt.isMixpress == false && (isNaN(this.opt.app_id) || parseInt(this.opt.app_id) 0 || this.opt.isMixpress) { t = 2000; } var doValidate = 0; if ( ( Object.isUndefined(this.opt.isMixpress) || this.opt.isMixpress == false ) && (isNaN(this.opt.app_id) || parseInt(this.opt.app_id) Profile updated!'; html += '

Thank you for updating your details.

'; if (!Object.isUndefined(retData.oldpremium) && !Object.isUndefined(retData.premium)) { if (retData.premium != retData.oldpremium) { html += '

Your old premium: R ' + retData.oldpremium;// + '

'; html += '
Your new premium: R ' + retData.premium + ''; html += '


Please contact the call center if you have any questions.

'; } var oldPremium = parseFloat(retData.oldpremium || 0), newPremium = parseFloat(retData.premium || 0); if (oldPremium != newPremium) { var diff = 0; if (newPremium > oldPremium) { diff = (newPremium - oldPremium); trackEvent('change premium', 'increase premium', 'updated profile', parseInt(diff)); } else { diff = (oldPremium - newPremium); trackEvent('change premium', 'decrease premium', 'updated profile', parseInt(diff)); } } } $.alert({ alertHtml: html, alertType: 'info', alertButtons: { 'Ok' : function () { this.loadScreen.show('Reloading...'); top.location.href = (retData.redirect || top.location.href); }.bind(this) } }); break; default: if (!Object.isUndefined(retData.postVars)) { // tracking trackPageview('/gagoal/add-quote-success/'+(pId || 'E')); var tmp = ''; if (!Object.isUndefined(retData.postVars.clientId)) { $('#np_form').append(tmp.gsub('{n}', 'clientId').gsub('{v}', retData.postVars.clientId)); } if (!Object.isUndefined(retData.postVars.policyId)) { $('#np_form').append(tmp.gsub('{n}', 'policyId').gsub('{v}', retData.postVars.policyId)); } if (!Object.isUndefined(retData.postVars.policyLineItemId)) { $('#np_form').append(tmp.gsub('{n}', 'policyLineItemId').gsub('{v}', retData.postVars.policyLineItemId)); } if (!Object.isUndefined(retData.postVars.productId)) { $('#np_form').append(tmp.gsub('{n}', 'productId').gsub('{v}', retData.postVars.productId)); } if (!Object.isUndefined(retData.postVars.multi)) { $('#np_form').append(tmp.gsub('{n}', 'multi').gsub('{v}', retData.postVars.multi)); } this.load(); setTimeout(function () { $('#np_form').submit(); }, 500); } else { var e = globals.errors_generic || 'Sorry, and unknown error occurred. Please contact the call center.'; $.alert({alertHtml:e, alertType:"error"}); } break; } } else {$AR("nextPage", function(){$("#np_form").append(this.TEMPLATES.npInput.gsub("{app_id}", retData.app_id)); this.load(); $("#np_form").submit(); }.bind(this), 1);if(!Object.isUndefined(retData.showMessage)){$.alert({alertHtml: '

' + (globals.form_indicative_failed || 'Unfortunately an error occurred while retrieving your insurance information from TransUnion, we apologise for the inconvenience. Please click continue to load our user friendly form in order to complete your quote') + '

',alertType:"info",alertButtons:{ 'Continue': function(){$AC('nextPage');},'Close': function(){ $('input[name="noValidate"]').val(0);return false;} }});} else { if (this.opt.app_id > 0) { // tracking trackPageview('/gagoal/add-quote-success/'+(pId || 'E')); } setTimeout(function () { $AC('nextPage'); }, 1000);} } } else { var html = 'Something may have gone slightly wrong while your last request was being processed. ' + 'Please quote the message below when contacting our call center. ' + '

'; if (typeof retData.debug != 'undefined' && retData.debug != null) { html += retData.debug + '
'; } if (typeof retData.errors == 'object' && !isNaN(retData.errors.length) && retData.errors.length > 0) { retData.errors.each(function(error) { html += error + '
'; }); } if (typeof retData.errors == 'string' && retData.errors != '') { html += retData.errors + '
'; } html += '
'; $.alert({alertHtml:html, alertType:"error"}); } }.bind(this), error: function(request, status, error) { this.unload(); $('

Sorry, an error ('+error+') has occured. Please try again.

').insertAfter(this.opt.formSubmitBtn); $.alert({alertHtml:"

There was an error while trying to complete your request. Please quote the message below when calling the call center about this error.

Sorry, an unknown error has occured. Please try again or call the call center.", alertType:"error"});//("+request.status + '|' + request.statusText+") }.bind(this) }); }.bind(this), t); },checkProgress: function(){ if (Object.isFunction(this.completed.calculate)) { var percentage = this.completed.calculate(); //if(percentage >= 100){ //this.opt.formSubmitBtn.removeClass('disabled'); //this.bindSubmit(); //} }},bindSubmit: function(){// log('bindSubmit');// log(this.opt.formSubmitBtn);// log(this.opt.formSubmitBtn.parents('.form.tab-container'));this.opt.formSubmitBtn.unbind('click').click(this.submit.bind(this));}, load: function() { this.opt.loading = true; $(this.opt.validationSelect + ' input.auto_alt_toggle').clearDefaultValue();var msg = globals['loading_step'+this.opt.cur_step+'_loading_message'];Object.isUndefined(msg) ? msg = "Please wait..." : 0;// if (parseInt(this.opt.app_id) > 0 || this.opt.isMixpress) {// if (parseInt(this.opt.app_id) > 0 || this.opt.isMixpress) { //log('hi'); this.loadScreen.show(msg, globals['loading_step'+this.opt.cur_step+'_loading_block']);//'

'+msg+'

We promise that your premium will not change during a 12 month cycle - even if you have to claim!

Your cover starts from day 1!

We finalise car insurance claims in 4.5 days on average.

');// } else {// this.opt.formSubmitBtn.data('text', this.opt.formSubmitBtn.text());// this.opt.formSubmitBtn.text('Sending...').addClass('disabled').unbind('click');// this.opt.formSubmitBtn.insert({after:this.loader}); //$('div.validation_error').remove();// } }, unload: function() { this.opt.loading = false;// if (parseInt(this.opt.app_id) > 0 || this.opt.isMixpress) { this.loadScreen.close();// } else {// this.opt.formSubmitBtn.text(this.opt.formSubmitBtn.data('text')).removeClass('disabled');// this.loader.remove();// $(this.opt.validationSelect + ' input.auto_alt_toggle').setDefaultValue();// this.bindSubmit();// } try { setTimeout(function () { if ($('div.error:first').offset() != null) { $('body, html').animate({ scrollTop: $('div.error:first').offset().top - 200 }, 200); } }, 250); } catch (err) { } },setStepTimes: function(time, step){$.ajax({type: "POST",url: "/misc/xhr/form_actions.php",data: "fa=step_"+time+"&step="+step+"&app_id="+$('#app_id').val(),dataType: "json",timeout: 25000 });},checkDepends: function(e, el){var field=$(el),fid,value,parentId,depFields;this.tabCheckTimer ? clearTimeout(this.tabCheckTimer):0;fid = field.identify();//log('Checking Depends for '+fid);parentId = fid != null ? fid.gsub('field_','').gsub('_hiddeninput', '') : fid; if (!Object.isUndefined($FD(parentId))) { value = $FD(parentId).tiaValue || "";//this.formValues.getCurrentValues()[field.attr('name')]; depFields = FieldData.getFieldDependencies(parentId) || []; //log(depFields); // log('checkDepends: '+fid); depFields.each(function(v){ if(!Object.isUndefined($FD(v))){ //var depEl=$('.'+fid)[i], var depEl = $('#field_'+($FD(v).fieldId)).parents('.field'), depId= $FD(v).fieldId,dep,condition,checkVal; // depId = depEl.find('input, select, div.noedit-input').attr('id').gsub('field_','');// log("depID: "+depId); // log("parentID: "+parentId); // log(depEl); // log (depEl.find('input, select, div.noedit-input')); // log ('value: ' + value); // log ('dependingCondition: ' + $FD(depId).dependingCondition); // log ('dependingFieldValue: ' + $FD(depId).dependingFieldValue); // log ('hide_dependents: ' + $FD(fid).hide_dependents); //log('depId: '+depId); // dont check same field if (depId != fid) { if(value == "" && (Object.isUndefined($FD(parentId).hide_dependents) || $FD(parentId).hide_dependents == 'Y')) { this.dependentFieldToggle(depEl, 'hide'); } else if (value == "" && $FD(parentId).hide_dependents == 'N') { this.dependentFieldToggle(depEl, 'show'); } else { dep = $FD(depId); if(typeof dep == 'object'){ if(typeof dep.parentFields == 'object' && Object.keys(dep.parentFields).size() > 0){ if(typeof dep.parentFields[parentId] != 'undefined'){ condition = dep.parentFields[parentId].condition; checkVal = dep.parentFields[parentId].value; } else { condition = dep.dependingCondition; checkVal = dep.dependingFieldValue; } //log(condition); //log(value); //log(checkVal); switch(condition) { case '==': if (value == checkVal) { //log('hide'); this.dependentFieldToggle(depEl, 'hide'); } else { //log('show'); this.dependentFieldToggle(depEl, 'show'); } break; case '!=': if (value != checkVal) { //log('hide'); this.dependentFieldToggle(depEl, 'hide'); } else { //log('show'); this.dependentFieldToggle(depEl, 'show'); } break; } } } } } } }.bind(this));this.tabCheckTimer = setTimeout(function(){$AC('checkTabs');}.bind(this),800);// Object.isFunction(this.checkTabs) ? this.checkTabs() : 0; !Object.isUndefined(this.checkRegularDriver) ? this.checkRegularDriver() : 0; }},checkDependsDeep: function(depId){$(depId).find('input,select').each(function(){names.push($(this).attr('name'))})}, dependentFieldToggle: function (depEl, showOrHide) {var inputEl,fieldName,depFields,dep; // expects depEl to be selected div.field if (typeof showOrHide == 'string' && typeof depEl == 'object' && depEl.size() > 0) {// depId = depEl.find('input, select, div.noedit-input').attr('id').gsub('field_','');inputEl = depEl.find('input, select, div.noedit-input');fieldName = inputEl.attr('name');dep = $FD(fieldName);depFields = FieldData.getFieldDependencies(fieldName) || []; switch(showOrHide) { case 'show':if(depFields.size() > 0){depFields.each(function(f){if ($FD(f).fieldName != fieldName) {this.checkDepends(false, $('#field_'+$FD(f).fieldId));}}.bind(this));}setTimeout(function() {!depEl.is(':visible') ? depEl.show('blind').removeClass('hidden') : 0;inputEl.removeClass('dep-hidden');}.bind(this),500); break; case 'hide': !depEl.hasClass('hidden') ? depEl.hide('blind').addClass('hidden') : 0; inputEl.addClass('dep-hidden');// FieldData.resetFieldSaveValues(fieldName);if(depFields.size() > 0){depFields.each(function(f){ if (fieldName != $FD(f).fieldName) { var fIdEl = $('#field_'+$FD(f).fieldId),fIdCel;fIdCel = fIdEl.parents('.field');fIdEl.addClass('dep-hidden'); !fIdCel.hasClass('hidden') ? fIdCel.hide('blind').addClass('hidden') : 0;// FieldData.resetFieldSaveValues(f); this.checkDepends(false, $('#field_'+$FD(f).fieldId)); }}.bind(this));} break; } } }, checkHardcodedDepends: function () { return; //log('checkHardcodedDepends'); // check hardcoded dependencies. // product independent dependencies // uninterruptedcover// var depField = $FD('uninterruptedcover'),// dependents = ['haspreviousinsurance', 'regulardriveronanotherpolicy'],// show = false;//// if (!Object.isUndefined(depField)) {// var depEl = $('#field_'+depField.fieldId).parents('div.field'), depId = depField.fieldId;//// dependents.each(function (v) {// var dependent = $FD(v);// if (!Object.isUndefined(dependent.tiaValue)) {// if (dependent.tiaValue.toString().toUpperCase() == 'Y'/* && !$('#field_'+dependent.fieldId).hasClass('dep-hidden')*/) {// show = true;// }// }// });//// if (show) {// this.dependentFieldToggle(depEl, 'show');// } else {// this.dependentFieldToggle(depEl, 'hide');// }// }//// var depField = $FD('uninterruptedcover_regulardriver'),// dependents = ['haspreviousinsurance_regulardriver', 'regulardriveronanotherpolicy_regulardriver'],// show = false;//// if (!Object.isUndefined(depField)) {// var depEl = $('#field_'+depField.fieldId).parents('div.field'), depId = depField.fieldId;//// dependents.each(function (v) {// var dependent = $FD(v);// if (!Object.isUndefined(dependent.tiaValue)) {// if (dependent.tiaValue.toString().toUpperCase() == 'Y') {// show = true;// }// }// });//// if (show) {// this.dependentFieldToggle(depEl, 'show');// } else {// this.dependentFieldToggle(depEl, 'hide');// }// } // product specific dependencies var pId = this.opt.product_id; if (!Object.isUndefined(pId)) { pId = pId.toString().toUpperCase();// if (pId == 'STUFF') { // lightning conductor// var depField = $FD('lightning_conductor'),// show = false;// if (!Object.isUndefined(depField)) {// var depEl = $('#field_'+depField.fieldId).parents('div.field'), depId = depField.fieldId;// var within5 = $FD('within_5m');// if (!Object.isUndefined(within5.tiaValue) && within5 != null && within5.tiaValue != null) {// if (within5.tiaValue.toString().toUpperCase() == 'Y' && !$('#field_'+within5.fieldId).hasClass('dep-hidden')) {// show = true;// }// }// var thatchRoof = $FD('roof');// if (!Object.isUndefined(thatchRoof.tiaValue) && thatchRoof != null && thatchRoof.tiaValue != null) {// if (thatchRoof.tiaValue.toString().toUpperCase() == 'THA' && !$('#field_'+thatchRoof.fieldId).hasClass('dep-hidden')) {// show = true;// }// }// this.dependentFieldToggle(depEl, (show ? 'show' : 'hide'));// }// } /*if (pId == 'PLACE') { // lightning conductor var depField = $FD('lightning_conductor'), show = false; if (!Object.isUndefined(depField)) { var depEl = $('#field_'+depField.fieldId).parents('div.field'), depId = depField.fieldId; var thatchLapa = $FD('thatch_lapa'); if (!Object.isUndefined(thatchLapa.tiaValue) && thatchLapa != null && thatchLapa.tiaValue != null) { if (thatchLapa.tiaValue.toString().toUpperCase() == ' 0) {// $.alert({// alertId: 'fieldAssist',// alertHtml:this.TEMPLATES.assist.gsub('{body}', '

Chat to us right now by clicking the live chat button below or keep helping yourself.').gsub('{title}', 'Need some help?'),// alertType:'help',// alertButtons:{// 'Live Chat': function () {// $('#LP_DIV_1350916334825').find('a').click();// this.close();// },// 'No Thanks':function () { //this.close();// }// }// });// if(typeof lpMTagStatic === 'undefined'){// $("head").append(new Element("script", {'type':"text/javascript",'charset':"UTF-8",'src':"https://server.iad.liveperson.net/hc/86496974/?cmd=mTagRepstate&site=86496974&buttonID=7&divID=LP_DIV_1350916334825&bt=3&c=1"}));// }// } else { $.alert({ alertId: 'fieldAssist', alertHtml:this.TEMPLATES.assist.gsub('{body}', '

Request a callback and we\'ll call you right back! ... or keep helping yourself.').gsub('{title}', 'Need some help?'), alertType:'help', alertButtons:{ 'Call me back': function () { $('body').append(''); applyCallmeback(); $('a.call-me-back').first().click(); this.close(); }, 'No Thanks':function () { //this.close(); } } });// }},pageAssist: function(){//$.alert({// alertId: 'pageAssist',//alertHtml:this.TEMPLATES.assist.gsub('{body}', 'page idle assistance popup').gsub('{title}', 'Do you need some assistance?'),//alertType:'help',//alertButtons:{//'Yes': function () { //this.close();//},//'No':function () { //this.close();//}// }//});},preventPageLeave: function(e){//log(e);e.preventDefault();return false;}});////function yesnoChanged (id, newValue) {// if (!Object.isUndefined(id)) {// id = parseInt(id.gsub('field_',''));// $FD(id).tiaValue = newValue;// }//}jClass.create('customCarField', { initialize: function(options, vehicle_type){vType = vehicle_type == "BIKE" ? "Bike" : "Car"; this.opt = Object.extend({ columns: {}, rows:{ make: { label: 'Make', className: 'make', type: 'content', inputClass: 'car_make', content: ''// }, name : { label: 'Model', className: 'model_group', type: 'content', inputClass: 'car_model_group', content: ''// }, year : { label: 'Year', className: 'year', type: 'content', inputClass: 'car_year', content: ''// }, model: { label: vType, className: 'model', type: 'content', inputClass: 'car_model', content: ''// } }, onshow:ProtoBits.emptyFunction, onadd:ProtoBits.emptyFunction, showEvent:false, hideEvent:false, tooltipTitle:'Start with the make of your '+vType.toLowerCase(), fieldName:'custom', saveText:'Save', cancelText:'Cancel', onsave:ProtoBits.emptyFunction, oncancel:ProtoBits.emptyFunction, data:[], disallowMultiple: false }, options || {}); this.onshowfunc = this.opt.onshow.bind(this); this.columnList = Object.keys(this.opt.columns); this.rowList = Object.keys(this.opt.rows); this.saveBtn = $(new Element('a', {'class':'blue_btn save', 'href':'javascript:void(0);','onclick':'return false;'})).click(this.saveData.bind(this)); this.cancelBtn = $(new Element('a', {'class':'blue_btn cancel', 'href':'javascript:void(0);','onclick':'return false;'})).click(this.cancelClose.bind(this)); this.saveBtn.text(this.opt.saveText); this.cancelBtn.text(this.opt.cancelText); this.container = $(new Element('div', {'class':"selected-container"})); this.innerTooltip = $(new Element('div', {'id':'edit_'+this.opt.fieldName, 'class':'tooltip-inner'})) .append('

'+this.opt.tooltipTitle+'

').append(this.container).append(this.cancelBtn).append(this.saveBtn); if(this.rowList.size() > 0){ this.addItemRow = ''; this.rowList.each(this.createRowItem.bind(this));// this.addValues = this.container.serializeElement(); } this.items = $(new Element('div',{'class':'items_'+this.opt.fieldName})).append(this.addItemRow); this.container.append(this.titleRow).append(this.items)/*.append(this.addItemRow)*/; this.addValues = this.container.serializeElement(); this.tooltip = $(new Element('span', {'class':'tooltip'})).append(new Element('div', {'class':'tooltip-arrow'})).append(this.innerTooltip); this.tooltip.find("select").createSelect(); if(!Object.isArray(this.opt.data)){ this.opt.data = []; } if(this.opt.showEvent !== false){ this.bind(this.opt.showEvent, this.showTooltip.bind(this)); } if(this.opt.hideEvent !== false){ this.bind(this.opt.hideEvent, this.cancelClose.bind(this)); } this.addAllItems(); return this; }, createTitle: function(col){ if(this.opt.columns[col].title !== false){ this.titleRow.append(new Element('li', {'class':this.opt.columns[col].className}).insert(this.opt.columns[col].title)); } }, createRowItem: function(row){ var label,content; label = ''; switch(this.opt.rows[row].type){ case 'input': content = ''; break; case 'content': content = this.opt.rows[row].content.gsub('{fieldName}',this.opt.fieldName).gsub('{name}',row); break; } this.addItemRow += ''; }, filterVal: function(col, val){ if(typeof this.opt.columns[col].filter == 'function'){ return this.opt.columns[col].filter(val); } return val; }, showTooltip: function(){ var pos = {},parentParagraph,pleft; $('.tooltip').remove(); $('body').append(this.tooltip); this.tooltip.hide(); parentParagraph = $(this).parents('p').size() > 0 ? $(this).parents('p').eq(0) : $(this).parents('div.form'); offset = this.offset(); pos.left = (offset.left+(this.realWidth()/2))-(this.tooltip.realWidth()/2); pos.top = offset.top+this.realHeight()+5; if(parentParagraph.size() > 0){ pleft = parentParagraph.offset().left; pright = pleft+parentParagraph.realWidth()+24; if(pos.left pright){ pos.left = pright-this.tooltip.realWidth()-34; $('.tooltip-arrow').addClass('right').css({'left':(offset.left-pos.left)+(this.realWidth()/2)-10}); } else { $('.tooltip-arrow').removeClass('left').removeClass('right') } } this.tooltip.css({'top':pos.top+"px", 'left':pos.left+"px"}); this.saveBtn.unbind('click').bind("click",this.saveData.bind(this)); this.cancelBtn.unbind('click').bind("click",this.cancelClose.bind(this)); this.tooltip.fadeIn('slow', function () { this.onshowfunc(); this.tooltip.find('select').createSelect(); }.bind(this)); }, removeItem: function(e){ var el = $(e.currentTarget),id; id = el.identify().gsub(this.opt.fieldName+'_', ''); this.opt.data = this.opt.data.without(this.opt.data[id]); this.items.empty(); this.addAllItems(); this.tooltip.find('.remove-item').bind('click', this.removeItem.bind(this)); }, addAllItems: function(){ if(Object.isArray(this.opt.data) && this.opt.data.size() > 0){ this.opt.data.each(function(data, i){ var row=$(new Element('ul', {'class':'list-table'})); this.columnList.each(function(col){ var val = !Object.isUndefined(data[col]) ? data[col] != "" ? data[col] : ' ' : ' '; customClass = val != ' ' ? ' '+col+'-custom-'+val : 0; val = this.filterVal(col, val); val.length > 135 ? customClass+=' overflow' : 0; if (col !== 'removeItem' && col !== 'addBtn') { // for geysers if (col == 'isSolar' || col == 'geyserOutside') { var options = $(this.opt.columns[col].content).find('option'); options.each(function (i,v) { o = $(v); if (o.val() != '' && o.val() == val) { val = o.text(); } }); } $('#'+col).val(''); row.append(new Element('li', {'class':this.opt.columns[col].className+customClass}).insert({'bottom':val})); } else if(col === 'removeItem'){ row.append(new Element('li', {'class':this.opt.columns[col].className}) .insert({'bottom':this.opt.columns[col].content.gsub('{fieldName}',this.opt.fieldName).gsub('{key}',i)})); } }.bind(this)); this.items.append(row); }.bind(this)) } }, checkEmptyValues: function(){ var values = this.addValues.getCurrentValues(),ret=false; Object.keys(values).each(function(key){ if(values[key] != ""){ ret = true } }); return ret; }, saveData: function(e){ e.preventDefault(); e.stopPropagation(); var canClose = false; if ($('#model').size() > 0) { if (parseInt($('#model :selected').val()) > 0) { canClose = true; } } if(canClose !== false){ this.opt.onsave(this.opt.data, this.identify()); this.closeTooltip(); //log(this.identify()); $('#'+this.identify()).blur(); } else { $.alert('Please select your make, model group, year and model.'); } }, cancelClose: function(e){ e.preventDefault(); e.stopPropagation(); this.closeTooltip(); this.opt.oncancel(this.opt.data, this.identify()); }, closeTooltip: function(){ this.tooltip.find('.add-item').unbind('click'); this.tooltip.find('.remove-item').unbind('click'); this.cancelBtn.unbind('click'); this.saveBtn.unbind('click'); this.tooltip.remove(); }, isEmptyFunction: function(func){ if(Object.isFunction(func)){ return func.toString() === "function () { }"; } else { return true; } }});// TO BE MERGED INTO COMMON.JS FOR PRODUCTION/** * This is a clientside Fields "Database". It contains indexed fielddata for the current * pages form along with predefined functions to manipulate and retrieve the data quickly * and easily. */var $FD;var MiFields = Class.create((function(){function initialize(array) {this._object = {};array.each(function(obj, i){this._object[i] = obj;}.bind(this));// this._index = {};updateIndex.apply(this);// this._each(function(f){// if(typeof f.obj == 'object'){// this._index[f.obj.fieldId] = f.key;// this._index[f.obj.fieldName] = f.key;// }// }.bind(this));window.$FD = function(id){return this.getField(id);}.bind(this);}function updateIndex(){var index = {},dfix=[];this._each(function(d){var pdata={},f=d.obj,i=d.key,parentFields,pc;index[f.fieldId] = i;index[f.fieldName] = i;if(f.parentFields !== null && !Object.isUndefined(f.parentFields)){parentFields = Object.keys(f.parentFields);// console.log(parentFields);pc = parentFields.size();if(pc > 0){dfix.push(i);parentFields.each(function(parent){if(typeof index[parent+"_dependents"] == 'undefined')index[parent+"_dependents"] = [];index[parent+"_dependents"].push(f.fieldId);});}}}); dfix.each(function(i){var p,f = this._object[i],parentFields;parentFields = Object.keys(f.parentFields);//parentFields.size() > 1 ? console.log(f) : 0;parentFields.each(function(parent){//console.log(parent);parentFieldName = this._object[index[parent]].fieldName;if(typeof index[parentFieldName+"_dependents"] == 'undefined')index[parentFieldName+"_dependents"] = [];index[parentFieldName+"_dependents"].push(f.fieldName);this._object[i].dependsOnField = parentFieldName;}.bind(this))}.bind(this));this._index = index;this.initialized = true;}function _each(iterator) {for (var key in this._object) {var obj = this._object[key], pair = [key, obj];pair.key = key;pair.obj = obj;iterator(pair);}}function getFieldKey(s){if(Object.isString(s)){if(s.match('field_')){s = s.gsub('field_', '');}}return this._index[s];}function setValue(s, key, value){s = this.getFieldKey(s); if (key == 'displayName') { value = escape(value); } if (key == 'tiaValue') { value = escape(value); }return this._object[s][key] = value;}function resetFieldSaveValues(s){s = this.getFieldKey(s);this._object[s]['displayValue'] = '';this._object[s]['tiaValue'] = '';$('.active', $('#field_'+this._object[s]['fieldId']).parents('.field')).removeClass('active');$('#field_'+this._object[s]['fieldId']).val('');}function setFieldVal(s, tia, display){ //log(s);log(tia);log(display);s = this.getFieldKey(s); //log(s);if (typeof display == 'undefined') { if (typeof this._object[s]['displayValue'] != 'undefined' && this._object[s]['displayValue'] != '') { display = this._object[s]['displayValue']; } else { display = tia; } } if (!Object.isUndefined(this._object[s])) { this._object[s]['displayValue'] = escape(display); this._object[s]['tiaValue'] = (typeof tia == 'string') ? escape(tia) : tia; }return this._object[s];}function getValue(s, key) {s = this.getFieldKey(s); return this._object[s][key];}function getFieldById(s) {return this.getField(s);}function getFieldByName(s) {return this.getField(s);}function getFieldDependencies(s){return this._index[s+'_dependents'];} function getField(s) { var field = this._object[(this.getFieldKey(s))];if(typeof field === 'object' && !Object.isUndefined(field.tiaValue) && !Object.isUndefined(field.displayValue)){field = Object.extend(field, {tiaValue:Object.isString(field.tiaValue) ? unescape(field.tiaValue) : field.tiaValue,displayValue:unescape(field.displayValue)});}return field; }function storyText(fieldId, fieldValue){var fieldObj = this.getField(fieldId), storyText = false, story_text = false;//log(fieldObj);if (!Object.isUndefined(fieldObj)) {if (!Object.isUndefined(fieldObj.storyText)) {if (!Object.isUndefined(fieldObj.storyText[strId])) {storyText = unescape(fieldObj.storyText[strId][fieldValue])}} //log(storyText);if (!storyText) {story_text = fieldObj.story_text_for_field; //log(story_text);if (story_text != null && !Object.isUndefined(story_text)) {storyText = unescape(story_text[fieldValue]/*.base64_decode()*/)} else { //log(fieldObj.fieldValues); //log(fieldValue);if(fieldObj.fieldValues != null){if(Object.isArray(fieldObj.fieldValues.array)){fieldObj.fieldValues.array.each(function(val){if(val.valueId == fieldValue){storyText = val.displayName;}});}}}}return storyText;}return fieldObj;}function extractData(filter){var data = {};this._each(function(f){// if (f.obj.fieldName == 'previouslosses') {// log('1');// log(f.obj.displayValue);// log(f.obj.tiaValue);// log(escape(unescape(f.obj.displayValue)));// } //if ($('#field_' + f.obj.fieldId + ':not(.dep-hidden)').size() > 0) {typeof f.obj.displayValue == 'undefined' ? f.obj.displayValue = '' : 0;typeof f.obj.tiaValue == 'undefined' ? f.obj.tiaValue = '' : 0;//if (f.obj.fieldName == 'previouslosses') {// log('2');// log(f.obj.displayValue);// log(f.obj.tiaValue);// log(typeof f.obj.tiaValue);// log(f.obj.tiaValue != "");//}if (f.obj.displayValue != "" && f.obj.tiaValue !== "" ) {if(Object.isArray(filter)){if(filter.hasVal(f.obj.fieldName) || filter.hasVal(""+f.obj.fieldId)){data[f.obj.fieldName] = {displayValue: escape(unescape(f.obj.displayValue)),tiaValue: (typeof f.obj.tiaValue == 'string') ? escape(unescape(f.obj.tiaValue)) : f.obj.tiaValue}}} else {data[f.obj.fieldName] = {displayValue: escape(unescape(f.obj.displayValue)),tiaValue: (typeof f.obj.tiaValue == 'string') ? escape(unescape(f.obj.tiaValue)) : f.obj.tiaValue}}} else if(f.obj.fieldName.match('password') && $('input[name="'+f.obj.fieldName+'"]').val() != ""){data[f.obj.fieldName] = {displayValue: $('input[name="'+f.obj.fieldName+'"]').val(),tiaValue: $('input[name="'+f.obj.fieldName+'"]').val()}} // }}); //log(data['previouslosses']);return data;}function getQueryString(){return Object.toQueryString(this.extractData());}function getPercentComplete(){var completed=0,total=0;this._each(function(f){if(!Object.isUndefined(f.obj.tiaValue)){if(f.obj.tiaValue != "")completed = completed+1;}total = total+1;});return Math.round((completed/total)*100);}return {initialize: initialize,_each: _each,getFieldKey:getFieldKey,setValue:setValue,setFieldVal:setFieldVal,resetFieldSaveValues:resetFieldSaveValues,getValue:getValue,getField:getField,getFieldById:getFieldById,getFieldByName:getFieldByName,getFieldDependencies:getFieldDependencies,storyText:storyText,extractData:extractData,getQueryString:getQueryString,getPercentComplete:getPercentComplete};})());if(typeof fieldData != 'undefined'){var FieldData = new MiFields(fieldData);//fieldData = false;//delete fieldData;};MiApplication.addMethods({ updateServer: function(e) { var fieldId,el,value; el = $(e.target); fieldId = el.attr('name'); value = this.formValues.getCurrentValues()[fieldId]; if (Object.isUndefined(value)) { try { value = el.val(); } catch (err) { } } if (Object.isUndefined(value)) { try { value = $FD(fieldId).tiaValue; } catch (err) { } } if ($('input[name="'+fieldId+'"]').hasClass('check_insured_value')) { value = value.replace(/\s/, ''); } if (!Object.isUndefined(el.attr('placeholder')) && value == el.attr('placeholder')) { value = ''; } if(!el.hasClass('noupdate')){ FieldData.setFieldVal(fieldId, value); } el.valid && el.valid(); }});// buildingNo: "string",// postalCode: "string",// boxStreet: "string",// area: "string",// buildingName: "string",// suburb: "string",// streetNumber: "string",// streetName: "string",// longitude: "decimal",// latitude: "decimal"var MiForm, dev_test;window.product_id = 'WHEEL';$(document).ready(function() { new Image().src = '/images/ajax-loader-snake.gif'; $('.app-form-callback-cta').unbind('click').click(function (e) { e.preventDefault(); var el = $(this), formCont = $('#'+el.data('form')), callbackCont = $('#'+el.data('callback')), pluginId = el.data('form').gsub('form', ''); if (formCont.is(':visible')) { formCont.css('min-height', formCont.realHeight()); callbackCont.css('min-height', formCont.realHeight()); formCont.fadeOut('fast', function () { callbackCont.fadeIn('fast', function () { formCont.css('min-height', ''); callbackCont.css('min-height', ''); }); }); Miway.Tracking.pixelTrack(312994); try { callbackCont.find('form#callbackForm1020').data('obj').validate(); } catch (err) { } } else { formCont.css('min-height', formCont.realHeight()); callbackCont.css('min-height', formCont.realHeight()); callbackCont.fadeOut('fast', function () { formCont.fadeIn('fast', function () { formCont.css('min-height', ''); callbackCont.css('min-height', ''); }); }); //el.find('a').text('Request a callback!'); } });;MiForm = new MiApplication({ formValuesSelect: '#miwayForm1020_container', helpTimeout:300, app_id:0, product_id:'WHEEL', miwy_fa:'get_initial_quote', miwy_np:'101', cur_step:0, validationSelect: '#miwayForm1020', formSubmitBtn: $('#miwayForm1020 .form_submit'),getFormData:function(){ $('#miwayForm1020 input, #miwayForm1020 select').each(function () { $(this).fire('blur'); }); var postObj={ miwy_fa:this.opt.miwy_fa, app_id:this.opt.app_id, productId:this.opt.product_id, miwy_np:this.opt.miwy_np, noValidate: parseInt($('input[name="noValidate"]').val()), data:Object.toJSON(FieldData.extractData()) } return Object.toQueryString(postObj); },onInit: function(){ // tracking "started" on first field focus $('#miwayForm1020').find('input, select').not('[type="hidden"]').focus(function () { if ($(this).parents('form').data('started') != true) { trackPageview('/gagoal/started-WHEEL-insurance'); $(this).parents('form').data('started', true); } });this.addressFields = $(".address, .fulladdress"); if(this.addressFields.size() > 0){ this.addressFields.each(function(i){ this.createAddrAutocomplete(this.addressFields[i]); }.bind(this)); } this.vehicleSearch = $("input[name='make_model']"); if(this.vehicleSearch.size() > 0){ this.createVehicleAutocomplete(this.vehicleSearch); } if ($(".datepicker").size() > 0) { $(".datepicker").datepicker({ dateFormat: "yy-mm-dd", changeMonth:true, changeYear:true }); } $(".hidden").parents('div.field').hide(); $('#miwayForm1020').find('input:not(:checkbox), select').blur(this.updateServer.bind(this)); $('#miwayForm1020').find('input:checkbox').change(this.updateServer.bind(this));$('#miwayForm1020').find('select').createSelect({colMax:1,limiton:'columns', optionsClass: 'custom-car', colWidth: 210});clearTimeout(this.helpTimer);$('#miwayForm1020').find('input, select').focus(this.resetHelpTimer.bind(this));// $('form.validate input.auto_alt_toggle').setDefaultValue(); this.bindSubmit(); $('#miwayForm1020').find('input, select').not('[type="checkbox"]').blur(function () { $(this).parents('div.field').find('div.question').trigger('mouseleave'); }); $('#miwayForm1020').find('input, select').not('[type="checkbox"]').focus(function () { $(this).parents('div.field').find('div.question').trigger('mouseover'); });}});});

*SpeedQuote
The quoted premium will only be illustrative and not a binding offer.

© 2014 MiWay Insurance Limited

© 2014 MiWay Insurance Limited is an Authorised Financial Services Provider (Licence number:33970).