﻿
		function showDIV(divName){
			if(document.getElementById) {
				document.getElementById(divName).style.display = 'block';
				document.getElementById(divName).style.visibility='visible';
			}
			else if(document.layers) {
				for (i=0; i < document.layers.length; i++) {
					var whichEl = document.layers[i];
		
					if (whichEl.id.indexOf(divName) != -1) {
						whichEl.visibility='show';
					}
					arrange();
				}
		
				document.layers[divName].visibility='show';
				arrange();
			}
			else if(document.all) {
				document.all(divName).style.display = 'block';
				document.all(divName).style.visibility='visible';
			}
		}
		
		function hideDIV(divName){
			if(document.getElementById) {
				document.getElementById(divName).style.visibility='hidden';
				document.getElementById(divName).style.display = 'none';
			}
			else if(document.layers) {
				for (i=0; i < document.layers.length; i++) {
					var whichEl = document.layers[i];
		
					if (whichEl.id.indexOf(divName) != -1) {
						whichEl.display = 'none';
						whichEl.visibility='hide';
					}
					arrange();
				}
		
				document.layers[divName].display = 'none';
				document.layers[divName].visibility='hide';
		
			}
			else if(document.all) {
				document.layers[divName].display = 'none';
				document.all(divName).style.visibility='hidden';
			}
		}		
		
		
		function showart(action, art_id, showdiv, hidediv){
				//alert(media_arr[art_id]);
				if(action == 1){
					var showdiv = (showdiv == null) ? "fullsize" : showdiv;
					var hidediv = (hidediv == null) ? "thumbs" : hidediv;
					gallery_title=media_arr[art_id].gallery_title;
					img_url=media_arr[art_id].fullsize;
					img_h=media_arr[art_id].fullsize_h;
					img_w=media_arr[art_id].fullsize_w;
					id_next=media_arr[art_id].next;
					id_prev=media_arr[art_id].prev;
					art_caption=media_arr[art_id].caption;
					hideDIV(hidediv);
					html = "<center>";
					html += "<div style=\"padding-top:10px\"><h2>" + gallery_title + "</h2></div><table cellpadding=0 cellspacing=0 border=0 width=550><tr>";
					if(id_prev){
						html += "<td valign=center width=21><a href=\"javascript:showart(1, " + id_prev + ")\"><img src=\"http://www.freedomofteach.com/images/media_back.gif\" border=0></a></td>";
					} else {
						html += "<td valign=center width=21><img src=\"/images/blank.gif\" width=21></td>";
					}
					html += "<td valign=center width=548><div id=\"image_show\"><img src=\"" + img_url + "\" height=\"" + img_h + "\" width=\"" + img_w + "\"><div style=\"padding-top:20px; text-align:centerl\">" + art_caption + "</div></center></div></td>";
					if(id_next){
						html += "<td valign=center width=21><a href=\"javascript:showart(1, " + id_next + ")\"><img src=\"http://www.freedomofteach.com/images/media_next.gif\" border=0></a></td>";
					} else {
						html += "<td valign=center width=21><img src=\"http://www.freedomofteach.com/images/blank.gif\" width=21></td>";
					}
					html += "</tr><tr><td colspan=3 align=center><a href=\"javascript:showart(0,0,'" + hidediv + "', '" + showdiv + "')\"><img src=\"http://www.freedomofteach.com/images/media_close.gif\" border=0></a></td></tr></table></center>";
					//alert(html);
					document.getElementById(showdiv).innerHTML = html;
				}
				if(action == 0){
					var showdiv = (showdiv == null) ? "thumbs" : showdiv;
					var hidediv = (hidediv == null) ? "fullsize" : hidediv;
					showDIV(showdiv);
					document.getElementById(hidediv).innerHTML = "";
				}
			}	
		
			function showvid_narrow(action, art_id, quality, showdiv, hidediv){
				// set defauolt values
				 
				if(action == 1){	// show the vid
					var showdiv = (showdiv == null) ? "fullsize" : showdiv;
					var hidediv = (hidediv == null) ? "thumbs" : hidediv;
					gallery_title=media_arr[art_id].gallery_title;
					img_url=media_arr[art_id].fullsize;
					img_h=media_arr[art_id].fullsize_h;
					img_w=media_arr[art_id].fullsize_w;
					id_next=media_arr[art_id].next;
					id_prev=media_arr[art_id].prev;					
					art_caption=media_arr[art_id].caption;			
					if (media_arr[art_id].clip_height){
						clip_height = media_arr[art_id].clip_height;
					}
					if (media_arr[art_id].clip_width){
						clip_width = media_arr[art_id].clip_width;
					}				
					hideDIV(hidediv);
					html = "<center>";
					if(gallery_title){
						html += "<div style=\"padding-top:10px\"><h2>" + gallery_title + "</h2></div>";
					}
					html +="<center><iframe style=\"z-index:1\" src =\"/video.php?art_id=" + art_id + "&quality=" + quality + "&clip_height=" + clip_height + "&clip_width=" + clip_width + "\" width=\"" + clip_width + "\" height=\"" + clip_height + "\" scrolling=\"no\" frameborder=\"no\" marginwidth=\"0\" marginheight=\"0\"></iframe></center>";
					if(quality == "high"){
					 html +="<br><a href=\"javascript:showvid_narrow(1," + art_id + ",'low','" + showdiv + "', '" + hidediv + "')\">click here to switch to lo res version</a>"
					}
					if(quality == "low"){
					 html +="<bR><a href=\"javascript:showvid_narrow(1," + art_id + ",'high','" + showdiv + "', '" + hidediv + "')\">click here to switch to hi res version</a>"
					}					
					html += "<br><a href=\"javascript:showart(0, 0,'" + hidediv + "', '" + showdiv + "')\"><img src=\"http://www.freedomofteach.com/images/media_close.gif\" border=0></a></center>";
					//alert(html);
					document.getElementById(showdiv).innerHTML = html;
				}
				if(action == 0){ // hide tie vid/ show what was there before
					var showdiv = (showdiv == null) ? "thumbs" : showdiv;
					var hidediv = (hidediv == null) ? "fulslize" : hidediv;
					
					showDIV(showdiv);
					document.getElementById(hidediv).innerHTML = "";
				}
			}	
			
		function showvid(action, art_id, quality, showdiv, hidediv){
				// set defauolt values
				 
				if(action == 1){	// show the vid
					var showdiv = (showdiv == null) ? "fullsize" : showdiv;
					var hidediv = (hidediv == null) ? "thumbs" : hidediv;
					gallery_title=media_arr[art_id].gallery_title;
					img_url=media_arr[art_id].fullsize;
					img_h=media_arr[art_id].fullsize_h;
					img_w=media_arr[art_id].fullsize_w;
					id_next=media_arr[art_id].next;
					id_prev=media_arr[art_id].prev;					
					art_caption=media_arr[art_id].caption;
					
					var clip_height = 430;
					var clip_width = 550;
					
					if (media_arr[art_id].clip_height){
						clip_height = media_arr[art_id].clip_height;
					}
					if (media_arr[art_id].clip_width){
						clip_width = media_arr[art_id].clip_width;
					}


					
					hideDIV(hidediv);
					html = "<center>";
					html += "<div style=\"padding-top:10px\"><h2>" + gallery_title + "</h2></div><table cellpadding=0 cellspacing=0 border=0 width=\"550\"><tr>";
					if(id_prev){
						html += "<td valign=center><a href=\"javascript:showart(1, " + id_prev + ")\"><img src=\"http://www.freedomofteach.com/images/media_back.gif\" border=0></a></td>";
					} else {
						html += "<td valign=center><img src=\"http://www.freedomofteach.com/images/blank.gif\" width=21></td>";
					}
					//html += "<td valign=center width=100%><div id=\"image_show\"><img src=\"" + img_url + "\" height=\"" + img_h + "\" width=\"" + img_w + "\"><br/>"
					html +="<center><iframe style=\"z-index:1\" src =\"/video.php?art_id=" + art_id + "&quality=" + quality + "&clip_height=" + clip_height + "&clip_width=" + clip_width + "\" width=\"" + clip_width + "\" height=\"" + clip_height + "\" scrolling=\"no\" frameborder=\"no\" marginwidth=\"0\" marginheight=\"0\"></iframe></center>";
					if(quality == "high"){
					 html +="<br><a href=\"javascript:showvid(1," + art_id + ",'low','" + showdiv + "', '" + hidediv + "')\">click here to switch to lo res version</a>"
					}
					if(quality == "low"){
					 html +="<bR><a href=\"javascript:showvid(1," + art_id + ",'high','" + showdiv + "', '" + hidediv + "')\">click here to switch to hi res version</a>"
					}
					
					
					html += "</center></div></td>";
					if(id_next){
						html += "<td valign=center><a href=\"javascript:showart(1, " + id_next + ")\"><img src=\"http://www.freedomofteach.com/images/media_next.gif\" border=0></a></td>";
					} else {
						html += "<td valign=center><img src=\"http://www.freedomofteach.com/images/blank.gif\" width=21></td>";
					}
					html += "</tr></table><a href=\"javascript:showart(0, 0,'" + hidediv + "', '" + showdiv + "')\"><img src=\"http://www.freedomofteach.com/images/media_close.gif\" border=0></a></center>";
					//alert(html);
					document.getElementById(showdiv).innerHTML = html;
				}
				if(action == 0){ // hide tie vid/ show what was there before
					var showdiv = (showdiv == null) ? "thumbs" : showdiv;
					var hidediv = (hidediv == null) ? "fulslize" : hidediv;
					
					showDIV(showdiv);
					document.getElementById(hidediv).innerHTML = "";
				}
			}		
			
			function showart_update_thumb(art_id){
				getMovieName("gallery_thumbs").showart_update_thumb(art_id); 
				
			}
			function getMovieName(movieName) {
				if (navigator.appName.indexOf("Microsoft") != -1) {
					return window[movieName]
				} else {
				return document[movieName]
				}
			}
			
					
			function showart_artist(action, art_id, showdiv, hidediv){
				
				
				// hide the text
				//hideDIV("artist_text");
				//showDIV("artist_art");
				swap("artist_text", "artist_art");
				if(action == 1){
					// get vars from the media object
					art_title=media_arr[art_id].art_title;
					img_fullsize = media_arr[art_id].fullsize;
					img_h=media_arr[art_id].fullsize_h;
					img_w=media_arr[art_id].fullsize_w;
					id_next=media_arr[art_id].next;
					id_prev=media_arr[art_id].prev;
					art_caption=media_arr[art_id].caption;
					// change thumbnail /// BUG IS HERE
					//showart_update_thumb(art_id);
				//return;
				
				// write the html
					flash_h = (parseInt(img_h));
					flash_w = (parseInt(img_w) );
					html = "<center>";
					html += "<table cellpadding=0 cellspacing=0 border=0 width=519><tr><td valign=top align=right><div class=\"orange\" style=\"padding:70px 0px 0px 0px\">" + media_arr[art_id].pic_num + " of " + pics_total + "</div>";
					if(id_prev){
						html += "<a href=\"javascript:showart_artist(1, " + id_prev + ")\"><img src=\"http://www.freedomofteach.com/images/media_back.gif\" border=0 style=\"padding:20px 0px 0px 0px\"></a>";
					}
					html += "<br><img src=\"http://www.freedomofteach.com/images/blank.gif\" width=50></td><td valign=center align=center width=100%>";
					
					html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + flash_w + '" height="' + flash_h +'" id="gallery_fullsize" align="middle">';
					html += '<param name="salign" value="lt" />';
					html += '<param name="FlashVars" value="art_id=' + art_id +  '&fullsize=' +  img_fullsize + '">';
					html += '<param name="allowScriptAccess" value="sameDomain" /><param name="scale" value="noscale" />';
					html += '<param name="movie" value="http://www.freedomofteach.com/gallery_fullsize.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#bfc0c1" />';
					html += '<embed src="http://www.freedomofteach.com/gallery_fullsize.swf" quality="high" bgcolor="#bfc0c1" FlashVars="art_id=' + art_id +  '&fullsize=' +  img_fullsize + '" width="' + flash_w + '" height="' + flash_h + '" scale="noscale" salign="lt"  name="gallery_fullsize" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
					
					if(art_title){
						html +=  "<div style=\"color:black; padding:20px 0px 5px 0px\"><em>title: </em>" + art_title + "</div>";
					}
					if(art_caption){
						html +=  "<div style=\" padding:0px 0px 5px 0px\">" + art_caption + "</div>";
					}
					html += "</div></center></td><td valign=top align=left>";
					if(id_next){
						html += "<div class=\"orange\" style=\"padding:70px 0px 0px 0px\">&nbsp;</div><a href=\"javascript:showart_artist(1, " + id_next + ")\"><img src=\"http://www.freedomofteach.com/images/media_next.gif\" style=\"padding:20px 0px 0px 0px\" border=0></a>";
					} 
					html += "<br><img src=\"http://www.freedomofteach.com/images/blank.gif\" width=50></td>";
					html += "</tr></table></center>";
					//alert(html);
					document.getElementById("artist_art").innerHTML = html;
					//swap('artist_text', 'artist_art');
				}
				if(action == 0){
					//var showdiv = (showdiv == null) ? "artist_text" : showdiv;
					//var hidediv = (hidediv == null) ? "artist_art" : hidediv;
					//showDIV(showdiv);
					//document.getElementById(hidediv).innerHTML = "";
				}
			}	

