$(document).ready(function(){var locStr=String(window.location);var locIdx=locStr.indexOf('?creditflux_login=');if(locIdx>=0){window.location=locStr.slice(0,locIdx);}
if($("#tickerTop ul li").length>0){$("#tickerBottom").html($("#tickerTop").html().replace(/tickerTop/g,'tickerBottom'));$("#tickerTop ul").newsTicker(5000);$("#tickerBottom ul").newsTicker(5000);}
$("#Creditflux_LoginPopup input[type='image']").click(function(event){doAjaxSubscriberCall('login',{username:$("#Creditflux_LoginPopup input[name='username']").attr('value')});event.preventDefault();});$("#Creditflux_RegisterPopup input[type='image']").click(function(event){doAjaxSubscriberCall('register',{name:$("#Creditflux_RegisterPopup input[name='name']").attr('value'),username:$("#Creditflux_RegisterPopup input[name='username']").attr('value')});event.preventDefault();});if($(".SubscriberArticle").length>0){document.oncontextmenu=function(){return false};document.onselectstart=function(){return false};$(document).keydown(function(event){if(event.ctrlKey){event.preventDefault();}});}});function popUpLink(link){window.open(link.href,"popUpWindow","menubar=0,location=0,directories=0,status=0,toolbar=0,scrollbars=1,resizable=1,width=500,height=400,top=100,left=100");return true;}
function doAjaxSubscriberCall(action,ajaxParams){$.showLoadingMessage({message:'<strong>loading...</strong><br />Please be patient as we process your request.',blockColor:'#000',blockOpacity:0.65});ajaxRequest.make('Creditflux','Subscriber',action,ajaxParams,ajaxCallback);}
function ajaxCallback(result){if(result!=null&&!result.success){var message='';for(var i=0;i<result.messages.length;i++){message+='<p>'+result.messages[i]+'</p>';}
$("#"+result.action+"_errors").html(message).show();switch(result.action){case'login':$("#Creditflux_LoginPopup").cfpopup('open',{clearErrors:false,clearInputs:false});break;case'register':$("#Creditflux_RegisterPopup").cfpopup('open',{clearErrors:false,clearInputs:false});break;}
return false;}
$.hideLoadingMessage();switch(result.action){case'login':case'register':thankyou('To complete your login please check your inbox for an email with further instructions. For help please contact us on +44(0)20 7253 9510.');break;}
return true;}
function bookmark(link){$("#bookmark_continue").attr('href',link.href);$("#bookmark_members").attr('href',link.href+'&toMembers');$("#Creditflux_BookmarkPopup").cfpopup('open');return false;}
function login(){$("#Creditflux_LoginPopup").cfpopup('open');return false;}
function logout(){$("#Creditflux_LogoutPopup").cfpopup('open');return false;}
function register(articleHref){if(articleHref==null){$("#Creditflux_RegisterPopup_mainText").html('Sign up to this free service allowing you access to selected news and feature articles plus a daily email news bulletin.');$("#Creditflux_RegisterPopup_disclaimerText").html('This is an online only service and is available free of charge. Creditflux reserves the right to terminate access to the site at any time.');}else{$("#Creditflux_RegisterPopup_mainText").html('To read this article, free of charge, please sign up as a registered user.  Registration allows you access to selected news and feature articles, plus a daily email news bulletin.');$("#Creditflux_RegisterPopup_disclaimerText").html('This is an online only service and is available free of charge. Creditflux reserves the right to terminate access to the site at any time. If you don\'t want to register for this service please click <a href="'+articleHref.href+'">here</a> to view the article.');}
$("#Creditflux_RegisterPopup").cfpopup('open');return false;}
function freetrial(articleLink){if(articleLink==null){articleLink=true;}
$("#Creditflux_FreeTrialPopup .articleDetails").toggle(articleLink);$("#Creditflux_FreeTrialPopup").cfpopup('open');return false;}
function thankyou(msg){$("#Creditflux_ThankYouPopup .message").html(msg);$("#Creditflux_ThankYouPopup").cfpopup('open');return false;};(function($){$.fn.cfpopup=function(action,options){switch(action){case'open':if(options==null){options={};}
if(options.clearErrors==null){options.clearErrors=true;}
if(options.clearInputs==null){options.clearInputs=true;}
if($(this).attr('popup')==null){$(this).keyup(function(event){switch(event.keyCode){case 13:$(this).find("input[type='image']").click();break;case 27:$(this).cfpopup('close');break;}});$(this).find(".Creditflux_PopupClose").click(function(){$(this).cfpopup('close');});$(this).attr('popup',true);}
if(options.clearErrors){$(this).find(".Creditflux_PopupErrors").html('').hide();}
if(options.clearInputs){$(this).find("input[type='text']").attr('value','');}
$.blockUI({message:$(this),css:{backgroundColor:'transparent',cursor:'default',textAlign:'left',border:'0',left:'40%',top:'30%'},baseZ:1200,centerY:false,overlayCSS:{backgroundColor:'#000',opacity:0.65}});if($(this).find("input").length>0){$(this).find("input").get(0).focus();}
break;case'close':$.unblockUI();break;}}})(jQuery);