var uSwitchCommon=uSwitchCommon||{};uSwitchCommon.common=(function(f){var a=false,c=false,b=false,d=function(){if(navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)){var g=document.querySelector('meta[name="viewport"]');if(g){g.content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0";document.body.addEventListener("gesturestart",function(){g.content="width=device-width, minimum-scale=0.25, maximum-scale=1.6"},false)}}if(f(window).width()<=500){uSwitchCommon.common.isMobile=true}else{if(f(window).width()<=868){uSwitchCommon.common.isTablet=true}else{uSwitchCommon.common.isDesktop=true}}},e=function(){f("#footer .logos .consumer_focus").bind("click",function(){window.open(f(this).attr("href"),"focuswindow","menubar=1,resizable=1,scrollbars=1,width=450,height=300");return false});d()};f(e);return{isTablet:c,isMobile:b,isDesktop:a}})($);$(document).ready(function(){applyVolitality();applyShowJs();applyHideJs();testCookies();addApplyJobFormToCareers();var a=Sys.WebForms.PageRequestManager.getInstance();if(a!=null){a.add_endRequest(function(){applyVolitality();applyShowJs();applyHideJs()})}if($(".us-article-page-content, .us-article").length>0){googlePlusOne=new GooglePlusOne("#us-content h1.underline")}});function addTicker(){var a=$("<div class='ticker' style='border-bottom: 1px solid lightgrey; display:none; text-align:center; background:url(/SiteResources/static/images/ticker.jpg); height: 25px; font-weight:600; padding:6px 0 0 0; margin: 0 0 5px 0;'>Gas and electricity prices have gone up by as much as 19%. <a style='text-decoration:underline; color:inherit;' href='/gas-electricity/'>Compare fixed price and standard tariffs online with uSwitch now</a>.</div>");$("#header-wrapper").prepend(a);$(".us-header").prepend(a);$(".ticker").slideDown("slow")}function energySession(a){for(i=0;i<a.length;i++){if(a[i].indexOf("c_Energy=")==0){return a[i].substring(9)}}return undefined}function applyVolitality(){var a=$("input.volatile-text");a.each(function(){var b=$(this);b.focus(function(){if(b.attr("value")==b.attr("title")){b.attr("value","");b.removeClass("contains-default-value")}});b.blur(function(){if(b.attr("value")==""){b.attr("value",b.attr("title"));b.addClass("contains-default-value")}});if(b.attr("value")==b.attr("title")){b.addClass("contains-default-value")}})}function applyShowJs(){var a=$(".show-js");$(a).removeClass("show-js")}function applyHideJs(){var a=$(".hide-js");$(a).hide()}function showPopup(c,a){if(c.href&&c.href!=""){var b="scrollbars=1,";switch(a){case"Large":b+="width=800,height=800";break;case"Medium":b+="width=600,height=600";break;case"Small":b+="width=400,height=400";break}window.open(c.href,"popupwindow"+Math.floor(Math.random()*5000),b)}}function testCookies(){var a=new Date();chkcookie=(a.getTime()+"");document.cookie="chkcookie="+chkcookie+"; path=/";if(document.cookie.indexOf(chkcookie,0)<0){alert("To use this website, your web browser must accept cookies.\n\nIf they are disabled, please enable them now.\nIf you are using an outdated version of your web browser, please update it now.")}}$(function(){var a=function(){$("#main-nav ul > li").hover(function(){$(this).addClass("hover-on")},function(){$(this).removeClass("hover-on")});$("#main-nav ul li .subnav").hover(function(){$(this).parent().addClass("hover-on")},function(){$(this).parent().removeClass("hover-on")})};if(typeof($().placeholder)!="undefined"){$("#search_input").placeholder()}a()});function GooglePlusOne(c){var b=(("https:"==document.location.protocol)?"https://":"http://"),a=b+"apis.google.com/js/plusone.js";$.ajax({url:a,dataType:"script",cache:true,success:function(){$(c).append($('<span class="google-plus-one" id="google_plus_one">'));gapi.plusone.render("google_plus_one",{size:"standard",count:"true"})}});return this}function addApplyJobFormToCareers(){var a,b,c;url=/^\/careers\/(.*)\//i;if(url.test(document.location.pathname)){(function(s){var q,r,v=1,l,t=this,u=!1,o="postMessage",p="addEventListener",m,n=t[o]&&!s.browser.opera;s.receiveMessage=m=function(f,e,g){if(n){if(f){l&&m();l=function(d){if(typeof e==="string"&&d.origin!==e||s.isFunction(e)&&e(d.origin)===u){return u}f(d)}}if(t[p]){t[f?p:"removeEventListener"]("message",l,u)}else{t[f?"attachEvent":"detachEvent"]("onmessage",l)}}else{q&&clearInterval(q);q=null;if(f){g=typeof e==="number"?e:typeof g==="number"?g:100;q=setInterval(function(){var h=document.location.hash,d=/^#?\d+&/;if(h!==r&&d.test(h)){r=h;f({data:h.replace(d,"")})}},g)}}}})(jQuery);b=$("#us-content h1").text().trim();a="http://jobs.forward.co.uk/iframe?source=uswitch.com&amp;company=uSwitch&amp;role="+b+"&amp;origin="+escape(window.location);c=$('<iframe class="jobward" frameborder="0" id="jobward" style="width: 100%;" />').attr("src",a);$("#us-content").append(c);$.receiveMessage(function(d){c.height(parseInt(d.data)+10)})}};
