var activeThumb = 1;

function SwapImage(filename, thumbNr)
{
var obj;
var bigpic;

obj = document.getElementById('ThumbPic0');
obj.className = 'Thumb';

if (document.getElementById('BigPic') != null)
{
	bigpic = document.getElementById('BigPic');				
	bigpic.src = filename;
}

if (document.getElementById('ThumbPic' + activeThumb) != null)
{
	obj = document.getElementById('ThumbPic' + activeThumb);					
	obj.className = 'Thumb';
}


if (document.getElementById('ThumbPic' + thumbNr) != null)
{
	obj = document.getElementById('ThumbPic' + thumbNr);
	obj.className = 'Thumb_selected';
}
		
activeThumb = thumbNr;
}
function checkSelling(i)
{
	if(i == 4)
	{
		if(document.getElementById('a_price'))
		{
			document.getElementById('a_price').style.display = 'none';
		}
	} else {
		document.getElementById('a_price').style.display = 'block';
	}
}
var hiddenfields = ['brand','brand_id','a_distance','a_year','a_price','a_bhp','a_color','flags0','flags1','flags2','flags3','flags4','flags5','flags6','flags7','flags8','flags9','flags10','flags11','a_type','switchradio','sellingradio', 'a_model'];
function checkUpdates(i)
{
    for(a in hiddenfields)
    {
        if(document.getElementById(hiddenfields[a]))
        {
            document.getElementById(hiddenfields[a]).style.display = 'none';
        }
    }
    if(categories[i])
    {
        var attrs = categories[i]['attrs'].split(',');
        var flags = categories[i]['flags'].split(',');
        var types = categories[i]['types'].split(',');
		var brand = categories[i]['brand'];
        for(j in attrs)
        {
            div = "a_"+attrs[j];
            if(document.getElementById(div))
            {
                document.getElementById(div).style.display = 'block';
            }
        }
        for(k in flags)
        {
            flag = "flags"+flags[k];
            if(document.getElementById(flag))
            {
                document.getElementById(flag).style.display = 'inline';
            }
        }
        for(l in types)
        {
            radio = types[l]+"radio";
            if(document.getElementById(radio))
            {
                document.getElementById(radio).style.display = 'inline';
            }
        }
		if(brand == 1)
		{
			if(document.getElementById('brand'))
			{
				document.getElementById('brand').style.display = 'block';
			} 
			if(document.getElementById('brand_id'))
			{
                document.getElementById('brand_id').style.display = 'block';
			}
		}
		if(document.getElementById('selling'))
		{
		if(document.form.selling[0])
		{
//			document.form.selling[0].checked = true;
		}
		}
    }
}
