if ( gLang == 'en' ) {
	var GALLERY_VIEW_TITLE			= "Hidden Canopy Gallery";
	var GALLERY_VIEW_SIGNATURE		= "www.hiddencanopy.com";
	var GALLERY_VIEW_EXTERNAL		= "Launch in external player";
	var GALLERY_VIEW_ERROR_SLIDE_SHOW	= "Encountered errors attempting to display slide show";
	var GALLERY_PAUSE 			= "Pause";
	var GALLERY_EXIT 			= "Close";	
} else if ( gLang == 'es' ) {
	var GALLERY_VIEW_TITLE			= "Hidden Canopy Gallery";
	var GALLERY_VIEW_SIGNATURE		= "www.hiddencanopy.com";
	var GALLERY_VIEW_EXTERNAL		= "Launch in external player";
	var GALLERY_VIEW_ERROR_SLIDE_SHOW	= "Encountered errors attempting to display slide show";
	var GALLERY_PAUSE 			= "Pause";
	var GALLERY_EXIT 			= "Close";	
}


/* ----------------------------------------- */
function displayGallery( ajaxFile, dir) { 
	var objSubmitted 		= new Object();
	objSubmitted.dir		= dir;

	var theUrl			= ajaxFile + '?at=displayGallery&rnd=' + Math.random();
	var strSubmitted		= 'jstring=' + objSubmitted.toJSONString();
	var callback 			= { success:handleDisplayGallery, failure:handleAjaxError, argument:[] };
	var transaction 		= YAHOO.util.Connect.asyncRequest('POST', theUrl, callback, strSubmitted);
} 



/* ----------------------------------------- */
function handleDisplayGallery(o){
	var response 	= o.responseText.parseJSON();

	if ( response.result == 'success' ) {
	   if ( response.urlDir != "never" ) { 
		document.location = "/p/user/gallery.php?g=" + response.urlDir;
	   } else {
		document.getElementById('breadCrumb').innerHTML  = response.breadCrumbTrail;
		document.getElementById('galleryDirs').innerHTML = response.galleryDirs;
		document.getElementById('viewGallery').innerHTML = response.galleryFiles;
	   }	
	}
	
}

/* ----------------------------------------- */
function displaySlideshow( ajaxFile, dir) { 
	var objSubmitted 		= new Object();
	objSubmitted.dir		= dir;

	var theUrl			= ajaxFile + '?at=displaySlideshow&rnd=' + Math.random();
	var strSubmitted		= 'jstring=' + objSubmitted.toJSONString();
	var callback 			= { success:handleDisplaySlideshow, failure:handleAjaxError, argument:[] };
	var transaction 		= YAHOO.util.Connect.asyncRequest('POST', theUrl, callback, strSubmitted);
} 

/* ----------------------------------------- */
function handleDisplaySlideshow(o){
	var response 	= o.responseText.parseJSON();

	ImageWindow=window.open("", "viewImage");
	ImageWindow.document.write("<html><head>\n")
	ImageWindow.document.write("   <title>Hidden Canopy Slideshow</title>\n")
	ImageWindow.document.write("</head>\n")
	ImageWindow.document.write("<body bgcolor='white' >\n")
	ImageWindow.document.write("<table bgcolor='#cacaca' border='0' width='100%'>\n")
	ImageWindow.document.write("<tr height='20' style='background-color:#efefef'><td width='100%' align='center' style='font-size:14px; color:blue;font-weight:bold' >"+response.galleryName+"</td>")
	ImageWindow.document.write("<td align='center' width='20' id='slideButton'><a href=\"javascript:playSlides('pause')\"><img border='0' src='/images/pause.png' width='20' title='"+GALLERY_PAUSE+"'></a></td>")
	ImageWindow.document.write("<td align='center' width='20'><a href='javascript:close()'><img border='0' src='/images/smallX.png' width='20' title='"+GALLERY_EXIT+"'></a></td></tr>\n")
	
	if ( response.result == 'success' ) {
		ImageWindow.document.write("<script type='text/javascript' src='/js/slideshow.js'></script>\n")
		ImageWindow.document.write( response.jsString )
		ImageWindow.document.write("<tr><td id='img' colspan='3' align='center' valign='middle'>\n")
		ImageWindow.document.write("<img name='SLIDESIMG' src='' border='0'>\n")
		ImageWindow.document.write("</td></tr>\n")
		ImageWindow.document.write("<tr><td colspan='3' align='center' style='background-color:#efefef;color:brown;font-size:11px;'><div id='SLIDESTEXT'></div></td></tr>\n")
		ImageWindow.document.write( response.jsPlayGallery )
	} else {
		ImageWindow.document.write("<tr><td colspan='3' align='center' style='color:brown;font-size:11px;'>"+GALLERY_VIEW_ERROR_SLIDE_SHOW+"</td></tr>\n")
		
	}
	ImageWindow.document.write("</table>\n")
	ImageWindow.document.write("<table border='0' width='100%'><tr height='5' width='100%'><td height='5' colspan='2' align='center' valign='middle' style='background-color:white;color:gray;font-size:10px;'>"+GALLERY_VIEW_SIGNATURE+"</td></tr></table>\n")
	ImageWindow.document.write("</body></html>\n")
	ImageWindow.document.close()
}


