var active_pict;
var myrules = {
'div.imageswitcht a' : function(el)
{
var id = el.id.split('_');
if($(el).hasClassName("active") && $(el).hasClassName("first"))
active_pict = id[1];
else
$('product_img_'+id[1]).hide();
el.onclick = function()
{
var id = el.id.split('_');
var pict_id = id[1];
if(active_pict != pict_id)
{
new Effect.Fade('product_img_'+active_pict, 
{
afterFinish: function()
{
new Effect.Appear('product_img_'+pict_id, { duration: 0.5 });
},
duration: 0.5
});
$('pict_'+active_pict).removeClassName("active");
$('pict_'+pict_id).addClassName("active");
active_pict = pict_id;
}
return false;
}
},
'#imageversion' : function(el)
{
el.show();
}
}
// function to change price when option is changed
function price_change(id)
{
var i = 0;
while($('price_'+i))
{
$('price_'+i).style.display="none";
i++;
}
$('price_'+id).style.display="block";
}
if( typeof Behaviour != "undefined")
Behaviour.register(myrules);