if (!window.VWFSCQ) { VWFSCQ = {}; } if (!VWFSCQ.linkrewriter) { VWFSCQ.linkrewriter = {}; } VWFSCQ.linkrewriter.doRewrite = function(url, rewriteConfig) { var newUrl = url; if (rewriteConfig && rewriteConfig.linkrewriter) { $.each(rewriteConfig.linkrewriter, function(pluginname, config) { if (VWFSCQ.linkrewriter[pluginname] && VWFSCQ.linkrewriter[pluginname].rewriteLink && typeof(VWFSCQ.linkrewriter[pluginname].rewriteLink) == 'function') { newUrl = VWFSCQ.linkrewriter[pluginname].rewriteLink(newUrl, config); } }); } return newUrl; } $(document).ready(function() { $('a.sys_linkrewriter').live('click', function() { var element = $(this); var originalUrl = element.attr('href'); var config = element.attr('rev') ? eval('('+element.attr('rev')+')') : {}; resetURL = function() { element.attr('href', originalUrl); }; element.attr('href', VWFSCQ.linkrewriter.doRewrite(originalUrl, config)); setTimeout('resetURL()', 10); }); }); VWFSCQ.linkrewriter.ewbs = {}; VWFSCQ.linkrewriter.ewbs.rewriteLink = function (url, resourceAddonConfig) { if (resourceAddonConfig && resourceAddonConfig.enabled == "true") { var cookie = $.cookie('vwfs_campaign'); if (cookie) { if (url.indexOf('?') >= 0) { url += '&' + base64.decode(cookie); } else { url += '?' + base64.decode(cookie); } } } return url; } VWFSCQ.linkrewriter.salesteam = {}; VWFSCQ.linkrewriter.salesteam.rewriteLink = function (url, resourceAddonConfig) { if (resourceAddonConfig && resourceAddonConfig.enabled == "true") { var cookie = $.cookie('vwfs_salesteam'); if (cookie) { if (url.indexOf('?') >= 0) { url += '&' + base64.decode(cookie); } else { url += '?' + base64.decode(cookie); } } } return url; } VWFSCQ.linkrewriter.creditcard = {}; VWFSCQ.linkrewriter.creditcard.rewriteLink = function (url, resourceAddonConfig) { if (resourceAddonConfig && resourceAddonConfig.enabled == "true") { var cookie = $.cookie('vwfs_creditcardselector'); if (cookie) { if (url.indexOf('?') >= 0) { url += '&' + base64.decode(cookie); } else { url += '?' + base64.decode(cookie); } } } return url; } VWFSCQ.linkrewriter.calculation = {}; VWFSCQ.linkrewriter.calculation.rewriteLink = function (url, resourceAddonConfig) { if (resourceAddonConfig && resourceAddonConfig.enabled == "true") { var cookie = $.cookie('vwfs_calculation'); if (cookie) { if (url.indexOf('?') >= 0) { url += '&' + base64.decode(cookie); } else { url += '?' + base64.decode(cookie); } } } return url; } VWFSCQ.linkrewriter.directbanking = {}; VWFSCQ.linkrewriter.directbanking.rewriteLink = function (url, resourceAddonConfig) { if (resourceAddonConfig && resourceAddonConfig.directlogin == 'true') { if (typeof openLightbox == 'function') { var targetUrl = url; openLightbox('/content/sites/vwbank/volkswagenbankde/de/privatkunden/mein_banking/loginprocesses/directlogin.html', function(lightboxElement) { if (lightboxElement) { $('input[name="requesturl"]', lightboxElement).attr('value', targetUrl); } else { $('input[name="requesturl"]').attr('value', targetUrl); } }); url = '#'; } } return url; }