active_pict = 0;
var myrules = {
'div.imageswitcht a' : function(el)
{
var id = el.id.split('_');
if(el.className == 'active first')
active_pict = id[1];
else
Element.hide('product_img_'+id[1]);
el.onclick = function()
{
var id = el.id.split('_');
var pict_id = id[1];
if(active_pict != pict_id)
{
$('product_img_'+pict_id).style.visibility = 'visible';
Element.hide('product_img_'+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).className = $('pict_'+active_pict).className.replace(/active/, '');
$('pict_'+pict_id).className += ' active';
active_pict = pict_id;
}
return false;
}
},
'#imageversion' : function(el)
{
el.show();
}
};
if( typeof Behaviour != "undefined")
Behaviour.register(myrules);
// 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";
}