var furniture = new furniture();

function furniture()
{
	this.searchFurniture = function(page, input, value)
	{
		if (input){
			$(input).value = value;
		}
		
		if (!page)
			page = 1;
		$('fs_p').value = page;
		//window.location = "/main/products.php?"+Form.serialize('wt_form')+'&fs_p='+page;
		$('furnitureSearchForm').submit();
	}
	
	
	this.searchFurnitureBrand = function(brandSelectObj)
	{
		window.location = brandSelectObj.options[brandSelectObj.selectedIndex].value;
		brandSelectObj.selectedIndex = 0;
	}
	
	this.searchFurnitureDesigner = function(designerSelectObj)
	{
		window.location = designerSelectObj.options[designerSelectObj.selectedIndex].value;
		designerSelectObj.selectedIndex = 0;
	}
	
	this.furnitureMNChanged = function()
	{
		var mn = $('fs_mn').options[$('fs_mn').selectedIndex].value;
		$('fs_mn').selectedIndex = 1;
		if (mn != '' && mn != -1)
			//window.open(mn,'_blank','directories=0,menubar=0,scrollbars,resizable');
			window.location = mn;
		else
			furniture.searchFurniture();
	}
	
	
	this.searchFurnitureCategory = function(catSelectObj)
	{
		$('fs_cat').value = catSelectObj.options[catSelectObj.selectedIndex].value;
		furniture.searchFurniture();
	}
	
	this.searchFurnitureLocation = function(locSelectObj, level)
	{
		var loc = locSelectObj.options[locSelectObj.selectedIndex].value;
		if (loc == 114)
		{
			window.open('http://nydc.com/furniture.php', '_blank','');
			locSelectObj.selectedIndex = 0;
			return;
		}
		
		if (loc == 256)
		{
			window.open('http://adac.designcentersearch.com/products.php', '_blank','');
			locSelectObj.selectedIndex = 0;
			return;
		}
		
		if (loc == 329)
		{
			window.open('http://denverdesign.designcentersearch.com/products.php', '_blank','');
			locSelectObj.selectedIndex = 0;
			return;
		}
		
		if (loc == 261)
		{
			window.open('http://marketplacedc.designcentersearch.com/products.php', '_blank','');
			locSelectObj.selectedIndex = 0;
			return;
		}
		
		if (loc == 390)
		{
			window.open('http://www.lagunadesigncenter.com/products', '_blank','');
			locSelectObj.selectedIndex = 0;
			return;
		}
		
		if (loc == 257)
		{
			window.open('http://michigandesign.designcentersearch.com/products.php', '_blank','');
			locSelectObj.selectedIndex = 0;
			return;
		}
		
		if (loc == 311)
		{
			window.open('http://imsdesigncenter.designcentersearch.com/products.php', '_blank','');
			locSelectObj.selectedIndex = 0;
			return;
		}
		
		if (loc == 357)
		{
			window.open('http://seattledesigncenter.designcentersearch.com/products.php', '_blank','');
			locSelectObj.selectedIndex = 0;
			return;
		}
		
		if (loc == 436)
		{
			window.open('http://sfdesigncenter.com/product_search/', '_blank','');
			locSelectObj.selectedIndex = 0;
			return;
		}
		
		if (loc == 331)
		{
			window.open('http://ddbuilding.designcentersearch.com/products.php', '_blank','');
			locSelectObj.selectedIndex = 0;
			return;
		}
		
		if (loc == 498)
		{
			window.open('http://pacificdesigncenter.designcentersearch.com/products.php', '_blank','');
			locSelectObj.selectedIndex = 0;
			return;
		}
		
		if (loc == 497)
		{
			window.open('http://dcota.designcentersearch.com/products.php', '_blank','');
			locSelectObj.selectedIndex = 0;
			return;
		}
		
		if (loc == 499)
		{
			window.open('http://decorativecenter.designcentersearch.com/products.php', '_blank','');
			locSelectObj.selectedIndex = 0;
			return;
		}
		
		
		
		$('fs_loc').value = loc;
		$('fs_loc_level').value = level;
//		$('fs_cat').value = '';
		$('fs_mn').selectedIndex = 0;
		$('fs_d').selectedIndex = 0;
//		$('fs_c').selectedIndex = 0;
//		$('fs_s').selectedIndex = 0;
//		$('fs_l').selectedIndex = 0;
//		$('fs_io').selectedIndex = 0;
		furniture.searchFurniture();
	}
	
	
	this.searchFurnitureOption = function(radio_button)
	{
		$(radio_button).checked = true;
		furniture.searchFurniture();
	}
	
	this.furnitureClearSearch = function()
	{
		$('fs_cat').value = '';
		if ($('fs_cs'))
			$('fs_cs').selectedIndex = 0;
		$('fs_mn').selectedIndex = 0;
		$('fs_d').selectedIndex = 0;
//		$('fs_c').selectedIndex = 0;
		$('fs_s').selectedIndex = 0;
		$('fs_s1').selectedIndex = 0;
		$('fs_l').selectedIndex = 0;
		if ($('fs_io_all'))
			$('fs_io_all').checked = true;
		if ($('fs_ro'))
			$('fs_ro').checked = false;
		$('fs_loc').value = '';
		$('fs_ro').value = '';
		
		furniture.searchFurniture(1);
	}
	
	this.furnitureClearCarpetsSearch = function(carpets_cat_code)
	{
		$('fs_cat').value = carpets_cat_code;
		if ($('fs_cs'))
			$('fs_cs').selectedIndex = 0;
		if ($('fs_clr'))
			$('fs_clr').selectedIndex = 0;
		$('fs_mn').selectedIndex = 0;
		$('fs_d').selectedIndex = 0;
//		$('fs_c').selectedIndex = 0;
		$('fs_s').selectedIndex = 0;
		$('fs_s1').selectedIndex = 0;
		$('fs_l').selectedIndex = 0;
		$('fs_io_all').checked = true;
		$('fs_loc').value = '';
		
		furniture.searchFurniture(1);
	}
	
	
	this.changeShopAD = function()
	{
		$('sac').value = $('shop_ad_cat').options[$('shop_ad_cat').selectedIndex].value;
		$('sab').value = $('shop_ad_brand').options[$('shop_ad_brand').selectedIndex].value;
		window.location = '/products.php?'+$('furnitureSearchForm').serialize()+'&'+$('FurnitureShopADAdvertisersForm').serialize()+'#adads';
	}
}
