';
var tpl_pagejump = 'Page of ';
$.each(pagerobj, function(i, obj)
{
switch(obj.type)
{
case 'previous':
str_prev += prev_tpl.replace('{PAGEOFFSET}', obj.offset).replace('{PAGENUM}', obj.page).replace('{LAST_ID}', '0');
break;
case 'current':
str_curr += curr_tpl.replace('{PAGEOFFSET}', obj.offset).replace('{PAGENUM}', obj.page).replace('{LAST_ID}', obj.last_id);
if(obj.has_next)
{
tplstr = tplstr.replace('{OFFSET_NEXT}', Number(obj.offset) + Number(obj.limit)).replace('{LAST_ID}', obj.last_id);
tplstr = tplstr.replace('{LAST_ID}', obj.last_id);
}
else
{
tplstr = tplstr.replace('{OFFSET_NEXT}', Number(obj.offset));
tplstr = tplstr.replace('{LAST_ID}', obj.last_id);
}
break;
case 'next':
str_next += next_tpl.replace('{PAGEOFFSET}', obj.offset).replace('{PAGENUM}', obj.page).replace('{LAST_ID}', obj.last_id);
break;
default:
info = obj;
break;
}
});
offset_diff = info.offset_last / (info.pages - 1);
tpl_pagejump = tpl_pagejump
.replace('{PAGEOFFSET}', info.offset)
.replace(/{PAGENUM}/g, info.curr_page)
.replace('{PAGES}', info.pages)
.replace('{PAGE_LAST}', info.pages)
.replace('{OFFSET_DIFF}', offset_diff);
tplstr = tplstr
.replace('{PAGES}', str_prev + str_curr + str_next)
.replace('{OFFSET_LAST}', info.offset_last)
.replace('{OFFSET_FIRST}', 0)
.replace('{OFFSET_PREVIOUS}', info.offset_previous)
.replace(/{LAST_ID}/g, info.last_id)
.replace('{PAGEJUMP}', tpl_pagejump);
if(info.pages > 1)
{
return tplstr;
}
else
{
return '';
}
}
},
GUID: function()
{
var S4 = function()
{
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
};
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
}
};
var URLLoader = (function()
{
var pub = {};
// Default id of the target element
var default_target = 'portal-dashboard';
var event_before_load = 'href_event_before_load';
var event_after_load = 'href_event_after_load';
var event_callback_ready = 'href_event_callback_ready';
var target_element = {};
// List of loaded resources so we don't load multiple times
var loaded = {};
/**
* Load the data from the URL within target object. Upon finishing, execute callback function if any
*
* @param obj object
* @param targetElement (object | string)
* @param callback (null | function)
* @return void
*/
function loadURL(obj, targetElement, callback)
{
if ( targetElement.data('isLoading') == true )
{
return false;
}
targetElement.data('isLoading', true );
window.setTimeout( function()
{
targetElement.data( 'isLoading', false );
}, 300);
if(obj.parents('.header-box').length !== 0)
{
window.location.href = obj.attr('href');
}
if(typeof obj == 'object')
{
var url = obj.data('url');
var where = (typeof targetElement == 'object') ? targetElement : $("#" + (obj.data('href') || default_target));
var always_reload = ( typeof obj.data('always_reload') != 'undefined' && obj.data('always_reload') );
// If there is no current URL in the current counter
if( typeof loaded[url] == 'undefined' || always_reload )
{
// Show the UI spinner - changed to have the spinner inside target (elf)
//var $target_el = $( '#' + where ).spin();
where.trigger( event_before_load );
load_remote_data(url, obj, where, callback);
}
}
}
/**
* Load the data from the remote URL
*
* @param url string
* @param obj object
* @param where jQueryObject
* @param callback (null | function)
* @return void
*/
function load_remote_data(url, obj, where, callback)
{
// Start loading the data
$.template(url, obj.data(), function(html)
{
// Do we have to load the external JS for the tab?
var loadjs = obj.data('loadjs');
// If there was an attribute called "loadjs", attempt to load an external JS file based on the URL
if(typeof loadjs != 'undefined')
{
var jsURL;
if( typeof loadjs == 'boolean' || String(loadjs) == 'true' )
{
var URLPieces = url.split('/');
jsURL = defaultURL + URLPieces[3] + '/' + URLPieces[4] +'.js';
}
else
{
jsURL = loadjs;
}
where.trigger( event_after_load, {target_el: where, html: html} );
yepnope(
[
{
load: [jsURL],
complete: function()
{
// If there was an extra callback specified...
if(typeof callback == 'function')
{
callback();
}
where.trigger( event_callback_ready );
}
}
]);
}
else
{
where.trigger( event_before_load, {target_el: where} );
// object href attribute contains the definition of the element where we load the data
where.html(html);
// If there was an extra callback specified...
if(typeof callback == 'function')
{
callback();
}
where.trigger( event_callback_ready );
}
// Store the URL to the counter object
loaded[url] = obj.data();
});
}
/**
* Autotrigger links in an element wrapping them
* @param obj jQueryObject
* @return void
*/
function autotrigger(obj)
{
var querystring = getQueryString();
if(typeof querystring == 'object' && querystring.hasOwnProperty('component'))
{
if(typeof obj == 'object')
{
_link = $("a[data-component='"+ querystring.component +"']");
_link.trigger('click');
}
}
else
{
if(typeof obj == 'object')
{
links = $("a", obj);
if(links.length)
{
$.each(links, function(i, j)
{
_link = $(this);
if(_link.data('autoload') == 1)
{
_link.trigger('click');
}
});
}
}
}
}
/**
* Get key-value pairs from the querystring
*/
function getQueryString()
{
var result = {}, queryString = location.search.substring(1),
re = /([^&=]+)=([^&]*)/g, m;
while (m = re.exec(queryString))
{
result[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
}
return result;
}
/**
* Exposed members
*/
pub.loadURL = loadURL;
pub.autotrigger = autotrigger;
pub.before_load = event_before_load;
pub.after_load = event_after_load;
pub.default_target = default_target;
pub.target_element = target_element;
pub.callback_ready = event_callback_ready;
return pub;
})();
/*
** Created by: Jeff Todnem (http://www.todnem.com/)
** Created on: 2007-08-14
** Last modified: 2010-05-03
**
** License Information:
** -------------------------------------------------------------------------
** Copyright (C) 2007 Jeff Todnem
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2 of the License, or (at your
** option) any later version.
**
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** General Public License for more details.
**
** You should have received a copy of the GNU General Public License along
** with this program; if not, write to the Free Software Foundation, Inc.,
** 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
**
*/
String.prototype.strReverse = function() {
var newstring = "";
for (var s=0; s < this.length; s++) {
newstring = this.charAt(s) + newstring;
}
return newstring;
};
function chkPass(pwd) {
// Simultaneous variable declaration and value assignment aren't supported in IE apparently
// so I'm forced to assign the same value individually per var to support a crappy browser *sigh*
var nScore=0, nLength=0, nAlphaUC=0, nAlphaLC=0, nNumber=0, nSymbol=0, nMidChar=0, nRequirements=0, nAlphasOnly=0, nNumbersOnly=0, nUnqChar=0, nRepChar=0, nRepInc=0, nConsecAlphaUC=0, nConsecAlphaLC=0, nConsecNumber=0, nConsecSymbol=0, nConsecCharType=0, nSeqAlpha=0, nSeqNumber=0, nSeqSymbol=0, nSeqChar=0, nReqChar=0, nMultConsecCharType=0;
var nMultRepChar=1, nMultConsecSymbol=1;
var nMultMidChar=2, nMultRequirements=2, nMultConsecAlphaUC=2, nMultConsecAlphaLC=2, nMultConsecNumber=2;
var nReqCharType=3, nMultAlphaUC=3, nMultAlphaLC=3, nMultSeqAlpha=3, nMultSeqNumber=3, nMultSeqSymbol=3;
var nMultLength=4, nMultNumber=4;
var nMultSymbol=6;
var nTmpAlphaUC="", nTmpAlphaLC="", nTmpNumber="", nTmpSymbol="";
var sAlphaUC="0", sAlphaLC="0", sNumber="0", sSymbol="0", sMidChar="0", sRequirements="0", sAlphasOnly="0", sNumbersOnly="0", sRepChar="0", sConsecAlphaUC="0", sConsecAlphaLC="0", sConsecNumber="0", sSeqAlpha="0", sSeqNumber="0", sSeqSymbol="0";
var sAlphas = "abcdefghijklmnopqrstuvwxyz";
var sNumerics = "01234567890";
var sSymbols = ")!@#$%^&*()";
var sComplexity = "Too Short";
var sStandards = "Below";
var nMinPwdLen = 8;
var nd = (document.all) ? 0 : 1 ;
if (pwd) {
nScore = parseInt(pwd.length * nMultLength);
nLength = pwd.length;
var arrPwd = pwd.replace(/\s+/g,"").split(/\s*/);
var arrPwdLen = arrPwd.length;
/* Loop through password to check for Symbol, Numeric, Lowercase and Uppercase pattern matches */
for (var a=0; a < arrPwdLen; a++) {
if (arrPwd[a].match(/[A-Z]/g)) {
if (nTmpAlphaUC !== "") { if ((nTmpAlphaUC + 1) == a) { nConsecAlphaUC++; nConsecCharType++; } }
nTmpAlphaUC = a;
nAlphaUC++;
}
else if (arrPwd[a].match(/[a-z]/g)) {
if (nTmpAlphaLC !== "") { if ((nTmpAlphaLC + 1) == a) { nConsecAlphaLC++; nConsecCharType++; } }
nTmpAlphaLC = a;
nAlphaLC++;
}
else if (arrPwd[a].match(/[0-9]/g)) {
if (a > 0 && a < (arrPwdLen - 1)) { nMidChar++; }
if (nTmpNumber !== "") { if ((nTmpNumber + 1) == a) { nConsecNumber++; nConsecCharType++; } }
nTmpNumber = a;
nNumber++;
}
else if (arrPwd[a].match(/[^a-zA-Z0-9_]/g)) {
if (a > 0 && a < (arrPwdLen - 1)) { nMidChar++; }
if (nTmpSymbol !== "") { if ((nTmpSymbol + 1) == a) { nConsecSymbol++; nConsecCharType++; } }
nTmpSymbol = a;
nSymbol++;
}
/* Internal loop through password to check for repeat characters */
var bCharExists = false;
for (var b=0; b < arrPwdLen; b++) {
if (arrPwd[a] == arrPwd[b] && a != b) { /* repeat character exists */
bCharExists = true;
/*
Calculate icrement deduction based on proximity to identical characters
Deduction is incremented each time a new match is discovered
Deduction amount is based on total password length divided by the
difference of distance between currently selected match
*/
nRepInc += Math.abs(arrPwdLen/(b-a));
}
}
if (bCharExists) {
nRepChar++;
nUnqChar = arrPwdLen-nRepChar;
nRepInc = (nUnqChar) ? Math.ceil(nRepInc/nUnqChar) : Math.ceil(nRepInc);
}
}
/* Check for sequential alpha string patterns (forward and reverse) */
for (var s=0; s < 23; s++) {
var sFwd = sAlphas.substring(s,parseInt(s+3));
var sRev = sFwd.strReverse();
if (pwd.toLowerCase().indexOf(sFwd) != -1 || pwd.toLowerCase().indexOf(sRev) != -1) { nSeqAlpha++; nSeqChar++;}
}
/* Check for sequential numeric string patterns (forward and reverse) */
for (var s=0; s < 8; s++) {
var sFwd = sNumerics.substring(s,parseInt(s+3));
var sRev = sFwd.strReverse();
if (pwd.toLowerCase().indexOf(sFwd) != -1 || pwd.toLowerCase().indexOf(sRev) != -1) { nSeqNumber++; nSeqChar++;}
}
/* Check for sequential symbol string patterns (forward and reverse) */
for (var s=0; s < 8; s++) {
var sFwd = sSymbols.substring(s,parseInt(s+3));
var sRev = sFwd.strReverse();
if (pwd.toLowerCase().indexOf(sFwd) != -1 || pwd.toLowerCase().indexOf(sRev) != -1) { nSeqSymbol++; nSeqChar++;}
}
/* Modify overall score value based on usage vs requirements */
/* General point assignment */
if (nAlphaUC > 0 && nAlphaUC < nLength) {
nScore = parseInt(nScore + ((nLength - nAlphaUC) * 2));
}
if (nAlphaLC > 0 && nAlphaLC < nLength) {
nScore = parseInt(nScore + ((nLength - nAlphaLC) * 2));
}
if (nNumber > 0 && nNumber < nLength) {
nScore = parseInt(nScore + (nNumber * nMultNumber));
}
if (nSymbol > 0) {
nScore = parseInt(nScore + (nSymbol * nMultSymbol));
}
if (nMidChar > 0) {
nScore = parseInt(nScore + (nMidChar * nMultMidChar));
}
/* Point deductions for poor practices */
if ((nAlphaLC > 0 || nAlphaUC > 0) && nSymbol === 0 && nNumber === 0) { // Only Letters
nScore = parseInt(nScore - nLength);
}
if (nAlphaLC === 0 && nAlphaUC === 0 && nSymbol === 0 && nNumber > 0) { // Only Numbers
nScore = parseInt(nScore - nLength);
}
if (nRepChar > 0) { // Same character exists more than once
nScore = parseInt(nScore - nRepInc);
}
if (nConsecAlphaUC > 0) { // Consecutive Uppercase Letters exist
nScore = parseInt(nScore - (nConsecAlphaUC * nMultConsecAlphaUC));
}
if (nConsecAlphaLC > 0) { // Consecutive Lowercase Letters exist
nScore = parseInt(nScore - (nConsecAlphaLC * nMultConsecAlphaLC));
}
if (nConsecNumber > 0) { // Consecutive Numbers exist
nScore = parseInt(nScore - (nConsecNumber * nMultConsecNumber));
}
if (nSeqAlpha > 0) { // Sequential alpha strings exist (3 characters or more)
nScore = parseInt(nScore - (nSeqAlpha * nMultSeqAlpha));
}
if (nSeqNumber > 0) { // Sequential numeric strings exist (3 characters or more)
nScore = parseInt(nScore - (nSeqNumber * nMultSeqNumber));
}
if (nSeqSymbol > 0) { // Sequential symbol strings exist (3 characters or more)
nScore = parseInt(nScore - (nSeqSymbol * nMultSeqSymbol));
}
return nScore;
}
else
{
return 0;
}
}
function passScoreToText( nScore )
{
var sComplexity = 'N/A';
if (nScore >= 0 && nScore < 20) { sComplexity = "Very Weak"; }
else if (nScore >= 20 && nScore < 40) { sComplexity = "Weak"; }
else if (nScore >= 40 && nScore < 60) { sComplexity = "Good"; }
else if (nScore >= 60 && nScore < 80) { sComplexity = "Strong"; }
else if (nScore >= 80 && nScore <= 100) { sComplexity = "Very Strong"; }
return sComplexity;
}
$(document).ready(function()
{
// Handle the loading of portal links
$(document).on('click', 'a[data-component], #navbar-top-portal a:not([data-toggle="dropdown"]), #portal-nav-new a([data-toggle="dropdown"])', function ()
{
var $this = $(this);
var fnTitle = (function (elem)
{
if (typeof elem == 'object')
{
var _title = elem.data('browser_title');
if (typeof _title == 'string')
{
if (_title.length)
{
document.title = _title;
}
}
}
});
var fn = (function (fnHandleTitle, elem)
{
if ( ( window.formDirty ) && ( window.formDirty === true ) )
{
$.rpc.confirm('You have unsaved changes. Are you sure you wish to leave?', function ()
{
window.formDirty = false;
URLLoader.loadURL($this, $("#portal-dashboard"));
$('.first-section').removeClass('bg-light-green-dimmed');
if (typeof fnHandleTitle == 'function')
{
fnHandleTitle(elem);
}
});
return false;
}
else
{
URLLoader.loadURL($this, $("#portal-dashboard"));
$('.first-section').removeClass('bg-light-green-dimmed');
if (typeof fnHandleTitle == 'function')
{
fnHandleTitle(elem);
}
}
return true;
});
fn(fnTitle, $this);
return false;
});
//==============================================================================
// Event fired when we click the link for the first time
//==============================================================================
$(document).on(URLLoader.before_load, "#portal-dashboard", function (event, params){});
//==============================================================================
// HTML arrived
//==============================================================================
$(document).on(URLLoader.after_load, "#portal-dashboard", function (event, params)
{
params['target_el'].hide().html(params.html);
});
//==============================================================================
// JS arrived, if any
//==============================================================================
$(document).on(URLLoader.callback_ready, "#portal-dashboard", function (event, params)
{
$(this).fadeIn(600, 'linear');
});
//==============================================================================
// Dashboard images navigation
//==============================================================================
$(document).on('click', "div.dashboard_images a", function ()
{
$("a[data-component='" + $(this).data('trigger') + "']").trigger('click');
});
$(document).on('click',"button[data-role='change_password']", function ()
{
window.location = "/portal/reset_password/";
});
$(document).on('click',"button[data-role='register']", function ()
{
window.location = "/portal/signup/";
});
});
$(document).ready(function()
{
function openSubMenu()
{
$('.dropdownContainer').find('.productDrop').css('visibility', 'visible');
};
function closeSubMenu()
{
$('.dropdownContainer').find('.productDrop').css('visibility', 'hidden');
};
$(document).off('mouseover').off('mouseleave')
.on('mouseover', 'a[data-type="dropdown"]', openSubMenu)
.on('mouseover', 'a[data-type="standard"]', closeSubMenu)
.on('mouseover', '#indexBanner', closeSubMenu)
.on('mouseover', '#otherBanner', closeSubMenu)
.on('mouseleave', '.productDrop', closeSubMenu);
$(document).off('click.members').on('click.members','#goto_logout',function(){
window.location.href='/portal/logout/';
}).on('click.members','#goto_membersarea', function(){
window.location.href='/portal/';
});
$(document).on('click','a[data-role="load-product"]',function()
{
var identifier = $(this).data('identifier') || '';
if ( identifier != '' )
{
if ( $("#portal-dashboard").length > 0 )
{
window.location.hash = '';
$.template('/portal/rpc_client/load/product/', { autoload:1, identifier: identifier }, function (html)
{
$('#loading').hide();
// Render our product
$("#portal-dashboard").html(html);
// Fade in the product
$("#portal-wrapper").fadeIn(200);
$("#portal-load_product").fadeIn(200);
});
}
else
{
window.location.href = '/portal/quote/#'+identifier;
}
}
else
{
window.location = '/portal/';
}
return false;
});
$(document).on('click','button[data-role="load-product-nologin"]',function()
{
var identifier = $(this).data('identifier') || '';
if ( identifier != '' )
{
if ( $("#index-dashboard").length > 0 )
{
window.location.hash = '';
$.template('/index/rpc_client/load/captcha/', { autoload:1, identifier: identifier }, function (html)
{
$('#loading').hide();
// Render our product
$("#index-dashboard").html(html);
// Fade in the product
//$("#portal-wrapper").fadeIn(200);
//$("#portal-load_product").fadeIn(200);
});
}
else
{
window.location.href = '/';
}
}
else
{
window.location = '/';
}
return false;
});
});
$(document).ready(function(){
$("#c2msBrokerLogin, #index_login").bind('submit', function ()
{
$.rpc.JSONExecute('/login/rpc_client/broker_login_v2/', $(this).serialize(), null, null,
function (json)
{
localStorage.clear();
window.location = "/portal/";
return false;
},
function (json)
{
$("#password").val("");
$.rpc._showErrors(json);
});
return false;
});
});
var c2ms_quick_quote_handler;
$(document).ready(function()
{
c2ms_quick_quote_handler = (function ($)
{
var pubs = {};
function main(extended)
{
var defaults = {};
var settings = $.extend({}, defaults, extended);
$(document).off('quickQuote').on('quickQuote', function (event, data)
{
var $form = ( data.hasOwnProperty('form') ) ? $(data.form) : $('#quick_quote_form');
delete data.form;
var postData = $form.serialize();
if (typeof data != 'undefined')
{
var add = [];
$.each(data, function (k, v)
{
if (k != 'form')
{
add.push(k + '=' + v);
}
});
postData += '&' + add.join('&');
}
clearErrors($form);
var $inputs = $form.find('input[type="text"], select');
if (checkInputs($inputs))
{
var renderCallback = ( function (json, $form)
{
renderOutput(json, $form);
});
requestRating(postData, renderCallback, $form);
}
else
{
reportErrors($form);
}
});
$(document).off('quickReQuote').on('quickReQuote', function (event, data)
{
var isPublic = false;
var postData = '';
var $form;
if (typeof data == 'object')
{
if ( data.hasOwnProperty('data') )
{
postData = typeof data.data === 'string' ? data.data : $.param(data.data);
$form = ( data.hasOwnProperty('form') ) ? $(data.form) : $('body');
if ( data.hasOwnProperty('is_public') && data.is_public )
{
isPublic = true;
}
}
else
{
postData = typeof data === 'string' ? data : $.param(data);
$form = ( data.hasOwnProperty('form') ) ? $(data.form) : $('body');
delete data.form;
}
}
else
{
$form = $('body');
postData = data;
}
postData += '&' + $form.find('[data-role="varcom"]').serialize();
clearErrors($form);
var renderCallback = ( function (json, $form)
{
renderOutput(json, $form);
});
requestRating(postData, renderCallback, $form, isPublic);
$('div[data-role="documents_info_holder"],div[data-role="quote_info_holder"]').hide();
});
}
function renderOutput(json, $form)
{
// var target = $form.find('#quick_quote_result_holder');
var target = $('#quick_quote_result_holder', $form);
$('#button_wrapper').show();
if ( json.is_refer )
{
$form.find('#referral_id').val(json.referral_id);
if ( json.hasOwnProperty('referral_tpl') )
{
if (parseInt(json.show_stats) == 1)
{
$form.find("#quote_ph").html(json.referral_tpl );
}
else
{
target.html(json.referral_tpl);
}
}
else
{
JSONTemplate.getTpl('/portal/rpc_client/quickquote/refer/', true, function (html)
{
var output = html;
output = output.replace('{REFERRAL_ID}', json.referral_id);
output = output.replace('{REF_PHONE}', json.referral_phone);
if (parseInt(json.show_stats) == 1)
{
$form.find("#quote_ph").html(output);
}
else
{
target.html(output);
}
});
}
}
else if ( json.is_marker )
{
$('#button_wrapper').hide();
if ( json.hasOwnProperty('referral_tpl') )
{
if (parseInt(json.show_stats) == 1)
{
$form.find("#quote_ph").html(json.referral_tpl );
}
else
{
target.html(json.referral_tpl);
}
}
else
{
JSONTemplate.getTpl('/portal/rpc_client/quickquote/marker/', true, function (html)
{
if (parseInt(json.show_stats) == 1)
{
$form.find("#quote_ph").html(html);
}
else
{
target.html(html);
}
});
}
}
else
{
$form.find('#referral_id').val('');
if (parseInt(json.show_stats) == 1)
{
// Show the stats, not the quoted premium
JSONTemplate.getTpl('/portal/rpc_client/quickquote/overview/', true, function (html)
{
var output = html;
output = output.replace('{CALCULATED_PREMIUM}', json.figures.base);
output = output.replace('{CALCULATED_TAX}', json.figures.tax);
output = output.replace('{CALCULATED_NET}', json.figures.taxed);
output = output.replace('{CALCULATED_COMM}', json.figures.commission);
output = output.replace('{PRODUCT_NAME}', json.product.name);
if (json.hasOwnProperty('is_var_commission') && ( json.is_var_commission == true ))
{
var vcf = '';
var vcp = '';
var vcCbF = '';
var vcCbP = '';
var varname = '';
var sregex = '';
if (json['figures'].hasOwnProperty('varcom'))
{
var vcType = ( json.figures.varcom.hasOwnProperty('type') ? parseInt(json.figures.varcom.type) : 0 );
switch (vcType)
{
case 1:
vcf = json.figures.varcom.amount;
vcCbF = ' checked="checked"';
break;
case 2:
vcp = json.figures.varcom.amount;
vcCbP = ' checked="checked"';
break;
}
}
output = output.replace('{VAR_COMMISSION_AMOUNT_FIXED}', vcf);
output = output.replace('{VAR_COMMISSION_AMOUNT_PCNT}', vcp);
output = output.replace('{VAR_COMMISSION_FIXED_SELECTED}', vcCbF);
output = output.replace('{VAR_COMMISSION_PCNT_SELECTED}', vcCbP);
varname = "not_var_commission";
sregex = '([\\s\\S]*)';
output = output.replace(new RegExp(sregex, 'g'), '');
}
else
{
varname = "var_commission_tpl";
sregex = '([\\s\\S]*)';
output = output.replace(new RegExp(sregex, 'g'), '');
varname = "is_var_commission";
sregex = '([\\s\\S]*)';
output = output.replace(new RegExp(sregex, 'g'), '');
}
var $ph = $form.closest("#quote_ph");
if ($ph.length == 0)
{
$ph = $form.find("#quote_ph");
}
$ph.html(output);
$ph.addClass('quote_info_holder').waypoint('sticky', {offset: 30});
if($('#quote_ph').is(":visible"))
{
$('#quote_ph').parents(".ui-accordion-content").css('overflow', 'visible');
if($('#quote-sticky').hasClass('stuck'))
{
$('.quote-toast').addClass('fixed-toast');
}
else
{
$('.quote-toast').removeClass('fixed-toast');
}
$('.quote-toast').hide().show().delay(3000).fadeOut();
}
else
{
$('#quote_ph').parents(".ui-accordion-content").css('overflow', 'hidden');
}
});
}
else
{
JSONTemplate.getTpl('/portal/rpc_client/quickquote/success/', true, function (html)
{
var output = html;
output = output.replace('{PREMIUM_VALUE}', json['figures'].taxed);
output = output.replace('{TAX_RATE}', json['figures'].tax_rate);
target.html(output);
console.log(target);
if($('#quote_ph').is(":visible"))
{
$('#quote_ph').parents(".ui-accordion-content").css('overflow', 'visible');
$('.quote-toast').hide().show().delay(3000).fadeOut();
}
else
{
$('#quote_ph').parents(".ui-accordion-content").css('overflow', 'hidden');
}
});
}
if (json.hasOwnProperty('fields') && typeof json.fields == 'object')
{
$.each(json.fields, function (fname, val)
{
$("#" + fname).val(val);
});
}
}
}
function requestRating(postData, callback, $form, isPublic )
{
isPublic = isPublic || false;
var url = '/'+ ( isPublic ? 'index' : 'portal' ) + '/rpc_client/quickquote_json/';
try
{
//'/index/rpc_client/quickquote_json/'
$.rpc.JSONExecute(url, postData, null, null,
function (json)
{
if (typeof callback == 'function')
{
callback(json, $form);
}
},
function (json)
{
$.rpc._showErrors(json);
}
);
}
catch (e)
{
}
}
function clearErrors($form)
{
var errElement = $form.find('#quick-quote-error');
if (errElement.length)
{
errElement.remove();
}
}
function checkInputs(inputs)
{
if (inputs.length)
{
var _status = true;
$.each(inputs, function (i, obj)
{
var checkAgainst = ( $(this).is('select') ) ? '0' : '';
if ($(this).val() == checkAgainst)
{
_status = false;
return false;
}
return true;
});
return _status;
}
return false;
}
function reportErrors($form)
{
var _errorHolder = '
Please fill in the required fields before continuing.
';
var _where = $form.find('.quick_quote_field_holder:last');
_where.append(_errorHolder);
}
pubs.main = main;
return pubs;
})(jQuery);
// Initiate quick quotes
$qq = c2ms_quick_quote_handler;
$qq.main({});
//==============================================================================
// QuickQuote box handler - get quick quote
//==============================================================================
$(document).on('submit', '#quick_quote_form', function (event)
{
var $ct = $(event.currentTarget);
var $form = ( $ct.is('form') ) ? $ct : $ct.closest('form');
$(document).trigger('quickQuote', { /*show_continue: 1,*/ form : $form });
return false;
});
//==============================================================================
// QuickQuote box handler - goto full form
//==============================================================================
$(document).on('click', '#button_quote_save', function (event)
{
var form = $(event.currentTarget).closest('form');
var identifier = form.find('input[name="identifier"]').val();
window.location.href = '/portal/quote/#' + identifier;
});
});
// Replaces all occurrences of a comma in the rating qq box with an empty string -> comma is not a valid separator in the number ffs
$(document).on('blur','input[data-role="qqinput"]',function(){
$(this).val( $(this).val().replace(/,/g,"") );
});
$.depFields = function( product_identifier, arr_dep_fields, data )
{
var $form = $('form[data-identifier^="c2ms_"]');
if ( typeof arr_dep_fields == 'object' )
{
$.each( arr_dep_fields, function(src_field, dest_field )
{
var $field = $form.find('#'+src_field );
var $dest_field = $form.find('#'+dest_field );
$dest_field.find('option[value!="0"]').remove();
$field.on('change initChange',function(ev)
{
$dest_field.find('option[value!="0"]').remove();
var post = {
identifier : product_identifier,
src_field_name : src_field,
src_field_val : parseInt($(ev.currentTarget).val()),
dst_field_name : dest_field
};
var fieldVal = data ? ( data.hasOwnProperty( dest_field ) ? data[ dest_field ] : 0 ) : 0 ;
if ( post.src_field_val > 0 )
{
$.rpc.fetchJSON('/portal/rpc_client/load/dependant/', post, function(rjson)
{
if(rjson.success == 1)
{
$dest_field.append( rjson.instances ).val( fieldVal );
$dest_field.trigger('initChange');
$(document).trigger('dependant.loaded', dest_field );
}
});
}
}).trigger('initChange');
});
}
};
$.depFieldsQQ = function( product_identifier, arr_dep_fields, $placeholder )
{
var $form = $($placeholder);
$.each( arr_dep_fields,function( src_field, dest_field )
{
var $dest_field = $form.find( '#'+dest_field );
$dest_field.find('option[value!="0"]').remove();
$form.find('#'+src_field)
.one('change',function(ev)
{
$dest_field.parent('.quick_quote_field_holder').show();
})
.on('change',function(ev)
{
var post = {
identifier : product_identifier,
src_field_name : src_field,
src_field_val : parseInt($(ev.currentTarget).val()),
dst_field_name : dest_field
};
$dest_field.find('option[value!="0"]').remove();
if ( post.src_field_val > 0 )
{
$.rpc.fetchJSON('/portal/rpc_client/load/dependant/', post, function(json)
{
if(json.success == 1)
{
$dest_field.append( json.instances ).val( 0 );
}
});
}
});
});
};
/*!
* Bootstrap v3.1.1 (http://getbootstrap.com)
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.isLoading=!1};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",f.resetText||d.data("resetText",d[e]()),d[e](f[b]||this.options[b]),setTimeout(a.proxy(function(){"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},b.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}a&&this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}if(e.hasClass("active"))return this.sliding=!1;var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});return this.$element.trigger(j),j.isDefaultPrevented()?void 0:(this.sliding=!0,f&&this.pause(),this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(1e3*d.css("transition-duration").slice(0,-1))):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")),f&&this.cycle(),this)};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("collapse in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?void this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);!e&&f.toggle&&"show"==c&&(c=!c),e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(jQuery),+function(a){"use strict";function b(b){a(d).remove(),a(e).each(function(){var d=c(a(this)),e={relatedTarget:this};d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown",e))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;f.toggleClass("open").trigger("shown.bs.dropdown",h),e.focus()}return!1}},f.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var f=c(d),g=f.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&f.find(e).focus(),d.click();var h=" li:not(.divider):visible a",i=f.find("[role=menu]"+h+", [role=listbox]"+h);if(i.length){var j=i.index(i.filter(":focus"));38==b.keyCode&&j>0&&j--,40==b.keyCode&&j').appendTo(document.body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),d&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;d?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()):b&&b()};var c=a.fn.modal;a.fn.modal=function(c,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},b.DEFAULTS,e.data(),"object"==typeof c&&c);f||e.data("bs.modal",f=new b(this,g)),"string"==typeof c?f[c](d):g.show&&f.show(d)})},a.fn.modal.Constructor=b,a.fn.modal.noConflict=function(){return a.fn.modal=c,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());c.is("a")&&b.preventDefault(),e.modal(f,this).one("hide",function(){c.is(":visible")&&c.focus()})}),a(document).on("show.bs.modal",".modal",function(){a(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){a(document.body).removeClass("modal-open")})}(jQuery),+function(a){"use strict";var b=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};b.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'
',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},b.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},b.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},b.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show()},b.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},b.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){if(this.$element.trigger(b),b.isDefaultPrevented())return;var c=this,d=this.tip();this.setContent(),this.options.animation&&d.addClass("fade");var e="function"==typeof this.options.placement?this.options.placement.call(this,d[0],this.$element[0]):this.options.placement,f=/\s?auto?\s?/i,g=f.test(e);g&&(e=e.replace(f,"")||"top"),d.detach().css({top:0,left:0,display:"block"}).addClass(e),this.options.container?d.appendTo(this.options.container):d.insertAfter(this.$element);var h=this.getPosition(),i=d[0].offsetWidth,j=d[0].offsetHeight;if(g){var k=this.$element.parent(),l=e,m=document.documentElement.scrollTop||document.body.scrollTop,n="body"==this.options.container?window.innerWidth:k.outerWidth(),o="body"==this.options.container?window.innerHeight:k.outerHeight(),p="body"==this.options.container?0:k.offset().left;e="bottom"==e&&h.top+h.height+j-m>o?"top":"top"==e&&h.top-m-j<0?"bottom":"right"==e&&h.right+i>n?"left":"left"==e&&h.left-i'}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;(e||"destroy"!=c)&&(e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]())})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(a(c).is("body")?window:c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);{var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})}},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);if(g&&b<=e[0])return g!=(a=f[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(b.RESET).addClass("affix");var a=this.$window.scrollTop(),c=this.$element.offset();return this.pinnedOffset=c.top-a},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"top"==this.affixed&&(e.top+=d),"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top(this.$element)),"function"==typeof h&&(h=f.bottom(this.$element));var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;if(this.affixed!==i){this.unpin&&this.$element.css("top","");var j="affix"+(i?"-"+i:""),k=a.Event(j+".bs.affix");this.$element.trigger(k),k.isDefaultPrevented()||(this.affixed=i,this.unpin="bottom"==i?this.getPinnedOffset():null,this.$element.removeClass(b.RESET).addClass(j).trigger(a.Event(j.replace("affix","affixed"))),"bottom"==i&&this.$element.offset({top:c-h-this.$element.height()}))}}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(jQuery);
/*
* Copyright (C) 2012 PrimeBox (info@primebox.co.uk)
*
* This work is licensed under the Creative Commons
* Attribution 3.0 Unported License. To view a copy
* of this license, visit
* http://creativecommons.org/licenses/by/3.0/.
*
* Documentation available at:
* http://www.primebox.co.uk/projects/cookie-bar/
*
* When using this software you use it at your own risk. We hold
* no responsibility for any damage caused by using this plugin
* or the documentation provided.
*/
(function($){
$.cookieBar = function(options,val){
if(options=='cookies'){
var doReturn = 'cookies';
}else if(options=='set'){
var doReturn = 'set';
}else{
var doReturn = false;
}
var defaults = {
message: 'We use cookies to track usage and preferences.', //Message displayed on bar
acceptButton: true, //Set to true to show accept/enable button
acceptText: 'I Understand', //Text on accept/enable button
acceptFunction: function(cookieValue){if(cookieValue!='enabled' && cookieValue!='accepted') window.location = window.location.href;}, //Function to run after accept
declineButton: false, //Set to true to show decline/disable button
declineText: 'Disable Cookies', //Text on decline/disable button
declineFunction: function(cookieValue){if(cookieValue=='enabled' || cookieValue=='accepted') window.location = window.location.href;}, //Function to run after decline
policyButton: false, //Set to true to show Privacy Policy button
policyText: 'Privacy Policy', //Text on Privacy Policy button
policyURL: '/privacy-policy/', //URL of Privacy Policy
autoEnable: true, //Set to true for cookies to be accepted automatically. Banner still shows
acceptOnContinue: false, //Set to true to accept cookies when visitor moves to another index
acceptOnScroll: false, //Set to true to accept cookies when visitor scrolls X pixels up or down
acceptAnyClick: false, //Set to true to accept cookies when visitor clicks anywhere on the index
expireDays: 365, //Number of days for cookieBar cookie to be stored for
renewOnVisit: false, //Renew the cookie upon revisit to website
forceShow: false, //Force cookieBar to show regardless of user cookie preference
effect: 'slide', //Options: slide, fade, hide
element: 'body', //Element to append/prepend cookieBar to. Remember "." for class or "#" for id.
append: false, //Set to true for cookieBar HTML to be placed at base of website. Actual position may change according to CSS
fixed: false, //Set to true to add the class "fixed" to the cookie bar. Default CSS should fix the position
bottom: false, //Force CSS when fixed, so bar appears at bottom of website
zindex: '', //Can be set in CSS, although some may prefer to set here
domain: String(window.location.hostname), //Location of privacy policy
referrer: String(document.referrer) //Where visitor has come from
};
var options = $.extend(defaults,options);
//Sets expiration date for cookie
var expireDate = new Date();
expireDate.setTime(expireDate.getTime()+(options.expireDays*86400000));
expireDate = expireDate.toGMTString();
var cookieEntry = 'cb-enabled={value}; expires='+expireDate+'; path=/';
//Retrieves current cookie preference
var i,cookieValue='',aCookie,aCookies=document.cookie.split('; ');
for (i=0;i=0 && String(window.location.href).indexOf(options.policyURL)==-1 && doReturn!='cookies' && doReturn!='set' && cookieValue!='accepted' && cookieValue!='declined'){
doReturn = 'set';
val = 'accepted';
}
}
if(doReturn=='cookies'){
//Returns true if cookies are enabled, false otherwise
if(cookieValue=='enabled' || cookieValue=='accepted'){
return true;
}else{
return false;
}
}else if(doReturn=='set' && (val=='accepted' || val=='declined')){
//Sets value of cookie to 'accepted' or 'declined'
document.cookie = cookieEntry.replace('{value}',val);
if(val=='accepted'){
return true;
}else{
return false;
}
}else{
//Sets up enable/accept button if required
var message = options.message.replace('{policy_url}',options.policyURL);
if(options.acceptButton){
var acceptButton = ''+options.acceptText+'';
}else{
var acceptButton = '';
}
//Sets up disable/decline button if required
if(options.declineButton){
var declineButton = ''+options.declineText+'';
}else{
var declineButton = '';
}
//Sets up privacy policy button if required
if(options.policyButton){
var policyButton = ''+options.policyText+'';
}else{
var policyButton = '';
}
//Whether to add "fixed" class to cookie bar
if(options.fixed){
if(options.bottom){
var fixed = ' class="fixed bottom"';
}else{
var fixed = ' class="fixed"';
}
}else{
var fixed = '';
}
if(options.zindex!=''){
var zindex = ' style="z-index:'+options.zindex+';"';
}else{
var zindex = '';
}
//Displays the cookie bar if arguments met
if(options.forceShow || cookieValue=='enabled' || cookieValue==''){
if(options.append){
$(options.element).append('
');
}
}
var removeBar = function(func){
if(options.acceptOnScroll) $(document).off('scroll');
if(typeof(func)==='function') func(cookieValue);
if(options.effect=='slide'){
$('#cookie-bar').slideUp(300,function(){$('#cookie-bar').remove();});
}else if(options.effect=='fade'){
$('#cookie-bar').fadeOut(300,function(){$('#cookie-bar').remove();});
}else{
$('#cookie-bar').hide(0,function(){$('#cookie-bar').remove();});
}
$(document).unbind('click',anyClick);
};
var cookieAccept = function(){
document.cookie = cookieEntry.replace('{value}','accepted');
removeBar(options.acceptFunction);
};
var cookieDecline = function(){
var deleteDate = new Date();
deleteDate.setTime(deleteDate.getTime()-(864000000));
deleteDate = deleteDate.toGMTString();
aCookies=document.cookie.split('; ');
for (i=0;i=0){
document.cookie = aCookie[0]+'=0; expires='+deleteDate+'; domain='+options.domain.replace('www','')+'; path=/';
}else{
document.cookie = aCookie[0]+'=0; expires='+deleteDate+'; path=/';
}
}
document.cookie = cookieEntry.replace('{value}','declined');
removeBar(options.declineFunction);
};
var anyClick = function(e){
if(!$(e.target).hasClass('cb-policy')) cookieAccept();
};
$('#cookie-bar .cb-enable').click(function(){cookieAccept();return false;});
$('#cookie-bar .cb-disable').click(function(){cookieDecline();return false;});
if(options.acceptOnScroll){
var scrollStart = $(document).scrollTop(),scrollNew,scrollDiff;
$(document).on('scroll',function(){
scrollNew = $(document).scrollTop();
if(scrollNew>scrollStart){
scrollDiff = scrollNew - scrollStart;
}else{
scrollDiff = scrollStart - scrollNew;
}
if(scrollDiff>=Math.round(options.acceptOnScroll)) cookieAccept();
});
}
if(options.acceptAnyClick){
$(document).bind('click',anyClick);
}
}
};
})(jQuery);
(function ($)
{
$.fn.c2msShowHide = function (options)
{
var _defaults = {
speed : 100,
onReady : null
};
var settings = $.extend( {}, _defaults, options);
this.each(function ()
{
var $block = $(this);
$(this).find('p').addClass('closed');
$(this).on('click', 'h3', function ()
{
$block.find('h3').removeClass('active');
$(this).addClass('active');
$(this).next('p').slideDown(settings.speed, function()
{
$(this).removeClass('closed').addClass('opened');
});
$block.find('p.opened').slideUp(settings.speed, function(){
$(this).removeClass('opened').addClass('closed');
});
});
if ( typeof settings.onReady == 'function' )
{
settings.onReady();
}
});
}
})(jQuery);
/*
* Copyright (C) 2012 PrimeBox (info@primebox.co.uk)
*
* This work is licensed under the Creative Commons
* Attribution 3.0 Unported License. To view a copy
* of this license, visit
* http://creativecommons.org/licenses/by/3.0/.
*
* Documentation available at:
* http://www.primebox.co.uk/projects/cookie-bar/
*
* When using this software you use it at your own risk. We hold
* no responsibility for any damage caused by using this plugin
* or the documentation provided.
*/
(function($){
$.cookieBar = function(options,val){
if(options=='cookies'){
var doReturn = 'cookies';
}else if(options=='set'){
var doReturn = 'set';
}else{
var doReturn = false;
}
var defaults = {
message: 'We use cookies to track usage and preferences.', //Message displayed on bar
acceptButton: true, //Set to true to show accept/enable button
acceptText: 'I Understand', //Text on accept/enable button
acceptFunction: function(cookieValue){if(cookieValue!='enabled' && cookieValue!='accepted') window.location = window.location.href;}, //Function to run after accept
declineButton: false, //Set to true to show decline/disable button
declineText: 'Disable Cookies', //Text on decline/disable button
declineFunction: function(cookieValue){if(cookieValue=='enabled' || cookieValue=='accepted') window.location = window.location.href;}, //Function to run after decline
policyButton: false, //Set to true to show Privacy Policy button
policyText: 'Privacy Policy', //Text on Privacy Policy button
policyURL: '/privacy-policy/', //URL of Privacy Policy
autoEnable: true, //Set to true for cookies to be accepted automatically. Banner still shows
acceptOnContinue: false, //Set to true to accept cookies when visitor moves to another index
acceptOnScroll: false, //Set to true to accept cookies when visitor scrolls X pixels up or down
acceptAnyClick: false, //Set to true to accept cookies when visitor clicks anywhere on the index
expireDays: 365, //Number of days for cookieBar cookie to be stored for
renewOnVisit: false, //Renew the cookie upon revisit to website
forceShow: false, //Force cookieBar to show regardless of user cookie preference
effect: 'slide', //Options: slide, fade, hide
element: 'body', //Element to append/prepend cookieBar to. Remember "." for class or "#" for id.
append: false, //Set to true for cookieBar HTML to be placed at base of website. Actual position may change according to CSS
fixed: false, //Set to true to add the class "fixed" to the cookie bar. Default CSS should fix the position
bottom: false, //Force CSS when fixed, so bar appears at bottom of website
zindex: '', //Can be set in CSS, although some may prefer to set here
domain: String(window.location.hostname), //Location of privacy policy
referrer: String(document.referrer) //Where visitor has come from
};
var options = $.extend(defaults,options);
//Sets expiration date for cookie
var expireDate = new Date();
expireDate.setTime(expireDate.getTime()+(options.expireDays*86400000));
expireDate = expireDate.toGMTString();
var cookieEntry = 'cb-enabled={value}; expires='+expireDate+'; path=/';
//Retrieves current cookie preference
var i,cookieValue='',aCookie,aCookies=document.cookie.split('; ');
for (i=0;i=0 && String(window.location.href).indexOf(options.policyURL)==-1 && doReturn!='cookies' && doReturn!='set' && cookieValue!='accepted' && cookieValue!='declined'){
doReturn = 'set';
val = 'accepted';
}
}
if(doReturn=='cookies'){
//Returns true if cookies are enabled, false otherwise
if(cookieValue=='enabled' || cookieValue=='accepted'){
return true;
}else{
return false;
}
}else if(doReturn=='set' && (val=='accepted' || val=='declined')){
//Sets value of cookie to 'accepted' or 'declined'
document.cookie = cookieEntry.replace('{value}',val);
if(val=='accepted'){
return true;
}else{
return false;
}
}else{
//Sets up enable/accept button if required
var message = options.message.replace('{policy_url}',options.policyURL);
if(options.acceptButton){
var acceptButton = ''+options.acceptText+'';
}else{
var acceptButton = '';
}
//Sets up disable/decline button if required
if(options.declineButton){
var declineButton = ''+options.declineText+'';
}else{
var declineButton = '';
}
//Sets up privacy policy button if required
if(options.policyButton){
var policyButton = ''+options.policyText+'';
}else{
var policyButton = '';
}
//Whether to add "fixed" class to cookie bar
if(options.fixed){
if(options.bottom){
var fixed = ' class="fixed bottom"';
}else{
var fixed = ' class="fixed"';
}
}else{
var fixed = '';
}
if(options.zindex!=''){
var zindex = ' style="z-index:'+options.zindex+';"';
}else{
var zindex = '';
}
//Displays the cookie bar if arguments met
if(options.forceShow || cookieValue=='enabled' || cookieValue==''){
if(options.append){
$(options.element).append('