// JavaScript Document
function startList(thisDiv) {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById(thisDiv);
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}

///don't forget <body onload="startList('navRowOne'); startList('navRowTwo');">


function copyrightDate(){
	var d = new Date();
	var curr_year = d.getFullYear();
	var dateString = "&copy;" + " " + curr_year + " ";
	//return dateString
	document.write(dateString);
}



NumberOfImagesToRotate = 11;

FirstPart = '<img src="images/rand';
LastPart = '.jpg" width="196" height="196" hspace="15" class="border">';

function printImage() {
var r = Math.ceil(Math.random() * NumberOfImagesToRotate);
document.write(FirstPart + r + LastPart);
}


//derived from http://newsourcemedia.com/art.117.flash_activex_workaround_.php
function embedFlash(swfName, swfHeight, swfWidth){
	var swfPath;
	swfPath = "swf/" + swfName + ".swf";
	
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + swfWidth + ' " height="' + swfHeight + '" id="' + swfName + '">');
	document.write('<param name="allowScriptAccess" value="sameDomain" /><param name="wmode" value="opaque" />');
	document.write('<param name="movie" value="' + swfPath + '" /><param name="quality" value="high" />');
	document.write('<embed src="' + swfPath + '" allowScriptAccess="sameDomain" wmode="opaque" quality="high" width="' + swfWidth + '" height="' + swfHeight + '" wmode="opaque" name="' + swfName + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function imgRand(){
	
	var rand1 = Math.ceil(Math.random() * 12);
	var rand2 = Math.ceil(Math.random() * 12);
	var rand3 = Math.ceil(Math.random() * 12);
	
	if(rand1 == rand2){
		while (rand1 == rand2) {
			var rand2 = Math.ceil(Math.random() * 12);
			}
		}
		
	if(rand1 == rand3 || rand2 == rand3){
		while (rand1 == rand3 || rand2 == rand3) {
			var rand3 = Math.ceil(Math.random() * 12);
			}
		}	
	
	document.getElementById('randImg1').src = "images/random/img" + rand1 + ".jpg";
	document.getElementById('randImg2').src = "images/random/img" + rand2 + ".jpg";
	document.getElementById('randImg3').src = "images/random/img" + rand3 + ".jpg";
}

//load featured services randomly
function loadFeaturedServices(){
	var randImg = Math.floor(Math.random() * 4);
	
	
	
	//imaging services
	featuredServicesArray = new Array(2);
	featuredServicesArray[0] = new Array(2);
	featuredServicesArray[0][0] = "images/homeFeaturedServicesImageImaging.jpg"; 
	featuredServicesArray[0][1] = "url(images/homeFeaturedServicesBgImaging.gif) no-repeat"; 
	featuredServicesArray[0][2] = "Special events such as wedding receptions, banquets, class reunions and meetings are easy to plan when using our Culinary Services Department. More about  <a href='http:\/\/www.stanly.org/patientsFamilyEducationCenter.aspx'>Culinary Services</a>."; 
	
	//roy cancer center
	featuredServicesArray[1] = new Array(2);
	featuredServicesArray[1][0] = "images/homeFeaturedServicesImageRoy.jpg";
	featuredServicesArray[1][1] = "url(images/homeFeaturedServicesBgRoy.gif) no-repeat";
	featuredServicesArray[1][2] = "Staffed with board-certified radiation and medical oncologists, the Roy M. Hinson Cancer Center is a full-service oncology center offering radiation therapy and chemotherapy. It is a facility that is rarely seen in communities of comparable size. More about <a href='specialtiesRoyCancer.html'>the Roy M. Hinson Cancer Center</a>."; 
	
	//health promotion
	featuredServicesArray[2] = new Array(2);
	featuredServicesArray[2][0] = "images/homeFeaturedServicesImageHealth.jpg";
	featuredServicesArray[2][1] = "url(images/homeFeaturedServicesBgHealth.gif) no-repeat";
	featuredServicesArray[2][2] = "Stanly Regional is committed to the community’s well-being and offers an array of classes designed to help improve one’s health and manage diseases such as diabetes and congestive heart failure.  Our comprehensive diabetes education series is nationally recognized by the American Diabetes Association.  Find out more about <a href='healthOverview.html'>Health Promotion</a>."; 
	
	//women's services
	featuredServicesArray[3] = new Array(2);
	featuredServicesArray[3][0] = "images/homeFeaturedServicesImageWomens.jpg";
	featuredServicesArray[3][1] = "url(images/homeFeaturedServicesBgWomens.gif) no-repeat";
	featuredServicesArray[3][2] = "Stanly Regional is right beside women for the most advanced care in the region.  Our Women’s Center boasts of spacious labor, delivery & recovery suites, which offer the latest amenities.  For mammograms and the latest advances in imaging, women can rely on us as a Breast Imaging Center of Excellence, a designation awarded by the American College of Radiology.  Check out the <a href='specialtiesWomens.html'>Women's Center</a>."; 
	
	document.getElementById('featuredServicesImg').src = featuredServicesArray[randImg][0];
	document.getElementById('homeFeaturedServices').style.background = featuredServicesArray[randImg][1];
	document.getElementById('homeFeaturedServicesText').innerHTML = featuredServicesArray[randImg][2];
}