function showart_artist_old(action, art_id, showdiv, hidediv){
				// hide the text
				//hideDIV("artist_text");
				//showDIV("artist_art");
				swap("artist_text", "artist_art");
				if(action == 1){
					// get vars from the media object
					art_title=media_arr[art_id].art_title;
					img_fullsize = media_arr[art_id].fullsize;
					img_h=media_arr[art_id].fullsize_h;
					img_w=media_arr[art_id].fullsize_w;
					id_next=media_arr[art_id].next;
					id_prev=media_arr[art_id].prev;
					art_caption=media_arr[art_id].caption;
					// change thumbnail
					showart_update_thumb(art_id);
					// write the html
					flash_h = (parseInt(img_h));
					flash_w = (parseInt(img_w) );
					html = "<center>";
					html += "<table cellpadding=0 cellspacing=0 border=0 width=519><tr><td valign=top><div class=\"orange\" style=\"padding:70px 0px 0px 0px\">" + media_arr[art_id].pic_num + " of " + pics_total + "</div>";
					if(id_prev){
						html += "<a href=\"javascript:showart_artist(1, " + id_prev + ")\"><img src=\"http://www.freedomofteach.com/images/media_back.gif\" border=0 style=\"padding:20px 0px 0px 10px\"></a>";
					}
					html += "<br><img src=\"http://www.freedomofteach.com/images/blank.gif\" width=50></td><td valign=center align=center width=100%>";
					
					html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + flash_w + '" height="' + flash_h +'" id="gallery_fullsize" align="middle">';
					html += '<param name="salign" value="lt" />';
					html += '<param name="FlashVars" value="art_id=' + art_id +  '&fullsize=' +  img_fullsize + '">';
					html += '<param name="allowScriptAccess" value="sameDomain" /><param name="scale" value="noscale" />';
					html += '<param name="movie" value="http://www.freedomofteach.com/gallery_fullsize.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#bfc0c1" />';
					html += '<embed src="http://www.freedomofteach.com/gallery_fullsize.swf" quality="high" bgcolor="#bfc0c1" FlashVars="art_id=' + art_id +  '&fullsize=' +  img_fullsize + '" width="' + flash_w + '" height="' + flash_h + '" scale="noscale" salign="lt"  name="gallery_fullsize" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
					
					if(art_title){
						html +=  "<div style=\"color:black; padding:20px 0px 5px 0px\"><em>title: </em>" + art_title + "</div>";
					}
					if(art_caption){
						html +=  "<div style=\" padding:0px 0px 5px 0px\">" + art_caption + "</div>";
					}
					html += "</div></center></td><td valign=top align=right>";
					if(id_next){
						html += "<div class=\"orange\" style=\"padding:70px 0px 0px 0px\">&nbsp;</div><a href=\"javascript:showart_artist(1, " + id_next + ")\"><img src=\"http://www.freedomofteach.com/images/media_next.gif\" style=\"padding:20px 10px 0px 0px\" border=0></a>";
					} 
					html += "<br><img src=\"http://www.freedomofteach.com/images/blank.gif\" width=50></td>";
					html += "</tr></table></center>";
					//alert(html);
					document.getElementById("artist_art").innerHTML = html;
					//swap('artist_text', 'artist_art');
				}
				if(action == 0){
					//var showdiv = (showdiv == null) ? "artist_text" : showdiv;
					//var hidediv = (hidediv == null) ? "artist_art" : hidediv;
					//showDIV(showdiv);
					//document.getElementById(hidediv).innerHTML = "";
				}
			}	



