function makeProp(wdo,hgo,wd,hg){

	if(wd==undefined){

		wd= document.documentElement.clientWidth;

		hg= document.documentElement.clientHeight;

	}

	var nwd=wdo-wd;

	var nhg=hgo-hg;

	if(nwd<0 && nhg<0){ return {'width':wdo,'height':hgo} } 

	else {

		if (nwd>=nhg){return {'width':wd,'height':(wd/wdo)*hgo}} 

		else {return new Hash({'width':(hg/hgo)*wdo,'height':hg})}

	}

}

function ww(){

	if(window.innerWidth==undefined){

		wd= document.documentElement.clientWidth;

	} else {wd=window.innerWidth}

	return wd

}

function wh(){

	if(window.innerHeight==undefined){

		hg= document.documentElement.clientHeight;

	} else {hg=window.innerHeight}

	return hg

}

function lbClose(){

	I=$("lbI")

	I.setStyles({

		"position":"absolute",

		"left":window.pageXOffset+(ww()/2),

		"top":window.pageYOffset+(wh()/2)

	})

	new Fx.Morph(I).start({

		"width":$("ga").width,

		"height":$("ga").height,

		"left":$("ga").getPosition().x+5,

		"top":$("ga").getPosition().y,

		"margin-left":"0px",

		"margin-top":"0px"

	}).chain(function(){

		I.destroy()

		$("ga").id=""

	})

}



function res1(I){

	var prop=makeProp(I.width,I.height,window.innerWidth,window.innerHeight)

	I.setStyles(prop);

	oH=I.height

	oW=I.width

	$$("body").adopt(I)

	var gc=$("gagaga").getCoordinates()

	I.set("opacity",1).setStyles({

		"position":"absolute",

		"width":$("gagaga").width,

		"height":gc.height,

		"left":$("gagaga").getPosition().x+5,

		"top":gc.top,
		"z-index":"9999"

	})

	new Fx.Morph(I).start({

		'margin-left':-(oW)/2,

		'margin-top':(-(oH)/2),

		'width':oW,

		'height':oH,

		'top':window.pageYOffset+(wh()/2),

		'left':window.pageXOffset+(ww()/2),

		"z-index":"9999",

		"cursor":"pointer"

	}).chain(function(){

		I.setStyles({

			"position":"fixed",

			'margin-left':-(oW)/2,

			'margin-top':(-(oH)/2),

			'top':wh()/2,

			'left':ww()/2,
			"z-index":"9999"

		}).addEvent("click", lbClose)

		$("gagaga").id="ga"

	})

}





function boxer(){

	if (this.get("href")!="#"){

		this.getFirst().id="gagaga"

		if ($defined($("lbI"))){

			J=$("lbI")

			J.setStyles({
				"position":"absolute",
				"left":window.pageXOffset+(ww()/2),
				"top":window.pageYOffset+(wh()/2),
				"z-index":"9999"
			})

			new Fx.Morph(J).start({

				"width":$("ga").width,

				"height":$("ga").height,

				"left":$("ga").getPosition().x+5,

				"top":$("ga").getPosition().y,

				"margin-left":"0px",

				"margin-top":"0px",
				"z-index":"9999"

			}).chain(function(){

				J.destroy()

				$("ga").id=""

			})

		}

	   	var I = new Element('img', { 'id':'lbI','src': this.href,"z-index":9999});

		if (I.complete){

			res1(I)

		} else {

			I.addEvent("load", function(){

				res1(I)

			})

		}

	}

	return false

}





function zoomishbox(){

	$$("#screenshots a").addEvent("click", boxer)

	$$("#capa a").addEvent("click", boxer)
	
	$$("#video object, #video embed").setStyle("z-index","10")		

}