// Supress errors
//window.onerror = new Function("return true;");
//**********************************************

// ***** Main Nav Rollover *****
function roll(imgName,imgState) {
	document.images[imgName].src = "/images/nav/" + imgName + "_" + imgState + ".gif"
}
// ***********************************************************************

// ***** Preload Rollover Images ***************************************
if (document.images) {
	image1 = new Image(); image1.src = "/images/nav/main_about_us_ON.gif";
	image2 = new Image(); image2.src = "/images/nav/main_find_community_ON.gif";
	image3 = new Image(); image3.src = "/images/nav/main_learn_about_senior_living_ON.gif";
	image4 = new Image(); image4.src = "/images/nav/main_our_services_care_ON.gif";
	image5 = new Image(); image5.src = "/images/nav/main_professional_referrals_ON.gif";
	image6 = new Image(); image6.src = "/images/nav/main_sunrise_difference_ON.gif";
	
	image100 = new Image(); image100.src = "/images/clear.gif";
}
// *********************************************************************

// *********************************************************************
// Function to format a phone number to Sunrise standards
// *********************************************************************
function formatPhone(field) {
    var newValue = "";
    newValue = field.value.replace(/\D/g,"");
    if (newValue.length == 10) {
        var area = newValue.substring(0,3);
        var prefix = newValue.substring(3,6);
        var suffix = newValue.substring(6,10);
        newValue = area + "-" + prefix + "-" + suffix;
        field.value = newValue;
    } else {
        // do nothing!
    }
}

// *********************************************************************
// Function to create pop-up windows at a custom size.
// w = width
// h = height
// d = directories
// l = location
// m = menubar
// r = resizeable
// sc = scrollbars
// st = status
// t = toolbar
// EXAMPLE CALL: <a href="javascript:popUp('[URL]','[WINDOW NAME]',400,300,1,1,0,0,0,0,0);">LINK</a>
// *********************************************************************
function popUp(URL,name,w,h,d,l,m,r,sc,st,t) {
	var featureStr = "";
	featureStr = "width=" + w + ",height=" + h + ",directories=" + d + ",location=" + l + ",menubar=" + m + ",resizable=" + r + ",scrollbars=" + sc + ",status=" + st + ",toolbar=" + t;
	window.open(URL,name,featureStr);
}

function popUpScroll(URL){	
	window.open(URL,'','scrollbars=1');
}


// *********************************************************************
// Below is all javascript repurposed from the current Sunrise website in order to recreate the DHTML
// for the Sunrise History section. (WF:1.7)
// *********************************************************************
CSAg = window.navigator.userAgent; CSBVers = parseInt(CSAg.charAt(CSAg.indexOf("/")+1),10);
CSIsW3CDOM = ((document.getElementById) && !(IsIE()&&CSBVers<6)) ? true : false;
function IsIE() { return CSAg.indexOf("MSIE") > 0;}
function CSGetImage(n) {if(document.images) {return ((!IsIE()&&CSBVers<5)?CSFindElement(n,0):document.images[n]);} else {return null;}}
CSDInit=false;
function CSScriptInit() {
if(typeof(skipPage) != "undefined") { if(skipPage) return; }
idxArray = new Array;
for(var i=0;i<CSInit.length;i++)
	idxArray[i] = i;
CSAction2(CSInit, idxArray);
}
function CSScriptExit() {
idxArray = new Array;
for(var i=0;i<CSExit.length;i++)
	idxArray[i] = i;
CSAction2(CSExit, idxArray);
}
CSInit = new Array;
CSExit = new Array;
CSStopExecution=false;
function CSAction(array) {return CSAction2(CSAct, array);}
function CSAction2(fct, array) { 
	var result;
	for (var i=0;i<array.length;i++) {
		if(CSStopExecution) return false; 
		var aa = fct[array[i]];
		if (aa == null) return false;
		var ta = new Array;
		for(var j=1;j<aa.length;j++) {
			if((aa[j]!=null)&&(typeof(aa[j])=="object")&&(aa[j].length==2)){
				if(aa[j][0]=="VAR"){ta[j]=CSStateArray[aa[j][1]];}
				else{if(aa[j][0]=="ACT"){ta[j]=CSAction(new Array(new String(aa[j][1])));}
				else ta[j]=aa[j];}
			} else ta[j]=aa[j];
		}			
		result=aa[0](ta);
	}
	return result;
}
CSAct = new Object;
CSIm=new Object();
function CSIShow(n,i) {
	if (document.images) {
		if (CSIm[n]) {
			var img=CSGetImage(n);
			if (img&&typeof(CSIm[n][i].src)!="undefined") {img.src=CSIm[n][i].src;}
			if(i!=0) self.status=CSIm[n][3]; else self.status=" ";
			return true;
		}
	}
	return false;
}
function CSILoad(action) {
	im=action[1];
	if (document.images) {
		CSIm[im]=new Object();
		for (var i=2;i<5;i++) {
			if (action[i]!='') {CSIm[im][i-2]=new Image(); CSIm[im][i-2].src=action[i];}
			else CSIm[im][i-2]=0;
		}
		CSIm[im][3] = action[5];
	}
}
// *********************************************************************

// *********************************************************************
// Below code was moved into this global file from the top of the Sunrise History page
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button',/*URL*/'images/timeline/1981a.gif',/*URL*/'images/timeline/1981b.gif',/*URL*/'','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button2',/*URL*/'images/timeline/1982a.gif',/*URL*/'images/timeline/1982b.gif',/*URL*/'','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button3',/*URL*/'images/timeline/1988a.gif',/*URL*/'images/timeline/1988b.gif',/*URL*/'','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button4',/*URL*/'images/timeline/1990a.gif',/*URL*/'images/timeline/1990b.gif',/*URL*/'','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button5',/*URL*/'images/timeline/1995a.gif',/*URL*/'images/timeline/1995b.gif',/*URL*/'','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button6',/*URL*/'images/timeline/1996a.gif',/*URL*/'images/timeline/1996b.gif',/*URL*/'','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button7',/*URL*/'images/timeline/1999a.gif',/*URL*/'images/timeline/1999b.gif',/*URL*/'','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button8',/*URL*/'images/timeline/2000a.gif',/*URL*/'images/timeline/2000b.gif',/*URL*/'','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'button9',/*URL*/'images/timeline/2003a.gif',/*URL*/'images/timeline/2003b.gif',/*URL*/'','');

var zindex=100
var currentMenu = null;
var currentMenuStyle = null;

function dropit(e,whichone){
	killcurrentmenu();
	
	themenu = document.getElementById(whichone);
	themenuStyle = themenu.style;
	themenuStyle.display = "block";
	currentMenu = themenu;
	currentMenuStyle = themenuStyle;
	return false
}

function killcurrentmenu() {
	if ((window.themenu) && (currentMenuStyle != null)) currentMenuStyle.display = "none";
}
// *********************************************************************
var newwindow;
function videoPopup(url){
    newwindow=window.open(url,'name','height=480,width=560');
	if (window.focus) {newwindow.focus()}
	return false;
}

// *********************************************************************

<!-- Idea by:  Nic Wolfe -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function popUp(URL) {

	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=0,width=518,height=660,left = 640,top = 225');");
}
// End -->
