//teasers.js
//Modify this file to change teasers for the technews site and the technews area on the cms home page

//Web author:
//Follow these steps to change the teasers...


//Step 1:  modify the titles array.  Add or delete titles as needed.  Be sure that the array elements are separated by commas!
var titles = new Array	(   "New Expedited Remote Access Request Process",
							"Web Conferencing Now Available at SU",
							"Public Computer Labs to be Upgraded in August",
						 	"University Data Network Enhancements",
							"IT4SU Online Student Survey Completed Successfully",
							"Introducing SUmail, SU's New Student Email System",
							"Blackboard Upgrade this Summer",
							"UNIX Timeshare and file storage services to be discontinued",
							"Kimmel ITS Support Center has Moved to the Center for Science & Technology / Life Sciences Complex",
							"Safer Computing for the SU Community"
						);
						
//Step 2:  modify the text array.  Add or delete text as needed.  Be sure that the array elements are separated by commas!						
var text = new Array	(	"As part of the University's business and academic continuity planning related to the potential impact of the H1N1 flu, ITS has streamlined the remote access request process in order to allow affected employees to work from home.",	
							"After months of research and development, ITS is pleased to announce the availability of Adobe Connect Pro (ACP) as SU's web conferencing tool. Now groups large and small can convene online to securely share documents, audio, video, presentations, desktops, whiteboard updates and more in real time, right from their individual desktops. Adobe Connect Pro provides a whole new set of collaborative opportunities.",	
							"Software upgrades to the computers in the public computer labs across campus will require that each lab be closed for a few hours sometime between August 3 and 14.  Email stations across campus will be upgraded between August 17 and 21.  The major upgrade is the installation of Adobe Creative Suite 4. ",
						 	"In order to facilitate expansion of the University's fiber optic network, ITS will be removing abandoned wiring and cabling from the underground conduit system on the North Campus and some points beyond the Campus proper. This work, part of SU's Network Master Plan, will enable ITS to grow the network with greater ease and more effectively support network-intensive functions such as learning and research activities.",
							"The IT4SU online survey focusing on student use and opinions about ITS's computer labs and support services is complete. Learning Environments and Media Production (LEMP), which manages the public computer labs, is finding the survey results valuable.",	
							"Following months of development, preparation and testing, Information Technology and Services (ITS) is pleased to announce the availability of SUmail, the new student email system at Syracuse University.  SUmail will replace the aging and less-capable MyMail system.  SUmail is managed by ITS and utilizes Microsoft's Outlook Live email service.",	
							"Information Technology and Services (ITS) envisions an outstanding technology environment at SU that, among other things, facilitates scholarship, teaching and learning.  A key element in this vision is the Blackboard learning and course management system, which enables anytime, anywhere student engagement.  Blackboard supports more than 2,400 classes (on-campus, distance learning and hybrid) and approximately 300 organizations per semester.",
							"Information Technology and Services (ITS) will eliminate the following legacy UNIX services on May 19, 2009: Access to shared UNIX timeshares gamera and rodan; UNIX applications such as  SAS, APL, perl, pico, emacs, ssh, ftp, telnet, gcc, sftp, newsreaders, Sun C and Fortran compilers; Personal and project data storage on UNIX platform (data.syr.edu); and Space for personal web pages (web.syr.edu). The last day these services will be available is May 18, 2009.",	
							"In order to be closer to more students, faculty and staff the ITS Service Center has moved from the Kimmel Computer Lab to the Center for Science & Technology/Life Sciences Complex. Though the Service Center has moved, the Kimmel computer lab will continue to operate as usual, open at all times.",	
							"Network & Systems Management has implemented a new system to improve the computing experience of students registering their computers on the campus network. All students, faculty, and staff connecting to the AirOrangeX or the wired network in the residence halls will see a web page instructing them to download and install a small program."
						);

//Step 3:  modify the links array.  Add or delete links as needed.  Do not use entire URLs.  The http://its.syr.edu/ will be included later. Be sure that the array elements are separated by commas!						
var links = new Array	(	"/technews/campustech/stories/2009-11-04-remote.cfm",	
							"/technews/campustech/stories/2009-11-04-acp.cfm",	
							"/technews/campustech/stories/2009-08-04-labs.cfm",	
						 	"/technews/campustech/stories/2009-06-30-network.cfm",	
							"/technews/campustech/stories/2009-06-01-it4su-survey.cfm",	
							"/technews/campustech/stories/2009-04-20-sumail.cfm",
							"/technews/campustech/stories/2009-04-21-blackboard.cfm",	
							"/technews/campustech/stories/2009-04-14-unixdecom.cfm",	
							"/technews/resnet/stories/2009-01-10-kimmelmove.cfm",	
							"/technews/campustech/stories/2008-08-01-safeconnect.cfm"
						);

//Step 4:  modify the images array.  Add or delete images as needed.  If no image is need, enter "" as the value.  Complete url paths are not necessary.  /technews/images/... is fine. Be sure that the array elements are separated by commas!						
var images = new Array	(	"",
							"",	
							"",
						 	"",
							"",	
							"",
							"",	
							"",
							"",
							""
						);

//Step 5: modify the cmsHomePage array.  If the teaser should be on the CMS home page, it's value should be true.  Otherwise, make it false. Be sure that the array elements are separated by commas!
var cmsHomePage = new Array	(   true,
								true,
								false,
							 	false,
								false,
								false,
								false,
								false,
								false,
								false
							);

//Step 6:  change the numTeasers variable to reflect how many teasers you want to have
var numTeasers = 9;
						
//End of instructions

