document.domain="which.co.uk";
$(document).ready(function(){$("#reviews-nonjs").hide();
$("#customer-views-sel").removeClass("hide-iframe")
});
function loadCustomerRatingsInformation(a,b){var c=new RequestBatch();
c.AddToRequest(new ReviewPage(new ArticleKey(b),10,1));
c.BeginRequest(a,renderRatings)
}function renderRatings(a){if(a.Messages[0].Message!="ok"||a.Responses.length==0){return
}if(a.Responses[0].ReviewPage.NumberOfReviews!=null){$(".js-mgc").show();
var c=a.Responses[0].ReviewPage.NumberOfReviews;
var b=$("#customer-ratings-tab").html();
$("#customer-ratings-tab").html(b+" ("+c+")");
$(".total-reviews-count").html(c);
if(c>0){$(".total-reviews-text").html("Average customer view")
}else{$(".total-reviews-text").html("Be the first to post a view!")
}if(c==0){$("#member-rating-sidebar a").html("Tell us what you think")
}}if(showPluckForm){commentsSetup()
}}function commentsSetup(){$("#average-views-container .non-js").hide();
$("#reviewsiframe").show();
$("#average-views-container").after("<div id='do-you-own'><h3>Do you own this product? If so, why not share your experiences and tips?</h3> <p class='pluck-intro'>We want to know how you've found using this product (rather than what you thought of the buying experience) to help others decide if it's the right choice for them and build on the picture provided by our rigorous, comparative and independent testing.</p> </div>");
var b=getCookie("at");
if(b!=null){var a=unescape(b.split("&")[1]);
a=a.substring(2,a.length)
}else{a=null
}if(b==null){$("#do-you-own p.pluck-intro").after("<p>To give us your view either <a href='/login'>login</a> or <a href='/signup'>sign up to Which?</a>.</p>")
}else{if(b!=null&&b.length>0){if(a==(null||"")){$("#do-you-own p.pluck-intro").after("<p>If this is your first time posting your view you will need to <a href='/account/edit-display-name/'>create a screen name</a>. </p>")
}else{if(/^\d+$/i.test(a)){$("#do-you-own").html("<h3>Please set your screen name</h3><p>You need a screen name to use this feature. Screen names should contain either letters a-z or a combination of letters a-z and numbers 0-9 and be minimum 6 characters in length.</p><p><a href='/account/edit-display-name/'>Please amend your screen name</a>.</p>")
}else{$("#do-you-own p.pluck-intro").after("<p>Your screen name is currently "+a+". <a href='/account/edit-display-name/'>Change screen name</a>. </p>");
$("p.views-conditions").show()
}}}}$(function(){addPluckFunctionality(a)
})
}function getCookie(c){var b=document.cookie;
var e=c+"=";
var d=b.indexOf("; "+e);
if(d==-1){d=b.indexOf(e);
if(d!=0){return null
}}else{d+=2
}var a=document.cookie.indexOf(";",d);
if(a==-1){a=b.length
}return unescape(b.substring(d+e.length,a))
}function addPluckFunctionality(f){var g=null;
var e=0;
var b=true;
var d=false;
if(f&&f.length>0&&!(/^\d+$/i.test(f))){d=true
}if(!d){$("#reviewsiframe").contents().find("input").attr("disabled","true");
$("#reviewsiframe").contents().find("textarea").attr("disabled","true")
}var c=function(){if($("#reviewsiframe").contents().find(".Reviews_Submit").length){e=e+1;
if(e>1000||e>1&&!$.browser.msie){clearInterval(g)
}a()
}};
var a=function(){if(b){$("#reviewsiframe").contents().find("form").show()
}else{$("#reviewsiframe").contents().find("form").hide()
}if(!d){$("#reviewsiframe").contents().find("input").attr("disabled","true");
$("#reviewsiframe").contents().find("textarea").attr("disabled","true")
}};
g=setInterval(c,10)
};
