document.write('<link rel="shortcut icon" href="'+RM_Directory_Path+'Appearance/favicon.ico">');

// **** Must fix FullPath in embedMovie for go-live

var http = createRequestObject();
var Domino_Address = "";
function createRequestObject(){
  var request_o;
  //declare the variable to hold the object.
  var browser = navigator.appName;
  //find the browser name
  if (browser == "Microsoft Internet Explorer"){
    /* Create the object using MSIE's method */
    request_o = new ActiveXObject("Microsoft.XMLHTTP");
  }else{
    /* Create the object using other browser's method */
    request_o = new XMLHttpRequest();
  }
  return request_o;
  //return the object
}
function getIP(){
  /* Create the request.
     The first argument to the open function is the method (POST/GET),
     and the second argument is the url...
  */
//  var localhost = java.net.InetAddress.getLocalHost();
//  var ip = localhost.getHostAddress();
//  alert(ip);
  try {
//    alert(location.href);
    if ((location.href.substring(7, 20) == "172.16.242.23") || (location.href.substring(7, 20) == "172.16.242.35") || (location.href.substring(7, 20) == "172.16.242.36") || (location.href.substring(7, 20) == "172.16.242.37") || (location.href.substring(7, 20) == "172.16.242.38") || (location.href.substring(0, 11) == "file:///R:/"))
      Domino_Address = "172.16.242.23:8023";
    else
      Domino_Address = "66.218.8.3:8023";
    http.open("get", "http://www.rmsyr.org/Appearance/getIP.php");
    http.onreadystatechange = gotIP();
    http.send(null);
  } catch (e) {
    if ((location.href.substring(7, 20) == "172.16.242.23") || (location.href.substring(7, 20) == "172.16.242.35") || (location.href.substring(7, 20) == "172.16.242.36") || (location.href.substring(7, 20) == "172.16.242.37") || (location.href.substring(7, 20) == "172.16.242.38") || (location.href.substring(0, 11) == "file:///R:/"))
      Domino_Address = "172.16.242.23:8023";
    else
      Domino_Address = "66.218.8.3:8023";
  }
}
function gotIP(){
  /* Make sure that the transaction has finished.
     The XMLHttpRequest object has a property called readyState with several states:
       0: Uninitialized
       1: Loading
       2: Loaded
       3: Interactive
       4: Finished
  */
  if (http.readyState == 4) Domino_Address = http.responseText;
}
getIP();
var RM_WebEmail = "barry_rosales@rmsyr.org";
var RM_Appearance_Path = RM_Directory_Path;
var Home_Page_Path = "Corporate/Home/Main_Page.htm";

Loc_Directory_Path=new String;
Page_Directory_Path=new String;
CurrentLoc=new String;
Loc_Href=new String;
var Num_Loc_Href_Levels;
Loc_Href_Levels=new Object;
var AuxilaryPage;
Breadcrumbs=new String;
var Num_Breadcrumb_Levels;
Breadcrumb_Levels=new Object;
getLoc();

var ThisPage;
var wait = 250;
var defaultwait = 250;
var onmousewait = 500;
var onclickwait = 10000;
var timeoutID = null;
var menu = "";
var tdID = "";
var textID = "";
var tailIndex = 1;
var prevMenuID = "";
var prevMenuIDs;
var PartsTimeoutId = null;

var BrowserDetect = {
  init: function () {
    this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
    this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version";
    this.OS = this.searchString(this.dataOS) || "an unknown OS";
  },
  searchString: function (data) {
    for (var i=0;i<data.length;i++) {
      var dataString = data[i].string;
      var dataProp = data[i].prop;
      this.versionSearchString = data[i].versionSearch || data[i].identity;
      if (dataString) {
        if (dataString.indexOf(data[i].subString) != -1) return data[i].identity;
      } else if (dataProp) return data[i].identity;
    }
  },
  searchVersion: function (dataString) {
    var index = dataString.indexOf(this.versionSearchString);
    if (index == -1) return;
    return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
  },
  dataBrowser: [
    { string: navigator.userAgent, subString: "OmniWeb", versionSearch: "OmniWeb/", identity: "OmniWeb" },
    { string: navigator.vendor, subString: "Apple", identity: "Safari" },
    { prop: window.opera, identity: "Opera" },
    { string: navigator.vendor, subString: "iCab", identity: "iCab" },
    { string: navigator.vendor, subString: "KDE", identity: "Konqueror" },
    { string: navigator.userAgent, subString: "Firefox", identity: "Firefox" },
    { string: navigator.vendor, subString: "Camino", identity: "Camino" },
    { // for newer Netscapes (6+)
      string: navigator.userAgent, subString: "Netscape", identity: "Netscape" },
    { string: navigator.userAgent, subString: "MSIE", identity: "Explorer", versionSearch: "MSIE" },
    { string: navigator.userAgent, subString: "Gecko", identity: "Mozilla", versionSearch: "rv" },
    { // for older Netscapes (4-)
      string: navigator.userAgent, subString: "Mozilla", identity: "Netscape", versionSearch: "Mozilla" }
  ],
  dataOS : [
    { string: navigator.platform, subString: "Win", identity: "Windows" },
    { string: navigator.platform, subString: "Mac", identity: "Mac" },
    { string: navigator.platform, subString: "Linux", identity: "Linux" }
  ]
};
BrowserDetect.init();

