// JavaScript Document

function init(){
	if (!document.createElement) return;
	
	// Add Lightbox to Project Images
	var mc = document.getElementById('middle_column');
	if (mc){
		var divs = mc.getElementsByTagName('div');
		for (var i=0; i<divs.length; i++){
			var div = divs[i];
			if (div.className == "block project"){
				var _divs = div.getElementsByTagName('div');
				var div_image = _divs[0];
				var div_caption = _divs[1];
				var img = div_image.getElementsByTagName('img')[0];
				
				div_image.removeChild(img);
				
				var a = document.createElement('a');
				a.setAttribute('href', img.src.replace("thumbs/",""));
				a.setAttribute('rel', 'lightbox[gal]');
				a.setAttribute('title', div_caption.innerHTML);
				
				a.appendChild(img);
				div_image.appendChild(a);
			}
		}
	}
}

function aviso_legal(){
	width = 350;
	height = 380;
	
	x = parseInt((screen.width - width) / 2);
	y = parseInt((screen.height - height) / 2) - 50;
	features = "width="+width+",height="+height+",dependent=no,alwaysRaised=yes,left="+x+",top="+y+",location=no,menubar=no,resizable=no,status=no,titlebar=no,toolbar=no,scrollbars=auto";
	
	window.open("/aviso_legal.html","aviso_legal",features);
}

window.onload = init;