/*******************************************************************
 *    Copyright © 2006 Dragon of The South. All rights reserved.   *
 *    ---------------------------------------------------------    *
 *    credit also goes to: Geoff Stearns (geoff@choppingblock.com, http://www.choppingblock.com/) *							
 *******************************************************************/

//get the correct gallery (retrieve query string)
function getGalleryNo()
{
	if(qsParm['galleryid']=='DPHQ')	// dorset police HQ
		return 0;
	else if(qsParm['galleryid']=='CFAW') //christchurch Food and wine
		return 1;  
	else if(qsParm['galleryid']=='BBIC') //bmouth BIC 
		return 2;
	else if(qsParm['galleryid']=='PDEM') //poole park demo
		return 3;
	else if(qsParm['galleryid']=='BMKT') //boscombe market
		return 4;
}


// Picture Gallery function
function displayFlashGallery()
{
	// get location of relevant files
	var photo_file;
	var galleryconfig_file;
	var flash_file;
	var path;

	var galleryid = getGalleryNo();
	
	if(galleryid == 0)
		path = "PhotoGallery/police%20headquarters/";   
	else if((galleryid == 1))
		path = "PhotoGallery/Gallery%20Food%20and%20Wine%20Festival/";
	else if((galleryid == 2))
		path = "PhotoGallery/BIC/";
	else if((galleryid == 3))
		path = "PhotoGallery/poole%20park%20demo/";
	else if((galleryid == 4))
		path = "PhotoGallery/boscombe%20market/";

	var photos_file = path + "photos.xml";
	var galleryconfig_file = "xml/galleryconfig.xml";	
	var flash_file = path + "gallery.swf";

	//create flash object and display
	var myFlashObject = new FlashObject(flash_file, "gallery", "100%", "100%", 6, "#ffffff");
	myFlashObject.addParam("scale", "noscale");
	myFlashObject.addVariable("request", getQueryParamValue("image"));
	myFlashObject.addVariable("photosXmlFile", photos_file);
	myFlashObject.addVariable("configXmlFile", galleryconfig_file);
	myFlashObject.write();
}


function displayFlashGallery2()
{
	// location of relevant files
	var photos_file = "PhotoGallery/Gallery%20Food%20and%20Wine%20Festival/photos.xml";
	var galleryconfig_file = "PhotoGallery/Gallery%20Food%20and%20Wine%20Festival/galleryconfig.xml";	
	var flash_file = "PhotoGallery/Gallery%20Food%20and%20Wine%20Festival/gallery.swf";

	var myFlashObject = new FlashObject(flash_file, "gallery", "100%", "100%", 6, "#ffffff");

	myFlashObject.addParam("scale", "noscale");

	myFlashObject.addVariable("request", getQueryParamValue("image"));

	myFlashObject.addVariable("photosXmlFile", photos_file);

	myFlashObject.addVariable("configXmlFile", galleryconfig_file);

	myFlashObject.write();
}

function loadflash()
{
	window.onload = function() 
		{
			if ((window.document.getElementById) && (window.document.getElementById('gallery').focus)) 
			{
				window.document.getElementById('gallery').focus();
			}
		}
}
