// JavaScript Document
var MOVIES = new Array();
var IMAGES = new Array();
var WIDTH = "300";
var HEIGHT = "60";

var SECTION = "flex08";
var SECTIONS = new Array();
SECTIONS["flex08"] = "http://www.flexperienceconsulting.com/forum/flex2008/";

var BLURBS = new Array();
BLURBS["flex08"] = "";


var LINKS = new Array();
LINKS["flex08"] = new Array();

function sendEvent(swf,typ,prm) { 
  thisMovie(swf).sendEvent(typ,prm); 
};
function getUpdate(typ,pr1,pr2,swf) {};
function thisMovie(swf) {
  if(navigator.appName.indexOf("Microsoft") != -1) {
    return window[swf];
  } else {
    return document[swf];
  }
};

var slideNum = 0;
var movieNum = 0;
var currTimeout;
var movieDone = false;
function slideShow() {
	
	showImage(slideNum);
	slideNum = (slideNum + 1) % IMAGES[SECTION].length;
	currTimeout = setTimeout("slideShow()",3000);
}
function movieShow() {
    if ( movieDone ) {
	showMovie(movieNum);
	movieNum = (movieNum + 1) % MOVIES[SECTION].length;
	}
	currTimeout = setTimeout("movieShow()",1000);
}

function addImage(sec,info) {
	if ( ! IMAGES[sec] ) {
		IMAGES[sec] = new Array();
	}
	IMAGES[sec].push(info.split("|"));
}

//for ( i = 12; i > 0; i-- ){
//}


function addMovie(sec,id,desc,title,who) {
	if ( ! MOVIES[sec] ) {
		MOVIES[sec] = new Array();
	}
	MOVIES[sec].push(new Array(id,desc,title,who));
}


/** Generated code 
addMovie("flex08","flex2008-06-1","Introduction","Introduction","");
addMovie("flex08","flex2008-06-2","Keynote Address","","");
addMovie("flex08","flex2008-06-3","Moderator","","");
addMovie("flex08","flex2008-06-4","Panel Discussion","","");
addMovie("flex08","flex2008-06-5","Questions and Answers 1","How do you think about productivity in a part time context?","");
addMovie("flex08","flex2008-06-6","Questions and Answers 2","What are some strategies for hourly employees?","");
addMovie("flex08","flex2008-06-7","Questions and Answers 3","","");
addMovie("flex08","flex2008-06-8","Questions and Answers 4","","");
addMovie("flex08","flex2008-06-9","Closing Statements","","");
**/
addMovie("flex08","intro","Introduction","","");
addMovie("flex08","keynote","Keynote Address","","");
addMovie("flex08","moderator","Moderator","","");
addMovie("flex08","panel","Panel Discussion","","");
addMovie("flex08","QA1","Questions and Answers 1","How do you think about productivity in a part time context?","");
addMovie("flex08","QA2","Questions and Answers 2","What are some strategies for hourly employees?","");
addMovie("flex08","QA2.5","Questions and Answers 3","What are the attitudes towards part time work?","");
addMovie("flex08","QA2.6","Questions and Answers 4","What is your perspective on job sharing?","");
addMovie("flex08","QA3","Questions and Answers 5","What is &quot;on-ramping&quot;? How do you define a flexible work environment?","");
addMovie("flex08","Q4","Questions and Answers 6","How do you create a flexible work environment in the home office.","");
addMovie("flex08","Q5","Questions and Answers 7","How do you stay in regulatory compliance with flexible work environments?","");
addMovie("flex08","Q6","Questions and Answers 8","How do you break the face to face model?","");
addMovie("flex08","Q7","Questions and Answers 9","What is the impact of unions?","");
addMovie("flex08","Q8","Questions and Answers 10","What percentage of your workforce has a flexible work arrangement?","");
addMovie("flex08","Q9","Questions and Answers 11","How about the efficiency of the model?","");
addMovie("flex08","Q10","Questions and Answers 12","How do you manage this globally?","");
addMovie("flex08","Q11","Questions and Answers 13","How do smooth the transitions to and from maternity?","");
addMovie("flex08","Q12","Questions and Answers 14","Any final words of advice?","");
addMovie("flex08","closing","Closing","","");


