invoice.js 1.64 KB
var invoice = new Class({

initialize : function(){
this.families = [];
this.images = [];
this.load_image = null;

  this.invoice_rel();
  this.onloadImages();
  if(this.families[0])this.view_pic(this.families[0]);
},

invoice_rel : function(){
  $$('a').each(function(a){
   if(a.rel && a.rel.test(/^invoice_button/i)){this.families.push(a);this.images.push(a.href);}
  },this);
},


onloadImages : function(){
 this.families.each(function(a){
  $(a).addEvent('click',function(e){new Event(e).stop();this.view_pic(a);}.bindWithEvent(this));
 },this);
},


view_pic : function(a){
 new Asset.images(this.images, {

 onComplete: function(){


  this.families.each(function(famil){$(famil).style.border = "4px solid #D7D7D7";$(famil).style.display = "block";});
  $('invoice_pic').erase('html');
  $(a).style.border = "4px solid #ab3d4a";
  $(a).style.display = "block";
  var img = new Element("img");
  img.setProperty('src', a.href);
  img.setProperty('width', 390);
  img.style.border = "4px solid #D7D7D7";
  img.setProperty('id', 'invoice_img');
  $('invoice_pic').appendChild(img);
  $('invoice_img').setStyles({'opacity':0});
  var myEffect = new Fx.Morph('invoice_img', {duration: 'long'});
  myEffect.start({'opacity':3});
  //var array_title = a.title.split("|");
  //$('invoice_articl').innerHTML=array_title[0];
  //$('invoice_cine').innerHTML=(array_title[1]) ? 'Öåíà: <span class="ciner_red">'+array_title[1]+'</span>' : "";
  //$('invoice_size').innerHTML=(array_title[2]) ? 'Ðàçìåð ðóëîíà: <span class="ciner_red">'+array_title[2]+'</span>' : "";

 }.bindWithEvent(this)

 });

}

});

window.addEvent('domready', function(){
        invoice = new invoice();
});