function ReferFriend() {
	var mywin
	mywin = window.opener;
	document.form1.SendLink.value = mywin.location.href;
}

function EmailFriend()
{
	LeftPosition = (window.screen.width) ? (window.screen.width-400)/2 : 0;
	TopPosition = (window.screen.height) ? (window.screen.height-300)/2 : 0;

	window.open("emailFriend.html","floorplans","width=400,height=300,top="+TopPosition+",left="+LeftPosition+",toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=yes,menubar=no");

}

function WriteFooterHome() {
	document.write("<a href='aboutUs.html' class='splashFooter'>About</a> | <a href='waystoGive.html' class='splashFooter'>Ways to Give</a> | <a href='getInvolved.html' class='splashFooter'>Get Involved</a> | <a href='urgentNeeds.html' class='splashFooter'>Urgent Needs</a> | <a href='yourDonations.html' class='splashFooter'>Donations</a> | <a href='newsEvents.html' class='splashFooter'>News &amp; Events</a> | <a href='faqs.html' class='splashFooter'>FAQs</a> | <a href='hospitalStaff.html' class='splashFooter'>Staff</a> | <a href='https://dnbweb1.blackbaud.com/OPXDONATE/donate.asp?cguid=099365C5%2DDCC4%2D4908%2D96B8%2D117A3C884D46&dpid=10724' target='_blank' class='splashFooter'>Dontate Now</a> | <a href='contact.html' class='splashFooter'>Contact</a>");	
}

function WriteFooter() {
	document.write("<a href='aboutUs.html' class='insideFooter'>About</a> | <a href='waystoGive.html' class='insideFooter'>Ways to Give</a> | <a href='getInvolved.html' class='insideFooter'>Get Involved</a> | <a href='urgentNeeds.html' class='insideFooter'>Urgent Needs</a> | <a href='yourDonations.html' class='insideFooter'>Donations</a> | <a href='newsEvents.html' class='insideFooter'>News &amp; Events</a> | <a href='faqs.html' class='insideFooter'>FAQs</a> | <a href='hospitalStaff.html' class='insideFooter'>Staff</a> | <a href='https://dnbweb1.blackbaud.com/OPXDONATE/donate.asp?cguid=099365C5%2DDCC4%2D4908%2D96B8%2D117A3C884D46&dpid=10724' target='_blank' class='insideFooter'>Dontate Now</a> | <a href='contact.html' class='insideFooter'>Contact</a>");	
}

function WriteFooterChinese() {
	document.write("<a href='aboutUs-chinese.asp' class='insideFooter'>&#38364;&#26044;&#25105;&#20497;</a> | <a href='waystoGive-chinese.asp' class='insideFooter'>&#25424;&#36104;&#26041;&#24335;</a> | <a href='getInvolved-chinese.asp' class='insideFooter'>&#20849;&#21516;&#21443;&#33287;</a> | <a href='urgentNeeds-chinese.asp' class='insideFooter'>&#32202;&#24613;&#38656;&#35201;</a> | <a href='yourDonations-chinese.asp' class='insideFooter'>&#21892;&#27454;&#36939;&#29992;</a> | <a href='newsEvents-chinese.asp' class='insideFooter'>&#26032;&#32862;&#21450;&#27963;&#21205;</a> | <a href='faqs-chinese.asp' class='insideFooter'>&#24120;&#35211;&#21839;&#38988;</a> | <a href='https://dnbweb1.blackbaud.com/OPXDONATE/donate.asp?cguid=099365C5%2DDCC4%2D4908%2D96B8%2D117A3C884D46&dpid=10724' target='_blank' class='insideFooter'>&#32178;&#19978;&#25424;&#27454;</a> | <a href='contact-chinese.asp' class='insideFooter'>&#32879;&#32097;&#25105;&#20497;</a>");	
}

function GetRandomPicture() {

	images = new Array(3);
	images[0] = "<img src='/images/splashRandomPhoto1.png'>";
	images[1] = "<img src='/images/splashRandomPhoto2.png'>";
	images[2] = "<img src='/images/splashRandomPhoto3.png'>";
	index = Math.floor(Math.random() * images.length);
	
	document.write(images[index]);

}

function GetRandomPictureInside() {
var MyNum = Math.floor(Math.random()*3);
document.getElementById("headerPhotoContainer").style.background="url('/images/randomPhoto" + MyNum + ".png')";
document.getElementById("headerPhotoContainerB").style.background="url('/images/randomPhoto" + MyNum + "B.png')";
}


function RandomPhotoInside(number)
{
	var RandomNum = document.form1.TheNumber.value;
	
	if (number == 1){
	document.write("<img src='/images/randomPhoto"+RandomNum+".png'>");
	}
	
	if (number == 2){
	document.write("<img src='/images/randomPhoto"+RandomNum+"B.png'>");
	}
}


function fontsizeLarge() {
	setActiveStyleSheet('A++');
}

function fontsizeMedium() {
	setActiveStyleSheet('A+');
}

function fontsizeSmall() {
	setActiveStyleSheet('A');
}

function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  return ('A+');
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
if (title == 'null') {
  title = getPreferredStyleSheet();
}

setActiveStyleSheet(title);