﻿function abrefoto(id, path){
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}

	var yScroll;
	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}
	
	var fotoSliderHide = document.getElementById('fotoSliderHide');
	var fader = document.getElementById('faderBody');
	var pgWidth = document.getElementById('bodyAll').offsetWidth;
	var pgHeight = document.getElementById('bodyAll').offsetHeight;
	fader.style.height = pgHeight +'px';
	fader.style.display = 'block';
	show('faderLoading');
	document.getElementById('faderLoading').style.left = ((pgWidth-100)/2)+"px";
	document.getElementById('faderLoading').style.top = (yScroll+((windowHeight-100)/2)-5)+"px";
		
	fotoSliderHide.innerHTML = "<img src=\"updates/album/"+path+"\" border=\"0\" id=\"fotoHiden\" onload=\"abrefotoPos('"+id+"', '"+path+"',this.width,this.height);\" />";
}
	
function abrefotoPos(ftID, ftPath, ftWidth, ftHeight){
	var pgWidth = document.body.offsetWidth;
	
	var windowWidth, windowHeight;

	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}

	var yScroll;
	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}
	
	var ftText = document.getElementById(ftID).getAttribute('alt');
	document.getElementById('fotoSlider').style.left = (pgWidth-ftWidth)/2;
	document.getElementById('fotoSlider').style.top = yScroll+((windowHeight-ftHeight)/2)-5;
	hidden('faderLoading');
	fotoSlider.innerHTML = "<div id=\"fotoSliderFrame\"><div id=\"fotoSliderClose\"><a href=\"javascript:void(0);\" onclick=\"fechafoto();\">X fechar</a></div><img src=\"updates/album/"+ftPath+"\" border=\"0\" onClick=\"fechafoto();\" /><div id=\"fotoSliderText\"></div></div>";
	document.getElementById('fotoSliderFrame').style.width = ftWidth;
	document.getElementById('fotoSliderFrame').style.height = ftHeight;
	if(ftText != ""){
		document.getElementById('fotoSliderText').style.display = "block";
		document.getElementById('fotoSliderText').innerHTML = "<span>"+ftText+"</span>";
	}else{
		document.getElementById('fotoSliderText').style.display = "none";
	}
	
	
}

function fechafoto(){
	document.getElementById('fotoSlider').innerHTML = "";
	hidden('faderBody');
}