    var images = $$('a.imageswitch');

    images.each(function(i) {

	i.observe( 'click', function( event ) {
	    Event.stop(event);
	    
	    var view = $('imageswitch_view');
	    var href = this.readAttribute('href');
	    var vhref = view.readAttribute('href');

	    var bg = this.firstChild.readAttribute('src');
	    //bg = bg.replace(/^url\(/g, "").replace(/\)$/g, "").replace(/\"/g, "");
	    bg = bg.split('#');
	   
	    bg_small = bg[0];
	    bg_big = bg[1];

	    var vbg = view.firstChild.readAttribute('src');
	    //vbg = vbg.replace(/^url\(/g, "").replace(/\)$/g, "").replace(/\"/g, "");
	    vbg = vbg.split('#');
	   
	    vbg_small = vbg[1];
	    vbg_big = vbg[0];

		//alert('small:' + vbg_small + '; big:' + vbg_big);

	    this.firstChild.writeAttribute('src', vbg_small + '#' + vbg_big );
	    this.writeAttribute('href', vhref);

		//alert('views bg will be:' + 'url(' + href + '#' + bg + ')');

	    view.firstChild.writeAttribute('src', bg_big + '#' + bg_small);
	    view.writeAttribute('href', href);
	});
    });

