		  function display(epSegs)
			{
			var xmlDoc;
			if (window.XMLHttpRequest)
			  {
			  xmlDoc=new window.XMLHttpRequest();
			  xmlDoc.open("GET", epSegs+".xml",false);
			  xmlDoc.send("");
			  xmlDoc=xmlDoc.responseXML;
			  }
			// IE 5 and IE 6
			else if (ActiveXObject("Microsoft.XMLDOM"))
			  {
			  xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
			  xmlDoc.async=false;
			  xmlDoc.load( epSegs+".xml");
			  }
			var x=xmlDoc.getElementsByTagName("segment");

			episodeList ="";
			for (var i=0;i<x.length;i++)
				{ 
					//a = i + 1;
					flvSrc = (x[i].getElementsByTagName("url")[0].childNodes[0].nodeValue);
					
					topPreV = "<div id='"+ i +"' title='"+ flvSrc +"' class='segDiv' onmouseover='collapse(this.id)' onmouseout='uncollapse(this.id);' onclick='loadPlayer(this.title,this.id,0);'>";
					
					botPreV = "</div>";
					
					
					// "<img style ='clear:right' src='" + (x[i].getElementsByTagName("thumbNormal")[0].childNodes[0].nodeValue)+"' />";
					imgSrc = (x[i].getElementsByTagName("thumbNormal")[0].childNodes[0].nodeValue);
					flvSrc = (x[i].getElementsByTagName("url")[0].childNodes[0].nodeValue);
					//alert (flvSrc);
					imgPreV = "<img class='imgPreview' id='img"+ i + "' style='clear:right;vertical-align:text-top;' src='../video/"+ imgSrc+"'/><br>"
					//alert (imgSrc);
					
					titlePreV = "<b><label id='lblCurTitle"+ i +"'>" + (x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue) +"</label></b><br>";
					descPreV = "<span style='display:none' id='span_" + i + "'>" + titlePreV  + "<label id='lblCurDesc"+ i +"'>" + (x[i].getElementsByTagName("description")[0].childNodes[0].nodeValue)+"</label></span>";
					
					//a = topPreV + imgPreV + titlePreV + "<br>" + descPreV + botPreV;
					a = topPreV + imgPreV  + descPreV + botPreV;
					episodeList += a ;
					//alert (appList);					
				}
				document.getElementById("divSegments").innerHTML= episodeList;// + '<a href="http://www.energystar.gov/" target="_blank" style="color:#ffffff;"><div class="segDivSponsor">Optional Episode Sponsor</div></a>' ;
				
			}

	//**********************************************************************************************
		function setText(id){
			
			var src = document.getElementById(id+"_IN");
			if(src.className != "NowPlayDiv NowPlayingEpisode")
			{
				src.className = "NowPlayDiv NowPlayingEpisodeHover";
				//opacity(id,70,100,500);
			}
		//	src.style.backgroundColor = '#efefef';
		//	src.style.padding = '20px';
			//var element = document.getElementById('lblText');
			var segments = document.getElementById('divSegments');
			//var EpImg = document.getElementById('imgEpisodeIntro');
			
			
		
			//element.style.opacity == '0';

			//id;
			/*
			opacity('fadeBlock',100,0,0);
			setTimeout( "end();",200);
			element.innerHTML = id;
			var epSegs = id;

			
			display(epSegs);
			imgSrc = "images/" + id + "_1_intro.jpg";
			EpImg.src= imgSrc; 
			*/
		}
		function end(){ 
			opacity('fadeBlock',0,100,500);
			
			}
		function collapse(id){
			
			var src = document.getElementById(id);
			var img = document.getElementById("img" + id);
			var curDesc = document.getElementById("curDesc");
			var descImg = document.getElementById("desImg");
			
			var lblNowPlayingSegmentHover = document.getElementById("lblNowPlayingSegmentHover");
			
			//alert("collapse id: " +id);
			
			imgSrc = img.src;
			imgFlip = imgSrc.replace(".gif" , "_rollover.gif")
//			descImg.src = imgSrc;
		
			
			curDesc.innerHTML = "<img src='" + imgFlip  + "'/><br>" + document.getElementById("span_"+id).innerHTML;
			lblNowPlayingSegmentHover.innerHTML =  document.getElementById("lblCurDesc"+id).innerHTML;
			img.src = imgFlip;
			
			src.style.cursor = "pointer";
			src.style.backgroundColor = '#68A136';//#333333';
			//opacity(id,60,100,900);
		}
		function uncollapse(id){
			
			var src = document.getElementById(id);
			var imgOut = document.getElementById("img" + id);
		 	var imgSrcOut = imgOut.src;
	 		
			
			document.getElementById("lblNowPlayingSegmentHover").innerHTML= "";
			imgOut.src = imgSrcOut.replace("_rollover.gif",".gif" );
			
			if (src.className == "segDiv active"){
					src.style.backgroundColor = "#68A136";//#333333";
			}
			else {
				src.style.backgroundColor = "#D9D2C1"; //transparent
				};
		}
			

		//**********************************************************************************************
		function bg(id){
			var src = document.getElementById(id+"_IN");
			
			if(src.className != "NowPlayDiv NowPlayingEpisode")
			{
				src.className = "NowPlayDiv";
			}
			//opacity(id,100,60,900);
			//opacity('fadeBlock',100,50,500);
		 //	src.style.backgroundColor='#ffffff';
		//	src.style.padding = '10px';
			
		}
		//**********************************************************************************************
		
		function opacity(id, opacStart, opacEnd, millisec) {
			//speed for each frame
			var speed = Math.round(millisec / 100);
			var timer = 0;
		
			//determine the direction for the blending, if start and end are the same nothing happens
			if(opacStart > opacEnd) {
				for(i = opacStart; i >= opacEnd; i--) {
					setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
					timer++;
				}
			} else if(opacStart < opacEnd) {
				for(i = opacStart; i <= opacEnd; i++)
					{
					setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
					timer++;
				}
			}
		}
		
		//change the opacity for different browsers
		function changeOpac(opacity, id) {
			var object = document.getElementById(id).style;
			object.opacity = (opacity / 100);
			object.MozOpacity = (opacity / 100);
			object.KhtmlOpacity = (opacity / 100);
			object.filter = "alpha(opacity=" + opacity + ")";
		} 

		
		
		function showInfo(){
		
		
		/**/
		var plugin = $f("player").getPlugin("content");

		if (plugin.opacity == 1){
			plugin.fadeOut(2000);
		}
		else if (plugin.opacity == 0){
			plugin.fadeIn(2000);
		}
}




	function ajaxUpdater(id,url) {  
//		alert (id +"--"+url);
		new Ajax.Updater(id,url,{asynchronous:true}); 
		setTimeout( "renderTab();",1000);
		
		
	}
	
	function ajaxUpdaterT(id,url) {  
		new Ajax.Updater(id,url,{asynchronous:true}); 
		//setTimeout( "renderTab();",1000);
	}    

	//RENDER Tab Function
	function renderTab(){
		
		new Control.Tabs('main_tabs',{linkSelector: 'li.tab a',	defaultTab: 'ProjectGuide'});
	
	//END Tab Render
	
	}
	
	/* ajax.Request */
		function ajaxRequest(url,data) {
		  var aj = new Ajax.Request(
		  url, {
		   method:'get', 
		   parameters: data, 
		   onComplete: getResponse
		   }
		  );

		}
		/* ajax.Response */
		function getResponse(oReq) {
		  $('result').innerHTML = oReq.responseText;
		    
		}


