$(document).ready(function() {
	$(".faqAnswer").hide();

	$(".faqQuestion").css("cursor", "pointer").click(function() {
		var id = this.id.substring(9);
		$("#answer_" + id).slideToggle( "fast" );
		$(this).toggleClass('faqOpen');
	});

	$("#faqExpandAll").click(function() {
		$(".faqAnswer").slideDown("fast");
		$(".faqQuestion").addClass("faqOpen");
		$("#faqExpandAll").hide();
		$("#faqContractAll").show();
	}).show();

	$("#faqContractAll").click(function() {
		$(".faqAnswer").slideUp("fast");
		$(".faqQuestion").removeClass("faqOpen");
		$("#faqExpandAll").show();
		$("#faqContractAll").hide();
	});

	$("table tr:first td").addClass("firstrow");
	$("table tr:odd td").addClass("even");
	$("table tr td:first").addClass("leftcell");
	$("table tr td:last").addClass("rightcell");

	$(".nextResult img").mouseover(function() {
		$(this).attr("src", "images/neste_hover.gif");
	});
	$(".nextResult img").mouseout(function() {
		$(this).attr("src", "images/neste_off.gif");
	});
	$(".previousResult img").mouseover(function() {
		$(this).attr("src", "images/forrige_hover.gif");
	});
	$(".previousResult img").mouseout(function() {
		$(this).attr("src", "images/forrige_off.gif");
	});
	$(".sok,#btnSearch").mouseover(function() {
		$(this).attr("src", "images/search_hover.gif");
	});
	$(".sok,#btnSearch").mouseout(function() {
		$(this).attr("src", "images/search_off.gif");
	});
});

$(window).load(function() {
	fiximages();
});

function fiximages() {
	$(".articleListItem img").each(function() {
		$("this").css("height", "");
		var x = ($(this).width() / 2) - 50;
		var y = ($(this).height() / 2) - 50;

		$(this).crop( x, y, 100, 100, 'http://www2.tine.no/transparent.gif' );
	});
/*
	$(".imageContainer img").each(function() {
		$("this").css("width", "");
		var x = ($(this).width() / 2) - 307;
		var y = ($(this).height() / 2) - 200;

		$(this).crop( x, y, 400, 615, 'http://www2.tine.no/transparent.gif' );
	});
*/
}