Lang file : Update lang french file
[ldapsaisie.git] / trunk / includes / js / LSformElement_image.js
1 var LSformElement_image = new Class({
2     initialize: function(){
3       $$('div.LSformElement_image').each(function(el) {
4         el.addEvent('mouseenter',this.onMouseEnterImage.bind(this));
5       }, this);
6       
7       $$('div.LSformElement_image').each(function(el) {
8         el.addEvent('mouseleave',this.onMouseLeaveImage.bind(this));
9       }, this);
10       
11       $$('img.LSformElement_image_action_zoom').each(function(el) {
12         var getId = /LSformElement_image_action_zoom_(.*)/
13         var id = getId.exec(el.id)[1];
14         var img = $('LSformElement_image_' + id);
15         el.addEvent('click',this.zoomImg.bindWithEvent(this,img));
16         varLSdefault.addHelpInfo(el,'LSformElement_date','zoom');
17       }, this);
18       
19       $$('img.LSformElement_image_action_delete').each(function(el) {
20         el.addEvent('click',this.onImageDeleteBtnClick.bind(this,el));
21         varLSdefault.addHelpInfo(el,'LSformElement_date','delete');
22       }, this);
23     },
24     
25     zoomImg: function(event, img) {
26       new Event(event).stop();
27       varLSsmoothbox.hideValidBtn();
28       varLSsmoothbox.openImg(img.src,{startElement: img});
29     },
30     
31     onMouseEnterImage: function() {
32       $$('ul.LSformElement_image_actions').each(function(el) {
33         el.setStyle('visibility','visible');  
34       }, this);
35     },
36     
37     onMouseLeaveImage: function() {
38       $$('ul.LSformElement_image_actions').each(function(el) {
39         el.setStyle('visibility','hidden');  
40       }, this);
41     },
42     
43     onImageDeleteBtnClick: function(img) {
44       $$('form.LSform').each(function(el) {
45         var input = new Element('input');
46         input.type = 'hidden';
47         var getInputId = /LSformElement_image_action_delete_(.*)/
48         var id = 'LSformElement_image_input_' + getInputId.exec(img.id)[1];
49         input.name = $(id).name + '_delete';
50         input.value='delete';
51         input.injectInside(el);  
52       },this);
53       
54       var main = img.getParent().getParent().getParent();
55       var hidder = new Fx.Tween(main,{property: 'opacity',duration:600,onComplete:main.dispose.bind(this)});
56       hidder.start(1,0);
57       //img.getParent().getParent().getParent().destroy();
58     }
59     
60 });
61 window.addEvent(window.ie ? 'load' : 'domready', function() {
62   varLSformElement_image = new LSformElement_image();
63 });