function getParameter(parmName) {
  var currentUrl = window.location.search;
  var strBegin = currentUrl.indexOf("?");
  if (strBegin == -1) {
    return "";
  } else {
    strBegin = currentUrl.indexOf(parmName, strBegin);
    if (strBegin == -1) {
      return "";
    } else {
      strBegin = strBegin + parmName.length + 1;
      var strEnd = currentUrl.indexOf("&", strBegin);
      if (strEnd == -1) strEnd = currentUrl.length;
      return currentUrl.substring(strBegin, strEnd);
    }
  }
}
function initFormVars() {
  getFormValueFromParm("_emailto", "emailto");
  getFormValueFromParm("_attach", "attach");
}
function stripBlanks(inputString) {
  var temp = inputString;
  temp = temp.replace(/%20%20%20/g, " ");
  temp = temp.replace(/%20%20/g, " ");
  temp = temp.replace(/%20/g, " ");
  temp = temp.replace(/   /g, " ");
  temp = temp.replace(/  /g, " ");
  temp = temp.replace(/ , /g, ",");
  temp = temp.replace(/ ,/g, ",");
  return temp;
}
function getFormValueFromParm(formName, parmName) {
  var formNameElement = document.getElementById(formName);
  var parmNameValue = getParameter(parmName);
  if ((formNameElement != null) && (parmNameValue != "")) {
    formNameElement.value = stripBlanks(parmNameValue);
  }
}
function getFormValue(formName) {
  var formNameElement = document.getElementById(formName);
  if (formNameElement != null) return formNameElement.value;
  else return "";
}
function getParmValue(parmName) {
  return stripBlanks(getParameter(parmName));
}
function sendEmail(emailTo, subject) {
//  window.document.location.href = RM_Directory_Path+"Appearance/Email_Form.htm?emailto="+emailTo+"&subject="+subject;
  email_window = window.open(RM_Directory_Path+"Appearance/Email_Form.htm?emailto="+emailTo+"&subject="+subject,"Email","height=400,width=550,left=237,top=150,resizable=no,menubar=no,scrollbars=no,toolbar=no,status=no,location=no,directories=no");
  return false;
}
function getLoc(){
  Num_Loc_Href_Levels=1;
  Loc_Href_Levels[0]="Home";
  Loc_Href=location.href;
  var BuildArea1="/WebSite_Next";       // Must not end in a '/'
  var BuildArea2="/WebSite%5FNext";     // Must not end in a '/'
  var BuildArea3="/WebSite_Approved";   // Must not end in a '/'
  var BuildArea4="/WebSite%5FApproved"; // Must not end in a '/'
  var BuildArea5="/WebSite_Current";    // Must not end in a '/'
  var BuildArea6="/WebSite%5FCurrent";  // Must not end in a '/'
  if(Loc_Href.indexOf(BuildArea1)>-1)Loc_Href=Loc_Href.substring(Loc_Href.indexOf(BuildArea1)+BuildArea1.length,Loc_Href.length);
  else if(Loc_Href.indexOf(BuildArea2)>-1)Loc_Href=Loc_Href.substring(Loc_Href.indexOf(BuildArea2)+BuildArea2.length,Loc_Href.length);
  else if(Loc_Href.indexOf(BuildArea3)>-1)Loc_Href=Loc_Href.substring(Loc_Href.indexOf(BuildArea3)+BuildArea3.length,Loc_Href.length);
  else if(Loc_Href.indexOf(BuildArea4)>-1)Loc_Href=Loc_Href.substring(Loc_Href.indexOf(BuildArea4)+BuildArea4.length,Loc_Href.length);
  else if(Loc_Href.indexOf(BuildArea5)>-1)Loc_Href=Loc_Href.substring(Loc_Href.indexOf(BuildArea5)+BuildArea5.length,Loc_Href.length);
  else if(Loc_Href.indexOf(BuildArea6)>-1)Loc_Href=Loc_Href.substring(Loc_Href.indexOf(BuildArea6)+BuildArea6.length,Loc_Href.length);
  else Loc_Href=Loc_Href.substring(8,Loc_Href.length);
  Loc_Href=Loc_Href.substring(Loc_Href.indexOf("/")+1,Loc_Href.length);
  var stop=0;
  Page_Directory_Path="";
  var Loc_Href_Level_Start=0;
  while(!stop){
    var Loc_Href_Level_Start=Loc_Href.indexOf("/",Loc_Href_Level_Start+1);
    if (Loc_Href_Level_Start!=-1){
      Loc_Href_Levels[Num_Loc_Href_Levels]=Loc_Href.substring(0,Loc_Href_Level_Start);
      Page_Directory_Path=Loc_Href_Levels[Num_Loc_Href_Levels]+"/";
    }else{
      Loc_Href_Levels[Num_Loc_Href_Levels]=Loc_Href;
      stop=1;
    }
    Num_Loc_Href_Levels++;
  }
  CurrentLoc=Loc_Href_Levels[1];
  if(Num_Loc_Href_Levels<3){
    CurrentLoc="Corporate";
    Loc_Directory_Path+="Corporate/";
  }else{
    CurrentLoc=Loc_Href_Levels[1];
  }
  if((CurrentLoc=="Appearance")||(CurrentLoc=="Templates"))CurrentLoc="Corporate";
  Loc_Directory_Path=RM_Directory_Path+CurrentLoc+"/";
  AuxilaryPage=1;
  if(Loc_Href.indexOf("Main_Page.htm")>-1)AuxilaryPage=0;
}
function getBreadcrumbs(){
  Num_Breadcrumb_Levels=0;
  Breadcrumbs=BreadcrumbPath;
  var Breadcrumb_Level_Start=0;
  var stop=0;
  while(!stop){
    Breadcrumb_Level_Start=Breadcrumbs.indexOf("/");
    if(Breadcrumb_Level_Start!=-1){
      Breadcrumb_Levels[Num_Breadcrumb_Levels]=trim(Breadcrumbs.substring(0,Breadcrumb_Level_Start));
      Breadcrumbs=Breadcrumbs.substring(Breadcrumb_Level_Start+1,Breadcrumbs.length);
    }else{
      Breadcrumb_Levels[Num_Breadcrumb_Levels]=trim(Breadcrumbs);
      stop=1;
    }
    Num_Breadcrumb_Levels++;
  }
  while(Num_Breadcrumb_Levels<Num_Loc_Href_Levels){
    if(Num_Breadcrumb_Levels==(Num_Loc_Href_Levels-1))Breadcrumb_Levels[Num_Breadcrumb_Levels]="*";
    else Breadcrumb_Levels[Num_Breadcrumb_Levels]="";
    Num_Breadcrumb_Levels++;
  }
  if(Num_Breadcrumb_Levels>Num_Loc_Href_Levels){
    while(Num_Breadcrumb_Levels>Num_Loc_Href_Levels){
      Breadcrumb_Levels[Num_Breadcrumb_Levels]="*";
      Num_Breadcrumb_Levels--;
    }
    Breadcrumb_Levels[Num_Breadcrumb_Levels-1]="*";
  }
  if((Num_Loc_Href_Levels<3)||Loc_Href_Levels[Num_Loc_Href_Levels-1]==Home_Page_Path){
    Breadcrumbs="Home";
  }else{
    Breadcrumbs="<a href=\""+RM_Directory_Path+"Main_Page.htm\" class=\"breadcrumb\">Home</a>";
    var haveBreadCrumbs=0;
    for(var i=1;i<Num_Loc_Href_Levels;i++){
      if((Breadcrumb_Levels[i]!="")&&(AuxilaryPage||(i!=Num_Loc_Href_Levels-2))){
        haveBreadCrumbs=1;
        if(Breadcrumb_Levels[i]=="*"){
          if(document.title=="")Breadcrumbs+=" &#187; This Page";
          else Breadcrumbs+=" &#187; "+document.title;
          i=Num_Loc_Href_Levels;
        }else{
          Breadcrumbs+=" &#187; <a href=\"";
          Breadcrumbs+=RM_Directory_Path+Loc_Href_Levels[i]+"/Main_Page.htm"+"\" class=\"breadcrumb\">"+Breadcrumb_Levels[i]+"</a>";
        }
      }
    }
    if(!haveBreadCrumbs)Breadcrumbs="Home";
  }
}
function trim(s){
  var l=0; var r=s.length-1;
  while(l<s.length&&s[l]==' '){
    l++;
  }
  while(r>l&&s[r]==' '){
    r-=1;
  }
  if(s.substring(l,r+1)==" ")return "";
  else return s.substring(l,r+1);
}