/* ----------------------------------------- */
function playClip( clipType, imgTitle, imgURL, imgText ) {

	/*alert("clipType="+clipType+"\nimgURL="+imgURL+"\nimgTitle="+imgTitle); */
	var platform = navigator.platform;
	
	ClipWindow=window.open("", "viewClip", "height=400,width=360,toolbar=no,scrollbars='auto',menubar=no");
	ClipWindow.document.write("<html>")
	ClipWindow.document.write("<title>Hidden Canopy Video</title>")
	ClipWindow.document.write("<body bgcolor='white'>")
	
	ClipWindow.document.write("<table bgcolor='#cacaca' border='0' width='100%'>\n")
	ClipWindow.document.write("<tr height='20' width='100%'><td align='center' style='background-color:#efefef; font-size:14px; color:blue;font-weight:bold' >"+GALLERY_VIEW_TITLE+"</td><td align='center' width='17' style='background-color:#efefef'><a href='javascript:close()'><img border='0' src='/images/smallX.png' title='"+GALLERY_EXIT+"'></a></td></tr>\n")
	ClipWindow.document.write("<tr><td colspan='2' align='center' valign='middle'>\n")


	if ( clipType == '.mov' ) { 
	      ClipWindow.document.write("<!-- begin embedded QuickTime file... -->");
	      ClipWindow.document.write("<table bgcolor='#cacaca' border='0' cellpadding='0' align='center'  width='100%'>");
	      ClipWindow.document.write("  <!-- begin video window... -->");
	      ClipWindow.document.write("  <tr><td width='100%' align='center' valign='middle'>");
	      ClipWindow.document.write("  <OBJECT classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' width='320'");
	      ClipWindow.document.write("  height='255' codebase='http://www.apple.com/qtactivex/qtplugin.cab'>");
	      ClipWindow.document.write("  <param name='src' value='"+imgURL+"'>");
	      ClipWindow.document.write("  <param name='autoplay' value='true'>");
	      ClipWindow.document.write("  <param name='controller' value='true'>");
	      ClipWindow.document.write("  <param name='loop' value='false'>");
	      ClipWindow.document.write("  <EMBED src='"+imgURL+"' width='320' height='255' autoplay='true' ");
	      ClipWindow.document.write("  controller='true' loop='false' pluginspage='http://www.apple.com/quicktime/download/'>");
	      ClipWindow.document.write("  </EMBED>");
	      ClipWindow.document.write("  </OBJECT>");
	      ClipWindow.document.write("  </td></tr>");
	      ClipWindow.document.write("  <!-- ...end embedded QuickTime file -->");
	      ClipWindow.document.write("  </table>");
		

	} else if ( clipType == '.wmv' || clipType == '.wma' ) { 	
	      ClipWindow.document.write("<!-- begin embedded WindowsMedia file... -->");
	      ClipWindow.document.write("<table bgcolor='#cacaca' border='0' cellpadding='0' align='center' width='100%'>");
	      ClipWindow.document.write("<tr><td width='100%' align='center' valign='middle'>");
	      ClipWindow.document.write("<OBJECT id='mediaPlayer' width='320' height='285'"); 
	      ClipWindow.document.write("classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' ");
	      ClipWindow.document.write("codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'");
	      ClipWindow.document.write("standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'>");
	      ClipWindow.document.write("<param name='fileName' value='"+imgURL+"'>");
	      ClipWindow.document.write("<param name='animationatStart' value='true'>");
	      ClipWindow.document.write("<param name='transparentatStart' value='true'>");
	      ClipWindow.document.write("<param name='autoStart' value='true'>");
	      ClipWindow.document.write("<param name='showControls' value='true'>");
	      ClipWindow.document.write("<param name='loop' value='false'>");
	      ClipWindow.document.write("<EMBED type='application/x-mplayer2'");
	      ClipWindow.document.write("  pluginspage='http://microsoft.com/windows/mediaplayer/en/download/'");
	      ClipWindow.document.write("  id='mediaPlayer' name='mediaPlayer' displaysize='4' autosize='-1' ");
	      ClipWindow.document.write("  bgcolor='darkblue' showcontrols='true' showtracker='-1' ");
	      ClipWindow.document.write("  showdisplay='0' showstatusbar='-1' videoborder3d='-1' width='320' height='285'");
	      ClipWindow.document.write("  src='"+imgURL+"' autostart='true' designtimesp='5311' loop='false'>");
	      ClipWindow.document.write("</EMBED>");
	      ClipWindow.document.write("</OBJECT>");
	      ClipWindow.document.write("</td></tr>");
	      ClipWindow.document.write("<!-- ...end embedded WindowsMedia file -->");
	      ClipWindow.document.write("<!-- begin link to launch external media player... -->");
	      ClipWindow.document.write("  <tr><td align='center'>");
	      ClipWindow.document.write("  <a href='"+imgURL+"' style='font-size: 85%;' target='_blank'>"+GALLERY_VIEW_EXTERNAL+"</a>");
	      ClipWindow.document.write("  <!-- ...end link to launch external media player... -->");
	      ClipWindow.document.write("  </td></tr>");
	      ClipWindow.document.write("</table>");
		

	} else if ( clipType == '.rm' || clipType == 'ram' ) { 	
	       ClipWindow.document.write("<!-- begin embedded RealMedia file... -->");
	       ClipWindow.document.write("<table bgcolor='#cacaca' border='0' cellpadding='0' align='center' width='100%'>");
	       ClipWindow.document.write("  <!-- begin video window... -->");
	       ClipWindow.document.write("  <tr><td width='100%' align='center' valign='middle'>");
	       ClipWindow.document.write("  <OBJECT id='rvocx' classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'");
	       ClipWindow.document.write("  width='320' height='240'>");
	       ClipWindow.document.write("  <param name='src' value='"+imgURL+"'>");
	       ClipWindow.document.write("  <param name='autostart' value='false'>");
	       ClipWindow.document.write("  <param name='controls' value='imagewindow'>");
	       ClipWindow.document.write("  <param name='console' value='video'>");
	       ClipWindow.document.write("  <param name='loop' value='false'>");
	       ClipWindow.document.write("  <EMBED src='"+imgURL+"' width='320' height='240' ");
	       ClipWindow.document.write("  loop='false' type='audio/x-pn-realaudio-plugin' controls='imagewindow' console='video' autostart='false'>");
	       ClipWindow.document.write("  </EMBED>");
	       ClipWindow.document.write("  </OBJECT>");
	       ClipWindow.document.write("  </td></tr>");
	       ClipWindow.document.write("  <!-- ...end video window -->");
	       ClipWindow.document.write("    <!-- begin control panel... -->");
	       ClipWindow.document.write("    <tr><td>");
	       ClipWindow.document.write("    <OBJECT id='rvocx' classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'");
	       ClipWindow.document.write("    width='320' height='30'>");
	       ClipWindow.document.write("    <param name='src' value='"+imgURL+"'>");
	       ClipWindow.document.write("    <param name='autostart' value='false'>");
	       ClipWindow.document.write("    <param name='controls' value='ControlPanel'>");
	       ClipWindow.document.write("    <param name='console' value='video'>");
	       ClipWindow.document.write("    <EMBED src='"+imgURL+"' width='320' height='30' ");
	       ClipWindow.document.write("    controls='ControlPanel' type='audio/x-pn-realaudio-plugin' console='video' autostart='false'>");
	       ClipWindow.document.write("    </EMBED>");
	       ClipWindow.document.write("    </OBJECT>");
	       ClipWindow.document.write("    </td></tr>");
	       ClipWindow.document.write("    <!-- ...end control panel -->");
	       ClipWindow.document.write("    <!-- ...end embedded RealMedia file -->");
	       ClipWindow.document.write("  <!-- begin link to launch external media player... -->");
	       ClipWindow.document.write("  <tr><td align='center'>");
	       ClipWindow.document.write("  <a href='"+imgURL+"' style='font-size: 85%;' target='_blank'>"+GALLERY_VIEW_EXTERNAL+"</a>");
	       ClipWindow.document.write("  <!-- ...end link to launch external media player... -->");
	       ClipWindow.document.write("  </td></tr>");
	       ClipWindow.document.write("</table>");

	} else if ( clipType == '.swf' ) { 	
	      ClipWindow.document.write("<!-- begin embedded Flash file... -->");
	      ClipWindow.document.write("<table bgcolor='#cacaca' border='0' cellpadding='0' align='center' width='100%'>");
	      ClipWindow.document.write("  <tr><td width='100%' align='center' valign='middle'>");
	      ClipWindow.document.write("  <OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'");
	      ClipWindow.document.write("  codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0'");
	      ClipWindow.document.write("  width='320' height='240'>");
	      ClipWindow.document.write("  <param name='movie' value='"+imgURL+"'>");
	      ClipWindow.document.write("  <param name='quality' value='high'>");
	      ClipWindow.document.write("  <param name='bgcolor' value='#FFFFFF'>");
	      ClipWindow.document.write("  <param name='loop' value='false'>");
	      ClipWindow.document.write("  <EMBED src='"+imgURL+"' quality='high' bgcolor='#FFFFFF' width='320'");
	      ClipWindow.document.write("  height='240' loop='false' type='application/x-shockwave-flash'");
	      ClipWindow.document.write("  pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'>");
	      ClipWindow.document.write("  </EMBED>");
	      ClipWindow.document.write("  </OBJECT>");
	      ClipWindow.document.write("  </td></tr>");
	      ClipWindow.document.write("  <!-- ...end embedded Flash file -->");
	      ClipWindow.document.write("</table>");
			
	} else {
	      ClipWindow.document.write("<!-- begin embedded Flash file... -->");
	      ClipWindow.document.write("<table bgcolor='#cacaca' border='0' cellpadding='0' align='center' width='100%'>");
	      ClipWindow.document.write("  <tr><td width='100%' align='center' valign='middle'>");
	      ClipWindow.document.write("<embed ");
	      ClipWindow.document.write("src='" + imgURL + "' menu='true' quality='high' autostart='true' ");
	      ClipWindow.document.write("controller='true' showdisplay='0' showstatusbar='-1' videoborder3d='-1' ");
	      ClipWindow.document.write("width='320' height='285' >");
	      ClipWindow.document.write("</embed>");
	      ClipWindow.document.write("  </td></tr>");
	      ClipWindow.document.write("  <!-- ...end embedded Flash file -->");
	      ClipWindow.document.write("</table>");
      
	}

	ClipWindow.document.write("</td></tr>\n")
	ClipWindow.document.write("<tr><td colspan='2' align='center' style='font-size:11px;'><font color='brown'>"+imgTitle+"</font><div id='ImageText'>"+imgText+"</div></td></tr>\n")
	ClipWindow.document.write("</table>\n")

	ClipWindow.document.write("<table border='0' width='100%'><tr height='5' width='100%'><td height='5' colspan='2' align='center' valign='middle' style='background-color:white;color:gray;font-size:10px;'>"+GALLERY_VIEW_SIGNATURE+"</td></tr></table>\n")

	ClipWindow.document.write("</body></html>")
	ClipWindow.document.close()
	ClipWindow.focus()
	
}

