/*
* Global ajax loading screen handler. Shows a loading screen when ajax requests are issued.
* Executed on page display.
*/
$(document).ready(function(){
checkCookiesEnabled(); // Perform the cookie check.
checkBrowserSupport(); // Check if the browser is supported
$("#loading").loading();
// Ajax loading dialogs.
$(document).ajaxStart(function(){
$('a.help-def').each(function() {
$(this).btOff();
});
$('a.btn-help').each(function() {
$(this).btOff();
});
var msgList = getLoadingMessageList();
$("#loading").showLoading(msgList);
});
$(document).ajaxStop(function(){
$("#loading").hideLoading();
if($('#vehicleSelection').hasClass('error-highlight')){
scrollToNoInsuredCar();
}
});
});
function getLoadingMessageList(){
var quoteProcess;
if(quoteProcess == "IDQ"){
return getIdqLoadingMessageList();
}
else{
return getQuickQLoadingMessageList();
}
}
function getQuickQLoadingMessageList()
{
return{
0 : '',
10000 : 'Our system is processing - this could take up to a couple of minutes',
50000 : 'Sorry for the delay - our system is still processing',
180000 : function(){
window.location.href = getReferralUrl();
}
}
}
function getIdqLoadingMessageList()
{
return{
0 : '',
10000 : 'Our system is processing - this could take up to a couple of minutes',
50000 : 'Sorry for the delay - our system is still processing',
90000 : 'Thank you for your patience - our system is still processing. If you would like us to call you to complete your transaction, select \'Cancel\' and we will ask for your phone number. Cancel',
130000 : 'Still processing - thank you for waiting. Remember - we can call you to complete your transaction. Click \'Cancel\', and we will ask for your phone number. Cancel',
180000 : function(){
window.location.href = getReferralUrl();
}
}
}
function getReferralUrl(){
return '../cancelReferral.html?cancelReferralId=2012&ss=' + $("#ss").val();
}