addImage("flex08","desc|flex2008|DSC_0113");
addImage("flex08","desc|flex2008|DSC_0114");
addImage("flex08","desc|flex2008|DSC_0115");
addImage("flex08","desc|flex2008|DSC_0116");
addImage("flex08","desc|flex2008|DSC_0118");
addImage("flex08","desc|flex2008|DSC_0119");
addImage("flex08","desc|flex2008|DSC_0120");
addImage("flex08","desc|flex2008|DSC_0121");
addImage("flex08","desc|flex2008|DSC_0126");
addImage("flex08","desc|flex2008|DSC_0131");

var FO;



function initVideo(autoplay){
// FO = {movie:"http://localhost/FLX/cmsmadesimple/player/flvplayer.swf",id:"mediaplayer",name:"mediaplayer",width:"320",height:"260",majorversion:"8",build:"0",bgcolor:"#FFFFFF",allowfullscreen:"true",flashvars:"file=http://flexperienceforum.com/forum1//intro.flv&enablejs=true&overstretch=false" };
// UFO.create(FO, "mm_viewer");
if ( autoplay == false ) {
	autoplay =  'false';
} else {
	autoplay =  'true';
}
/**
	var s1 = new SWFObject("mediaplayer.swf","mediaplayer",WIDTH,HEIGHT,"8");
		s1.addParam("allowfullscreen","true");
		s1.addVariable("width",WIDTH);
		s1.addVariable("height",HEIGHT);
		s1.addVariable('enablejs','true');
		s1.addVariable("file","http://flexperienceforum.com/forum2/intro.flv&enablejs=true&overstretch=false");
		s1.write("mm_viewer");
		
		**/
// list movies 
  var html = "";
  var mov;
  

  //html += "<h3>View the videos and relive the night right from your desktop:</h3>";
  //html += "<ul>";  
  for ( i = 0; i < MOVIES[SECTION].length; i++ ) {
  		mov = MOVIES[SECTION][i];
    	html += '<li class="play"><a href="javascript:void();" onclick="showMovie(' + i + ')">' + mov[1] + '</a></li>'; 
  }
 // html += "</ul>";
  
  if ( document.getElementById("mm_list") ) {
  document.getElementById("mm_list").innerHTML =  html;
  }

  showMovie(0,autoplay);
}

function initImages(tot,w) {
   var img;
   if ( !w ) {
   		w = 100;
   }
   if (! tot ) {
   	tot = 	IMAGES[SECTION].length;
	}
   var html = "";
  
  //html += "<h2>Downloads</h2>";
 // html += "<ul>";  
  //for ( i =0; i < LINKS[SECTION].length; i ++ ){
  //	html += '<li class="download"><a target="_blank" href="' + LINKS[SECTION][i][1] + '">' + LINKS[SECTION][i][0]   + '</a></li>';
 // }
 // html += "</ul>";
  
 // html += "<h2>Photos</h2>";
  //html += "";  
  html += '<a href="javascript:slideShow()">slideshow</a><br>'
  for ( i = 0; i < tot; i++ ) {
  		img = IMAGES[SECTION][i];
    	html += '<a href="javascript:showImage(' + i + ')">' + 
		'<img width="' + w + '" border="0" src="' + "http://www.flexperienceconsulting.com/forum/" + img[1] + "/thumbs/" + img[2] + ".jpg"  + '"></a>'; 
 	}
  html += "";
  document.getElementById("mm_imglist").innerHTML =  html ;
   
}

function showSummary(id) {
	SECTION = id;
	initVideo(false);
	//for ( i = 0; i < SECTIONS.length; i ++ ) {
	//	document.getElementById(SECTIONS[i]).style.fontWeight = "normal";
	//}
	//document.getElementById(id).style.fontWeight = "bold";
	//document.getElementById("event_details").innerHTML = BLURBS[id];
	initImages(9);
}
function showImages(sect) {
	SECTION = sect;
	initImages(null,90);
	//for ( i = 0; i < SECTIONS.length; i ++ ) {
	//	document.getElementById(SECTIONS[i]).style.fontWeight = "normal";
	//}
	//document.getElementById(id).style.fontWeight = "bold";
	//document.getElementById("event_details").innerHTML = BLURBS[sect];
	showImage(0);
}


