$(document).ready(function(){
	// capture change event of currency selectbox and submit form  
	$("select#selCur").change(function () {
		$("form[name='selCurForm']").submit();
	});
	
	// init main navigation
	$("#categories li").pdnav();
	
	// change articlelist prices for variants and selectboxes	
	$("#jArticlePricelist div.article").each(function(){
		var oArticle = $(this);
		oArticle.find("div.variants select").change(function(){
			if (this.name == "aid") {
				// get new price from title-attribute of select options
				$oNewPrice = $(this).find("option:selected").attr("title");
				// find price object to change			
				$oPrice = oArticle.find("div.price span");
				// find price from object to preserve
				$oPriceHTML = $oPrice.contents().filter(function (index) {
					if ($oPrice.contents().length <= 2)
						return index == 1;
					else
						return index == 2; 
				});                
				// change price and add child elements
				$oPrice.text($oNewPrice);
				$oPrice.append($oPriceHTML);
			}
		});
	});
	
	$('select[name="aid"]').change(function() {
		var sVariantPicUrl = $(this).find(':selected').val();
		bdsGetVariantImages($(this) ,sVariantPicUrl);
	});
});


