
/*

<!-- 

The swfaddress.js needs to be included after swfobject.js and before the embed declaration 
because it adds a hook that automates the invocation of SWFAddress.addId(flashObjId). 

If you need to include the files differently this SWFAddress method can be called manually and 
everything will function normally.

The id attribute is also very important because the script somehow needs to find the Flash object 
and notify it about address changes. With SWFObject 1.5 this parameter was mandatory but it can be 
easily skipped with the new API.

-->

*/



document.observe("dom:loaded", function() {
  // Load Home after dom is loaded
  loadHome(); // $$('div.tabcontent').invoke('hide');
});


function reportError(request) {
	$F('middle') = "Error";
}

<!-- REGGIE BUSH -->

function hideRows() {
   document.getElementById('rowThree').style.display = 'none';
   document.getElementById('rowKids').style.display = ''
}

function showRows() {
   document.getElementById('rowThree').style.display = '';
   document.getElementById('rowKids').style.display = 'none'
}


function loadHome() {
	var flashvars = {};
    flashvars.pid = pid;

	var params = {};
	params.play = "true";
	params.loop = "false";
	params.quality = "high";
	params.allowscriptaccess = "always";
	var attributes = {};
	attributes.id = "main_navigation_movie_idFlashContent";
	attributes.name = "main_navigation_movie_id";
	attributes.align = "middle";
	swfobject.embedSWF("main_navigation.swf", "main_navigation_movie_div", "980", "80", "8.0.0", "swfobject/expressInstall.swf", flashvars, params, attributes);

 
//	swfobject.embedSWF("main_navigation.swf","main_navigation_movie_div","980","80","8.0.0", 'swfobject/expressinstall.swf',{},{bgcolor: '#CCCCCC',menu: 'false'}, {id: 'main_navigation_movie_id', name: 'main_navigation_movie_id'});
//	loadSWF('RB_Content_HOME.swf', 'middleFlash_div', 'RB_Content_HOME', 980, 390, '');
	swfobject.embedSWF("RB_UnderBar_elements_A.swf?my_type_pass=message","bottomLeft_div","326","148","8.0.0", 'swfobject/expressinstall.swf',{},{bgcolor: '#CCCCCC',menu: 'false'}, {id: 'bottomLeft_id'});
	swfobject.embedSWF("RB_UnderBar_elements_A.swf?my_type_pass=foundations","bottomMiddle_div","326","148","8.0.0", 'swfobject/expressinstall.swf',{},{bgcolor: '#CCCCCC',menu: 'false'}, {id: 'bottomMiddle_id'});
	swfobject.embedSWF("RB_UnderBar_elements_A.swf?my_type_pass=downloads","bottomRight_div","326","148","8.0.0", 'swfobject/expressinstall.swf',{},{bgcolor: '#CCCCCC',menu: 'false'}, {id: 'bottomRight_id'});
	swfobject.embedSWF("RB_Under_JOIN.swf","joinList_div","320","86","8.0.0", 'swfobject/expressinstall.swf',{},{bgcolor: '#CCCCCC',menu: 'false'}, {id: 'joinList_id'});
	swfobject.embedSWF("RB_UnderBar_off.swf", "kidsFlash_div", "980", "16", "8.0.0", 'swfobject/expressinstall.swf',{},{bgcolor: '#CCCCCC',menu: 'false'}, {id: 'LT_UnderBar_off_id'});  

// 	swfobject.embedSWF("swf_address_website.swf","swfAddress_div","480","480","8.0.0", 'swfobject/expressinstall.swf',{id: 'RB_swfAddress'},{bgcolor: '#CCCCCC',menu: 'false'}, {id: 'RB_swfAddress_id'});
//	SWFAddress.addId('RB_swfAddress_id');
	SWFAddress.addId('main_navigation_movie_idFlashContent');
}


function loadSWF2(url, divID, movieID, width, height, flashvarsin){
    if (url=='RB_UnderBar_elements_A.swf') {
       return;
    }

	if(isObject(divID)){
		//replace object/element with a new div
		replaceSwfWithEmptyDiv(divID);
	}
     swfobject.createSWF('RB_Content_HOME.swf', divID, '980', '390', '8.0.0', 'swfobject/expressinstall.swf', {}, {bgcolor: '#CCCCCC', menu: 'false'}, {id: 'website'});

}



