
var Img = Class.create();

Img.prototype = {

	initialize: function(id, opt){
		var defaults = {
			marginTop:0,
			scrollTop:0
		}; 
		var opt = Object.extend(defaults, opt || {});
		
		this.id = id;
		this.top = opt.marginTop;
		this.father = opt.father; 
  
	},

	big: function(obj, id){

	  if($('layer')){this.small('layer'); }
	  var topPos = (this.scrollTop)? this.getScrollTop() + 'style="top:'+this.top+'px;"' : '';  
      
	  // Body holen
	  var body = (this.father)? $(this.father) : document.getElementsByTagName("body")[0]; 
	  
	  var father = $(id); 
	  
	  // Position holen
	  var pos = Position.cumulativeOffset(father);
      var left = pos[0] + 'px';
      var top= pos[1] + 'px'; 
      	  
	  var url = document.location.href;
	  var tcl = 'Fenster schliessen';
	  if(/\/fr\//.test(url)){var tcl = 'Fermer';}
	  if(/\/en\//.test(url)){var tcl = 'Close';}
	  if(/\/de\//.test(url)){var tcl = 'Fenster schliessen';}
	  
	  
      var src = obj.src; 
      src = src.replace(/medium/, "big");
      
      alt = obj.alt;
      
      var html = ''
                +'<div id="layer" style="left:'+left+'; top:'+top+';" >'
                +'<img src="'+src+'" alt="" onclick="img.small(\'layer\')" />'
                +'<p class="verdana">'+alt
                +' <a id="closeLink" href="javascript:img.small(\'layer\')" title="close">'+tcl+'</a> '
                +'</p></div>'; 
      
      
      new Insertion.Bottom(body, html); 
      
      //$('layer').absolutize('container'); 
      
	},
	
	
	getScrollTop: function(){
	  return window.pageYOffset||
      document.documentElement&&document.documentElement.scrollTop||
      document.body.scrollTop||0;
	},

	small: function(id){
		
		$(id).remove();
		

	},

	timeFormat: function(sec){

	}
}

img = new Img('layer', {
   
  marginTop:0,
  scrollTop:0,
  father:''
  
});

