$(document).ready(function(){if($("a").is('.colorbox')){$(".colorbox").colorbox({width:600,height:350});}PEPS.rollover.init();});$(document).ready(function(){$('#banners').innerfade({speed:'slow',timeout:8000,type:'sequence',containerheight:'264px'});$("#contactName, #telephoneNumber").focus(function(){var currentVal=$(this).val();if(currentVal=="Contact Name"||currentVal=="Telephone Number"){$(this).val('');$(this).blur(function(){var getNewVal=$(this).val();if(getNewVal==''||getNewVal==' '){$(this).val(currentVal);}});}});$("#submitNow").submit(function(){if($("#contactName").val()==""||$("#contactName").val()=="Contact Name"){alert("Please enter your Full Name");return false;}if($("#telephoneNumber").val()==""||$("#telephoneNumber").val()=="Telephone Number"){alert("Please enter your Telephone Number");return false;}});$("#debtCalculatorStep1").submit(function(){if($("#yourName").val()==""){alert("Please enter your Full Name");return false;}if($("#yourTelephone").val()==""){alert("Please enter your Telephone Number");return false;}if(!isValidEmailAddress($("#yourEmail").val())){alert("Please enter a valid E-mail Address");return false;}if($("#yourPostcode").val()==""){alert("Please enter your Postcode");return false;}if($("#yourCountry").val()==""){alert("Please select your Country");return false;}});$("#client-form").submit(function(){if(!isValidEmailAddress($("#emailAddress").val())){alert("Please enter a valid E-mail Address and Password");return false;}});});function isValidEmailAddress(emailAddress){var pattern=new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);return pattern.test(emailAddress);}$(window).bind('load',function(){var preload=new Array();$(".main-nav").each(function(){s=$(this).attr("src").replace(/\.(.+)$/i,"-roll.$1");preload.push(s);});var img=document.createElement('img');$(img).bind('load',function(){if(preload[0]){this.src=preload.shift();}}).trigger('load');});PEPS={};PEPS.rollover={init:function(){this.preload();$(".main-nav").hover(function(){$(this).attr('src',PEPS.rollover.newimage($(this).attr('src')));},function(){$(this).attr('src',PEPS.rollover.oldimage($(this).attr('src')));});},preload:function(){$(window).bind('load',function(){$('.main-nav').each(function(key,elm){$('<img>').attr('src',PEPS.rollover.newimage($(this).attr('src')));});});},newimage:function(src){return src.substring(0,src.search(/(\.[a-z]+)$/))+'-roll'+src.match(/(\.[a-z]+)$/)[0];},oldimage:function(src){return src.replace(/-roll\./,'.');}};