function isObject(divID){
	var isFound = false;
	var el = document.getElementById(divID);

	if(el && (el.nodeName === "OBJECT" || el.nodeName === "EMBED")){
		isFound = true;
	}
	return isFound;
}


function replaceSwfWithEmptyDiv(divID){
    
	var el = document.getElementById(divID);
	
	if(el){
		var div = document.createElement("div"); 
		el.parentNode.insertBefore(div, el);
    	swfobject.removeSWF(divID);
		div.setAttribute("id", divID);
        return true;
	} else {
        alert('el=false');
        return false;
    }
}


function loadSWF3(url, divID, movieID, width, height, flashvarsin){
	if(isObject(divID)){
		//replace object/element with a new div
		replaceSwfWithEmptyDiv(divID);
	}
	
	if (swfobject.hasFlashPlayerVersion("7")) {
		var attributes = { data: url, width:"550", height:"400" };
		var params = {id: 'website'};
		var obj = swfobject.embedSWF(attributes, params, divID);
	}
}

function go(divId, width, height, htmlUrl, url, flashvars) {
   loadSWF(url, 'middleFlash_div', '', width, height, '');
}


function loadSWF(url, divID, movieID, width, height, flashvarsin){
    if (url=='RB_UnderBar_elements_A.swf') {
       return;
    }

	if(isObject(divID)){
		//replace object/element with a new div
		replaceSwfWithEmptyDiv(divID);
	}
	
	if (swfobject.hasFlashPlayerVersion("7")) {
		var attributes = { data: url, width: width, height:height };
		var params = {id: 'website'};
		var obj = swfobject.createSWF(attributes, params, divID);
	}
}




function formSend() {
  var text = document.htmlForm.sendField.value;
  getFlashMovie("z_test_flash_broswer_comm").sendTextToFlash(text);
}

function getTextFromFlash(str) {
  document.htmlForm.receivedField.value = "From Flash: " + str;
  return str + " received";
}

function setFlashNav(str) {
  getFlashMovie("main_navigation_movie_id").set_nav_bar(str);
}


function setFlashPageChanger(str) {
  getFlashMovie("main_navigation_movie_id").callFlashPageChanger(str);
}

function change_page(str) {
  setFlashNav(str);
  setFlashPageChanger(str);
}

function kids_display(str) {
   go('bottomLeft_div','326','16', 'loadmovie.php', 'RB_UnderBar_off.swf', 'my_type_pass=off');
   go('bottomMiddle_div','326','16', 'loadmovie.php', 'RB_UnderBar_off.swf', 'my_type_pass=off');
   go('bottomRight_div','326','16', 'loadmovie.php', 'RB_UnderBar_off.swf', 'my_type_pass=off');
   hideRows();
}

function setFlashSection(divID,sectionName) {
  if (divID=='bottomLeft') {
    divID='bottomLeft_id';
  }

  if (divID=='bottomMiddle') {
    divID='bottomMiddle_id';
  }

  if (divID=='bottomRight') {
    divID='bottomRight_id';
  }

  getFlashMovie(divID).set_section(sectionName);
}


/*
function getFlashMovie(movieName)
{
  return window.document[movieName];
}

function getFlashMovieB(movieName)
{
  return document.embeds[movieName];
}

function getFlashMovieC(movieName)
{
  return window[movieName];
}

function getFlashMovieD(movieName)
{
  return document.getElementById(movieName);
}
*/


function getFlashMovie(movieName) {
 if (window.document[movieName]) 
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  } 	

}


function hideFooter(url){
     if(url=='privacy.php'){
        hideRows();
     }
}


function goHTML(divId, width, height, url, flashmovie, flashvars) {
    if (divId=='middle') {divId='middleFlash_div'};

    hideFooter(url);  

	if(isObject(divId)){
		replaceSwfWithEmptyDiv(divId);
	}
	
  /* FLASH VARS */
   flashvars = escape(flashvars);

  /* AJAX PAGE VARS */
  var params = 'width=' + width + '&height='+height + '&movie=' + flashmovie + '&flashvars=' + flashvars;
  var ajax = new Ajax.Updater(
  {success: divId},
  url,
  {method: 'get', parameters: params, evalScripts: true, onFailure: reportError});
}




