    var yt_id = new Array();
    var yt_video_id = new Array();
    var yt_video_owner = new Array();
    var wyt_video_url = new Array();
    var yt_video_url = new Array();
 
    
        yt_id.push("Nq9XykAeGRA");
        yt_video_id.push("Nq9XykAeGRA");
        yt_video_owner.push("Livingston County Tourism");
      wyt_video_url.push('fingerlakeswest.com');
     yt_video_url.push('fingerlakeswest.com');

    
        yt_id.push("oF37pgxNkI0");
        yt_video_id.push("oF37pgxNkI0");
        yt_video_owner.push("Ellis Hollow Vacation");
      wyt_video_url.push('ellishollow.perfect-heritage.com');
     yt_video_url.push('ellishollow.perfect-heritage.com');

    
        yt_id.push("Kv1fFpuDQx4");
        yt_video_id.push("Kv1fFpuDQx4");
        yt_video_owner.push("Lansing Center");
      wyt_video_url.push('lansing.perfect-heritage.com');
     yt_video_url.push('lansing.perfect-heritage.com');

    
        yt_id.push("zfPbxSm65mE");
        yt_video_id.push("zfPbxSm65mE");
        yt_video_owner.push("Penfield Dental Care");
      wyt_video_url.push('penfielddentistry.com');
     yt_video_url.push('penfielddentistry.com');

     

var colors = new Array('#999966','#003333','#0033CC','#990066','#669933','#336666','#660099','#FFCC00','#FF9F5F','#BF8D47','#B3E059');

var _yt_video_id = new Array('rGWQdQFRKwE','aYJrC4movoI','IVY0TEHhQxs');
var _yt_video_owner = new Array('Learn More...','Buy it on Amazon','Photo Radius');
var _yt_video_url = new Array('http://www.backwayhome.com/index.php?home/category/join_rss','http://www.amazon.com/Detroit-Ragtime-Jazz-Images-America/dp/0738561134/ref=sr_1_2?ie=UTF8&s=books&qid=1264616901&sr=1-2','http://www.photoradius.com/docuad.htm');
var _yt_id = new Array('rGWQdQFRKwE','aYJrC4movoI','IVY0TEHhQxs');
var story_player;
var ytplayer;

//yt_video_id.sort( randOrd );
var swf;
var t;
var timer_is_on=0;
//var rotate_time = 10000;
var resume_time = 30000

// var story_player;
       // Loads the selected video into the player.
      function loadVideo(videoID) {

        if(story_player) {story_player.loadVideoById(videoID);}
      }
	  
// This function is automatically called by the player once it loads
function onYouTubePlayerReady() 
{
	ytplayer = document.getElementById("ytPlayer");
	story_player = document.getElementById("story_player");
}


  
function timedCount()
{
	var next_button = document.getElementById('next_button');
	if(next_button != null) {next_button.click();}
  t=setTimeout("timedCount()",10000);
}

function timed_long_count()
{
	if(!movies_playing() && timer_is_on) 
	{alert('short ' + timer_is_on);
		timedCount(10000);
	}
  else 
	{alert('long ' + timer_is_on);
		t=setTimeout("timedCount()",30000);
	}
}

function movies_playing()
{
	var id;;

	var play_status = false;
	for (i=0;i<=yt_video_id.length - 1;i++)
	{
			id = document.getElementById(yt_video_id[i]).id;
		//	alert(id);
			alert(eval(id).getPlayerState());
		 if (id.getPlayerState() == 1) { play_status = true; }
	}
	return play_status;
}

function start_ad_rotation()
{
   if (!timer_is_on)
   {
      timer_is_on=1;
      timedCount();
   }
}

function pause_ad_rotation()
{
   if (!timer_is_on)
   {
      timer_is_on=1;
      timed_long_count();
   }
}

function stop_all_videos()
{	
	var id;
	clearTimeout(t);
	timer_is_on=0;
	for (i=0;i<yt_video_id.length ;i++)
	{
		id = document.getElementById(yt_video_id[i]);

		id.stopVideo();
	}
	//pause_ad_rotation();
}

function randOrd()
{
   return (Math.round(Math.random())-0.5); 
}

function _get_title_videos()
{
	var table_elements = new Array();
	var slidshow_content = '<DIV id=yt_videos class="items" >';
	
	for (i=0;i<=yt_video_id.length - 1;i++)
	{
	table_elements[i] = '<table class=tbl_config_2>';   
	table_elements[i] += '<tr><td align="center" valign="middle" style="background-color:' + colors[i] + '"><input name="button" type="button" id="button" value="button ';
	table_elements[i] +=  eval(i+1) + '" onClick="show_layered_div2(this.value)"></td></tr><tr><td align="center" valign="middle">caption ' + eval(i+1) + '</td></tr></table>';
	
		// table_elements[i] += '<table class="tbl_video_title"><tr><td>';
		table_elements[i] = '<div id=' + yt_video_id[i] + ' class="element">';  
		table_elements[i] += 'You need Flash player 8+ and JavaScript enabled to view this video.</div>';  
//		table_elements[i] += '<img src=crop.php?video_id=' + yt_video_id[i] + '>';  
//		table_elements[i] += '</td></tr></table>';
//		table_elements[i] += '';


		slidshow_content += table_elements[i];

	}
	
	slidshow_content += '</DIV>';
	document.writeln( slidshow_content);
}