/************************************************************************************/
function loadPlayer(id,imgId,imgRoll){

			var lblNowPlayingTitle = document.getElementById('lblNowPlayingTitle');
			var lblNowPlayingSegment = document.getElementById('lblNowPlayingSegment');
			var lblPage = document.getElementById("lblPageName");

			//lblNowPlayingTitle.innerHTML = document.getElementById(imgId).innerHTML + "&nbsp;>&nbsp;";
			lblNowPlayingSegment.innerHTML = document.getElementById('lblCurTitle'+imgId).innerHTML;
			
			if(imgRoll == 0){

			var inactiveDiv = getElementsByClassName('segDiv active')[0];
	//		alert(inactiveDiv.id);
			inactiveDiv.className = "segDiv";
			inactiveDiv.style.backgroundColor = '#D9D2C1'; //transparent
			
			//var inactiveDiv = getElementsByClassName("segDiv active");
			//alert(inactiveDiv.id);
						
			document.getElementById(imgId).className = "segDiv active";

			imgId = document.getElementById("img"+imgId).src;
			
			if (imgId.substr(7,3) =='www')
				{
				 	imgId=imgId.replace("http://www.greenmadesimple.com/video/thumbs/","");
				}
			else if (imgId.substr(7,3) =='gre')
				{
					imgId=imgId.replace("http://greenmadesimple.com/video/thumbs/","");
				};
			
			//alert(imgId.substr(7,3));
			imgId=imgId.replace("http://www.greenmadesimple.com/video/thumbs/","");
			
			imgId=imgId.replace("_rollover.gif","");
				}
					else
				{

					imgId = imgRoll;
			}					
			//alert(imgId);
			//alert(imgId.substr(7,3));
			imgId=imgId.replace("http://www.greenmadesimple.com/video/thumbs/","");
			
			
			episodeImg = imgId.substr(0,3).toUpperCase();
			
			segmentImg = imgId.substr(4).toUpperCase();
			activeTab = 'ProjectGuide';
			activeTabTarget ='ProjectGuide';
			args = '?EP='+ episodeImg + '&SEG='+ segmentImg + '&TAB=';
			
			//alert (args);
			
			ajaxUpdater(activeTabTarget,'updateme.php'+ args + activeTab);

			var link = document.getElementById("player");
			var VidSegment = document.getElementById("lblSegment");
			//var divShowHide = document.getElementById("divShowHide");
			

			
			
			VidSegment.innerHTML = " :: " + id.replace('http://greenmadesimple.s3.amazonaws.com/gmstv2/','');
			
			//divShowHide.style.display = "block";
			link.href = id;//"video/"+ id + ".flv";
			link.style.backgroundColor = "#333333";//#68A136";//
		
		

		
				
		var player = $f("player", "player/flowplayer-3.1.3.swf",{
			 
  		plugins: { 
			gatracker: { 
		 	  url: 'player/flowplayer.GoogleTracker.swf', 
			  google_id: 'UA-3481467-1', 
			  debug: false
			}, 
			
   			controls: {
			  backgroundGradient: 'high',
			  borderRadius: 0,  
			  bottom:0,
			  left:0,  
			  tooltips:  { buttons: true },  
			  width: '100%',  
			  fullscreen: true,  
			  mute: true,  
			  volume: true,
			  progressColor: '#68A136',
			  buttonColor: '#68A136',//#D3EABF
			  backgroundColor: '#cccccc'
              //durationColor: '#fcee31'
			   //sliderColor: '#000000', 
			  //			  opacity: .8,  

              // 			  autoHide: false,
              //tooltipTextColor: '#ffffff', 
              // 
              /*progressGradient: 'medium', 
              bufferGradient: 'none', 
              tooltipColor: '#5F747C', 
              timeBgColor: '#555555', 
              sliderGradient: 'none', 
              
              volumeSliderColor: '#000000', 
              timeColor: '#fbf013', 
             
              borderRadius: '0px', 
              
              buttonOverColor: '#fbee37', 
              volumeSliderGradient: 'none', 
              height: 24, 
              opacity: 1.0 */
             },
		  content:{
					url: 'player/flowplayer.content-3.1.0.swf', 
					top: 200,
					left: 110,
					width: 400, 
					height: 100, 
					//padding: 4,
					borderRadius: 5,
					opacity: .92,
					backgroundColor:'#009900',
					style: {
							p: {
								fontSize: 18
								}
					},
					display: 'none',
					onClick: function(){
						this.fadeOut(2000); 
					}
				  }


           }, 
		   onLoad: function() { 
                var plugin = $f("player").getPlugin("content"); 
				plugin.append(document.getElementById("curDesc").innerHTML);  
				//plugin.fadeIn(2000);
				

             },	
		  clip: { 
		        
			 	onCuepoint: [4000, function(clip) { 
						var plugin = $f("player").getPlugin("content"); 
						plugin.fadeOut(5000);//.setHtml(document.getElementByID("content1").html); 
					}]
		   }
		
  }); 
			
			/*
			plugins:{

			content:{
					url: 'player/flowplayer.content-3.1.0.swf', 
					top: 150,
					//left: 20,
					width: 500, 
					height: 100, 
					padding: 14,
					borderRadius: 5,
					opacity: .92,
					backgroundColor:'#009900',
					style: {
							p: {
								fontSize: 18
								}
					},
					display: 'none',
					onClick: function(){
						this.fadeOut(2000); 
					}
				  },

				clip: { 
					url:'player/flowplayer.controls-3.1.3.swf',
					onCuepoint: [1000, function(clip) { 
						var plugin = $f("player").getPlugin("content"); 
					plugin.fadeOut(2000);//.setHtml(document.getElementByID("content1").html); 
					}]
				},			
			controls: {
				//autoHide: true,
				backgroundGradient: 'high',  
				borderRadius: 13,  
				bottom: 5,  
				hideDelay: 2000,  
				left: '50%',  
				tooltips:  { buttons: true },  
				width: '90%',  
				fullscreen: true,  
				mute: true,  
				volume: true
			}



						}
			});*///endo to var:player section
		  
		  $f().load();
			// this function is called when splash image is clicked or player's load() method is called 
			//player.onLoad(function()  { 
			 
				// this is the place to start scripting with Flowplayer 
				//alert("player loaded"); 
			 
				// this- variable points to the player's API 
			//this.getScreen().animate({width:636, height:358}); 
		}
		  
		  
		  //display();
		  // JavaScript Document
		  
	document.observe('dom:loaded',function(){
		new Control.Tabs('main_tabs',{
			linkSelector: 'li.tab a',
			defaultTab: 'ProjectGuide'
		});
	});
	
	function isActiveDiv(id){
		
		var activeDiv =  document.getElementById(id);
		if (activeDiv.className = "segDiv active"){
			alert('this is active');
			activeDiv.style.backgroundColor = '#68A136';//#333333';
		}
	}