// JavaScript Photogallery
var pFot = 0;
var pFmax = 0;
var masurl = Array();

function previewf()
{
if( pFot != 0 ){
pFot --;
document.getElementById( 'photoitem2' ).src=masurl[ pFot ][0];
tmp2=document.getElementById('bigFOTO1');
tmp2.style.left = ((screenSize().w/2)-(masurl[ pFot ][1]/2)+docScroll().l)+'px';
tmptop = (screenSize().h/2)-(masurl[ pFot ][2]/2);
if( tmptop < 0 ) tmptop = 3;
tmp2.style.top = (tmptop+docScroll().t)+'px';}
}

function nextf(){
if( ( pFot + 1 ) < pFmax ){
pFot ++;
document.getElementById( 'photoitem2' ).src = masurl[ pFot ][0];
tmp2=document.getElementById('bigFOTO1');
tmp2.style.left = ((screenSize().w/2)-(masurl[ pFot ][1]/2)+docScroll().l)+'px';
tmptop = (screenSize().h/2)-(masurl[ pFot ][2]/2);
if( tmptop < 0 ) tmptop = 3;
tmp2.style.top = (tmptop+docScroll().t)+'px';}
}

function WinFotOn(id)
{
pFot=id;
document.getElementById( 'photoitem2' ).src=masurl[ pFot ][0];
tmp=document.getElementById('closeFON1');
tmp.style.width=getPageSize().pW+'px';
tmp.style.height=getPageSize().pH+'px';
tmp.style.display='block';
tmp2=document.getElementById('bigFOTO1');
tmp2.style.left = ((screenSize().w/2)-(masurl[ pFot ][1]/2)+docScroll().l)+'px';
tmptop = (screenSize().h/2)-(masurl[ pFot ][2]/2);
if( tmptop < 0 ) tmptop = 3;
tmp2.style.top = (tmptop+docScroll().t)+'px';
tmp2.style.display='block';
}

function WinFotOff()
{
document.getElementById('bigFOTO1').style.display='none';
document.getElementById('closeFON1').style.display='none';
}

function screenSize(){var w, h;w = (window.innerWidth ? window.innerWidth : (document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.offsetWidth));h = (window.innerHeight ? window.innerHeight : (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.offsetHeight));return {w:w, h:h};}

function docSize()
{
var w,h;
if(document.body) w= document.body.clientWidth;
if(document.layers) w= innerWidth;
if(document.all) h= document.body.clientHeight;
if(document.layers) h= innerHeight;

var width = window.innerWidth || (document.documentElement && document.documentElement.clientWidth) || document.body.clientWidth;
var height = window.innerHeight || (document.documentElement && document.documentElement.clientHeight) || document.body.clientHeight;
return {w:width, h:height};
}

function docScroll()
{
var top = window.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop;
var left = window.pageXOffset || (document.documentElement && document.documentElement.scrollLeft) || document.body.scrollLeft;
return {t:top,l:left}
}

function  getPageSize(){

var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
	   xScroll = document.body.scrollWidth;
	   yScroll = window.innerHeight + window.scrollMaxY;}
else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
	   xScroll = document.body.scrollWidth;
	   yScroll = document.body.scrollHeight;}
else if (document.documentElement && document.documentElement.scrollHeight > document.documentElement.offsetHeight){ // Explorer 6 strict mode
	   xScroll = document.documentElement.scrollWidth;
	   yScroll = document.documentElement.scrollHeight;}
else { // Explorer Mac...would also work in Mozilla and Safari
	   xScroll = document.body.offsetWidth;
	   yScroll = document.body.offsetHeight;}

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;}

// for small pages with total height less then height of the viewport

if(yScroll < windowHeight){
	   pageHeight = windowHeight;}
else {
	   pageHeight = yScroll;}

// for small pages with total width less then width of the viewport

if(xScroll < windowWidth){
	pageWidth = windowWidth;}
else{
	pageWidth = xScroll;}

return {pW:pageWidth,pH:pageHeight,wW:windowWidth,wH:windowHeight};

}