function get_title_videos()
{
	var table_elements = new Array();
	var slidshow_content = '<DIV id=yt_videos class="items" >';
	
	for (i=0;i<=yt_video_id.length - 1;i++)
	{
		// table_elements[i] += '<table class="tbl_video_title"><tr><td>';
		table_elements[i] = '<div id=' + yt_video_id[i] + ' class="element">';  
		table_elements[i] += 'You need Flash player 8+ and JavaScript enabled to view this video.</div>';  
//		table_elements[i] += '<img src=crop.php?video_id=' + yt_video_id[i] + '>';  
//		table_elements[i] += '</td></tr></table>';
//		table_elements[i] += '';


		slidshow_content += table_elements[i];

	}
	
	slidshow_content += '</DIV>';
	document.writeln( slidshow_content);
}

function player(id)
{ 
	for (i=0;i<=yt_video_id.length - 1;i++)
	{youtube_player(yt_video_id[i]);}
}

function youtube_player(id)
{ 
    var params = { allowScriptAccess: "always",
					wmode: "transparent"};
    var atts = { id: id };
    swf = swfobject.embedSWF("http://www.youtube.com/v/" + id + "?enablejsapi=1&playerapiid=ytplayer", 
                       id, "326", "207", "8", null, null, params, atts);
}




function UI_slideshow(src)
{
	var path = '<img src="' + src + '" border="0" class="borders" alt="image">';
	document.writeln(path);
}

function show_layered_div1(element_value)
{
	var tipsDiv = document.getElementById('tbl_concept_1_tooltip');
	tipsDiv.innerHTML = '<center>' + element_value + '</center><br><button id="tbl_concept1_close" onclick="document.getElementById(\'tbl_concept_1_tooltip\').style.display=\'none\'">Close </button>';
	//document.getElementById('showL3Button').click();
}

function show_layered_div2(element_value)
{
	var tipsDiv = document.getElementById('tbl_concept_2_tooltip');
	tipsDiv.innerHTML = '<center>' + element_value + '</center><br><button id="tbl_concept2_close" onclick="document.getElementById(\'tbl_concept_2_tooltip\').style.display=\'none\'">Close </button>';
	//document.getElementById('showL3Button').click();
}

function show_layered_div3(element_value)
{
	var tipsDiv = document.getElementById('tbl_concept_3_tooltip');
	tipsDiv.innerHTML = '<center>' + element_value + '</center><br><button id="tbl_concept3_close" onclick="document.getElementById(\'tbl_concept_3_tooltip\').style.display=\'none\'">Close </button>';
	//document.getElementById('showL3Button').click();
}

function slideshow_data(data_set)
{

	var tables = get_slideshow_data_2();
	var i=0;

	var slidshow_content = '<DIV class="items">';
	
	for (i=0;i<=tables.length - 1;i++)
	{
			
		slidshow_content += '<div class="element">' + tables[i] + '</div>';
		
	}
	
	slidshow_content += '</DIV>';
	document.writeln( slidshow_content);
}


function get_slideshow_data_1()
{

var table_elements = new Array();
var i=0;
for (i=0;i<=15;i++)
{
	table_elements[i] = '<table class=tbl_config_1>';   
	table_elements[i] += '<tr><td align="center" valign="middle" style="background-color:' + colors[i] + '"><input class="modalInput" rel="#L3" name="button" type="button" id="button" value="button ';
	table_elements[i] +=  eval(i+1) + '" onclick="show_layered_div1(this.value)"></td></tr><tr><td align="center" valign="middle">caption ' + eval(i+1) + '</td></tr></table>';
}

return table_elements;	
}

function get_slideshow_data_2()
{

var table_elements = new Array();
var i=0;
for (i=0;i<=yt_video_id.length - 1;i++)
{

	table_elements[i] = '<table class=tbl_config_2>';   
	table_elements[i] += '<tr><td align="center" valign="middle" style="border:1px solid #013C5A"> ';
	table_elements[i] += '<div id=' + yt_video_id[i] + '>';  
	table_elements[i] += 'You need Flash player 8+ and JavaScript enabled to view this video.</div>';  
	table_elements[i] += '</td></tr><tr><td align="center" valign="bottom" height="22px" class=contacttext>' + client_contact(i);	
	table_elements[i] +=  '</td></tr></table>';
}

return table_elements;	
}

function client_contact(i)
{
	for (j=0; j<yt_video_id.length; j++) 
	{
		if (yt_video_id[i] == yt_id[j]) 
		{
			var url = '<a href=http://www.' + yt_video_url[j] + ' target=_blank>';
			url += yt_video_owner[j] + '</a>';
			 return url;
		}
	}
}
function _get_slideshow_data_2()
{

var table_elements = new Array();
var i=0;
for (i=0;i<=2;i++)
{

	table_elements[i] = '<table class=tbl_config_2>';   
	table_elements[i] += '<tr><td align="center" valign="middle" style="background-color:' + colors[i] + '"><input name="button" type="button" id="button" value="button ';
	table_elements[i] +=  eval(i+1) + '" onClick="show_layered_div2(this.value)"></td></tr><tr><td align="center" valign="middle">caption ' + eval(i+1) + '</td></tr></table>';
}

return table_elements;	
}

function get_slideshow_data_3()
{

var table_elements = new Array();
var i=0;
for (i=0;i<=10;i++)
{
	table_elements[i] = '<table  class=tbl_config_3>';   
	table_elements[i] += '<tr><td align="center" valign="middle" style="background-color:' + colors[i] + '"><input name="button" type="button" id="button" value="button ';
	table_elements[i] +=  eval(i+1) + '" onClick="show_layered_div3(this.value)"></td><td align="center" valign="middle">caption ' + eval(i+1) + '</td></tr></table>';
}

return table_elements;	
}