/*
* Javascript Library (ver. 1.0)
*@author Khramkov Ivan
*© Copyright 2010, VAMG
*/

function addContentHider(textField) {
	var hider = new Element('div');
	hider.addClassName('content_hider fly');
	hider.setStyle({'width' : '100%', 'height' : '10px', 'top': (textField.getHeight()) + 'px'});
	textField.insert(hider);
	var h_img = new Element('img');
	h_img.src = '/i/vert_hider.png';
	h_img.addClassName('hider fly');
	h_img.setStyle({'width' : '100px', 'left': (textField.getWidth() - 100) + 'px', 'top': (textField.getHeight() - 10) + 'px'});
	textField.insert(h_img);
}

function addRelationToLightBox(img) {
	var a = new Element('a');
	a.rel = 'lightbox';
	var path = img.src.replace('tn_', '');
	a.href = path;
	a.target = '_self';
	var new_img = new Element('img', {'src': img.src, 'width': img.width, 'height': img.height});
	new_img.setStyle({float: img.getStyle('float')});
	a.insert(new_img);
	img.parentNode.insertBefore(a, img);
	img.remove();
}

function hideOverflow() {
	$$('.text_content').each(addContentHider);	
}

function setLightBox() {
	$$('#middle_column img').each(addRelationToLightBox);	
}