// JavaScript Document

// 

function MM_reloadPage(init)
{  //reloads the window if Nav4 resized
	if (init==true) with (navigator)
	{
		if ((appName=="Netscape")&&(parseInt(appVersion)==4))
		{
			document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage;
		}
	}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) 
	{
		location.reload();
	}
}

MM_reloadPage(true);


function MM_openBrWindow(theURL,winName,features)
{ //v2.0
  var newWindow = window.open(theURL,winName,features);
  newWindow.focus();
} 

function ranImage()
{
	var num = 3; // number of images in folder
	var ran = 1;
	ran = ((Math.round(Math.random()*50) % num) + 1);
	
	document.write("<img src=\"http://www.eng.auburn.edu/images/homepg/large/image" + ran + ".jpg\" width=\"565px\" height=\"292px\" border=\"0\" />");
	
}

function acadRanImage(locale)
{
	var num = 4;
	var ran = 1;
	var dept = Split_URL(locale);
	
	ran = ((Math.round(Math.random()*50) % num) + 1);
	
	document.write("<p><img src=\"http://www.eng.auburn.edu/images/acad_depts/"+ dept + "/hmpgRanImg/image");
	document.write(ran + ".jpg\" width=\"565px\" height=\"292px\" border=\"0\" /></p>");
}

function acadRanImage2(locale, num)
{
	//var num = 2;
	var ran = 1;
	var dept = Split_URL(locale);
	
	ran = ((Math.round(Math.random()*50) % num) + 1);
	
	document.write("<p><img style=\"margin: 5px 0px 5px 10px;\" src=\"http://www.eng.auburn.edu/images/acad_depts/"+ dept + "/images/image");
	document.write(ran + ".jpg\" align=\"right\" border=\"0\" /></p>");
}

function Split_URL(URL)
{
	var slash_separator = "/";
	var slash_arrayofStrings = URL.split(slash_separator);
	var dot_separator = ".";
	var dot_arrayofStrings = slash_arrayofStrings[2].split(dot_separator);
	
	if((slash_arrayofStrings[3] != "") && (slash_arrayofStrings[4] == ""))
	{
		return slash_arrayofStrings[3];
	}
	
	if((slash_arrayofStrings[3] != "") && (slash_arrayofStrings[4] == "index.html"))
	{
		return slash_arrayofStrings[3];
	}
	
	if((slash_arrayofStrings[3] != "") && (slash_arrayofStrings[4] != "programs") && (slash_arrayofStrings[4] != "centers"))
	{
		return slash_arrayofStrings[4];
	}
	
	if((slash_arrayofStrings[3] == "") && (slash_arrayofStrings[4] == "programs"))
	{
		return slash_arrayofStrings[5];
	}

	if((slash_arrayofStrings[3] == "") && (slash_arrayofStrings[5] == "centers"))
	{
		return slash_arrayofStrings[6];
	}

	if((slash_arrayofStrings[3] != "") && (slash_arrayofStrings[4] == "centers"))
	{
		return slash_arrayofStrings[5];
	}
	
	if((slash_arrayofStrings[3] == "") && (slash_arrayofStrings[4] == ""))
	{
		return dot_arrayofStrings[0];
	}
	
	if(slash_arrayofStrings[2] != "www.eng.auburn.edu")
	{
		return dot_arrayofStrings[1];
	}
	
	if((slash_arrayofStrings[2] != "www.eng.auburn.edu") && (slash_arrayofStrings[3] == "courses"))
	{
		return dot_arrayofStrings[1];
	}
	
	if((dot_arrayofStrings[1] == "engce"))
	{
		return dot_arrayofStrings[1];
	}

	if((dot_arrayofStrings[1] == "engce"))
	{
		if((slash_arrayofStrings[3] == "courses"))
		{
			return dot_arrayofStrings[1];
		}
	}
	
}
	
function print_large_style(locale)
{
	var dept = Split_URL(locale);
	//document.write("<div id=\"titleGraphic\" class=\"headerRight\" style=\"");
	document.write("<div class=\"titleGraphicImg\" style=\"background-image: ");
	document.write("url(http://www.eng.auburn.edu/images/acad_depts/" + dept +"/");
	document.write(dept + ".jpg);");
	document.write("background-position: top left; height: 110px; width: 565px;");
	document.write("\">");
}

function print_center_style(locale)
{
	var center = Split_URL(locale);
	//document.write("<div id=\"titleGraphic\" class=\"headerRight\" style=\"");
	document.write("<div class=\"titleGraphicImg\" style=\"background-image: ");
	document.write("url(http://www.eng.auburn.edu/images/centers/" + center +"/");
	document.write(center + ".jpg);");
	document.write("background-position: top left; height: 110px; width: 565px;");
	document.write("\">");
}

function print_small_style(locale)
{
	var dept = Split_URL(locale);
	//document.write("<div id=\"titleGraphic_small\" class=\"headerRight\" style=\"");
	document.write("<div class=\"titleGraphicImg\" style=\"background-image: ");
	document.write("url(http://www.eng.auburn.edu/images/acad_depts/" + dept + "/small_version/");
	document.write(dept + ".jpg);");
	document.write("background-position: top left; height: 92px; width: 565px;");
	document.write("\">");
}

