/*
	This method runs the static photo viewer that uses a static pre-generated XML.
	The example XML for this is multiple_gallery.xml.
	The ActionScript within the FLA references 
		dir/multiple_gallery.xml
	
	example of being called from page:
		onclick="loadPhotoGallery('products/atvmagnum/'); return false;"
*/

function loadPhotoGallery(dir) {
	loadStr = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="739" height="346" id="photoViewer" align="middle">';
	loadStr += '<param name="allowScriptAccess" value="sameDomain" />';
	loadStr += '<param name="movie" value="photoViewer.swf?dir='+dir+'" />';
	loadStr += '<param name="quality" value="high" />';
	loadStr += '<param name="wmode" value="transparent" />';
	loadStr += '<param name="bgcolor" value="#ffffff" />';
	loadStr += '<embed src="photoViewer.swf?dir='+dir+'" quality="high" wmode="transparent" bgcolor="#ffffff" width="739" height="346" name="photoViewer" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	loadStr += '</object>';
	document.getElementById('photoDiv').innerHTML = loadStr;
	document.getElementById('photoDiv').style.visibility = 'visible';
}

/*
	This method builds the SWF using the dynamic photo gallery.  The dir is where the images are normally stored,
	the album ID is used to access the database.  Basically the system could be rewritten so that the DIR is pointless 
	and the XML generated by the PHP handles the DIR but I modded it from the static version so it was 
	quicker this way.
	Really cheap method ... if "dir" has the word "albums" (instead of "news") then I pass on to "albumGenerate.php" 
	page and if it's just "news" then I pass to singlePicGenerate.php.  I know, really cheap, again, just the 
	way I ended up modding stuff.
	The two PHP (alubm & singlePic generate) hit the database and generate the XML that the above static 
	method assumed was already available.  The SWF reads the XML generated by the PHP and displays the 
	pictures accordingly.

	example of being called from page:
		onclick="loadDynamicPhotoGallery('admin/albums_images/',<?=$albumid?>); return false;"
*/
function loadDynamicPhotoGallery(dir,albumid) {
	if (dir.indexOf('albums') > -1)
		phpG = 'albumGenerate';
	else
		phpG = 'singlePicGenerate';
	loadStr = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="820" height="600" id="dynPhotoViewer" align="middle">';
	loadStr += '<param name="allowScriptAccess" value="sameDomain" />';
	loadStr += '<param name="movie" value="dynPhotoViewer.swf?phpG='+phpG+'&dir='+dir+'&albumid='+albumid+'" />';
	loadStr += '<param name="quality" value="high" />';
	loadStr += '<param name="wmode" value="transparent" />';
	loadStr += '<param name="bgcolor" value="#ffffff" />';
	loadStr += '<embed src="dynPhotoViewer.swf?phpG='+phpG+'&dir='+dir+'&albumid='+albumid+'" quality="high" wmode="transparent" bgcolor="#ffffff" width="820" height="600" name="dynPhotoViewer" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	loadStr += '</object>';
	document.getElementById('photoDiv').innerHTML = loadStr;
	document.getElementById('photoDiv').style.visibility = 'visible';
}
function loadDynamicPhotoGallerySingle(dir,albumid,photonumber) {
	phpG = 'singlePicGenerate';
	loadStr = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="739" height="346" id="dynPhotoViewer" align="middle">';
	loadStr += '<param name="allowScriptAccess" value="sameDomain" />';
	loadStr += '<param name="movie" value="dynPhotoViewer.swf?phpG='+phpG+'&dir='+dir+'&albumid='+albumid+'&photonumber='+photonumber+'" />';
	loadStr += '<param name="quality" value="high" />';
	loadStr += '<param name="wmode" value="transparent" />';
	loadStr += '<param name="bgcolor" value="#ffffff" />';
	loadStr += '<embed src="dynPhotoViewer.swf?phpG='+phpG+'&dir='+dir+'&albumid='+albumid+'&photonumber='+photonumber+'" quality="high" wmode="transparent" bgcolor="#ffffff" width="739" height="346" name="dynPhotoViewer" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	loadStr += '</object>';
	document.getElementById('photoDiv').innerHTML = loadStr;
	document.getElementById('photoDiv').style.visibility = 'visible';
}
function closePhotoDiv() {
	window.location.href = "http://www.multiplexultra.com/index.php?id=6&type=casereview";
//	document.getElementById('photoDiv').style.visibility = 'hidden';
//	document.getElementById('photoDiv').innerHTML = "&nbsp;";
}

