


    function LoadAttributes(obj)
    {
		var objOption;
		var objAttribute;
		var objProduct;
		var n=0;
		var i=0;
		
		if(obj==null || obj.value==null || obj.value==-1) return;
		if(arAttributes==null || arAttributes.length==0) return;
		if(arProducts==null || arProducts.length==0) return;
		
		
		for(n=0;n<=arAttributes.length-1;n++)
		{
			if(arAttributes[n]!=null)
			{
				if(arAttributes[n].Ctrl.id==obj.id)
				{
					objAttribute=arAttributes[n];
					break;
				}
			}
		}

		for(n=0;n<=arAttributes.length-1;n++)
		{
			if(arAttributes[n]!=null)
			{
				if(arAttributes[n].Ctrl.id!=obj.id)
				{
					arAttributes[n].Ctrl.options.length=0;
					arAttributes[n].Ctrl.options[0]=new Option(arAttributes[n].Attribute,'-1');
		
					for(i=0;i<=arProducts.length-1;i++)
					{
						if(arProducts[i]!=null)
						{
							if(arProducts[i][objAttribute.JSName+'_id']==obj.value)
							{
								objOption=new Option(arProducts[i][arAttributes[n].JSName],arProducts[i][arAttributes[n].JSName+'_id']);
								arAttributes[n].Ctrl.options[arAttributes[n].Ctrl.options.length]=objOption;
							}
						}
					}
			
				}
			}
		}
		
		for(n=0;n<=arImages.length-1;n++)
		{
			if(document.Form1.imgProduct!=null  && arImages[n]!=null && arImages[n][objAttribute.JSName+'_id']==obj.value)
			{
				document.Form1.imgProduct.src=arImages[n].image.src;
				break;
			}	
		}
    
    }