
	/**
	* showDiv - first function called when user rolls over link on schedule, finds out if user is using safari
	* passes vars to programInfoDiv
	*
	*/
	function isSafari() {
		var user = navigator.userAgent
		
		// turn off certain functionality for safari (as of now, no images)
		if(user.match("Safari")) {
			return true;
		}
		else {
			return false;
		}
	}

	var clockTimeoutID;
	/**
	* programInfoDiv - places html from hidden divs into 'programInfoDiv', with position
	*	based on the mouse pointer.
	*	
	*	object e - event object
	*	int programID - ID of the hidden div with program info
	* 	bool timeOut - determines whether or not to use time delay on hiding the div
	*/
	function programInfoDiv(e,episodeID,timeOut,programID){ 
		
		// user is mousingout
		if(!e) {
			
			if(timeOut){
				clockTimeoutID = setTimeout("$('programInfoDiv').style.display = 'none';",250 );
				clockTimeoutID2 = setTimeout("$('programInfoDiv').innerHTML = '';",251 );
			} else {
				$('programInfoDiv').style.display = 'none';	
			}
			
		// user is mousingover
		} else if(episodeID && e) {
			
			if(clockTimeoutID){
				clearTimeout(clockTimeoutID);
				clearTimeout(clockTimeoutID2);
			}
			
			$('programInfoDiv').innerHTML = $(episodeID).innerHTML + $('closeWindow').innerHTML;
				
			// setup vars for position correction
			var heightAboveBottom =  windowSize()[1] - (e.screenY) + 144;
			var offsetFromRight = windowSize()[0] - (e.screenX);		
			var infoDivHeight = Element.getHeight('programInfoDiv');
			
			// correct div position if user is close to right edge of window
			if(160 > offsetFromRight) {
				var horOffset = -170;
			} else {
				horOffset = 10;
			}
			
			// correct div postion if user is close to bottom of window
				var divHeightAdjust;
				
				// adjust if user is using safari
				if( isSafari() ) {
					divHeightAdjust = -70;
				} else {
					divHeightAdjust = 0;
				}
				
				if(infoDivHeight + 50 + divHeightAdjust > heightAboveBottom) {
					var vertOffset = infoDivHeight - 2*(infoDivHeight) +30 - divHeightAdjust;
					var status = 'true';
				} else {
					vertOffset = -10;
					var status = 'false';
				}

			$('programInfoDiv').style.left = horOffset + Event.pointerX(e) + 'px';
			$('programInfoDiv').style.top = vertOffset + Event.pointerY(e) + 'px';	
			$('programInfoDiv').style.display = 'inline';	
			
			/* Following is for calling an image into the program div */
			
			// put correct id for photo in 'live' div
			/*$('programInfoDiv').innerHTML = $('programInfoDiv').innerHTML.replace(/schedInfoDivImage/,"schedInfoDivImage" + episodeID); */
			
			/*if( !isSafari() ) 
			{	
				// rock out ajax 
 				var myAjax = new Ajax.Request(
					'php/scheduleAjax.php', 
					{
						method: 'get',
						parameters: {programID: programID},
						onComplete: function(response)
						{
							if(response.responseText == '') {
								$('schedInfoDivImage' + episodeID).style.height = '10px';
							}
							$('schedInfoDivImage' + episodeID).innerHTML =  response.responseText;
						}
					});	
			} */
		}
	}
	
	
	/**
	* windowSize - returns width and height of browser window
	*
	*/	
	windowSize = function() {
	var w = 0;
	var h = 0;

	//IE
	if(!window.innerWidth) {
		//strict mode
		if(!(document.documentElement.clientWidth == 0)) {
			w = document.documentElement.clientWidth;
			h = document.documentElement.clientHeight;
		}
		//quirks mode
		else {
			w = document.body.clientWidth;
			h = document.body.clientHeight;
		}
	}
	//w3c
	else {
		w = window.innerWidth;
		h = window.innerHeight;
	}
	
	var coordinates = [w,h]
	return coordinates;
}
