// JavaScript Document

var whatPic = Math.ceil(5*Math.random())-1;
//var whatPic = 3;

var backImage = new Array();

backImage[0] = "http://biology.emory.edu/multimedia/images/skeleton/background1.jpg";
backImage[1] = "http://biology.emory.edu/multimedia/images/skeleton/background2.jpg";
backImage[2] = "http://biology.emory.edu/multimedia/images/skeleton/background3.jpg";
backImage[3] = "http://biology.emory.edu/multimedia/images/skeleton/background4.jpg";
backImage[4] = "http://biology.emory.edu/multimedia/images/skeleton/background5.jpg";

//document.body.background = backImage[whatPic];

function changeBGImage(){
if (document.body){
document.body.background = backImage[whatPic];

}
}


//var whatTable = document.getElementById("myTable");
// getElementById Special to handle quirky browsers
// most will use getElementById()
function getElementById_s(id){
			var obj = null;
			if(document.getElementById){
			/* Prefer the widely supported W3C DOM method, if
			available:-
			*/
			obj = document.getElementById(id);
			}else if(document.all){
			/* Branch to use document.all on document.all only
			browsers. Requires that IDs are unique to the page
			and do not coincide with NAME attributes on other
			elements:-
			*/
			obj = document.all[id];
			}
			/* If no appropriate element retrieval mechanism exists on
			this browser this function always returns null:-
			*/
			//alert(obj);
			return obj;
			
}

function searchEmory() {
	var whatText = getElementById_s("txtSearch");
	document.location = "http://search.emory.edu/search?q=" + whatText.value + "&client=default_frontend&output=xml_no_dtd&proxystylesheet=homepage&site=default_collection&searchString=" + whatText.value + "&x=0&y=0";
}

function alertSize() {
		  var myWidth = 0, myHeight = 0;
		  if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		  }
		//  window.alert( 'Width = ' + myWidth +  'Height = ' + myHeight);
		
		var whatCell = getElementById_s("holderTableCell");
		var whatBackTable = getElementById_s("holderTable");
		
		//alert(myHeight);
		whatBackTable.style.height = myHeight+"px";
		
		//alert(window.innerHeight);

}

function hideFrame(){
	var whatLayer1 = getElementById_s("Layer1");
	whatLayer1.style.visibility = "hidden";
	
	var whatLayer2 = getElementById_s("Layer2");
	whatLayer2.style.visibility = "hidden";

	var whatIFrame = getElementById_s("wciIFrame");
	whatIFrame.src = "";
}

function showCalendar(){
	var whatLayer1 = getElementById_s("Layer1");
	whatLayer1.style.visibility = "visible";

	var whatLayer2 = getElementById_s("Layer2");
	whatLayer2.style.visibility = "visible";
	
	var whatIFrame = getElementById_s("wciIFrame");
	whatIFrame.src = "https://secure.web.emory.edu/cancer/calendar/wciCalendar.html";
}


function checkBackPosition(){

	  var myWidth = 0, myHeight = 0;
	  if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myOffsetY = window.pageYOffset;
		myOffsetX = window.pageXOffset;
	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myOffsetY = document.documentElement.scrollTop;
		myOffsetX = document.documentElement.scrollLeft;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myOffsetY = document.body.pageYOffset;
		myOffsetX = document.body.pageXOffset;
	  }

	//var whatBody = getElementById_s("wciBody");
	var whatLayer1 = getElementById_s("Layer1");
	var whatLayer2 = getElementById_s("Layer2");
	
	whatLayer1.style.top = myOffsetY;
	whatLayer1.style.left = myOffsetX;
	
	whatLayer2.style.top = myOffsetY;

	
	//alert(myOffsetY);
}


function footer()
{
	document.write("<table width='950' class='copyrightText'><tr><td align='left' valign='midle' width='135'>");
	
	document.write("<a href='http://www.emoryhealthcare.org/' target='_blank'><img src='multimedia/images/skeleton/EHCLogo.jpg' border='0' /></a>");
	document.write("</td><td align='left' valign='middle'>");
		
	document.write("The Emory Winship Cancer Institute<br>");
	document.write("1365C Clifton Road, Atlanta, Georgia 30322 ");
	
	document.write("</td><td align='right' valign='middle'>");
	document.write("<a href='http://cancer.emory.edu/intranet'><font color='#99CCFF'>Employee Login</font></a> | ");
	document.write("<a href='index.cfm?pageid=503'><font color='#99CCFF'>Site Map</font></a> | ");
	document.write("<a href='index.cfm?pageid=502'><font color='#99CCFF'>Privacy Policy</font></a> | ");
	document.write("<a href='index.cfm?pageid=502'><font color='#99CCFF'>Legal Statements</font></a> <br> ");

	document.write("Copyright &copy;2008 Emory Winship Cancer Institute");
	document.write("</td></tr></table>");
	
	
	
}

function init_frame()
{
	document.write("<div id='Layer1' class='layerHide'>");
		document.write("<table style='filter: alpha(opacity=80); height: 100%; background-color: #000000; opacity: 0.8; -moz-opacity: 0.8; border: black 1px solid;' border='0' cellspacing='0' cellpadding='0' width='100%' align='center'>");
			document.write("<tbody>");
			document.write("<tr>");
				document.write("<td>&nbsp;</td>");
			document.write("</tr>");
			document.write("</tbody>");
			document.write("</table>");
	document.write("</div>");
	
	document.write("<div id='Layer2' class='layerHide'>");
			document.write("<table style='height: 100%;' border='0' cellspacing='0' cellpadding='0' width='100%' align='center'>");
			document.write("<tbody>");
			document.write("<tr>");
			document.write("<td align='center'>");
			document.write("<table width='825'><tr><td align='right' valign='bottom'><a href='javascript:hideFrame()'><img src='multimedia/images/skeleton/close.png' border='0'></a></td></tr></table>");
			document.write("<table width='825' style='background-color: #ffffff;'><tr><td><iframe id='wciIFrame'  name='wciIFrame' height=590 width=825 scrolling='auto' frameborder='0' allowtransparency='false' src=''>");
			document.write("</iframe></td></tr></table>");
			document.write("</td>");
			document.write("</tr>");
			document.write("</tbody>");
		document.write("</table>");
	document.write("</div>");

}

function showEmory1(){
	var whatLayer1 = getElementById_s("emory1");
	whatLayer1.style.display = "block";
}
function hideEmory1(){
	var whatLayer1 = getElementById_s("emory1");
	whatLayer1.style.display = "none";
}
function showEmory2(){
	var whatLayer1 = getElementById_s("emory2");
	whatLayer1.style.display = "block";
}
function hideEmory2(){
	var whatLayer1 = getElementById_s("emory2");
	whatLayer1.style.display = "none";
}function showEmory3(){
	var whatLayer1 = getElementById_s("emory3");
	whatLayer1.style.display = "block";
}
function hideEmory3(){
	var whatLayer1 = getElementById_s("emory3");
	whatLayer1.style.display = "none";
}