//Web authors:
//DO NOT MODIFY CODE BEYOND THIS POINT!

var newsArea = new Array();
for(i=0; i<numTeasers; i++){
	//if this story is in the campustech area, mark it as campustech
	if(links[i].indexOf("/technews/campustech/") >= 0){
		newsArea[i] = "campus";
	}
	else if(links[i].indexOf("/technews/resnet/") >= 0){
		newsArea[i] = "resnet";
	}
	else{
		newsArea[i] = "null";
	}
}
						
function writeTeasers(source){

	var protocol_and_machine = window.location + "";  //must add + "" to make it a string
	var thirdSlash = protocol_and_machine.indexOf("/", protocol_and_machine.indexOf("://") + 3);  //offset by length of "://"
	protocol_and_machine = protocol_and_machine.substring(0, thirdSlash);
	//write the teasers for the cms home page
	if(source == "cmshome"){
		document.writeln("<table border='0' cellspacing='2' cellpadding='5' width='100%'>");
// remove banner from homepage		document.writeln("<tr><td valign='bottom' align='center'><a href='http://its.syr.edu/technews/'><img src='" + protocol_and_machine + "/images-2002/cms_home_news_banner.gif' alt='Go to Computing and IT News' border='0'></td></tr>");
		for(i=0; i<numTeasers; i++){
			if(cmsHomePage[i]){
				document.writeln("<tr>");
				document.writeln("<td><p class='headlinebox'>");
				document.writeln("<b>" + titles[i] + "</b><br>");
				document.writeln(text[i] + "&nbsp;&nbsp;<a href='http://its.syr.edu" + links[i] + "'>Full&nbsp;Story</a><p>");
				document.writeln("</td>");
				document.writeln("</tr>");
			}
		}
		document.writeln("</table>");
	
	}
	
	//write the teasers for the technewshome page
	else if(source == "technewshome"){
		document.writeln("<table border='0' cellspacing='0' cellpadding='10'>");
		for(i=0; i<numTeasers; i++){
			//only write the campus area stories on the technewshome page
			if(newsArea[i] == "campus"){
				var needsImage = true;
				var cellWidth = 300;
				var colspan = 1;
				if(images[i] == ""){
					needsImage = false;
					cellWidth = 600;
					colspan = 2;
				}
				document.writeln("<tr>");	
				if(i%2 == 0){
					document.writeln("<td summary='[Teaser Cell]' valign='top' width='" + cellWidth + "' colspan='" + colspan + "'>");
					document.writeln("<p>");
					document.writeln("<h4>" + titles[i] + "</h4>");
					document.writeln(text[i] + "&nbsp;&nbsp;<a href='" + links[i] + "'>Full&nbsp;Story</a><p>");
					document.writeln("</td>");
					if(needsImage){
						document.writeln("<td summary='[Image Cell]' width='" + cellWidth + "' align='center'><img src='" + images[i] + "' alt='" + titles[i] + "' border='0'><p></td>");
					}
				}
				else{
					if(needsImage){
						document.writeln("<td summary='[Image Cell]' width='" + cellWidth + "' align='center'><img src='" + images[i] + "' alt='" + titles[i] + "' border='0'><p></td>");
					}
					document.writeln("<td summary='[Teaser Cell]' valign='top' width='" + cellWidth + "' colspan='" + colspan + "'>");
					document.writeln("<p>");
					document.writeln("<h4>" + titles[i] + "</h4>");
					document.writeln(text[i] + "&nbsp;&nbsp;<a href='" + links[i] + "'>Full&nbsp;Story</a><p>");
					document.writeln("</td>");
				}
				document.writeln("</tr>");
			}
		}
		document.writeln("</table>");
	}
	
	//write the teasers for the resnet home page
	else if(source == "resnetnews"){
		document.writeln("<table border='0' cellspacing='0' cellpadding='10'>");
		for(i=0; i<numTeasers; i++){
			//only write the resnet area stories on the resnet page
			if(newsArea[i] == "resnet"){
				var needsImage = true;
				var cellWidth = 300;
				var colspan = 1;
				if(images[i] == ""){
					needsImage = false;
					cellWidth = 600;
					colspan = 2;
				}
				document.writeln("<tr>");	
				if(i%2 == 0){
					document.writeln("<td summary='[Teaser Cell]' valign='top' width='" + cellWidth + "' colspan='" + colspan + "'>");
					document.writeln("<p>");
					document.writeln("<h4>" + titles[i] + "</h4>");
					document.writeln(text[i] + "&nbsp;&nbsp;<a href='" + links[i] + "'>Full&nbsp;Story</a><p>");
					document.writeln("</td>");
					if(needsImage){
						document.writeln("<td summary='[Image Cell]' width='" + cellWidth + "' align='center'><img src='" + images[i] + "' alt='" + titles[i] + "' border='0'><p></td>");
					}
				}
				else{
					if(needsImage){
						document.writeln("<td summary='[Image Cell]' width='" + cellWidth + "' align='center'><img src='" + images[i] + "' alt='" + titles[i] + "' border='0'><p></td>");
					}
					document.writeln("<td summary='[Teaser Cell]' valign='top' width='" + cellWidth + "' colspan='" + colspan + "'>");
					document.writeln("<p>");
					document.writeln("<h4>" + titles[i] + "</h4>");
					document.writeln(text[i] + "&nbsp;&nbsp;<a href='" + links[i] + "'>Full&nbsp;Story</a><p>");
					document.writeln("</td>");
				}
				document.writeln("</tr>");
			}
		}
		document.writeln("</table>");
	}
	
	else{
		document.writeln("Error:  Unknown source");
	}


}
