/*
   New Perspectives on JavaScript
   Tutorial 1
   Tutorial Case


   Function List:
   stringReverse
      Used to reverse the order of characters in a text string

*/

/*$(document).ready(function() { 
    pageHeight('box', 250); 
}); 

$(document).ready(function() { 
    document.box.date.value = showDate();
	$("h2.date").showDate();
}); */

$(document).ready(function() { 
    $('ul.sf-menu').superfish(); 
}); 

function stringReverse(textString) {
   if (!textString) return '';
   var revString='';
   for (i = textString.length-1; i>=0; i--)
       revString+=textString.charAt(i)
   return revString;
}

function showEM(userName, emServer)	{
/*
 * 	The showEM() function displays a link to the user's e-mail address.
 * The userName and e-mail server name are entered in reverse order
 * to thwart e-mail harvesting programs.
 */
		userName = stringReverse(userName);
		emServer = stringReverse(emServer);
		var emLink = userName + "@" + emServer;
		document.write("<a href='mailto:" + emLink + "'>");
		document.write(emLink);
		document.write("</a");
}

function showDate() {
   thisDate = new Date();
   var thisWDay=thisDate.getDay();
   var thisDay=thisDate.getDate();
   var thisMonth=thisDate.getMonth();
   var thisYear=thisDate.getFullYear();
   var mName = new Array("January", "February", "March", "April", "May", 
       "June", "July", "August", "September", "October","November", "December");
   var wdName = new Array("Sunday", "Monday", "Tuesday", "Wednesday",
       "Thursday", "Friday", "Saturday");
   return wdName[thisWDay]+", "+mName[thisMonth]+" "+thisDay+", "+thisYear;
}

function winHeight() {
   if (window.innerHeight) return window.innerHeight;
   else if (document.documentElement) return document.documentElement.offsetHeight;
   else if (document.body.clientHeight) return document.body.clientHeight;
}

function pageHeight(id, x) {
   H = (winHeight()-x);
   object=document.getElementById(id);
   object.style.height=H+"px";
}


/*//the function below detects screen res and alerts user to change view zoom

function detect(){
if(screen.width>1120||screen.height>768){
alert("This web page is best viewed with a screen resolution of 1024 x 768 or 1120 x 700.  Your current resolution is "+screen.width+" by "+screen.height+".  If this page looks too small or large, please go your toolbar, click View, then change the Zoom Magnification to increase/decrease the page as desired.")
}
else{
	


//alert("Whoa, you have a high resolution.  Nice Job!")
}

}*/

//function below detects browser size and redirects to appropriately-sized page

function detect(){
	
pageFor800 = "atlasHome800.html";
pageFor1280 = "atlasHome1280.html";
pageFor1440 = "atlasHome1440.html";
pageFor1600 = "atlasHome1600.html";
pageFor1680 = "atlasHome1680.html";
pageFor1920 = "atlasHome1920.html";

var Wide = screen.width;
var High = screen.height;

if (Wide < 1000 && High < 700){
	
	alert("This web page is designed for a higher screen resolution than your current resolution of "+screen.width+" by "+screen.height+".  Please go your toolbar, click View, then change the Zoom Magnification to 75%.");
}

else if ((Wide >= 1280&& High >= 960) && Wide < 1400 ){

  window.location = pageFor1280;
}

else if (Wide >= 1400 && Wide < 1600){

  window.location = pageFor1440;
}

else if (Wide >= 1600 && Wide < 1680){

  window.location = pageFor1600;
}

else if (Wide >= 1680 && Wide <= 1920 && High <= 1080){

  window.location = pageFor1680;
}

else if (Wide >= 1920 && High > 1080){

  window.location = pageFor1920;
}

else {


}
	
}