function showSection(id) {
	SECTION = id;
	initVideo();
	for ( i = 0; i < SECTIONS.length; i ++ ) {
		document.getElementById(SECTIONS[i]).style.fontWeight = "normal";
	}
	document.getElementById(id).style.fontWeight = "bold";
	document.getElementById("event_details").innerHTML = BLURBS[id];
	
}
function nextMovie() {
	movieNum ++;
	showMovie( movieNum , 'true');
}
function showMovie(ndx,autoplay) {
movieNum = ndx;
clearTimeout(currTimeout);
  var mov = MOVIES[SECTION][ndx];
  var urlbase = SECTIONS[SECTION];
 
// id,desc,title,who
  var name = mov[2];
  var id = mov[0];
  var title = mov[2];
  var description = mov[1];
  var who = mov[3];
  
  newMovie(urlbase,name,id,title,description,who,autoplay);
}
function showImage(ndx) {
  var img = IMAGES[SECTION][ndx];
  var urlbase = "http://www.flexperienceconsulting.com/forum/";
  var path =  img[1] ;
  var desc = img[0];
	var url = "http://www.flexperienceconsulting.com/forum/" + img[1] + "/" + img[2] + ".jpg";  
	
if( document.getElementById("mm_imgviewer") ) {
  document.getElementById("mm_imgviewer").innerHTML = '<a href="' + url + '" target="nwwind"><img id="curr_img" src="' + url + '" border="0"  width="100%"/></a>'

}
if( document.getElementById("mm_viewer") ) {
  document.getElementById("mm_viewer").innerHTML = '<a href="' + url + '" target="nwwind"><img id="curr_img" src="' + url + '" border="0" height="100%" width="100%"/></a>'

}
	
	
	
  document.getElementById("mm_id").innerHTML = "";
  document.getElementById("mm_name").innerHTML ="";
 // document.getElementById("mm_url").innerHTML = directurl;
  document.getElementById("mm_title").innerHTML = "";
  document.getElementById("mm_description").innerHTML = desc;
 // document.getElementById("mm_created").innerHTML = created;
 // document.getElementById("mm_modified").innerHTML = modified;
  //document.getElementById("mm_start_date").innerHTML ="";
 // document.getElementById("mm_end_date").innerHTML = end_date;
 // document.getElementById("mm_genre").innerHTML = "";
 // document.getElementById("mm_member").innerHTML = member;
 // document.getElementById("mm_length").innerHTML ="";
}


var currentPosition;
var currentVolume;


function newMovie(urlbase,name,id,title,description,who, autoplay) {
//
// This function will load the movie file into the player
// (Note, the URL and a bunch of other possible parameters are not 
// given to the loadFile function (see above), only the defaults are
// you should be able to modify this code to do that as you see fit.
//
// This function also attempts to modify the text of some divs to update
// a detail view.  You will need the id's specified below to appear
// somewhere in one of your templates.
//  
//
// Note: the id's used in the getElementById calls below must match those
// in your detail view.  This is used  to perform dynamic updating of the
// detail view when clicking on an item in the summary view.
//
  movie = urlbase+''+id+'.mp3';
  image = urlbase+''+id+'.jpg';
  
  		var s1 = new SWFObject("mediaplayer.swf","mediaplayer",WIDTH,HEIGHT,"8");
		s1.addParam("allowfullscreen","false");
		s1.addVariable("width",WIDTH);
		s1.addVariable("height",HEIGHT);
		if ( autoplay == 'true' ) {
		s1.addVariable("autostart","1");
		}
		s1.addVariable("file",movie);
		s1.write("mm_viewer");

  
  //loadFile(movie,title,movie,id,image,member);
  document.getElementById("mm_id").innerHTML = id;
  document.getElementById("mm_name").innerHTML = name;
  document.getElementById("mm_title").innerHTML = title;
  document.getElementById("mm_description").innerHTML = description;
  document.getElementById("mm_who").innerHTML = who;
};