function showMenu(thisID, waitduration) {
	if (timeoutID != null) clearTimeout(timeoutID);
	var menuID = "";
	var j = thisID.lastIndexOf("_");
	if (j >= 0) {
		if (thisID.substring(j,thisID.length) == "_image") {
			textID = thisID;
			tdID = thisID;
			menuID = thisID.substring(0,j);
		} else {
      if (thisID.substring(j,thisID.length) == "_text") {
			textID = thisID;
			menuID = thisID.substring(0,j);
		} else {
			textID = "";
			tdID = thisID;
			menuID = thisID;
		}
		}
	} else {
		textID = "";
		tdID = thisID;
		menuID = thisID;
	}
	var elementId = null;
	var MenuIDs = menuID.split("_");
	if (prevMenuID != "") {
		var k = (MenuIDs.length < prevMenuIDs.length) ? MenuIDs.length : prevMenuIDs.length;
		if ((k > 0) && (prevMenuIDs[0] == MenuIDs[0]) && (prevMenuIDs[1] == MenuIDs[1])) {
			if (waitduration > wait) wait = waitduration;
		} else {
			wait = waitduration;
		}
		tailIndex = k - 1;
		for (i = 0; i < k; i++) {
			if (prevMenuIDs[i] != MenuIDs[i]) {
				tailIndex = i;
				break;
			}
		}
		menu = prevMenuIDs[0];
		if (tailIndex == 0) {
			tailIndex = 1;
			processMenuTail("hidden", menu+"hidden", menu, menu+"edge", "_unselected");
			menu = MenuIDs[0];
		} else {
			for (i = 1; i < tailIndex; i++) {
				menu = menu + "_" + prevMenuIDs[i];
			}
			var idSave = menu;
			processMenuTail("hidden", prevMenuIDs[0]+"hidden", prevMenuIDs[0], prevMenuIDs[0]+"edge", "_unselected");
			menu = idSave;
		}
	} else {
		wait = waitduration;
		tailIndex = 1;
		menu = MenuIDs[0];
	}
	prevMenuIDs = MenuIDs;
	processMenuTail("visible", prevMenuIDs[0]+"visible", prevMenuIDs[0]+"highlight", prevMenuIDs[0]+"highlight", "_hover");
	prevMenuID = menuID;
	if (timeoutID != null) clearTimeout(timeoutID);
}
function hideMenuCheck(thisID) {
	if ((tdID != "") && (thisID.substring(thisID.lastIndexOf("_"),thisID.length) == "_text")) return;
	if ((tdID != "") && (thisID.substring(thisID.lastIndexOf("_"),thisID.length) == "_image")) return;
	timeoutID=setTimeout('hideMenu()',wait)
}
function hideMenu() {
	if (prevMenuID != "") {
		wait = defaultwait;
		menu = prevMenuIDs[0];
		tailIndex = 1;
		processMenuTail("hidden", menu+"hidden", menu, menu+"edge", "_unselected");
		prevMenuIDs = new Array();
		prevMenuID = "";
		tdID = "";
		textID = "";
	}
}
function processMenuTail(menuVisibility, menuVisibilityClass, menuHighlightClass, menuEdgeClass, menuImageClass) {
	var startTail = tailIndex;
	if (tailIndex == 1) {
      var bordervisibility=menuVisibility;
      if(bordervisibility=="hidden")bordervisibility=LeftMenuItemBorderVisibility;
		menu = menu+"_"+prevMenuIDs[1];
		startTail = 2;
		elementId = document.getElementById(menu+"_border_N");
		if(elementId != null)
			elementId.style.visibility=bordervisibility;
		elementId = document.getElementById(menu+"_border_W");
		if(elementId != null)
			elementId.style.visibility=bordervisibility;
		elementId = document.getElementById(menu+"_border_E");
		if(elementId != null)
			elementId.style.visibility=bordervisibility;
		elementId = document.getElementById(menu+"_border_S");
		if(elementId != null)
			elementId.style.visibility=bordervisibility;
		processMenuItem(menuVisibilityClass, menuHighlightClass+"_main", menuEdgeClass, menuImageClass);
	}
	for (i = startTail; i < prevMenuIDs.length; i++) {
		menu = menu+"_"+prevMenuIDs[i];
		processMenuItem(menuVisibilityClass, menuHighlightClass, menuEdgeClass, menuImageClass);
	}
}
function processMenuItem(menuVisibilityClass, menuHighlightClass, menuEdgeClass, menuImageClass) {
	elementId = document.getElementById(menu);
	if(elementId != null)
		elementId.className=menuHighlightClass;
	elementId = document.getElementById(menu+"_image");
	if(elementId != null)
		elementId.className = menu+menuImageClass;
	elementId = document.getElementById(menu+"_text");
	if(elementId != null)
		elementId.className = menuHighlightClass+"text";
	elementId = document.getElementById(menu+"_menu");
	if(elementId != null) {
		elementId.className=menuVisibilityClass;
		elementId = document.getElementById(menu+"_edge");
		if(elementId != null)
			elementId.className=menuEdgeClass;
	}
}
var importJavaScript = function (url,callback) {
  importJavaScript.headTag = document.getElementsByTagName("head")[0];
  importJavaScript.importedScripts = {};
  importJavaScript = function (url,callback) {
    if (importJavaScript.importedScripts[url]) {
      return false;
    }
    importJavaScript.importedScripts[url] = true;
    var newScript = document.createElement("script");
    doCallback = true;
    newScript.type = "text/javascript";
    newScript.onload = function(e) {
      if (doCallback) {
        doCallback = false;
        callback(e);
      }
    };
    newScript.onreadystatechange = function (e) {
      if (doCallback && ("loaded" === this.readyState || "complete" === this.readyState)) {
        doCallback = false;
        callback(e);
      }
    };
    newScript.src = url;
    importJavaScript.headTag.appendChild(newScript);
    return true;
  };
  return importJavaScript(url,callback);
};