function print_acad_toolbar(locale)
{
	var dept = Split_URL(locale);
	
	if(dept == "comp")
	{
		dept = "csse";
	}
	
	if(dept == "txen")
	{
		dept = "pfen";
	}

	if(dept == "elec")
	{
		dept = "ece";
	}
	
	document.write("<a href=\"http://eng.auburn.edu/programs/" + dept + "/prospective/\">Prospective Students </a>");
	document.write("<a href=\"http://eng.auburn.edu/programs/" + dept + "/students/\">Current Students </a>");
	document.write("<a href=\"http://eng.auburn.edu/programs/" + dept + "/business/\">Business and Government </a>");
	document.write("<a href=\"http://eng.auburn.edu/programs/" + dept + "/alumni/\">Alumni </a>");
	document.write("<a href=\"http://eng.auburn.edu/programs/" + dept + "/faculty/\">Faculty </a>");
}

function print_admin_phone_nums(locale)
{
	var dept = Split_URL(locale)
	
	switch (dept)
	{
		case "audfs":
			document.write("334-844-3322");
			break;
			
		case "attmep":
			document.write("334-844-2331");
			break;
		
		case "bo":
			document.write("334-844-4302");
			break;
		
		case "do":
			document.write("334-844-2308");
			break;
		
		case "ce":
			document.write("334-844-4370");
			break;
		
		case "development":
			document.write("334-844-2736");
			break;
		
		case "distance-learning":
			document.write("334-844-4370");
			break;
			
		case "ems":
			document.write("334-844-4804");
			break;
		
		case "ens":
			document.write("334-844-2280");
			break;
		
		case "engce":
			document.write("334-844-4370");
			break;
		
		case "erc":
			document.write("334-844-5722");
			break;

		case "ess":
			document.write("334-844-2309");
			break;
		
		case "gop":
			document.write("334-844-5300");
			break;
		
		case "k-12":
			document.write("334-844-4370");
			break;
		
		case "marketing":
			document.write("334-844-2220");
			break;
		
		case "outreach":
			document.write("334-844-4370");
			break;

		case "planning":
			document.write("334-844-3329");
			break;
		
		case "enewsletter":
			document.write("334-844-2220");
			break;
			
		case "ac-pabe":
			document.write("334-844-2016");
			break;
			
		default:
			document.write("334-844-2308");
	}	
}

function print_acaddept_phone_nums(locale)
{
	var dept = Split_URL(locale);

	switch (dept)
	{
		case "aero":
			document.write("334-844-4874");
			break;
		
		case "bsen":
			document.write("334-844-4180");
			break;
		
		case "chen":
			document.write("334-844-4827");
			break;
		
		case "civil":
			document.write("334-844-4320");
			break;
		
		case "comp":
			document.write("334-844-4330");
			break;

		case "csse":
			document.write("334-844-4330");
			break;
		
		case "ece":
			document.write("334-844-1800");
			break;
	
		case "elec":
			document.write("334-844-1800");
			break;
		
		case "insy":
			document.write("334-844-4340");
			break;
		
		case "matl":
			document.write("334-844-4822");
			break;
		
		case "mech":
			document.write("334-844-4820");
			break;
		
		case "pfen":
			document.write("334-844-4123");
			break;
		
		case "wireless":
			document.write("334-844-1800");
			break;
		
		default:
			document.write("334-844-2308");
	}
}

function print_quicklinks()
{
	var links = new Array(6);

	links[0] = "<a href=\"http://www.eng.auburn.edu/admin/ess/schfi/\">Scholarships</a>";
	links[1] = "<a title=\"Tigermail\" href=\"https://tigermail.auburn.edu/\" target=\"_blank\">Tigermail</a>";
	links[2] = "<a title=\"Student Services\" href=\"http://www.eng.auburn.edu/admin/ess/\">Student Services</a>";
	links[3] = "<a title=\"Webcams\"href=\"http://www.eng.auburn.edu/about/facilities/webcams.html\">Webcams</a>";
	links[4] = "<a title=\"Engineering Faculty Resources\" href=\"http://www.eng.auburn.edu/faculty/faculty-resources.html\">Faculty Resources</a>";
	links[5] = "<a title=\"AU Access\" href=\"http://auaccess.auburn.edu/\" target=\"_blank\">AU Access</a>";
	links[6] = "<a title=\"AU Blackboard\" href=\"http://blackboard.auburn.edu/\" target=\"_blank\">AU Blackboard</a>";

	document.write("<ul id=\"quickLinks\">");
	for(var i=0; i < links.length; i++)
	{
		document.write("<li>" + links[i] + "</li>");
	}
	document.write("</ul>");
}
function checkwords(ab)
{
	var maxlength = 175;
	if(document.images)
	{
		var temp = ab.Abstract.value.split(" ");
		if(temp.length > maxlength)
		{
			alert("Please restrict your abstract to 175 words or less. Thank You!");
			return false;
		}
	}
}

function autotab(original, destination)
{
	if (original.getAttribute && original.value.length == original.getAttribute("maxlength"))
	{
		destination.focus()
	}
}

if(window.parent != window.self)
{
	window.open(document.location,'_blank');
}




