$(document).ready(function(){

	//Init tabs
	$('#article-tabs').tabs();
	//$("#article-tabs").tabs().addClass('ui-tabs-vertical ui-helper-clearfix');
	$("#article-tabs").tabs().addClass('ui-helper-clearfix');
    $("#article-tabs li").removeClass('ui-corner-top').addClass('ui-corner-left');
	
	//mini FAQ
	$('ul.faq > li > p').hide();
	$('ul.faq > li > h5').click(function(e){
								$(e.currentTarget).parent().siblings().find('p').hide();
								$(e.currentTarget).siblings('p').show();
							});

/*
	// Tipafriend
	$("a.popup-dialog").click(function(evt)
	{
		var popupDialog = window.open(this.href,"_popup-window","width=700,height=300,scrollbars=no,status=no,resizable=no");
		return !popupDialog;
	});
	
	// Ugly color thing
	var selectsLeft = $("select.parameter_LEFT");
	var selectsRight = $("select.parameter_RIGHT");
	var updateImage = function(side)
	{
		var root = imgurl + "/";
		var idx = this.selectedIndex;
		var option = this.options[idx];
		var url = option.attributes["img"];
		if(url)
		{
			var target = $("#displayinfo_" + side);
			$("#displayinfo_pre").html("");
			
			if(url.value) target.html("<img src='" + root + url.value + "/MINITHUMB.JPG' style='width:100px;'/>");
			else target.html("");
		}
	}
	selectsLeft.change(function() { updateImage.call(this, "LEFT"); });
	selectsRight.change(function() { updateImage.call(this, "RIGHT"); });
	
	
	// Price calculation 
	var prices = $("#article-pricelist")[0].value.split("|");
	var displays = $("select[name^=COUNT_], select[name=COUNT]");
	var displayTotal = $("#showSum")[0];
	var priceRefresh = function()
	{
		var count = 0, priceCount = 0, pricePerArticle;
		displays.each(function(i, em) {count+=parseInt(em.value||0);});
		priceCount = Math.min(prices.length-1, Math.max(0, count));
		pricePerArticle = prices[priceCount];
		
		displayTotal.value = (pricePerArticle*count) + " kr";
	};
	displays.change(priceRefresh);
	priceRefresh();
*/

});