function doMenu(text,thisID) {
	found=false;
	for(var i=0;(!found)&&(i<TopMenuACount);i++){
		if(thisID=="TopMenuA_item"+i) {
			var path=TopMenuAXrefArray[i];
			if(path!="")
				if(path.substring(path.length-1,path.length)=="/")window.document.location.href = RM_Directory_Path+path+"Main_Page.htm";
				else window.document.location.href = RM_Directory_Path+path;
			found = true;
		}
      	for(var j=0;(!found)&&(j<TopMenuASubMenuCountsArray[i]);j++){
			if(thisID=="TopMenuA_item"+i+"_item"+j) {
				var path=eval("TopMenuASubMenu"+i+"XrefArray")[j];
				if(path!="")
					if(path.substring(path.length-1,path.length)=="/")window.document.location.href = RM_Directory_Path+path+"Main_Page.htm";
					else window.document.location.href = RM_Directory_Path+path;
				found = true;
			}
		}
	}
	for(var i=0;(!found)&&(i<TopMenuBCount);i++){
		if(thisID=="TopMenuB_item"+i) {
			var path=TopMenuBXrefArray[i];
			if(path!="")
				if(path.substring(path.length-1,path.length)=="/")window.document.location.href = RM_Directory_Path+path+"Main_Page.htm";
				else window.document.location.href = RM_Directory_Path+path;
			found = true;
		}
      	for(var j=0;(!found)&&(j<TopMenuBSubMenuCountsArray[i]);j++){
			if(thisID=="TopMenuB_item"+i+"_item"+j) {
				var path=eval("TopMenuBSubMenu"+i+"XrefArray")[j];
				if(path!="")
					if(path.substring(path.length-1,path.length)=="/")window.document.location.href = RM_Directory_Path+path+"Main_Page.htm";
					else window.document.location.href = RM_Directory_Path+path
				found = true;
			}
		}
	}
	for(var i=0;(!found)&&(i<LeftMenuCount);i++){
		if(thisID=="LeftMenu_item"+i) {
			var path=LeftMenuXrefArray[i];
			if(path!="")
				if(path.substring(path.length-1,path.length)=="/")window.document.location.href = RM_Directory_Path+path+"Main_Page.htm";
				else window.document.location.href = RM_Directory_Path+path;
			found = true;
		}
      	for(var j=0;(!found)&&(j<LeftMenuSubMenuCountsArray[i]);j++){
			if(thisID=="LeftMenu_item"+i+"_item"+j) {
				var path=eval("LeftMenuSubMenu"+i+"XrefArray")[j];
				if(path!="")
					if(path.substring(path.length-1,path.length)=="/")window.document.location.href = RM_Directory_Path+path+"Main_Page.htm";
					else window.document.location.href = RM_Directory_Path+path;
				found = true;
			}
		}
	}
}

