﻿
jQuery.fn.delay=function(time,func){this.each(function(){setTimeout(func,time);});return this;};$(document).ready(function(){$('.topNav a').click(function(){ga_trackEvent('Navigation/TopNav',$(this).text());});$('#csNav a').click(function(){ga_trackEvent('Navigation/CSNav',$(this).text());});$('#bloglist a').click(function(){ga_trackEvent('Navigation/BlogNav',$(this).text());});$('#headerMain a').click(function(){ga_trackEvent('Navigation/Header',$(this).text());});$('#categoryList a').click(function(){ga_trackEvent('Navigation/Category',$(this).text());});$('#currencyList a').click(function(){ga_trackEvent('Navigation/Currency',$(this).text());});$('#frontPagePromo a').click(function(){ga_trackEvent('Navigation/FrontPagePromo',$(this).text());});$('#footerInner').click(function(){ga_trackEvent('Navigation/Footer',$(this).text());})
$('#currentCountry').click(function(){ga_trackEvent('Navigation/CurrentSite',$(this).text());})
$('#countrySelector').click(function(){ga_trackEvent('Navigation/ChangeSite',$(this).text());})
$('.topNavPromo').click(function(){ga_trackEvent('Navigation/topNavPromo',$(this).text());})
$('#brandListing li').hover(function(){$(this).css('backgroundColor','#868379').children().css('color','#ffffff');},function(){$(this).css('backgroundColor','#fff').children().css('color','#868379');});});function URLEncode(clearString){if(clearString==null){return''}
var output='';var x=0;clearString=clearString.toString();var regex=/(^[a-zA-Z0-9_.]*)/;while(x<clearString.length){var match=regex.exec(clearString.substr(x));if(match!=null&&match.length>1&&match[1]!=''){output+=match[1];x+=match[1].length;}
else{if(clearString[x]==' ')
output+='+';else{var charCode=clearString.charCodeAt(x);var hexVal=charCode.toString(16);output+='%'+(hexVal.length<2?'0':'')+hexVal.toUpperCase();}
x++;}}
return output;}
function fadeBackground(elementId,startColor,endColor,timeMs){var startTime=new Date().getTime();stepFade(elementId,startColor,endColor,startTime,startTime+timeMs);}
function stepFade(elementId,startColor,endColor,startTime,endTime){var now=new Date().getTime();var step=new Array(3);var progress=(now-startTime)/(endTime-startTime);step[0]=Math.round(startColor[0]+((endColor[0]-startColor[0])*progress));step[1]=Math.round(startColor[1]+((endColor[1]-startColor[1])*progress));step[2]=Math.round(startColor[2]+((endColor[2]-startColor[2])*progress));document.getElementById(elementId).style.backgroundColor="rgb("+step[0]+","+step[1]+","+step[2]+")";if(now<=endTime){setTimeout(function(){stepFade(elementId,startColor,endColor,startTime,endTime);},20);}
else{document.getElementById(elementId).style.backgroundColor="rgb("+endColor[0]+","+endColor[1]+","+endColor[2]+")";}}
function GetXmlHttpObject(){if(window.XMLHttpRequest){return new XMLHttpRequest();}
if(window.ActiveXObject){return new ActiveXObject("Microsoft.XMLHTTP");}
return null;}
function ga_trackEvent(category,action,label,value){var pageTracker=_gat._getTracker("UA-213745-1");pageTracker._initData();pageTracker._trackEvent(category,action,label,value);}
if(top.frames.length!=0){if(window.location.href.replace)
top.location.replace(self.location.href);else
top.location.href=self.document.href;}
function hideSiteWarning(){$('#siteWarning').slideUp('normal');SetCookie("siteWarning","1",1);}
function hideUKPostage(){$('#ukpostage').slideUp('normal');SetCookie("ukpostage","1",1);}
function SetCookie(cookieName,cookieValue,nDays){var today=new Date();var expire=new Date();if(nDays==null||nDays==0)
nDays=1;expire.setTime(today.getTime()+3600000*24*nDays);document.cookie=cookieName+"="+escape(cookieValue)+";expires="+expire.toGMTString();}
function ReadCookie(cookieName){var theCookie=""+document.cookie;var ind=theCookie.indexOf(cookieName);if(ind==-1||cookieName=="")
return"";var ind1=theCookie.indexOf(';',ind);if(ind1==-1)
ind1=theCookie.length;return unescape(theCookie.substring(ind+cookieName.length+1,ind1));}
function showSearchBox(){if($('#topNavSearch').css('display')=='none'){$('#topNavSearch').slideDown('normal');}
else{$('#topNavSearch').slideUp('normal');}}
$(document).ready(function(){if($('#sli_search_1').val()=='Search'){$('#sli_search_1').css('color','#e8e2cf');}
$('.topNavSearch').click(function(){if($(this).val()=='Search'){$(this).val('').css('color','#868379');}});$('.topNavSearch').blur(function(){if($(this).val()==''){$(this).val('Search').css('color','#e8e2cf');}});$('#currentCountry').click(function(){$('#countryList').slideDown('normal');});$('#countryList').mouseleave(function(){$(this).delay(500,function(){$('#countryList').slideUp('normal');});});$('.topNavSearchGo').click(function(){if($('.topNavSearch').val()!=''&&$('.topNavSearch').val()!='Search'){$('#searchform').submit();}
else{alert('Please enter search terms');}})
$('#scope').change(function(){$('#scopeParam').val($(this).val());});});