
$(function(){
	
	$(".visitshopbutton, #shl").click(function(){
	
		var w_new = window.open('http://www.laptops-vergelijken.nl/ltexs/&isx='+$(this).attr('rel'));
		
	});
	
	$("#prosellers tr td img").css({cursor:'pointer'}).click(function(){
			$(this).parent().parent().find(".visitshopbutton").trigger('click');
	});
	
	$("#productimages li").css({cursor:'pointer'}).click(function(){
		
		var img = $(this).attr('ref')+'&save=1&re='+Math.random();
		
		$("#proimg > img").attr('src',img);
		
	});
	
	$("#reviewformbuttons a.review").click(function(){
		
		$("#reviewformbuttons a.comment").removeClass('ui-state-hover2');
		$("#reviewform #reviewformintro").html('<b>Plaats een review</b><br />Geef uw mening! Waarom deze laptop? Wat bevalt u aan deze laptop? Wat valt u tegen?');
		$("#reviewform input[type=submit]").attr('value', 'Plaats review');
		$("#reviewprosandcons").show();
		
		$(this).toggleClass('ui-state-hover2');
		
		if ($("#reviewform input[name=comment_type]").val() == 'review') {
			$("#reviewform").toggle();
		} else {
			$("#reviewform").show();	
		}
		
		$("#reviewform input[name=comment_type]").val('review');
		
		return false;
	});
	
	$("#reviewformbuttons a.comment").click(function(){
		
		$("#reviewformbuttons a.review").removeClass('ui-state-hover2');
		$("#reviewform #reviewformintro").html('<b>Plaats een reactie</b>');
		$("#reviewform input[type=submit]").attr('value', 'Plaats reactie');
		$("#reviewprosandcons").hide();
		
		$(this).toggleClass('ui-state-hover2');
		
		if ($("#reviewform input[name=comment_type]").val() == 'comment') {
			$("#reviewform").toggle();
		} else {
			$("#reviewform").show();
		}
		
		$("#reviewform input[name=comment_type]").val('comment');
		
		return false;
	});
	
	if ($("#reviewformerrors").length) {
		
		if ($("#reviewform input[name=comment_type]").val() == 'review') {
			$("#reviewformbuttons a.review").trigger('click');
		} else if ($("#reviewform input[name=comment_type]").val() == 'comment') {
			$("#reviewformbuttons a.comment").trigger('click');
		}
		
	}
	
});
	