// Globals
var gGalleryWind = '';
var gSiteBasePath = 'http://www.paragliding-zermatt.ch/';


	 
//-------------------------------------------------------------
// Open the gallery preview window.
//-------------------------------------------------------------
function openGalleryWind( imgPath )
{	
	var fullPath = gSiteBasePath + 'includes/gallery.php?' + gSiteBasePath + imgPath;
	//alert( 'full img path: ' + fullPath );
	
	gGalleryWind = window.open(fullPath,'Gallery','toolbar=0,scrollbars=1,location=1,statusbar=0,menubar=0,resizable=1,width=570,height=540,left=50,top=50');
	if ( window.focus ) { gGalleryWind.focus(); }
	
	return false;
}

//-------------------------------------------------------------
// Close the gallery preview window.
//-------------------------------------------------------------
function closeGalleryWind()
{	
	this.focus();
	self.opener = this;
	self.close();
}


//-------------------------------------------------------------
// Makes the gallery window resize to the image size passed in
// when opening the gallery wind.
// Script code from: http://www.sitepoint.com/article/resize-popup-fit-images-size
//-------------------------------------------------------------
var arrTemp=self.location.href.split("?");
var picUrl = (arrTemp.length>0)?arrTemp[1]:"";
var NS = (navigator.appName=="Netscape")?true:false;
function resizeGalleryWind()
{	
	// not used!
	return;
	
	iWidth = (NS)?window.innerWidth:document.body.clientWidth;
	iHeight = (NS)?window.innerHeight:document.body.clientHeight;
	
	iWidth = document.images[0].width - iWidth;
	iHeight = document.images[0].height - iHeight;
	window.resizeBy(iWidth, iHeight);
	self.focus();
	
	//alert( 'Pic URL:' + picUrl );
	//alert( 'Width: ' + iWidth + '.  Height:' + iHeight );
	
}