function rm_import_js(jsFile){
  var scriptElement=document.createElement('script');
  scriptElement=document.getElementsByTagName('head')[0].appendChild(scriptElement);
  scriptElement.type='text/javascript';
  scriptElement.src=jsFile;
}
function embedVideoPart1(PartName){
  var yearStart = PartName.indexOf("_");
  var PartYear = PartName.substring(yearStart+1, yearStart+5);
//  var PartPath = "http://www.rmsyr.org/Parts/Year"+PartYear+"/"+PartName+"/";
  var PartPath = "http://www.rmsyr.org/WebSite_Next/Parts/Year"+PartYear+"/"+PartName+"/";
//  document.write('<script language="JavaScript" src="'+PartPath+'Title.js"><'+'/script>');
//  rm_import_js(PartPath+"Title.js");
importJavaScript(PartPath+"Title.js",function (){embedVideoPart(PartName, title);});
}
function embedVideoPart(title, PartName){
  if(!title){
    var title="";
  }
  var yearStart = PartName.indexOf("_");
  var heightStart = PartName.indexOf("x",5);
  var PartWidth = PartName.substring(5,heightStart);
  var PartHeight = PartName.substring(heightStart+1,yearStart);
  var PartYear = PartName.substring(yearStart+1,yearStart+5);
  embedMovie(title,"Parts/Year"+PartYear+"/"+PartName+"/Slide.jpg","Parts/Year"+PartYear+"/"+PartName+"/Video.flv",PartWidth*GridCellWidth-15,PartHeight*GridCellHeight-15);
}
function embedVideo(title, slide, video, width_in_grids, aspect){
  var width = width_in_grids*GridCellWidth-15;
  var height = 0;
  if (aspect=="F") height=(width/4)*3+20;
  if (aspect=="W") height=(width/16)*9+20;
  else height=(width/3)*2+20;
  embedMovie(title, slide, video, width, height);
}
function embedMovie(title, slide, video, width, height){
  var FullPath = "http://www.rmsyr.org/";
//  var FullPath = "http://www.rmsyr.org/WebSite_Next/";
  document.write('<!--[if !IE]>-->');
  document.write('<object width="'+width+'" height="'+height+'" border="0" padding="0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"><param name="salign" value="lt"><param name="quality" value="high"><param name="scale" value="noborder"><param name="wmode" value="transparent"><param name="movie" value="'+FullPath+'Appearance/flayr.swf">');
  document.write('<!--<![endif]-->');
  document.write('<!--[if IE]>');
  document.write('<object width="'+width+'" height="'+height+'">');
  document.write('<!--<![endif]-->');
  document.write('<embed width="'+width+'" height="'+height+'" src="'+FullPath+'Appearance/flayr.swf?movie='+FullPath+video+'&preview='+FullPath+slide+'&name='+title+'&controls=show&color_controls=#4d4d4d&color_background=#D7D8DC&color_slider=#920C24&color_bar=#908F94&color_buffer=#515152" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="opaque"></embed></object>');
}
function NewsletterSelectChanged(filterDropdown){
  elementId = document.getElementById(filterDropdown);
  if(elementId != null){
    var index=elementId.selectedIndex;
    var selectValue=elementId[index].value.toUpperCase();
    window.document.location.href = RM_Directory_Path+NewsletterFilterXrefArray[selectValue]+"Main_Page.htm";
  }
  return true;
}
function FilterInitialize(filterDropdown, tableToFilter, filterCol){
  elementId = document.getElementById(filterDropdown);
  if(elementId != null){
    elementId.options[0].selected = true;
  }
  FilterChanged(filterDropdown, tableToFilter, filterCol);
  return true;
}
function FilterChanged(filterDropdown, tableToFilter, filterCol){
  elementId = document.getElementById(filterDropdown);
  if(elementId != null){
    var index=elementId.selectedIndex;
    var selectValue=elementId[index].value.toUpperCase();
    filterTable(tableToFilter, filterCol, selectValue);
  }
  return true;
}
function filterTable(tableToFilter, filterCol, filterValue){
  var show;
  if (navigator.appName.indexOf("Microsoft")>-1){
    show="block";
  }else{
    show="table-row";
  }
  elementId = document.getElementById(tableToFilter);
  if(elementId != null){
    for (var r=0; r<elementId.rows.length; r++){
      var value = elementId.rows[r].cells[filterCol].innerHTML.toUpperCase();
      if((filterValue=="")||(value=="")||(value.indexOf(filterValue)>-1)){
        elementId.rows[r].style.display=show;
      }else{
        elementId.rows[r].style.display="none";
//      elementId.rows[r].cells[filterCol].style.display="none";
      }
    }
  }
}
function sortTable(tableToSort, col){
  var iCurCell = col + tableToSort.cols;
  var totalRows = tableToSort.rows.length;
  var bSort = 0;
  var colArray = new Array();
  var oldIndex = new Array();
  var indexArray = new Array();
  var bArray = new Array();
  var newRow;
  var newCell;
  var i;
  var c;
  var j;
  // ** POPULATE THE ARRAY colArray WITH CONTENTS OF THE COLUMN SELECTED
  for (i=1; i < tableToSort.rows.length; i++){
    colArray[i - 1] = setDataType(tableToSort.cells[iCurCell].innerHTML);
    iCurCell = iCurCell + tableToSort.cols;
  }
  // ** COPY ARRAY FOR COMPARISON AFTER SORT
  for (i=0; i < colArray.length; i++){
    bArray[i] = colArray[i];
  }
  // ** SORT THE COLUMN ITEMS
  //alert ( colArray );
  colArray.sort();
  //alert ( colArray );
  for (i=0; i < colArray.length; i++){
    // LOOP THROUGH THE NEW SORTED ARRAY
    indexArray[i] = (i+1);
    for(j=0; j < bArray.length; j++){
      // LOOP THROUGH THE OLD ARRAY
      if (colArray[i] == bArray[j]){
        // WHEN THE ITEM IN THE OLD AND NEW MATCH, PLACE THE
        // CURRENT ROW NUMBER IN THE PROPER POSITION IN THE
        // NEW ORDER ARRAY SO ROWS CAN BE MOVED ....
        // MAKE SURE CURRENT ROW NUMBER IS NOT ALREADY IN THE
        // NEW ORDER ARRAY
        for (c=0; c<i; c++){
          if ( oldIndex[c] == (j+1) ){
            bSort = 1;
          }
        }
        if (bSort == 0){
          oldIndex[i] = (j+1);
        }
        bSort = 0;
      }
    }
  }
  // ** SORTING COMPLETE, ADD NEW ROWS TO BASE OF TABLE ....
  for (i=0; i<oldIndex.length; i++){
    newRow = tableToSort.insertRow();
    for (c=0; c<tableToSort.cols; c++){
      newCell = newRow.insertCell();
      newCell.innerHTML = tableToSort.rows(oldIndex[i]).cells[c].innerHTML;
    }
  }
  //MOVE NEW ROWS TO TOP OF TABLE ....
  for (i=1; i<totalRows; i++){
    tableToSort.moveRow((tableToSort.rows.length -1),1);
  }
  //DELETE THE OLD ROWS FROM THE BOTTOM OF THE TABLE ....
  for (i=1; i<totalRows; i++){
    tableToSort.deleteRow();
  }
}
function setDataType(cValue){
  // THIS FUNCTION CONVERTS DATES AND NUMBERS FOR PROPER ARRAY
  // SORTING WHEN IN THE SORT FUNCTION
  var isDate = new Date(cValue);
  if (isDate == "NaN"){
    if (isNaN(cValue)){
      var isString = new String();
      isString = cValue + "/1900";
      var isDate2 = new Date(isString);
      if (isDate2 != "NaN"){
        return setDateType(isDate2);
      }else{
        // THE VALUE IS A STRING MAKE ALL CHARACTERS IN
        // STRING UPPER CASE TO ASSURE PROPER A-Z SORT
        cValue = cValue.toUpperCase();
        return cValue;
      }
    }else{
      // VALUE IS A NUMBER, TO PREVENT STRING SORTING OF A NUMBER
      // ADD AN ADDITIONAL DIGIT THAT IS THE + TO THE LENGTH OF
      // THE NUMBER WHEN IT IS A STRING
      var myNum;
      myNum = String.fromCharCode(48 + cValue.length) + cValue;
      return myNum;
    }
  }else{
    return setDateType(isDate);
  }
}
function setDateType(isDate){
  // VALUE TO SORT IS A DATE, REMOVE ALL OF THE PUNCTUATION AND
  // ( 1 - 10 - 11 - 2 - 3 - 4 - 41 - 5  etc.)
  var myDate = 0;
  myDate = myDate + isDate.getYear() * 10000;
  myDate = myDate + isDate.getMonth() * 100;
  myDate = myDate + isDate.getDate();
  return myDate ;
}
function ShowPartAt(x, y, z, PartsBase, PartsArray, RotateSpeed) {
  var temp="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  var xIndex=temp.indexOf(x);
  if(xIndex<0){
  temp="abcdefghijklmnopqrstuvwxyz";
  xIndex=temp.indexOf(x);
  if(xIndex<0)xIndex=0;
  }
  if(xIndex>=GridCellsHorizontalCount)xIndex=GridCellsHorizontalCount;
  var yIndex=y-1;
  if(yIndex<0)yIndex=0;
  if(yIndex>=GridCellsVerticalCount)yIndex=GridCellsVerticalCount;
  var zIndex=z;
  if(zIndex<=0)zIndex=xIndex*GridCellsVerticalCount+yIndex+1;
  if(zIndex>GridCellsVerticalCount*GridCellsHorizontalCount)zIndex=GridCellsVerticalCount*GridCellsHorizontalCount;
  var PartsCount = PartsArray.length;
  var PartsIndex = 0;
  var PartsName = "";
  var PartsYear = "";
//  if ((RotateSpeed <= 0) || (PartsCount == 1 )) {
//  Non-Rotating Random (or single part) section
  var now = new Date();
  var sec = now.getSeconds();
  PartsIndex = sec % PartsCount;
  PartsName = PartsArray[PartsIndex];
  if (PartsName.substring(0, 3) == "Box") {
    PartsYear = PartsName.substring(3, 7);
  } else if (PartsName.substring(0, 3) == "Mai") {
    PartsYear = PartsName.substring(7, 11);
  } else if (PartsName.substring(0, 3) == "Dou") {
    PartsYear = PartsName.substring(9, 13);
  } else {
    PartsYear = PartsName.substring(5, 9);
  }
  document.write('Top: '+eval(MainAreaTop+(yIndex*GridCellHeight))+'<br>Left: '+eval(MainAreaLeft+(xIndex*GridCellWidth))+'<br>z-index: '+zIndex+'<br>');
  document.write('PartsCount: '+PartsCount+'<br>PartsIndex: '+PartsIndex+'<br>PartsName: '+PartsName+'<br>PartsYear: '+PartsYear+'<br>');
  document.write('<div id="MainArea" style="position: absolute; top: '+eval(MainAreaTop+(yIndex*GridCellHeight))+'px; left: '+eval(MainAreaLeft+(xIndex*GridCellWidth))+'px; z-index: '+zIndex+'; visibility: visible;">');
  document.write('<script language="JavaScript" src="'+RM_Directory_Path+'Parts/Year'+PartsYear+'/'+PartsName+'/Part.js"><'+'/script>');
  document.write('</div>');
}
function AddToPartsArray(PartsArray, Part) {
  // Enter Part into next element of PartsArray
  var PartsCount = PartsArray.length;
  PartsArray[PartsCount] = Part;
}
function ShowOnePart(PartsBase, Part) {
  PartsArray = new Array();
  var RotateSpeed = 0;
  // Add Part to PartsArray
  AddToPartsArray(PartsArray, Part);
  // Display the Part
  ShowParts(PartsBase, PartsArray, RotateSpeed);
}
function ShowParts(PartsBase, PartsArray, RotateSpeed) {
  var PartsCount = PartsArray.length;
  if (PartsCount == 0) return true;
  var PartsIndex = 0;
  var PartsName = "";
  var PartsYear = ""; //Box4x4_2009_20-BingAnnounce
//  if ((RotateSpeed <= 0) || (PartsCount == 1 )) {
  if ((RotateSpeed <= 0) || (PartsCount == 1) || (!(BrowserDetect.browser == "Firefox") || (BrowserDetect.OS == "Windows"))) {
//  Non-Rotating Random (or single part) section
    var now = new Date();
    var sec = now.getSeconds();
    PartsIndex = sec % PartsCount;
    PartsName = PartsArray[PartsIndex];
    var yearStart = PartsName.indexOf("_");
    yearStart++;
    PartsYear = PartsName.substring(yearStart, yearStart+4);
    document.write('<script language="JavaScript" src="'+RM_Directory_Path+'/Parts/Year'+PartsYear+'/'+PartsName+'/Part.js"><'+'/script>');
  } else {
//  Rotating section
//    document.write('<div style="position: relative">');
    for (PartsIndex = 0; PartsIndex < PartsCount; PartsIndex++) {
      PartsName = PartsArray[PartsIndex];
      var yearStart = PartsName.indexOf("_");
      PartsYear = PartsName.substring(yearStart, yearStart+4);
      if (PartsIndex == 0) document.write('<div id="'+PartsBase+'_Loc"><div><script language="JavaScript" src="'+RM_Directory_Path+'/Parts/Year'+PartsYear+'/'+PartsName+'/Part.js"><'+'/script></div></div>');
      document.write('<div id="'+PartsBase+'_'+PartsIndex.toString()+'" style="position: absolute; top: 0px; left: 0px; visibility: hidden; display: none"><div><script language="JavaScript" src="'+RM_Directory_Path+'/Parts/Year'+PartsYear+'/'+PartsName+'/Part.js"><'+'/script></div></div>');
    }
//    document.write('</div>');
    var TimeoutCall = "RotateParts('" + PartsBase + "'," + PartsCount.toString() + ",0," + RotateSpeed.toString() + ")";
    PartsTimeoutId = setTimeout(TimeoutCall, RotateSpeed);
  }
}
function RotateParts(PartsBase, PartsCount, PartIndex, RotateSpeed) {
    if (PartsTimeoutId != null) clearTimeout(PartsTimeoutId);
    var NextPartIndex = PartIndex + 1;
    if (NextPartIndex >= PartsCount) NextPartIndex = 0;
//    alert("RotateParts: "+PartsBase);
    var LocNode = document.getElementById(PartsBase+"_Loc");
//    if (LocNode == null) alert("Error: Location Node not found.");
    var PartNode = document.getElementById(PartsBase + "_" + NextPartIndex.toString());
//    if (PartNode == null) alert("Error: Next Part Node not found.");
    if ((LocNode != null) && (PartNode != null)) {
//      var LocNodeChild = LocNode.firstChild;
//      if (LocNodeChild == null) alert("Error: Location child not found.");
//      var PartNodeChild = PartNode.firstChild;
//      if (PartNodeChild == null) alert("Error: Next Part child not found.");
//      var ClonedPartNodeChild = PartNodeChild.cloneNode(true);
//      if (LocNodeChild == null) alert("Error: Could not clone Part.");
//      LocNode.replaceChild(ClonedPartNodeChild, LocNodeChild);
      LocNode.replaceChild(PartNode.firstChild.cloneNode(true), LocNode.firstChild);
    }
    var TimeoutCall = "RotateParts('" + PartsBase + "'," + PartsCount.toString() + "," + NextPartIndex.toString() + "," + RotateSpeed.toString() + ")";
    PartsTimeoutId = setTimeout(TimeoutCall, RotateSpeed);
}

