$(function(){
	//$('#topRightBannerArea a:first').css("margin-top",0);
	$('#mainBannerArea a:first').css("margin-left",0);
	//$('#mainBrands a:hover').css("opacity","0.5");
	$('.productList span:nth-child(3n),.products-list .item:nth-child(3n)').addClass("subcategories2");
	$('.centernoleft .products-list .item:nth-child(3n)').removeClass("subcategories2");
	$('.centernoleft .dialog .products-list .item:nth-child(6n)').addClass("subcategories2");
	$('.centernoleft .dialog .products-list .item:last-child').addClass("subcategories2");
	$('.image-box #sliderUD a').colorbox({
		//transition:"none", 
		maxWidth:"75%", 
		maxHeight:"75%"
	});
	$('.products table:first').css("border","none");

});
function imageResize(obj,w,h){
	$(obj).removeAttr("width");
	$(obj).removeAttr("height");
	var ow = $(obj).width();
	var oh = $(obj).height();
	var per=1;
	if(ow>oh){ 
		per = w/ow;
		if((per*oh)>h) per=h/oh;
	}else{
		per = h/oh;
		if((per*ow)>w) per=w/ow;
	}
	$(obj).css("width",Math.ceil(per*ow)+"px");
	$(obj).css("height",Math.ceil(per*oh)+"px");
};


/* left bar */
function setValues(v1,v2){
	$("#fiyatAralik1").attr("value",v1);
	$("#fiyatAralik2").attr("value",v2);
	$("#leftBarForm").submit();
}

function addFilter(filter,value){
	switch(filter){
		case "category":
			$("#categoryId").attr("value",value);
			break;
		case "manufacturers":
			if($("#manufacturers").attr("name")=="posted_data[manufacturers][]"){
				$("#manufacturers").attr("value",value);
			}else{
				$('#leftBarForm').prepend('<input type="hidden" name="posted_data[manufacturers][]" id="manufacturers" value="">');
				$("#manufacturers").attr("value",value);
			}
			break;
	}
	$("#leftBarForm").submit();
}

function removeFilter(filter){
	switch(filter){
		case "category":
			$("#categoryId").attr("value","");
			break;
		case "manufacturers":
			$("#manufacturers").remove();
			break;
		case "price":
			$("#fiyatAralik1").attr("value","");
			$("#fiyatAralik2").attr("value","");
			break;
	}
	$("#leftBarForm").submit();
}


