var preloaded = new Array();
var toolTipState=1;

function preloadImages() {
    for (var i = 0; i < arguments.length; i++){
        preloaded[i] = document.createElement('img');
        preloaded[i].setAttribute('src',arguments[i]);
    };
}

preloadImages(
    '../images/requestinfo_over.gif',
    '../images/apply_over.gif'
	);





function externalContent(url, title, type, size)
{
	var screenHeight = screen.availHeight;
	var screenWidth = screen.availWidth;
    var toolbars = 'no';
    var scrollbars = 'yes';
    var resizable='yes';
    var width = 500;
    var height = 500;
    var realtitle = title;
	
    if (type == 'marginalia')
    {
	  width = 500;
	  height = 500;
          realtitle = 'marginalia';
    }
    else if (type == 'glossary')
    {
	  width = 350;
	  height = 350;
          realtitle = 'glossary';
    }
    else if (type == 'transcript')
    {
	  width = 610;
	  height = 440;
          realtitle = 'marginalia';
    }
    else if (type == 'graphics')
    {
	  width = 500;
	  height = 500;
          realtitle = 'graphics';
    }
    else if (type == 'flash')
    {
	  width = 500;
	  height = 420;
          realtitle = 'flash';
    }
    else if (type == 'video')
    {
	  width = 610;
	  height = 440;
          realtitle = 'video';
    }


    if (size == 'viewer')
    {
	  width = 790;
	  height = 530;
    }
    else if (size == 'large')
    {
	  width = 750;
	  height = 590;
    }
    else if (size == 'medium')
    {
	  width = 660;
	  height = 500;
    }
	
    var w = window.open(url,'_blank','width=' + width + ',height=' + height + ',resizable='+resizable + ',scrollbars=' + scrollbars);
    w.focus();
}






function redirectMe(){
window.location = "/explore-ellis/"
}


document.onmousemove = function(e) {
	var posx = 0;
var posy = 0;
	var winW;
	var toggleS, toggleE;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
		winW= window.innerWidth;
		
	}
	//ie
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
		winW= document.body.offsetWidth;
			
	}
	// posx and posy contain the mouse position relative to the document
	// Do something with this information
	
		
	//document.getElementById("coords").value= "x "+posx+ " y " +posy + " w "+ winW;
	document.getElementById("tooltip").style.top= posy   +25 + "px";
	document.getElementById("tooltip").style.left= posx  -35+ "px";
	
	toggleS= ((winW -800) /2)+615; toggleE = toggleS+170;
	var xStart= (winW -800) /2;
	var xEnd= ((winW -800) /2) +578;
	var myCase;
	var timer;
	var naviTop =document.getElementById('global_navigation').offsetTop;
	var naviBottom =document.getElementById('global_navigation').offsetTop + 36;
		
	if((posy > naviTop) &&(posy < naviBottom)&& (posx > xStart) &&(posx < xEnd))
	{
	document.getElementById("tooltip").style.display="block";
	
		
	
	
		if ((posx > xStart)&&(posx <  xStart + 100))
		{
		myCase=1;
		}
		if ((posx > xStart + 101)&&(posx <  xStart + 180))
		{
		myCase=2;
		}
		if ((posx > xStart + 181)&&(posx <  xStart + 305))
		{
		myCase=3;
		}
		if ((posx > xStart + 306)&&(posx <  xStart + 397))
		{
		myCase=4;
		}
		if ((posx > xStart + 398)&&(posx <  xStart + 492))
		{
		myCase=5;
		}
		if ((posx > xStart + 493)&&(posx <  xStart + 577))
		{
		myCase=6;
		}

		
		if (myCase != -1)
		{
		toolTipNavWriter(myCase);
		}
	}
	else if((posy < 89) ||(posy > 125) || (posx < xStart) ||(posx > xEnd))
	{document.getElementById("tooltip").style.display="none";}
}

function toolTipNavWriter(tW){
	var myText; var me=tW;
	switch (me)
	{
	case 1: myText= "<p class='blu'>Click here to return to your MyEllis dashboard page from anywhere in the Virtual Campus</p>"; 
	break
	case 2: myText = "<p class='blu'>Manage your profile settings, create blogs and add photos to share with the Ellis Community</p>"; 
	break
	case 3: myText = "<p class='blu'>You&rsquo;ll be alerted to student account messages, and have access to important and forms and documents</p>"; 
	break
	case 4: myText = "<p class='blu'>Make payments and print your statements for reimbursement here</p>"; 
	break
	case 5: myText = "<p class='blu'>This is your access to all of the online resources available to Ellis students</p>"; 
	break
	case 6: myText = "<p class='blu'>Get Technical Support or Troubleshoot issues connecting to your course</p>"; 
	break
	default: myText = "";
	}
	document.getElementById("tooltip").innerHTML = "<div class='pointer'></div>"+ myText + "<div class='btm'></div>";
	}

	
function hideMe(){
	document.getElementById("tooltip").style.display="none";
}	
	
function toggleTip(state){
	var mystate= state;
	if(mystate==1)
	{
	document.getElementById('tooltipContainer').style.display="block";
	moodframe.document.getElementById('tooltipContainer').style.display="block";
	alert("helpful tips enabled");
	 toolTipState= 1;
	}
	if(mystate==0)
	{
	document.getElementById('tooltipContainer').style.display="none";
	moodframe.document.getElementById('tooltipContainer').style.display="none";
	alert("helpful tips disabled");
	 toolTipState = 0;
	}
}	
