function designBlock()
{
	$('#topMenu ul li:last').css('border-right','none');
}

WBJSLoader.add('designBlock()');

function designSubMenu(from)
{
	var html='<table cellspacing="0" cellpadding="0">';
	html+='<tr align="left" valign="top">';
	var inCell=7;
	var curCell=0;
	$('#pageLeft .column'+from+' ul li').each(function(i)
												{
													if(curCell==0) html+='<td>';
													html+='<p'+(($(this).attr('class')=='select')? ' class="select"' : '')+'>'+$(this).html()+'</p>';
													curCell+=1;
													if(curCell>=inCell)
													{
														curCell=0;
														html+='</td>';
													}
												}
											);
	if(curCell<inCell) html+='</td>';
	html+='</tr>';
	html+='</table>';

	$('#subMenu').html(html);
}

function setGoodViewDesign()
{
	$('.afterShadow a').click(function()
								{
									$(this).parent().parent().css('height','auto');
									$(this).parent().parent().find('.shadow,.afterShadow').remove();
									return false;
								}
							);
}

function setCntStatus(value)
{
	if(value==0) return false;

	$('.goodView').each(function (index)
							{
								var cntSet=$(this).find('input[name="maxCnt[]"]');
								var visible=false;

								for(var i=0; i<cntSet.length; i++)
								{
									if(parseInt(cntSet.eq(i).attr('value'))>0)
									{
										visible=true;
										break;
									}
								}

								if(visible) $(this).find('.goodImg').append('<div class="visibleOn"><img src="/img/template/to_basket_status/add.gif" alt="В наличии" />В наличии</div>');
								else $(this).find('.goodImg').append('<div class="visibleOff"><img src="/img/template/to_basket_status/remove.gif" alt="Под заказ" />Под заказ</div>');
							}
						);
}

function openChoiseForm(id)
{
	$('#tireChoiceFormBtn,#diskChoiceFormBtn').removeClass('active');
	$('#tireChoiceForm,#diskChoiceForm').css('display','none');
	$('#'+id+'ChoiceForm').css('display','block');
	$('#'+id+'ChoiceFormBtn').addClass('active');
	return false;
}

function openDopChoiseForm(id) { $('#'+id+'DopChoiceForm').toggle('slow'); return false; }

function designChoiseForm()
{
	if($('#tireChoiceFormBtn').hasClass('active') || $('#diskChoiceFormBtn').hasClass('active')) return false;
	openChoiseForm('tire');
}
