


function imageRotator() {
	$(document).ready(function() {

		//Show Banner
		$(".main_image .desc").show();
		//Show Banner
		$(".main_image .block").animate({
			opacity : 0.85
		}, 1);
		//Set Opacity

		//Click and Hover events for thumbnail list
		$(".image_thumb ul li:first").addClass('active');
		$(".image_thumb ul li").click(function() {
			//Set Variables
			var imgAlt = $(this).find('img').attr("alt");
			//Get Alt Tag of Image
			var imgTitle = $(this).find('a').attr("href");
			//Get Main Image URL
			var imgDesc = $(this).find('.block').html();
			//Get HTML of block
			var imgDescHeight = $(".main_image").find('.block').height();
			//Calculate height of block

			if($(this).is(".active")) {//If it's already active, then...
				return false;
				// Don't click through
			} else {
				//Animate the Teaser
				$(".main_image .block").animate({
					opacity : 0,
					marginBottom : -imgDescHeight
				}, 250, function() {
					$(".main_image .block").html(imgDesc).animate({
						opacity : 0.85,
						marginBottom : "0"
					}, 250);
					$(".main_image img").attr({
						src : imgTitle,
						alt : imgAlt
					});
				});
			}

			$(".image_thumb ul li").removeClass('active');
			//Remove class of 'active' on all lists
			$(this).addClass('active');
			//add class of 'active' on this list only
			return false;

		}).hover(function() {
			$(this).addClass('hover');
		}, function() {
			$(this).removeClass('hover');
		});
		//Toggle Teaser
		$("a.collapse").click(function() {
			$(".main_image .block").slideToggle();
			$("a.collapse").toggleClass("show");
		});
	});
	//Close Function
}


// LiveTwitter
function liveTwitter()
{
  
	new TWTR.Widget({
	  version: 2,
	  type: 'profile',
	  rpp: 4,
	  interval: 6000,
	  width: 275,
	  height: 300,
	  theme: {
		shell: {
		  background: '#d4f5c1',
		  color: '#277019'
		},
		tweets: {
		  background: '#fafafa',
		  color: '#705b39',
		  links: '#43a818'
		}
	  },
	  features: {
		scrollbar: false,
		loop: false,
		live: false,
		hashtags: true,
		timestamp: true,
		avatars: true,
		behavior: 'all'
	  }
	}).render().setUser('GTGNews').start();

}

// The two functions below are used for the tab accordion on the left side.
// They call functions within JQuery.js.
function setAccordion()
{
	$(function() 
		{
			$("#accordion").tabs("#accordion div.pane", 
			{
				tabs: 'h2', 
				effect: 'slide'
			});
		});
}

function slideAccordion()
{
	// add new effect to the tabs 
	$.tools.addTabEffect("slide", function(i) { 
		 
		// 1. upon hiding, the active pane has a black background 
		this.getCurrentPane().slideUp("fast").css({backgroundColor: "#123"}); 
		 
		// 2. after a pane is revealed, its background is set to its original color (transparent)
		this.getPanes().eq(i).slideDown(function()  { 
			$(this).css({backgroundColor: 'transparent'}); 
		}); 
	});		
}

function japaneseMusicPanel()
{
	$(document).ready(function(){
			   $(".intro-pic").fadeTo("fast", 0.3); // This sets the opacity of the thumbs to fade down to 30% when the page loads
			   $(".intro-pic").hover(function(){
			   $(this).fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
			   },function(){
			   $(this).fadeTo("fast", 0.3); // This should set the opacity back to 30% on mouseout
			   });
	  });
	  $(document).ready(function(){
			   $(".influences-pic").fadeTo("fast", 0.3); // This sets the opacity of the thumbs to fade down to 30% when the page loads
			   $(".influences-pic").hover(function(){
			   $(this).fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
			   },function(){
			   $(this).fadeTo("fast", 0.3); // This should set the opacity back to 30% on mouseout
			   });
	  });
	  $(document).ready(function(){
			   $(".favorites-pic").fadeTo("fast", 0.3); // This sets the opacity of the thumbs to fade down to 30% when the page loads
			   $(".favorites-pic").hover(function(){
			   $(this).fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
			   },function(){
			   $(this).fadeTo("fast", 0.3); // This should set the opacity back to 30% on mouseout
			   });
	  });
	  $(document).ready(function(){
			   $(".articles-pic").fadeTo("fast", 0.3); // This sets the opacity of the thumbs to fade down to 30% when the page loads
			   $(".articles-pic").hover(function(){
			   $(this).fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
			   },function(){
			   $(this).fadeTo("fast", 0.3); // This should set the opacity back to 30% on mouseout
			   });
	  });
	  $(document).ready(function(){
			   $(".feedback-pic").fadeTo("fast", 0.3); // This sets the opacity of the thumbs to fade down to 30% when the page loads
			   $(".feedback-pic").hover(function(){
			   $(this).fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
			   },function(){
			   $(this).fadeTo("fast", 0.3); // This should set the opacity back to 30% on mouseout
			   });
	  });
	  
	  // 2nd row
	  $(document).ready(function(){
			   $(".quizzes-pic").fadeTo("fast", 0.3); // This sets the opacity of the thumbs to fade down to 30% when the page loads
			   $(".quizzes-pic").hover(function(){
			   $(this).fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
			   },function(){
			   $(this).fadeTo("fast", 0.3); // This should set the opacity back to 30% on mouseout
			   });
	  });
	  
}

/* Gets the number of songs currently inserted into the playlist */
function calcNoOfSongs(tableID)
{	
	var rowSkip = 2;  /* Subtracts the table caption and header rows */
	var table =  document.getElementById(tableID).getElementsByTagName('tr');
	var rowCount = table.length;
	rowCount = rowCount - 2;
	
	/* Sets the number of songs found (subtracts two as well) */
	document.getElementById("noOfSongs").innerHTML= rowCount + " songs";
}

// Global variables
var xmlDoc;   // Articles
var xmlDoc2;  // Music Picks
var xmlDoc3;  // Featured spotlights

var xmlDoc4;  // Japanese Music Charts XML
var xmlDoc5;  // Korean Music Charts XML
var xmlDoc6;  // News XML

var xmlDoc7;  // Vocaloid Music XML
var xmlDoc8;  // PicBook XML
var xmlDoc9;  // Editor's Corner

var xmlDoc10; // Events XML
var xmlDoc11; // Musings XML
var xmlDoc12; // Interviews XML

var xmlhttp = null;   // Articles
var xmlhttp2 = null;  // Music Picks
var xmlhttp3 = null;  // Featured spotlights

var xmlhttp4 = null;  // Japanese Oricon Charts XML
var xmlhttp5 = null;  // Korean Oricon Charts XML
var xmlhttp6 = null;  // News XML

var xmlhttp7 = null;  // Vocaloid Picks
var xmlhttp8 = null;  // PicBook Picks
var xmlhttp9 = null;  // Editor's Corner

var xmlhttp10 = null;  // Events XML
var xmlhttp11 = null;  // Musings XML
var xmlhttp12 = null; // Interviews XML


var xmlCount = 0; // Used for the xmlDocArray and xmlHttpArray

var curArticles;
var curFeaturedSpotlights;
var curMusicLists;
var curNewsType;
var curPicBookType;
var curEventsType;
var curInterviewsType;

/*var file;*/
var topArticlesFile = "XML-data/Top-Articles.xml";
var musicPicksFile = "XML-data/GTG-Music-Picks.xml";
var japaneseMusicPicksFile = "XML-data/Japanese-Music-Chart.xml";
var koreanMusicPicksFile = "XML-data/Korean-Music-Chart.xml";
var featuredSpotlightsFile = "XML-data/Featured-Spotlights.xml";
var editorsCornerFile = "XML-data/Editors-Corner.xml";
var newsFile = "XML-data/News.xml";
var picBookFile = "XML-data/PicBook.xml";
var vocaloidMusicPicksFile = "XML-data/Vocaloid-Music-Picks.xml";
var eventsFile = "XML-data/Events.xml";
var interviewsFile = "XML-data/Interviews.xml";

var featuredSpotlightsPictures = "Media-Holder-Pictures/Featured-Spotlight/Featured-Spotlight";
var newsPictures = "News-Holder-Pictures/News";
var picBookPictures = "PicBook-Pictures/PicBook";
var eventsPictures = "Events-Pictures/Events";
var interviewsPictures = "Interview-Pictures/Interview";

var mainPageThumbnails = "main-page-thumbnails/";

var mediaPath = "";

var curTitle;
var curAuthor;
var curCategory;
var curCountry;
var curDate;
var curDesc;

var curDateArticles;

var musicImage = "Pictures/Left-Pictures/Music-Icon-Green.png";
var movieImage = "Pictures/Left-Pictures/Movie-Icon-Green.png";
var animeImage = "Pictures/Left-Pictures/Anime-Icon-Green.png";
var gamesImage = "Pictures/Left-Pictures/Video-Game-Icon-Green.png"; 
var cultureImage = "Pictures/Left-Pictures/Culture-Icon-Green.png"; 
var TVDramasImage = "Pictures/Left-Pictures/Movie-Icon-Green.png";

var addToArticles = 0;  // For each article, add it to the array.
var addToFeaturedSpotlight = 0; // For each featured spotlight, add it to the array.
//var addToMusicLists = 0; // For each music list in GTG music list, kpop, or jpop lists, add it to the array.
var noOfArticles_1 = 0;		// This counts how many articles are in the past three days.
var noOfArticles_2 = 0;
var noOfArticles_3 = 0;

var noOfMusic = 0;

var curType;
var curSubType;
var curLevel;

var curXMLList; // This indicates which XML list is being read currently (e.g. top-articles.xml, featured-spotlight.xml, GTG-music-list.xml

var addToFlag = 0;
var dirRoot = "";

// For the master directory individual section categories.
var noOfJapaneseMusic = 0;
var noOfKoreanMusic = 0;
var noOfJapaneseMovies = 0;
var noOfKoreanMovies = 0;
var noOfAsianMovies = 0;
var noOfAnime = 0;
var noOfComics = 0;
var noOfVideoGames = 0;
var noOfChineseCulture = 0;
var noOfKoreanCulture = 0;
var noOfJapaneseCulture = 0;
var noOfFilipinoCulture = 0;

var lettersPerLine = 35; // This is the number of letters before making a new line.
var newLineString = "<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";

var didArticles = 0;
var shortCutBuffer = 38; // const.

/* For the articles accordion tab to the left */
var maxInterval = -90; // Max interval (2 weeks so far -- 14 days).
var firstInterval = -60;
var secondInterval = -30;

var tempDate;
var todayDate;

var maxRange;  // Total range.
var articleRange;
var listRange; // Sub range for sections that have two or more lists.

var tempCategory;
var tempCountry;

var curIndex;
var curFeaturedType; // Intro or drop down list.

var curMusicType;  // For the media top icons URLs in the media page.

var curPreLoadNum;

var mediaOnceCount = 0;

var featuredSpotlightText = "Featured-Spotlight";
var mediaHolderMusicText = "Media-Holder-music";
var japaneseMusicText = "Media-Holder-Japan-Charts";
var koreanMusicText = "Media-Holder-Korea-Charts";
var editorsCornerText = "Editors-Corner";
var vocaloidPicksText = "Vocaloid-Picks";

var interviewsText = "Interview"; // Not used just yet

var featuredSpotlightIndex = 0; // If 1, then only read the first date of the XML file, then exit.  0 means off.
var editorsCornerIndex = 0; // If 1, then only read the first date of the XML file, then exit.  0 means off.
var GTGMusicPicksListIndex = 0; // If 1, then only read the first date of the XML file, then exit.  0 means off.
var japanMusicPicksListIndex = 0;
var koreaMusicPicksListIndex = 0;
var vocaloidMusicPicksListIndex = 0; // If 1, then only read the first date of the XML file, then exit.  0 means off.

var allMusicListFlag = null;

var latestContentNum = 5; // Display the latest 6 articles, featured spotlight, music charts, etc.
var latestGTGMusic = 1;   // Display only one GTG music list at a time.
var latestJapanMusic = 2; // Display only two Japanese music lists at a time.
var latestKoreaMusic = 2; // Display only two Korean music lists at a time.
var latestVocaloidPicks = 1; // Display only on Vocaloid pick at a time.
var curReadXMLLimit = 0; // Used in the master-directory.html to see if it's all articles or 6 that's the range.

var isMusicListIcon = false;

// The default global variables to use in topList:
var featuredSpotlightType = "left";
//var featuredSpotlightLevel = -99;
//var musicListType = "left";
//var musicListLevel = -99;
var passIndex = "none"; // none means that in 95% of cases, the extra functions won't be called.
var passSubIndex = 0;
// All used for the left side
var addToMusicLists = 0;
var testArray = new Array();
var arrayUsed = new Array();

// Calculates the daily/weekly/monthly on the left side.
// The type is whether it will calculate just articles or if the user goes to Japanese, Korean music, etc.
// The subtype is an extension of type.  If type is articles, then subtype is set to "none."
// Level is how many levels after the root (greenteagraffiti) is the file located.
//   0 = file is in the root
//   1 = file is one level deep
//   2 = file is two levels deep
//   etc...
function topList(type, subType, level) // Sets up and displays the accordion's listings
{	
	curType = type;
	curSubType = subType; // Country
	curLevel = level;
	
	setImagesPath(); // Check where the current path is.
	importXML_TopArticles(topArticlesFile);
	/* After calling the articles, output the rest of the categories on the left side.*/
	featuredSpotlightList(curLevel, featuredSpotlightType); // Shows featuredSpotlightType
	curMusicLists = new arrayOfMusicLists();
	
	// This is for the left side's articles
	setAccordion();
	// Sets up the features of the left tab accordion.
	slideAccordion();
	// Goes through with the sliding when a user clicks on a left tab accordion.

	//GTGEditorsCornerList(passIndex); // The "index" indicates an index search.
	//GTGMusicPicksList(passIndex, passSubIndex);
	// The "index" indicates an index search.
	//japaneseMusicCharts(passIndex, passSubIndex);
	// The "index" indicates an index search.
	//koreanMusicCharts(passIndex, passSubIndex);
	// The "index" indicates an index search.
	//vocaloidPicksCharts(passIndex, passSubIndex);
	// The "index" indicates an index search.
}

function GTGMusicPicksList(setIndex, musicType) // musicType not always used.
{
	curIndex = setIndex;
	curMusicType = musicType;
	musicPicksFile = setCurPath(musicPicksFile);
	importXML_MusicPicks(musicPicksFile);
}

function japaneseMusicCharts(setIndex, musicType) // musicType not always used.
{
	curIndex = setIndex;
	curMusicType = musicType;
	japaneseMusicPicksFile = setCurPath(japaneseMusicPicksFile);
	importXML_JapaneseMusicPicks(japaneseMusicPicksFile);
}

function koreanMusicCharts(setIndex, musicType) // musicType not always used.
{
	curIndex = setIndex;
	curMusicType = musicType;
	koreanMusicPicksFile = setCurPath(koreanMusicPicksFile);
	importXML_KoreanMusicPicks(koreanMusicPicksFile);
}

function vocaloidPicksCharts(setIndex, musicType) // musicType not always used.
{
	curIndex = setIndex;
	curMusicType = musicType;
	vocaloidMusicPicksFile = setCurPath(vocaloidMusicPicksFile);
	importXML_VocaloidMusicPicks(vocaloidMusicPicksFile);
}

function featuredSpotlightList(setIndex, featuredType)
{ 
	curIndex = setIndex;
	curFeaturedType = featuredType;
	featuredSpotlightsFile = setCurPath(featuredSpotlightsFile);
	importXML_FeaturedSpotlights(featuredSpotlightsFile);		
}

function newsList(setIndex, newsType)
{
	curIndex = setIndex;
	curNewsType = newsType;
	newsFile = setCurPath(newsFile);
	importXML_News(newsFile);    		
}

function picBookList(setIndex, picBookType)
{
	curIndex = setIndex;
	curPicBookType = picBookType;
	picBookFile = setCurPath(picBookFile);
	importXML_PicBook(picBookFile);    		
}

function eventsList(setIndex, eventsType)
{
	curIndex = setIndex;
	curEventsType = eventsType;
	eventsFile = setCurPath(eventsFile);
	importXML_Events(eventsFile);    		
}

function interviewsList(setIndex, interviewsType)
{
	curIndex = setIndex;
	curinterviewsType = interviewsType;
	interviewsFile = setCurPath(interviewsFile);
	importXML_interviews(interviewsFile);    		
}

function GTGEditorsCornerList(setIndex)
{
	if (setIndex != "none")
	{
	    curIndex = setIndex;
	    editorsCornerFile = setCurPath(editorsCornerFile);
	    importXML_EditorsCorner(editorsCornerFile);
	}
}

// --------------------------------------------

//  Used only for the Top-Articles XML file; sets all the images' paths.
function setImagesPath()
{
	/* Adds a "../" for every depth level */
	var stringAdder = "../";
	
	for (var i = 0; i < curLevel; i++)
	{		
		musicImage = stringAdder + musicImage;
        movieImage = stringAdder + movieImage;
        animeImage = stringAdder + animeImage;
		gamesImage = stringAdder + gamesImage;
		TVDramasImage = stringAdder + TVDramasImage;
		cultureImage = stringAdder + cultureImage;
		topArticlesFile = stringAdder + topArticlesFile;
		
		dirRoot += "../";
	}
	
	/*alert("The music image is:   " + musicImage + "\n" +
		  "The file is:   " + file + "\n" + 
		  "The level is:   " + curLevel);*/
}

//  Used for any general import XMLs to find the correct directory and path of the XML file.
function setCurPath(typeOfFile)
{
	var stringAdder = "../";
	
	for (var i = 0; i < curLevel; i++)
	{	
	    typeOfFile = stringAdder + typeOfFile; // Adds another ../ to the beginning of the URL.
	}
 
	return typeOfFile;
}



//  The validDate function/class.
function arrayOfArticles()
{
	this.arrayOfTitles = new Array();
	this.arrayOfURLs = new Array();
}

function arrayOfFeaturedSpotlights()
{
	this.arrayOfTitles = new Array();
	this.arrayOfURLs = new Array();
}

//  Used for the Japan, Korea, and GTG music playlists left side.
function arrayOfMusicLists()
{
	this.arrayOfDates = new Array();
	this.arrayOfTitles = new Array();
	this.arrayOfURLs = new Array();
}

// ------------------------------------

function importXML_TopArticles(topArticlesFile) 
{
	 // if testing on IE5, IE6, or IE7 locally.
	 /*if(location.protocol=="file:"){
         if(!xmlhttp)
	       try
		   {
		      xmlhttp=new ActiveXObject("MSXML2.XMLHTTP"); 
			}
		   catch(e)
		   {
			   xmlhttp=false;
		   }
      
	     if(!xmlhttp)
	     try
		 {    
	        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
		 }
		 catch(e)
		 {
			xmlhttp=false;
		 }
		 alert(xmlhttp);
     } */
	  
	 if (window.XMLHttpRequest) // Applies to IE 7+, Chrome, Firefox, and Opera.
	 {
		xmlhttp = new XMLHttpRequest();
	    xmlhttp.onreadystatechange = function () {
						
			if (xmlhttp.readyState == 4) 
			{	
				if (xmlhttp.status == 200 || xmlhttp.status == 0)
				{			
					xmlDoc = xmlhttp.responseXML;
					extractArticles(topArticlesFile);	
				}
			}
		}
	   xmlhttp.open("GET",topArticlesFile,true);
	   xmlhttp.send(null);  
	 }
	 else if (window.ActiveXObject) // Applies to Internet Explorer 5 and 6
	 { 

	   xmlDoc = new ActiveXObject("Microsoft.XMLDOM");  
	   xmlDoc.onreadystatechange = function () {
			if (xmlDoc.readyState == 4) 
			{
				if (xmlhttp.status == 200 || xmlhttp.status == 0)
				{	
					extractArticles(topArticlesFile);	
				}
			}
		}
	
	   xmlDoc.load(topArticlesFile);
	 }	 
}



// -----------------------------



function importXML_MusicPicks(musicPicksFile) 
{    
   isMusicListIcon = true;

     if (curIndex == "index")
	 {
		mediaPath = "media/"; // Move up to the media folder.
		GTGMusicPicksListIndex = 1;
	 }

	 if (window.XMLHttpRequest) // Applies to IE 7+, Chrome, Firefox, and Opera.
	 {
	   xmlhttp2 = new XMLHttpRequest();
	   xmlhttp2.onreadystatechange = function () {
			if (xmlhttp2.readyState == 4) 
			{
			    xmlDoc2 = xmlhttp2.responseXML;
				
				allMusicListFlag = "GTGMusicList";
				
				extracXMLMusicLists_left(musicPicksFile);
				
				if (curIndex == "allMusicLists")
				{
					extractGTGMusicPicks_table(musicPicksFile);	
				}
				else if(passSubIndex == "dropdown")
				{
					extractGTGMusicPicks_dropdown(musicPicksFile);	
				}
				
				
				
			}
		}
	   xmlhttp2.open("GET",musicPicksFile,true);
	   xmlhttp2.send(null);
	   
	 } 
	 else if (window.ActiveXObject) // Applies to Internet Explorer 5 and 6
	 {  
	   xmlDoc2 = new ActiveXObject("Microsoft.XMLDOM");  
	   xmlDoc2.onreadystatechange = function () {
			if (xmlhttp2.readyState == 4) 
			{	
				xmlDoc2 = xmlhttp2.responseXML;
				
				allMusicListFlag = "GTGMusicList";
				
				extracXMLMusicLists_left(musicPicksFile);
					
				if (curIndex == "allMusicLists")
				{
					extractGTGMusicPicks_table(musicPicksFile);	
				}
				else if(passSubIndex == "dropdown")
				{
					extractGTGMusicPicks_dropdown(musicPicksFile);	
				}
				
			}
		}
	   xmlDoc2.load(musicPicksFile);
	 }	 
}
// -----------------------------

function importXML_JapaneseMusicPicks(japaneseMusicPicksFile) 
{
	isMusicListIcon = true;
	    
     if (curIndex == "index")
	 {
		mediaPath = "media/"; // Move up to the media folder.
		japanMusicPicksListIndex = 1;
	 }
	 
	 if (window.XMLHttpRequest) // Applies to IE 7+, Chrome, Firefox, and Opera.
	 {
	   xmlhttp4 = new XMLHttpRequest();
	   xmlhttp4.onreadystatechange = function () {
			if (xmlhttp4.readyState == 4) 
			{	
			
			    xmlDoc4 = xmlhttp4.responseXML;
				
				allMusicListFlag = "japaneseMusicList";
				
				extracXMLJapanMusicLists_left(japaneseMusicPicksFile);
				
				if ((curIndex == "allMusicLists") || (curIndex == "japaneseOnly"))
				{
					//allMusicListFlag = "japaneseMusicList";
					extractGTGMusicPicks_table(japaneseMusicPicksFile);	
				}
				/*else if (passSubIndex == "dropdown")
				{
					extractGTGMusicPicks_dropdown(japaneseMusicPicksFile);	
				}*/
				
			}
		}
	   xmlhttp4.open("GET",japaneseMusicPicksFile,true);
	   xmlhttp4.send(null);
	   
	 } 
	 else if (window.ActiveXObject) // Applies to Internet Explorer 5 and 6
	 {  
	   xmlDoc4 = new ActiveXObject("Microsoft.XMLDOM");  
	   xmlDoc4.onreadystatechange = function () {
			if (xmlhttp4.readyState == 4) 
			{	
				if (xmlhttp4.status == 200 || xmlhttp4.status == 0)
				{
					xmlDoc4 = xmlhttp4.responseXML;
				
					allMusicListFlag = "japaneseMusicList";
					
					extracXMLJapanMusicLists_left(japaneseMusicPicksFile);
					
					if ((curIndex == "allMusicLists") || (curIndex == "japaneseOnly"))
					{
						extractGTGMusicPicks_table(japaneseMusicPicksFile);	
					}
					/*else if (passSubIndex == "dropdown")
					{
						extractGTGMusicPicks_dropdown(japaneseMusicPicksFile);	
					}*/
					
				}
			}
		}
	   xmlDoc4.load(japaneseMusicPicksFile);
	 }	 
}
// -----------------------------
function importXML_KoreanMusicPicks(koreanMusicPicksFile) 
{
	isMusicListIcon = true;
	    
     if (curIndex == "index")
	 {
		mediaPath = "media/"; // Move up to the media folder.
		koreaMusicPicksListIndex = 1;
	 }
	 /*else if (curIndex == "media-top-icons") // For the small media icon URLs on top
	 {
		mediaPath = ""; // No additional path adds.  The current path is in the media folder already. 
		GTGMusicPicksListIndex = 1;
	 }*/
	 
	 if (window.XMLHttpRequest) // Applies to IE 7+, Chrome, Firefox, and Opera.
	 {
	   xmlhttp5 = new XMLHttpRequest();
	   xmlhttp5.onreadystatechange = function () {
			if (xmlhttp5.readyState == 4) 
			{	
			
			    xmlDoc5 = xmlhttp5.responseXML;
				
				allMusicListFlag = "koreanMusicList";
				
				extracXMLKoreaMusicLists_left(koreanMusicPicksFile);
						
				if ((curIndex == "allMusicLists") || (curIndex == "koreanOnly"))
				{
					extractGTGMusicPicks_table(koreanMusicPicksFile);	
				}
				else if (passSubIndex == "dropdown")
				{
					extractGTGMusicPicks_dropdown(koreanMusicPicksFile);	
				}
			}
		}
	   xmlhttp5.open("GET",koreanMusicPicksFile,true);
	   xmlhttp5.send(null);
	   
	 } 
	 else if (window.ActiveXObject) // Applies to Internet Explorer 5 and 6
	 {  
	   xmlDoc5 = new ActiveXObject("Microsoft.XMLDOM");  
	   xmlDoc5.onreadystatechange = function () {
			if (xmlhttp5.readyState == 4) 
			{	
				xmlDoc5 = xmlhttp5.responseXML;
				
				allMusicListFlag = "koreanMusicList";
				
				extracXMLKoreaMusicLists_left(koreanMusicPicksFile);
						
				if ((curIndex == "allMusicLists") || (curIndex == "koreanOnly"))
				{
					//allMusicListFlag = "koreanMusicList";
					extractGTGMusicPicks_table(koreanMusicPicksFile);	
				}
				else if (passSubIndex == "dropdown")
				{
					extractGTGMusicPicks_dropdown(koreanMusicPicksFile);	
				}
			}
		}
	   xmlDoc5.load(koreanMusicPicksFile);
	 }	 
}
// -----------------------------
function importXML_VocaloidMusicPicks(vocaloidMusicPicksFile) 
{
	isMusicListIcon = true;
	    
     if (curIndex == "index")
	 {
		mediaPath = "media/"; // Move up to the media folder.
		vocaloidMusicPicksListIndex = 1;
	 }
	 
	 if (window.XMLHttpRequest) // Applies to IE 7+, Chrome, Firefox, and Opera.
	 {
	   xmlhttp7 = new XMLHttpRequest();
	   xmlhttp7.onreadystatechange = function () {
			if (xmlhttp7.readyState == 4) 
			{	
			
			    xmlDoc7 = xmlhttp7.responseXML;
				
				allMusicListFlag = "vocaloidPicksList";
				
				extractXMLVocaloidMusicLists_left(vocaloidMusicPicksFile);
						
				if (curIndex == "allMusicLists")
				{
					extractGTGMusicPicks_table(vocaloidMusicPicksFile);	
				}
				else if (passSubIndex == "dropdown")
				{
					extractGTGMusicPicks_dropdown(vocaloidMusicPicksFile);	
				}
			}
		}
	   xmlhttp7.open("GET",vocaloidMusicPicksFile,true);
	   xmlhttp7.send(null);
	   
	 } 
	 else if (window.ActiveXObject) // Applies to Internet Explorer 5 and 6
	 {  
	   xmlDoc7 = new ActiveXObject("Microsoft.XMLDOM");  
	   xmlDoc7.onreadystatechange = function () {
			if (xmlhttp7.readyState == 4) 
			{	
				xmlDoc7 = xmlhttp7.responseXML;
				
				allMusicListFlag = "vocaloidPicksList";
				
				extractXMLVocaloidMusicLists_left(vocaloidMusicPicksFile);
						
				if (curIndex == "allMusicLists")
				{
					//allMusicListFlag = "koreanMusicList";
					extractGTGMusicPicks_table(vocaloidMusicPicksFile);	
				}
				else if (passSubIndex == "dropdown")
				{
					extractGTGMusicPicks_dropdown(vocaloidMusicPicksFile);	
				}
			}
		}
	   xmlDoc7.load(vocaloidMusicPicksFile);
	 }	 
}




// -----------------------------

function importXML_FeaturedSpotlights(featuredSpotlightsFile)
{
		
	 if (window.XMLHttpRequest) // Applies to IE 7+, Chrome, Firefox, and Opera.
	 {
	   xmlhttp3 = new XMLHttpRequest();
	   
	   xmlhttp3.onreadystatechange = function () {
			if (xmlhttp3.readyState == 4) 
			{				
				if (xmlhttp3.status == 200 || xmlhttp3.status == 0)
				{
					xmlDoc3 = xmlhttp3.responseXML;
															
					extractFeaturedSpotlights_Left(featuredSpotlightsFile);	
					
				}
			}
		}
	   xmlhttp3.open("GET",featuredSpotlightsFile,true);
	   xmlhttp3.send(null);
	   
	 } 
	 else if (window.ActiveXObject) // Applies to Internet Explorer 5 and 6
	 { 

	   xmlDoc3 = new ActiveXObject("Microsoft.XMLDOM");  
	   xmlDoc3.onreadystatechange = function () {
			if (xmlhttp3.readyState == 4) 
			{	
				if (xmlhttp3.status == 200 || xmlhttp3.status == 0)
				{
					xmlDoc3 = xmlhttp3.responseXML;
					
					extractFeaturedSpotlights_Left(featuredSpotlightsFile);	
					
				}
			}
		}
	   xmlDoc3.load(featuredSpotlightsFile);
	 }	 

}

// -----------------------------
function importXML_EditorsCorner(editorsCornerFile)
{	
     
     if (curIndex == "index")
	 {
		editorsCornerIndex = 1;
	 }

	 if (window.XMLHttpRequest) // Applies to IE 7+, Chrome, Firefox, and Opera.
	 {
	   xmlhttp9 = new XMLHttpRequest();
	   xmlhttp9.onreadystatechange = function () {
			if (xmlhttp9.readyState == 4) 
			{	
				if (xmlhttp9.status == 200 || xmlhttp9.status == 0)
				{
					xmlDoc9 = xmlhttp9.responseXML;
					extractEditorsCorner_dropdown(editorsCornerFile);
	
				}
			}
		}
	   xmlhttp9.open("GET",editorsCornerFile,true);
	   xmlhttp9.send(null);
	   
	 } 
	 else if (window.ActiveXObject) // Applies to Internet Explorer 5 and 6
	 { 

	   xmlDoc9 = new ActiveXObject("Microsoft.XMLDOM");  
	   xmlDoc9.onreadystatechange = function () {
			if (xmlhttp9.readyState == 4) 
			{	
				if (xmlhttp9.status == 200 || xmlhttp9.status == 0)
				{
					xmlDoc9 = xmlhttp9.responseXML;
					
					extractEditorsCorner_dropdown(editorsCornerFile);
					
				}
			}
		}
	   xmlDoc9.load(editorsCornerFile);
	 }	 

}

function importXML_PicBook(picBookFile)
{	
	 if (window.XMLHttpRequest) // Applies to IE 7+, Chrome, Firefox, and Opera.
	 {
	   xmlhttp8 = new XMLHttpRequest();
	   xmlhttp8.onreadystatechange = function () {
			if (xmlhttp8.readyState == 4) 
			{	
				if (xmlhttp8.status == 200 || xmlhttp8.status == 0)
				{
					xmlDoc8 = xmlhttp8.responseXML;
					
					if (curPicBookType.toLowerCase() == "intro")
			        {	
					   extractPicBook(picBookFile);	
					}
		
				}
			}
		}
	   xmlhttp8.open("GET",picBookFile,true);
	   xmlhttp8.send(null);
	   
	 } 
	 else if (window.ActiveXObject) // Applies to Internet Explorer 5 and 6
	 { 

	   xmlDoc8 = new ActiveXObject("Microsoft.XMLDOM");  

	   xmlDoc8.onreadystatechange = function () {
			if (xmlhttp8.readyState == 4) 
			{	
				if (xmlhttp8.status == 200 || xmlhttp8.status == 0)
				{
					xmlDoc8 = xmlhttp8.responseXML;
					
					if (curPicBookType.toLowerCase() == "intro")
					{
					   extractPicBook(picBookFile);	
					}			
				}
			}
		}
	   xmlDoc8.load(picBookFile);
	 }	 

}


function importXML_News(newsFile)
{	
	 if (window.XMLHttpRequest) // Applies to IE 7+, Chrome, Firefox, and Opera.
	 {
	   xmlhttp6 = new XMLHttpRequest();
	   xmlhttp6.onreadystatechange = function () {
			if (xmlhttp6.readyState == 4) 
			{	
				if (xmlhttp6.status == 200 || xmlhttp6.status == 0)
				{
					xmlDoc6 = xmlhttp6.responseXML;
					
					if (curNewsType.toLowerCase() == "intro")
			        {
					   extractNews(newsFile);	
					}
						
				}
			}
		}
	   xmlhttp6.open("GET",newsFile,true);
	   xmlhttp6.send(null);
	   
	 } 
	 else if (window.ActiveXObject) // Applies to Internet Explorer 5 and 6
	 { 

	   xmlDoc6 = new ActiveXObject("Microsoft.XMLDOM");  
	   //xmlDoc2.ondataavailable = extractGTGMusicPicks_dropdown(musicPicksFile);	
	   xmlDoc6.onreadystatechange = function () {
			if (xmlhttp6.readyState == 4) 
			{	
				if (xmlhttp6.status == 200 || xmlhttp6.status == 0)
				{
					xmlDoc6 = xmlhttp6.responseXML;
					
					if (curNewsType.toLowerCase() == "intro")
					{
					   extractNews(newsFile);	
					}
					
				}
			}
		}
	   xmlDoc6.load(newsFile);
	 }	 

}

function importXML_Events(eventsFile)
{	
	 if (window.XMLHttpRequest) // Applies to IE 7+, Chrome, Firefox, and Opera.
	 {
	   xmlhttp10 = new XMLHttpRequest();
	   xmlhttp10.onreadystatechange = function () {
			if (xmlhttp10.readyState == 4) 
			{	
				if (xmlhttp10.status == 200 || xmlhttp10.status == 0)
				{
					xmlDoc10 = xmlhttp10.responseXML;
					
					if (curEventsType.toLowerCase() == "intro")
			        {
					   extractEvents(eventsFile);	
					}
						
				}
			}
		}
	   xmlhttp10.open("GET",eventsFile,true);
	   xmlhttp10.send(null);
	   
	 } 
	 else if (window.ActiveXObject) // Applies to Internet Explorer 5 and 6
	 { 

	   xmlDoc10 = new ActiveXObject("Microsoft.XMLDOM");  
	   //xmlDoc2.ondataavailable = extractGTGMusicPicks_dropdown(musicPicksFile);	
	   xmlDoc10.onreadystatechange = function () {
			if (xmlhttp10.readyState == 4) 
			{	
				if (xmlhttp10.status == 200 || xmlhttp10.status == 0)
				{
					xmlDoc10 = xmlhttp10.responseXML;
					
					if (curEventsType.toLowerCase() == "intro")
					{
					   extractEvents(eventsFile);	
					}
					
				}
			}
		}
	   xmlDoc10.load(eventsFile);
	 }	 

}

function importXML_interviews(interviewsFile)
{	
	 if (window.XMLHttpRequest) // Applies to IE 7+, Chrome, Firefox, and Opera.
	 {
	   xmlhttp12 = new XMLHttpRequest();
	   xmlhttp12.onreadystatechange = function () {
			if (xmlhttp12.readyState == 4) 
			{	
				if (xmlhttp12.status == 200 || xmlhttp12.status == 0)
				{
					xmlDoc12 = xmlhttp12.responseXML;
					
					if (curinterviewsType.toLowerCase() == "intro")
			        {
					   extractInterviews(interviewsFile);	
					}
						
				}
			}
		}
	   xmlhttp12.open("GET",interviewsFile,true);
	   xmlhttp12.send(null);
	   
	 } 
	 else if (window.ActiveXObject) // Applies to Internet Explorer 5 and 6
	 { 

	   xmlDoc12 = new ActiveXObject("Microsoft.XMLDOM");  
	   //xmlDoc2.ondataavailable = extractGTGMusicPicks_dropdown(musicPicksFile);	
	   xmlDoc12.onreadystatechange = function () {
			if (xmlhttp12.readyState == 4) 
			{	
				if (xmlhttp12.status == 200 || xmlhttp12.status == 0)
				{
					xmlDoc12 = xmlhttp12.responseXML;
					
					if (curinterviewsType.toLowerCase() == "intro")
					{
					   extractInterviews(interviewsFile);	
					}
					
				}
			}
		}
	   xmlDoc12.load(interviewsFile);
	 }	 

}



// -----------------------------

function startSettings()
{
	
	tempDate = new Date(); // Pacific standard time (PST)
	todayDate = new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate());
	articleRange = new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate()-0+maxInterval); // 2 weeks
	maxRange = articleRange;
	
	if (curType.toLowerCase() == "music" ||
		curType.toLowerCase() == "movies" || 
		curType.toLowerCase() == "culture" || 
		curType.toLowerCase() == "video games" ||
		curType.toLowerCase() == "anime" ||
		curType.toLowerCase() == "comics" ||
	    curType.toLowerCase() == "master")
	{
				
		listRange = new Date(2000, 1, 1);
		
		// Sets the range to the music range instead.
		maxRange = listRange;
	}
	
}

function extractEditorsCorner_dropdown(editorsCornerFile)
{
	var editorsPicks = xmlDoc9.getElementsByTagName("editorsCorner");
	var noOfDates = editorsPicks[0].getElementsByTagName("date").length;
	var treeDate; 
		
	for (dateCount = 0; dateCount < noOfDates; dateCount++)
	{
		treeDate = editorsPicks[0].getElementsByTagName("date")[dateCount];
		
		var curDate = treeDate.getAttribute("day"); 
		
		// Turns curDate into a date format.
		var parseDate = new Date(curDate.split('/')[2], curDate.split('/')[0], curDate.split('/')[1]);
		// Adds one month to the parseDate because in a XML format, dates are one month behind.
		parseDate = parseDate.getMonth()+1 + "/" + parseDate.getDate() + "/" + parseDate.getFullYear();

        // If the editorsCornerIndex = 1, we just want the first date for the index.html file.
		if (editorsCornerIndex == 1)
		{
			var editorsCornerUpdatedLabel = document.getElementById("editorsCornerUpdated");
	        editorsCornerUpdatedLabel.innerHTML = "Updated: " + parseDate;
			break;	
		} 


		var curText = parseDate;
		
		var addToSelectList = document.getElementById("select-Editors-Corner-List");
		
		// Adds to the list.
		addToSelectList.options[dateCount] = new Option(curText);
		
		// Replace the slash with a dash for the URL link.
		// the \ tells Javascript that the following / is an actual / and not the end of the regular expression
		var dateToURL = parseDate.replace(/\//gi, "-"); 
		
		// Adds tgeURL to the used array.
		/*if (dateCount == 0)
		{
		    arrayUsed[dateCount] = editorsCornerText + "-current.html";	
		}
		else
		{
		    arrayUsed[dateCount] = 	editorsCornerText + "-" + dateToURL + ".html"; // Inserts a dash in the middle.
		}*/
		
		arrayUsed[dateCount] = 	editorsCornerText + "-" + dateToURL + ".html"; 
		
	}
	
	// Subtracts the noOfDates by the curIndex to get the correct setIndex below.
	finalIndex = (noOfDates - 1) - curIndex;
	document.getElementById("select-Editors-Corner-List").selectedIndex = finalIndex;
	
}





function extractFeaturedSpotlights_dropdown(featuredSpotlightsFile)
{
	var featPicks = xmlDoc3.getElementsByTagName("spotlightsList");
	var noOfDates = featPicks[0].getElementsByTagName("date").length;
	var treeDate; 
	
	
	var duplicateCount = 1;
	
	// Reads each date's day and it's child, title.
	for (dateCount = 0; dateCount < noOfDates; dateCount++)
	{
		treeDate = featPicks[0].getElementsByTagName("date")[dateCount];
		
		var curDate = treeDate.getAttribute("day"); 
		var curTitle = treeDate.getElementsByTagName("title")[0].childNodes[0].nodeValue;
		var curExt = treeDate.getElementsByTagName("type")[0].childNodes[0].nodeValue;
		
		// Turns curDate into a date format.
		var parseDate = new Date(curDate.split('/')[2], curDate.split('/')[0], curDate.split('/')[1]);
		// Adds one month to the parseDate because in a XML format, dates are one month behind.
		parseDate = parseDate.getMonth()+1 + "/" + parseDate.getDate() + "/" + parseDate.getFullYear();

		var curText = parseDate + " --- " + curTitle;
		
		var addToSelectList = document.getElementById("selectFeaturedList");
		
		// Adds to the list.
		addToSelectList.options[dateCount] = new Option(curText);
		
		// Replace the slash with a dash for the URL link.
		// the \ tells Javascript that the following / is an actual / and not the end of the regular expression
		var dateToURL = parseDate.replace(/\//gi, "-"); 
				
		// Adds tgeURL to the used array.
		arrayUsed[dateCount] = 	featuredSpotlightText + "-" + dateToURL + "." + curExt;
		
	}
	
	// Subtracts the noOfDates by the curIndex to get the correct setIndex below.
	//finalIndex = (noOfDates - 1) - featuredSpotlightLevel;
	finalIndex = (noOfDates - 1) - curIndex;
	document.getElementById("selectFeaturedList").selectedIndex = finalIndex;
}

function extractPicBook(picBookFile)
{	
	var editPicks = xmlDoc8.getElementsByTagName("picBookList");
	var noOfDates = editPicks[0].getElementsByTagName("date").length;
    var treeDate;

    // For every date, dynamically add a date into the Featured-Spotlight-Add ID.
    for (dateCount = 0; dateCount < noOfDates; dateCount++)
	{
		treeDate = editPicks[0].getElementsByTagName("date")[dateCount];
		var curDate = treeDate.getAttribute("day"); 
		
		var picBookAdd = document.createElement('div');
		picBookAdd.className = "PicBook-list";
		//picBookAdd.style.height = 240 + "px";
		
		var hrefLink;
		var parseDate;
		var dateToURL;
		
		// Turns curDate into a date format.
	    parseDate = new Date(curDate.split('/')[2], curDate.split('/')[0], curDate.split('/')[1]);
	    // Adds one month to the parseDate because in a XML format, dates are one month behind.
	    parseDate = parseDate.getMonth()+1 + "/" + parseDate.getDate() + "/" + parseDate.getFullYear();	
								
		
		dateToURL = parseDate.replace(/\//gi, "-"); 
		
		hrefLink = "PicBook-" + dateToURL + ".html";
		
		var addHrefLink = document.createElement('a');
		addHrefLink.setAttribute('href', hrefLink);

		var image = document.createElement('img');
		var picturesPath = setCurPath(picBookPictures);
		picturesPath = picturesPath + "-" + dateToURL + ".jpg";
		image.setAttribute('src', picturesPath);
		
		//alert(picturesPath);
		
	    var header = document.createElement('h3');
		header.innerHTML = editPicks[0].getElementsByTagName("title")[dateCount].childNodes[0].nodeValue;
			
		var paraAuthor = document.createElement('a');
		paraAuthor.id = "paraAuthor";
		paraAuthor.innerHTML = editPicks[0].getElementsByTagName("author")[dateCount].childNodes[0].nodeValue + "&nbsp;&nbsp;&nbsp;";

		var paraDate = document.createElement('a');
		paraDate.id = "paraDate";
		paraDate.innerHTML = parseDate;
		
		var paraDesc = document.createElement('p');
		paraDesc.innerHTML = editPicks[0].getElementsByTagName("desc")[dateCount].childNodes[0].nodeValue;
	
	
	    // Adds everything in the HTML file dynamically.
	    var spanAppend = document.getElementById("PicBook-Add");
	    spanAppend.appendChild(picBookAdd);
		
		picBookAdd.appendChild(addHrefLink);
		addHrefLink.appendChild(image);
		
		picBookAdd.appendChild(addHrefLink);
		addHrefLink.appendChild(header);
		
		picBookAdd.appendChild(paraAuthor);
		picBookAdd.appendChild(paraDate);
		picBookAdd.appendChild(paraDesc);
	}	
	
	
}

function extractNews(newsFile)
{
	var editPicks = xmlDoc6.getElementsByTagName("newsList");
	var noOfDates = editPicks[0].getElementsByTagName("date").length;
    var treeDate;

    // For every date, dynamically add a date into the Featured-Spotlight-Add ID.
    for (dateCount = 0; dateCount < noOfDates; dateCount++)
	{
		treeDate = editPicks[0].getElementsByTagName("date")[dateCount];
		var curDate = treeDate.getAttribute("day"); 
		
		var newsAdd = document.createElement('div');
		newsAdd.className = "News-list";
		//newsAdd.style.height = 240 + "px";
		
		var hrefLink;
		var parseDate;
		var dateToURL;
		
		// Turns curDate into a date format.
	    parseDate = new Date(curDate.split('/')[2], curDate.split('/')[0], curDate.split('/')[1]);
	    // Adds one month to the parseDate because in a XML format, dates are one month behind.
	    parseDate = parseDate.getMonth()+1 + "/" + parseDate.getDate() + "/" + parseDate.getFullYear();	
								
		// If the featuredSpotlightIndex = 1, we just want the first date for the index.html file.
		/*if (featuredSpotlightIndex == 1)
		{
			var featuredSpotlightUpdatedLabel = document.getElementById("featuredSpotlightUpdated");
	        featuredSpotlightUpdatedLabel.innerHTML = "Updated: " + parseDate;
			break;	
		}
		*/
		
		dateToURL = parseDate.replace(/\//gi, "-"); 
		
		hrefLink = "News-" + dateToURL + ".html";
		
		var addHrefLink = document.createElement('a');
		addHrefLink.setAttribute('href', hrefLink);

		var image = document.createElement('img');
		var picturesPath = setCurPath(newsPictures);
		picturesPath = picturesPath + "-" + dateToURL + ".jpg";
		image.setAttribute('src', picturesPath);
		
		//alert(picturesPath);
		
	    var header = document.createElement('h3');
		header.innerHTML = editPicks[0].getElementsByTagName("title")[dateCount].childNodes[0].nodeValue;
			
		var paraAuthor = document.createElement('a');
		paraAuthor.id = "paraAuthor";
		paraAuthor.innerHTML = editPicks[0].getElementsByTagName("author")[dateCount].childNodes[0].nodeValue + "&nbsp;&nbsp;&nbsp;";

		var paraDate = document.createElement('a');
		paraDate.id = "paraDate";
		paraDate.innerHTML = parseDate;
		
		var paraDesc = document.createElement('p');
		paraDesc.innerHTML = editPicks[0].getElementsByTagName("desc")[dateCount].childNodes[0].nodeValue;
	
	
	    // Adds everything in the HTML file dynamically.
	    var spanAppend = document.getElementById("News-Add");
	    spanAppend.appendChild(newsAdd);
		
		newsAdd.appendChild(addHrefLink);
		addHrefLink.appendChild(image);
		
		newsAdd.appendChild(addHrefLink);
		addHrefLink.appendChild(header);
		
		newsAdd.appendChild(paraAuthor);
		newsAdd.appendChild(paraDate);
		newsAdd.appendChild(paraDesc);
	}	
}

function extractEvents(eventsFile)
{
	var editPicks = xmlDoc10.getElementsByTagName("eventsList");
	var noOfDates = editPicks[0].getElementsByTagName("date").length;
    var treeDate;

    // For every date, dynamically add a date into the Featured-Spotlight-Add ID.
    for (dateCount = 0; dateCount < noOfDates; dateCount++)
	{
		treeDate = editPicks[0].getElementsByTagName("date")[dateCount];
		var curDate = treeDate.getAttribute("day");
		var curExt = editPicks[0].getElementsByTagName("type")[dateCount].childNodes[0].nodeValue; // Temporary - Sees if the file is PHP or HTML
		
		var eventsAdd = document.createElement('div');
		eventsAdd.className = "Events-list";
		
		var hrefLink;
		var parseDate;
		var dateToURL;
		
		// Turns curDate into a date format.
	    parseDate = new Date(curDate.split('/')[2], curDate.split('/')[0], curDate.split('/')[1]);
	    // Adds one month to the parseDate because in a XML format, dates are one month behind.
	    parseDate = parseDate.getMonth()+1 + "/" + parseDate.getDate() + "/" + parseDate.getFullYear();	
									
		dateToURL = parseDate.replace(/\//gi, "-"); 
		
		hrefLink = "Events-" + dateToURL + "." + curExt;
		
		var addHrefLink = document.createElement('a');
		addHrefLink.setAttribute('href', hrefLink);

		var image = document.createElement('img');
		var picturesPath = setCurPath(eventsPictures);
		picturesPath = picturesPath + "-" + dateToURL + ".jpg";
		image.setAttribute('src', picturesPath);
		
	    var header = document.createElement('h3');
		header.innerHTML = editPicks[0].getElementsByTagName("title")[dateCount].childNodes[0].nodeValue;
			
		var paraAuthor = document.createElement('a');
		paraAuthor.id = "paraAuthor";
		paraAuthor.innerHTML = editPicks[0].getElementsByTagName("author")[dateCount].childNodes[0].nodeValue + "&nbsp;&nbsp;&nbsp;";

		var paraDate = document.createElement('a');
		paraDate.id = "paraDate";
		paraDate.innerHTML = parseDate;
		
		var paraDesc = document.createElement('p');
		paraDesc.innerHTML = editPicks[0].getElementsByTagName("desc")[dateCount].childNodes[0].nodeValue;
	
	
	    // Adds everything in the HTML file dynamically.
	    var spanAppend = document.getElementById("Events-Add");
	    spanAppend.appendChild(eventsAdd);
		
		eventsAdd.appendChild(addHrefLink);
		addHrefLink.appendChild(image);
		
		eventsAdd.appendChild(addHrefLink);
		addHrefLink.appendChild(header);
		
		eventsAdd.appendChild(paraAuthor);
		eventsAdd.appendChild(paraDate);
		eventsAdd.appendChild(paraDesc);
	}	
}

function extractInterviews(interviewsFile)
{
	var editPicks = xmlDoc12.getElementsByTagName("interviewsList");
	var noOfDates = editPicks[0].getElementsByTagName("date").length;
    var treeDate;

    // For every date, dynamically add a date into the Featured-Spotlight-Add ID.
    for (dateCount = 0; dateCount < noOfDates; dateCount++)
	{
		treeDate = editPicks[0].getElementsByTagName("date")[dateCount];
		var curDate = treeDate.getAttribute("day"); 
		
		var interviewsAdd = document.createElement('div');
		interviewsAdd.className = "Interviews-list";
		
		var hrefLink;
		var parseDate;
		var dateToURL;
		
		// Turns curDate into a date format.
	    parseDate = new Date(curDate.split('/')[2], curDate.split('/')[0], curDate.split('/')[1]);
	    // Adds one month to the parseDate because in a XML format, dates are one month behind.
	    parseDate = parseDate.getMonth()+1 + "/" + parseDate.getDate() + "/" + parseDate.getFullYear();	
									
		dateToURL = parseDate.replace(/\//gi, "-"); 
		
		/*hrefLink = "Interview-" + dateToURL + ".html";
		
		var addHrefLink = document.createElement('a');
		addHrefLink.setAttribute('href', hrefLink);

		var image = document.createElement('img');
		var picturesPath = setCurPath(interviewsPictures);
		picturesPath = picturesPath + "-" + dateToURL + ".jpg";
		image.setAttribute('src', picturesPath);*/
		
	    var header = document.createElement('h3');
		header.innerHTML = editPicks[0].getElementsByTagName("title")[dateCount].childNodes[0].nodeValue;
			
		var paraAuthor = document.createElement('a');
		paraAuthor.id = "paraAuthor";
		paraAuthor.innerHTML = editPicks[0].getElementsByTagName("author")[dateCount].childNodes[0].nodeValue + "&nbsp;&nbsp;&nbsp;";

		var paraDate = document.createElement('a');
		paraDate.id = "paraDate";
		paraDate.innerHTML = parseDate;
		
		var paraDesc = document.createElement('p');
		paraDesc.innerHTML = editPicks[0].getElementsByTagName("desc")[dateCount].childNodes[0].nodeValue;
	

        // Replace the space with a dash for the URL link.
		// The title will not have the dashes, but the URL link will.
	    urlHeader = header.innerHTML.replace(/ /gi, "-");

	
	    hrefLink = "Interview-" + urlHeader + "-" + dateToURL + ".html";
		
		var addHrefLink = document.createElement('a');
		addHrefLink.setAttribute('href', hrefLink);

		var image = document.createElement('img');
		var picturesPath = setCurPath(interviewsPictures);
		picturesPath = picturesPath + "-" + urlHeader + "-" + dateToURL + ".jpg";
		image.setAttribute('src', picturesPath);
	
	    // Finally, adds "Interview with" to the title.
		header.innerHTML = "Interview with " + header.innerHTML;
	
	 
	    // Adds everything in the HTML file dynamically.
	    var spanAppend = document.getElementById("Interviews-Add");
	    spanAppend.appendChild(interviewsAdd);
		
		interviewsAdd.appendChild(addHrefLink);
		addHrefLink.appendChild(image);
		
		interviewsAdd.appendChild(addHrefLink);
		addHrefLink.appendChild(header);
		
		interviewsAdd.appendChild(paraAuthor);
		interviewsAdd.appendChild(paraDate);
		interviewsAdd.appendChild(paraDesc);
	}	
}

// -------------------------------------------------
// From Javascript.About.com
// Sort an array by date.
var dateRE = /^(\d{2})[\/\- ](\d{2})[\/\- ](\d{4})/;
function dmyOrdA(a, b)
{
	a = a.replace(dateRE,"$3$2$1");
	b = b.replace(dateRE,"$3$2$1");
	if (a>b) return 1;
	if (a <b) return -1;
	return 0; 
}
function dmyOrdD(a, b)
{
	a = a.replace(dateRE,"$3$2$1");
	b = b.replace(dateRE,"$3$2$1");
	if (a>b) return -1;
	if (a <b) return 1;
	return 0; 
}
function mdyOrdA(a, b)
{
	a = a.replace(dateRE,"$3$1$2");
	b = b.replace(dateRE,"$3$1$2");
	if (a>b) return 1;
	if (a <b) return -1;
	return 0; 
}
function mdyOrdD(a, b)
{
	a = a.replace(dateRE,"$3$1$2");
	b = b.replace(dateRE,"$3$1$2");
	if (a>b) return -1;
	if (a <b) return 1;
	return 0; 
}
// -------------------------------------------------
function extractXMLVocaloidMusicLists_left(musicPicksFile)
{
	var musicList;
	var insertToList;
	var latestLimitMusic;
	
	musicList = xmlDoc7.getElementsByTagName("musicList");
	insertToList = "insert-list-Vocaloid";
	holderText = vocaloidPicksText;
	musicURL = "Vocaloid-Picks-"; 
	
	latestLimitMusic = latestVocaloidPicks;
	
	lookForLabelID = "vocaloidMusicChartsUpdated";
	
	var musicPickURL = "vocaloidMusicPickURL";
	var musicPickBlockURL = "vocaloidMusicListBlockLabel";
	var musicIconID = "vocaloidMusicPickURL";
	
	// Checks if there are any date tags
	var noOfDates = musicList[0].getElementsByTagName("date").length;

	if (noOfDates == 0)
	{
	    return; // Exits the function	
	}
		
	var numOfLists = 0;
	
	
	for (dateCount = 0; dateCount < noOfDates; dateCount++)
	{
	    // Gets the very first element
		var treeDate = musicList[0].getElementsByTagName("date")[dateCount];  // Moves down to the date element tag
		curDate = treeDate.getAttribute("day");
		var curTitle = treeDate.getElementsByTagName("title")[0].childNodes[0].nodeValue;
										
		// Format when parsing is year/month/day -- [2],[0],[1] arrays
		var parseDate = new Date(curDate.split('/')[2], curDate.split('/')[0], curDate.split('/')[1]);
		curDate = parseDate;
	
	    var treeTitle = treeDate.getElementsByTagName("title")[0].childNodes[0].nodeValue;  // Moves down to the title element tag
	
		var tr = document.createElement('tr');  // Sets the row
		var th = document.createElement('th');  // Header
		var myList = document.createElement('a'); // List name
		var href = document.createAttribute('href'); // Creates a link attribute within the anchor tag
		var divTag = document.createElement('div'); // Creates a div id 'main-body'
		var img = document.createElement('img');  // Creates an image tag.
		var imgSrc = document.createAttribute('src');  // Creates an image source attribute.
		
		// Sets the id tag for the proper CSS topic image.  This will be "none" in this case.
		tr.className = "none";
		
		// Date in format of month, day, year
	    var tempYear = curDate.getYear();
	    if (tempYear < 1000)
           tempYear += 1900;
	
	    var tempDay = curDate.getDate();
        var tempMonth = curDate.getMonth()+1;	
		
		var curTitleURL;
		
		var dateToFormat = tempMonth + "/" + tempDay + "/" + tempYear;
		
		// Replace the slash with a dash for the URL link.
		// the \ tells Javascript that the following / is an actual / and not the end of the regular expression
	    var dateToURL = dateToFormat.replace(/\//gi, "-");
        curTitleURL = holderText + "-" + dateToURL + ".html"; // Inserts a dash in the middle.
	
	     //VocaloidMusicPicksListIndex
		// If the VocaloidMusicPicksListIndex = 1, we just want the first date for the index.html file.
		if(dateCount == 0)
		{
			if (vocaloidMusicPicksListIndex == 1)
			{	
				var musicPicksUpdatedLabel = document.getElementById(lookForLabelID);
				musicPicksUpdatedLabel.innerHTML = "Updated: " + dateToFormat;
				
				var musicPickURL = document.getElementById(musicPickURL);
				musicPickURL.setAttribute('href', mediaPath + holderText + "-" + dateToURL + ".html");
					
				//break;	
			}
		
			// For the media top icons in the Media.html page.
			if  ((curMusicType == "media-top-icons") || (curMusicType == "dropdown")) 
			{
				var musicIconURL = document.getElementById(musicIconID);
				musicIconURL.setAttribute('href', holderText + "-" + dateToURL + ".html");
												
				// For the media-holder.html intro page.
				if(curMusicType == 	"media-top-icons")
				{
				   musicPickBlockURL = document.getElementById(musicPickBlockURL);
				   musicPickBlockURL.setAttribute('href', mediaPath + holderText + "-" + dateToURL + ".html");
				}
				
				
			}
		}
		
		curMusicLists.arrayOfTitles[addToMusicLists] = curTitle;
		curMusicLists.arrayOfDates[addToMusicLists] = dateToFormat;
		curMusicLists.arrayOfURLs[addToMusicLists] = dirRoot + "media/" + musicURL + dateToURL + ".html";
		
		//alert(latestLimitMusic);
		
		// Inserts up to the latestContentNum (5 right now.)
		if(dateCount < latestLimitMusic)
		{
		   //alert(dateCount + "\n" + allMusicListFlag);
		   setupArticle("music-lists");
		   		   
		}
		
		// Adds the current music lists' date of publication.
		testArray.push(curMusicLists.arrayOfDates[addToMusicLists]);

		addToMusicLists++;
		
							
	}

}
// -------------------------------------------------
function extracXMLJapanMusicLists_left(musicPicksFile)
{	
	var musicList;
	var insertToList;
	var latestLimitMusic;
	
	musicList = xmlDoc4.getElementsByTagName("musicList");
	insertToList = "insert-list-Japanese";
	holderText = japaneseMusicText;
	musicURL = "Media-Holder-Japan-charts-";
	
	latestLimitMusic = latestJapanMusic;
	
	lookForLabelID = "japanMusicChartsUpdated";
	
	var musicPickURL = "japanMusicPickURL";
	var musicPickBlockURL = "japaneseMusicListBlockLabel";
	var musicIconID = "japanMusicPickURL";
	
	// Checks if there are any date tags
	var noOfDates = musicList[0].getElementsByTagName("date").length;

	if (noOfDates == 0)
	{
	    return; // Exits the function	
	}
		
	var numOfLists = 0;
	
	
	for (dateCount = 0; dateCount < noOfDates; dateCount++)
	{
	    // Gets the very first element
		var treeDate = musicList[0].getElementsByTagName("date")[dateCount];  // Moves down to the date element tag
		curDate = treeDate.getAttribute("day");
		var curTitle = treeDate.getElementsByTagName("title")[0].childNodes[0].nodeValue;
										
		// Format when parsing is year/month/day -- [2],[0],[1] arrays
		var parseDate = new Date(curDate.split('/')[2], curDate.split('/')[0], curDate.split('/')[1]);
		curDate = parseDate;
	
	    var treeTitle = treeDate.getElementsByTagName("title")[0].childNodes[0].nodeValue;  // Moves down to the title element tag
	
        var curExt  = treeDate.getElementsByTagName("type")[0].childNodes[0].nodeValue; 
	
		var tr = document.createElement('tr');  // Sets the row
		var th = document.createElement('th');  // Header
		var myList = document.createElement('a'); // List name
		var href = document.createAttribute('href'); // Creates a link attribute within the anchor tag
		var divTag = document.createElement('div'); // Creates a div id 'main-body'
		var img = document.createElement('img');  // Creates an image tag.
		var imgSrc = document.createAttribute('src');  // Creates an image source attribute.
		
		// Sets the id tag for the proper CSS topic image.  This will be "none" in this case.
		tr.className = "none";
		
		// Date in format of month, day, year
	    var tempYear = curDate.getYear();
	    if (tempYear < 1000)
           tempYear += 1900;
	
	    var tempDay = curDate.getDate();
        var tempMonth = curDate.getMonth()+1;	
		
		var curTitleURL;
		
		var dateToFormat = tempMonth + "/" + tempDay + "/" + tempYear;
		
		// Replace the slash with a dash for the URL link.
		// the \ tells Javascript that the following / is an actual / and not the end of the regular expression
	    var dateToURL = dateToFormat.replace(/\//gi, "-");
        //curTitleURL = holderText + "-" + dateToURL + ".html"; // Inserts a dash in the middle.
		curTitleURL = holderText + "-" + dateToURL + "." + curExt;
		
	     //JapanMusicPicksListIndex
		// If the japanMusicPicksListIndex = 1, we just want the first date for the index.html file.
		if(dateCount == 0)
		{
			if (japanMusicPicksListIndex == 1)
			{
				var musicPicksUpdatedLabel = document.getElementById(lookForLabelID);
				musicPicksUpdatedLabel.innerHTML = "Updated: " + dateToFormat;
				
				var musicPickURL = document.getElementById(musicPickURL);
				//musicPickURL.setAttribute('href', mediaPath + holderText + "-" + dateToURL + ".html");
				musicPickURL.setAttribute('href', mediaPath + holderText + "-" + dateToURL + "." + curExt);

			}
		
			// For the media top icons in the Media.html page.
			if  ((curMusicType == "media-top-icons") || (curMusicType == "dropdown")) 
			{
				var musicIconURL = document.getElementById(musicIconID);
				//musicIconURL.setAttribute('href', holderText + "-" + dateToURL + ".html");
				musicIconURL.setAttribute('href', holderText + "-" + dateToURL + "." + curExt);
												
				// For the media-holder.html intro page.
				if(curMusicType == 	"media-top-icons")
				{
				   musicPickBlockURL = document.getElementById(musicPickBlockURL);
				   // musicPickBlockURL.setAttribute('href', mediaPath + holderText + "-" + dateToURL + ".html");
				   musicPickBlockURL.setAttribute('href', mediaPath + holderText + "-" + dateToURL + "." + curExt);
				}
				
				// Only needs to read the very first date (the newest) for each Music XML file.
				/*if(curMusicType == 	"dropdown")
				{
					break;	
				}*/
			}
		}
		
		curMusicLists.arrayOfTitles[addToMusicLists] = curTitle;
		curMusicLists.arrayOfDates[addToMusicLists] = dateToFormat;
		//curMusicLists.arrayOfURLs[addToMusicLists] = dirRoot + "media/" + musicURL + dateToURL + ".html";
	    curMusicLists.arrayOfURLs[addToMusicLists] = dirRoot + "media/" + musicURL + dateToURL + "." + curExt;
	
		
		// Inserts up to the latestContentNum (5 right now.)
		if(dateCount < latestLimitMusic)
		{
		   //alert(dateCount + "\n" + allMusicListFlag);
		   setupArticle("music-lists");
		   		   
		}
		
		// Adds the current music lists' date of publication.
		testArray.push(curMusicLists.arrayOfDates[addToMusicLists]);

		addToMusicLists++;
		
							
	}

	
}

function extracXMLKoreaMusicLists_left(musicPicksFile)
{	
	var musicList;
	var insertToList;
	var latestLimitMusic;
	
	musicList = xmlDoc5.getElementsByTagName("musicList");
	insertToList = "insert-list-Korean";
	holderText = koreanMusicText;
	musicURL = "Media-Holder-Korea-charts-";
	
	latestLimitMusic = latestKoreaMusic;
	lastMusicTally = 1; // when the GTG, Japan, and Korea lists have all been read.	
	
	lookForLabelID = "koreaMusicChartsUpdated";
	var musicPickURL = "koreaMusicPickURL";
	var musicIconID = "koreaMusicPickURL";
	var musicPickBlockURL = "koreanMusicListBlockLabel";
	
	
	// Checks if there are any date tags
	var noOfDates = musicList[0].getElementsByTagName("date").length;

	if (noOfDates == 0)
	{
	    return; // Exits the function	
	}
		
	var numOfLists = 0;
	
	
	for (dateCount = 0; dateCount < noOfDates; dateCount++)
	{
	    // Gets the very first element
		var treeDate = musicList[0].getElementsByTagName("date")[dateCount];  // Moves down to the date element tag
		curDate = treeDate.getAttribute("day");
		var curTitle = treeDate.getElementsByTagName("title")[0].childNodes[0].nodeValue;
										
		// Format when parsing is year/month/day -- [2],[0],[1] arrays
		var parseDate = new Date(curDate.split('/')[2], curDate.split('/')[0], curDate.split('/')[1]);
		curDate = parseDate;
	
	    var treeTitle = treeDate.getElementsByTagName("title")[0].childNodes[0].nodeValue;  // Moves down to the title element tag
	
	    var curExt = treeDate.getElementsByTagName("type")[0].childNodes[0].nodeValue;  // Moves down to the title element tag
	
		var tr = document.createElement('tr');  // Sets the row
		var th = document.createElement('th');  // Header
		var myList = document.createElement('a'); // List name
		var href = document.createAttribute('href'); // Creates a link attribute within the anchor tag
		var divTag = document.createElement('div'); // Creates a div id 'main-body'
		var img = document.createElement('img');  // Creates an image tag.
		var imgSrc = document.createAttribute('src');  // Creates an image source attribute.
		
		// Sets the id tag for the proper CSS topic image.  This will be "none" in this case.
		tr.className = "none";
		
		// Date in format of month, day, year
	    var tempYear = curDate.getYear();
	    if (tempYear < 1000)
           tempYear += 1900;
	
	    var tempDay = curDate.getDate();
        var tempMonth = curDate.getMonth()+1;	
		
		var curTitleURL;
		
		var dateToFormat = tempMonth + "/" + tempDay + "/" + tempYear;
		
		// Replace the slash with a dash for the URL link.
		// the \ tells Javascript that the following / is an actual / and not the end of the regular expression
	    var dateToURL = dateToFormat.replace(/\//gi, "-");
        //curTitleURL = holderText + "-" + dateToURL + ".html"; // Inserts a dash in the middle.
		curTitleURL = holderText + "-" + dateToURL + "." + curExt;
		
	     //Korea music list
		// If the koreaMusicPicksListIndex = 1, we just want the first date for the index.html file.
		if (dateCount == 0)
		{
			if (koreaMusicPicksListIndex == 1)
			{
				var musicPicksUpdatedLabel = document.getElementById(lookForLabelID);
				musicPicksUpdatedLabel.innerHTML = "Updated: " + dateToFormat;

				var musicPickURL = document.getElementById(musicPickURL);
				//musicPickURL.setAttribute('href', mediaPath + holderText + "-" + dateToURL + ".html");	
				musicPickURL.setAttribute('href', mediaPath + holderText + "-" + dateToURL + "." + curExt);
					
			}
		
			// For the media top icons in the Media.html page.
			if  ((curMusicType == "media-top-icons") || (curMusicType == "dropdown")) 
			{
				var musicIconURL = document.getElementById(musicIconID);
				//musicIconURL.setAttribute('href', holderText + "-" + dateToURL + ".html");
				musicIconURL.setAttribute('href', holderText + "-" + dateToURL + "." + curExt);
								
				// For the media-holder.html intro page.
				if(curMusicType == 	"media-top-icons")
				{
				   musicPickBlockURL = document.getElementById(musicPickBlockURL);
				   //musicPickBlockURL.setAttribute('href', mediaPath + holderText + "-" + dateToURL + ".html");
				   musicPickBlockURL.setAttribute('href', mediaPath + holderText + "-" + dateToURL + "." + curExt);
				}
							
			}
		}
		
		curMusicLists.arrayOfTitles[addToMusicLists] = curTitle;
		curMusicLists.arrayOfDates[addToMusicLists] = dateToFormat;
		//curMusicLists.arrayOfURLs[addToMusicLists] = dirRoot + "media/" + musicURL + dateToURL + ".html";
		curMusicLists.arrayOfURLs[addToMusicLists] = dirRoot + "media/" + musicURL + dateToURL + "." + curExt;
		
		
		// Inserts up to the latestContentNum (5 right now.)
		if(dateCount < latestLimitMusic)
		{
		   //alert(dateCount + "\n" + allMusicListFlag);
		   setupArticle("music-lists");
		   		   
		}
		
		// Adds the current music lists' date of publication.
		//testArray.push(curMusicLists.arrayOfDates[addToMusicLists]);

		addToMusicLists++;
		
							
	}

	if (lastMusicTally == 1)
	{
	   tallyArticleTotals("music-lists");
		
	   //testArray.sort( mdyOrdD );
	   //alert(testArray);
	}
	
	// Use the date sort array function to find the five newest music playlists in the curMusicLists array.
	/*dateArray = new Array('15/10/2000','28/05/1999','17/09/2005','06/12/2004','02/01/1998');
     dateArray.sort( dmyOrdA );
	 alert(dateArray);*/
	 
	
}









function extracXMLMusicLists_left(musicPicksFile)
{	
	var musicList;
	var insertToList;
	var latestLimitMusic;
	
	musicList = xmlDoc2.getElementsByTagName("musicList");
	insertToList = "insert-list-GTG";
	holderText = mediaHolderMusicText;
	musicURL = "Media-Holder-music-";
		
	latestLimitMusic = latestGTGMusic;
	
	//  For the update section in the index.html page.		
	lookForLabelID = "musicPicksUpdated";
	var musicPickURL = "GTGMusicPickURL";	
	var musicIconID = "GTGMusicPickURL";
	
	var musicPickBlockURL = "GTGMusicListBlockLabel";
	
	
	// Checks if there are any date tags
	var noOfDates = musicList[0].getElementsByTagName("date").length;

	if (noOfDates == 0)
	{
	    return; // Exits the function	
	}
		
	var numOfLists = 0;
	
	
	for (dateCount = 0; dateCount < noOfDates; dateCount++)
	{
	    // Gets the very first element
		var treeDate = musicList[0].getElementsByTagName("date")[dateCount];  // Moves down to the date element tag
		curDate = treeDate.getAttribute("day");
		var curTitle = treeDate.getElementsByTagName("title")[0].childNodes[0].nodeValue;
										
		// Format when parsing is year/month/day -- [2],[0],[1] arrays
		var parseDate = new Date(curDate.split('/')[2], curDate.split('/')[0], curDate.split('/')[1]);
		curDate = parseDate;
	
	    var treeTitle = treeDate.getElementsByTagName("title")[0].childNodes[0].nodeValue;  // Moves down to the title element tag
	  
	    var curExt = treeDate.getElementsByTagName("type")[0].childNodes[0].nodeValue; 
	
		var tr = document.createElement('tr');  // Sets the row
		var th = document.createElement('th');  // Header
		var myList = document.createElement('a'); // List name
		var href = document.createAttribute('href'); // Creates a link attribute within the anchor tag
		var divTag = document.createElement('div'); // Creates a div id 'main-body'
		var img = document.createElement('img');  // Creates an image tag.
		var imgSrc = document.createAttribute('src');  // Creates an image source attribute.
		
		// Sets the id tag for the proper CSS topic image.  This will be "none" in this case.
		tr.className = "none";
		
		// Date in format of month, day, year
	    var tempYear = curDate.getYear();
	    if (tempYear < 1000)
           tempYear += 1900;
	
	    var tempDay = curDate.getDate();
        var tempMonth = curDate.getMonth()+1;	
		
		var curTitleURL;
		
		var dateToFormat = tempMonth + "/" + tempDay + "/" + tempYear;
		
		// Replace the slash with a dash for the URL link.
		// the \ tells Javascript that the following / is an actual / and not the end of the regular expression
	    var dateToURL = dateToFormat.replace(/\//gi, "-");
        //curTitleURL = holderText + "-" + dateToURL + ".html"; // Inserts a dash in the middle.
		curTitleURL = holderText + "-" + dateToURL + "." + curExt;
						
	    //GTGMusicPicksListIndex
		// If the GTGMusicPicksListIndex = 1, we just want the first date for the index.html file.
		if (dateCount == 0)
		{
			//alert(curMusicType + "\n" + GTGMusicPicksListIndex);
			
			if (GTGMusicPicksListIndex == 1)
			{
				var musicPicksUpdatedLabel = document.getElementById(lookForLabelID);
				musicPicksUpdatedLabel.innerHTML = "Updated: " + dateToFormat;
				
				var musicPickURL = document.getElementById(musicPickURL);
				//musicPickURL.setAttribute('href', mediaPath + holderText + "-" + dateToURL + ".html");
				musicPickURL.setAttribute('href', mediaPath + holderText + "-" + dateToURL + "." + curExt);	
					
			}
		
			// For the media top icons in the Media.html page.
			if  ((curMusicType == "media-top-icons") || (curMusicType == "dropdown")) 
			{							
				var musicIconURL = document.getElementById(musicIconID);
				//musicIconURL.setAttribute('href', holderText + "-" + dateToURL + ".html");
				musicIconURL.setAttribute('href', holderText + "-" + dateToURL + "." + curExt);
								
				// For the media-holder.html intro page.
				if(curMusicType == 	"media-top-icons")
				{
				   musicPickBlockURL = document.getElementById(musicPickBlockURL);
				   //musicPickBlockURL.setAttribute('href', mediaPath + holderText + "-" + dateToURL + ".html");
				   musicPickBlockURL.setAttribute('href', mediaPath + holderText + "-" + dateToURL + "." + curExt);
				}
				
			}
		}
		
		curMusicLists.arrayOfTitles[addToMusicLists] = curTitle;
		curMusicLists.arrayOfDates[addToMusicLists] = dateToFormat;
		//curMusicLists.arrayOfURLs[addToMusicLists] = dirRoot + "media/" + musicURL + dateToURL + ".html";
		curMusicLists.arrayOfURLs[addToMusicLists] = dirRoot + "media/" + musicURL + dateToURL  + "." + curExt;
		
		// Inserts up to the latestContentNum (5 right now.)
		if(dateCount < latestLimitMusic)
		{
		   //alert(dateCount + "\n" + allMusicListFlag);
		   setupArticle("music-lists");
		   		   
		}
		
		// Adds the current music lists' date of publication.
		//testArray.push(curMusicLists.arrayOfDates[addToMusicLists]);

		addToMusicLists++;
		
							
	}

	
}


// ---------------------------------------------

function extractGTGMusicPicks_table(musicPicksFile)
{	
	var musicList;
	var insertToList;
	
	if (allMusicListFlag == "GTGMusicList")
	{
		musicList = xmlDoc2.getElementsByTagName("musicList");
		insertToList = "insert-list-GTG";
		holderText = mediaHolderMusicText;
		musicIconID = "GTGMusicPickURL";
		musicPickBlockURL = "GTGMusicListBlockLabel";
	}
	else if (allMusicListFlag == "japaneseMusicList")
	{
		musicList = xmlDoc4.getElementsByTagName("musicList");
		insertToList = "insert-list-Japanese";
		holderText = japaneseMusicText;
		musicIconID = "japanMusicPickURL";
		musicPickBlockURL = "japaneseMusicListBlockLabel";
		
		if (curIndex == "japaneseOnly") // For the Music-Japanese.html file
		{
			holderText = dirRoot + "media/" + japaneseMusicText;
		}
		
	}
	else if (allMusicListFlag == "koreanMusicList")
	{
		musicList = xmlDoc5.getElementsByTagName("musicList");
		insertToList = "insert-list-Korean";
		holderText = koreanMusicText;
		musicIconID = "koreaMusicPickURL";
		musicPickBlockURL = "koreanMusicListBlockLabel";
		
		if (curIndex == "koreanOnly") // For the Music-Japanese.html file
		{
			holderText = dirRoot + "media/" + koreanMusicText;
		}
		
	}
	else if (allMusicListFlag == "vocaloidPicksList")
	{
		musicList = xmlDoc7.getElementsByTagName("musicList");
		insertToList = "insert-list-Vocaloid";
		holderText = vocaloidPicksText;
		musicIconID = "vocaloidMusicPickURL";
		musicPickBlockURL = "vocaloidMusicListBlockLabel";
	}
	
	// Checks if there are any date tags
	var noOfDates = musicList[0].getElementsByTagName("date").length;

	if (noOfDates == 0)
	{
	    return; // Exits the function	
	}
	
	var numOfLists = 0;
	
	
	for (dateCount = 0; dateCount < noOfDates; dateCount++)
	{
	    // Gets the very first element
		var treeDate = musicList[0].getElementsByTagName("date")[dateCount];  // Moves down to the date element tag
		curDate = treeDate.getAttribute("day");
										
		// Format when parsing is year/month/day -- [2],[0],[1] arrays
		var parseDate = new Date(curDate.split('/')[2], curDate.split('/')[0], curDate.split('/')[1]);
		curDate = parseDate;
	
	    var treeTitle = treeDate.getElementsByTagName("title")[0].childNodes[0].nodeValue;  // Moves down to the title element tag
	
	    var curExt = treeDate.getElementsByTagName("type")[0].childNodes[0].nodeValue;
	
		var tr = document.createElement('tr');  // Sets the row
		var th = document.createElement('th');  // Header
		var myList = document.createElement('a'); // List name
		var href = document.createAttribute('href'); // Creates a link attribute within the anchor tag
		var divTag = document.createElement('div'); // Creates a div id 'main-body'
		var img = document.createElement('img');  // Creates an image tag.
		/*var imgSrc = document.createAttribute('src');*/  // Creates an image source attribute.
		
		// Sets the id tag for the proper CSS topic image.  This will be "none" in this case.
		tr.className = "none";
		
		/* Date in format of month, day, year */
	    var tempYear = curDate.getYear();
	    if (tempYear < 1000)
           tempYear += 1900;
	
	    var tempDay = curDate.getDate();
        var tempMonth = curDate.getMonth()+1;	
		
		var curTitleURL;
		
		
		var dateToFormat = tempMonth + "/" + tempDay + "/" + tempYear;
		
		// Replace the slash with a dash for the URL link.
		// the \ tells Javascript that the following / is an actual / and not the end of the regular expression
	    var dateToURL = dateToFormat.replace(/\//gi, "-");
		curTitleURL = holderText + "-" + dateToURL + "." + curExt;
		
		// For the media top icons in the Media.html page.
		if  ((dateCount == 0) && (curMusicType == "media-top-icons") || (curMusicType == "dropdown")) 
		{
			var musicIconURL = document.getElementById(musicIconID);
			musicIconURL.setAttribute('href', holderText + "-" + dateToURL + "." + curExt);
			
			musicPickBlockURL = document.getElementById(musicPickBlockURL);
			musicPickBlockURL.setAttribute('href', mediaPath + holderText + "-" + dateToURL + "." + curExt);
						
			// Only needs to read the very first date (the newest) for each Music XML file.
			if(curMusicType == 	"dropdown")
			{
			    break;	
			}
		}
		
		// Currently, the music icon is tied to the background in CSS.  Need to replace that with the topic image.
		myList.setAttribute('href', curTitleURL);
		myList.innerHTML = treeTitle;

		var td1 = document.createElement('td'); // Author
		td1.innerHTML = dateToFormat;
			
		//divTag.id = "main-body";
		divTag.className = "main-body";
		
		var spanAppend = document.getElementById(insertToList);
		
		spanAppend.appendChild(tr);  // Create a list first.
		tr.appendChild(th);          // Then tie the image tag to the list.
		th.appendChild(myList);      // Also tie the a href tag to the list as well, so both are children to the list.
		tr.appendChild(td1);
		
		spanAppend.appendChild(divTag);
		/*divTag.appendChild(img);*/
		
		numOfLists++;
					
	}

    // Adds the respective lists.
	if (allMusicListFlag == "GTGMusicList")
	{
		var numOfListsLabel = document.getElementById("noOfGTGMusicLists");
		numOfListsLabel.innerHTML = numOfLists + " lists";
	
		var numOfListsLabel2 = document.getElementById("noOfGTGMusicListAbove");
		numOfListsLabel2.innerHTML = numOfLists + " lists";
		
	}
	else if (allMusicListFlag == "japaneseMusicList")
	{	
		var numOfListsLabel = document.getElementById("noOfJapaneseMusicLists");
		numOfListsLabel.innerHTML = numOfLists + " lists";
	
		var numOfListsLabel2 = document.getElementById("noOfJapaneseMusicListsAbove");
		numOfListsLabel2.innerHTML = numOfLists + " lists";
	}
	else if (allMusicListFlag == "koreanMusicList")
	{	
		var numOfListsLabel = document.getElementById("noOfKoreanMusicLists");
		numOfListsLabel.innerHTML = numOfLists + " lists";
	
		var numOfListsLabel2 = document.getElementById("noOfKoreanMusicListsAbove");
		numOfListsLabel2.innerHTML = numOfLists + " lists";
	}
	// for vocaloidPicksList
	else if (allMusicListFlag == "vocaloidPicksList")
	{	
		var numOfListsLabel = document.getElementById("noOfVocaloidMusicLists");
		numOfListsLabel.innerHTML = numOfLists + " lists";
	
		var numOfListsLabel2 = document.getElementById("noOfVocaloidMusicListsAbove");
		numOfListsLabel2.innerHTML = numOfLists + " lists";
	}
}


// Updates the "date updated" section for the music lists on the index.html page.
function updateDatesOnIndex(mediaPath, holderText, dateToURL, lookForLabelID, parseDate)
{
    //GTGMusicPicksListIndex
    // If the GTGMusicPicksListIndex = 1, we just want the first date for the index.html file.
	if (GTGMusicPicksListIndex == 1)
	{
		var musicPicksUpdatedLabel = document.getElementById(lookForLabelID);
		musicPicksUpdatedLabel.innerHTML = "Updated: " + parseDate;
		
		//alert(musicPicksUpdatedLabel.innerHTML);
		
		var musicPickURL = document.getElementById(musicPickURL);
		musicPickURL.setAttribute('href', mediaPath + holderText + "-" + dateToURL + ".html");
			
		//break;	
	}
	else if ((dateCount == 0) && (curMusicType == "dropdown"))  // Used only for the GTG Music playlist files (e.g. Media-Holder-music blah blah blah).
	{
		var musicIconURL = document.getElementById(musicIconID);
		musicIconURL.setAttribute('href', holderText + "-" + dateToURL + ".html");
		// Do not exit.  Just get the very first date.
	}	
	
	
}

/* Parses the GTG-Music-Picks.xml file to create the drop down list. */
function extractGTGMusicPicks_dropdown(musicPicksFile)
{
	var musicPickBlockURL;
	
	musicList = xmlDoc2.getElementsByTagName("musicList");
	insertToList = "insert-list-GTG";
	holderText = mediaHolderMusicText;
		
	lookForLabelID = "musicPicksUpdated";
	musicPickURL = "GTGMusicPickURL";
		
	musicIconID = "GTGMusicPickURL";	
	musicPickBlockURL = "GTGMusicListBlockLabel";
	
	//var musicPicks = xmlDoc2.getElementsByTagName("musicList");
	var noOfDates = musicList[0].getElementsByTagName("date").length;

	var treeDate; 
	
	var duplicateCount = 1;
		
	// Reads each date's day and it's child, title.
	for (dateCount = 0; dateCount < noOfDates; dateCount++)
	{
		treeDate = musicList[0].getElementsByTagName("date")[dateCount];
		
		var curDate = treeDate.getAttribute("day"); 
		var curTitle = treeDate.getElementsByTagName("title")[0].childNodes[0].nodeValue;
		var curExt = treeDate.getElementsByTagName("type")[0].childNodes[0].nodeValue;
		
		// Turns curDate into a date format.
		var parseDate = new Date(curDate.split('/')[2], curDate.split('/')[0], curDate.split('/')[1]);
		// Adds one month to the parseDate because in a XML format, dates are one month behind.
		parseDate = parseDate.getMonth()+1 + "/" + parseDate.getDate() + "/" + parseDate.getFullYear();

        // Replace the slash with a dash for the URL link.
		// the \ tells Javascript that the following / is an actual / and not the end of the regular expression
		var dateToURL = parseDate.replace(/\//gi, "-"); 

        if (dateCount == 0)  // Used only for the GTG Music playlist files (e.g. Media-Holder-music blah blah blah).
		{
			var musicIconURL = document.getElementById(musicIconID);
			//musicIconURL.setAttribute('href', holderText + "-" + dateToURL + ".html");
			musicIconURL.setAttribute('href', holderText + "-" + dateToURL + "." + curExt);
			// Do not exit.  Just get the very first date.
		}

		var curText = parseDate + " --- " + curTitle;
		
		var addToSelectList = document.getElementById("selectMusicList");
		
		// Adds to the list.
		addToSelectList.options[dateCount] = new Option(curText);
				
		// Adds URL to the used array.
		// arrayUsed[dateCount] = mediaHolderMusicText + "-" + dateToURL + ".html"; // Inserts a dash in the middle.
		arrayUsed[dateCount] = mediaHolderMusicText + "-" + dateToURL + "." + curExt;
	}
	
	// Subtracts the noOfDates by the curIndex to get the correct setIndex below.
	finalIndex = (noOfDates - 1) - curIndex;
	document.getElementById('selectMusicList').selectedIndex = finalIndex;
}

// -------------------------------

/* Test - New updated window on the left */
function extractFeaturedSpotlights_Left(featuredSpotlightsFile)
{
		
	curFeaturedSpotlights = new arrayOfFeaturedSpotlights();
	
	var featuredPicks = xmlDoc3.getElementsByTagName("spotlightsList");
	var noOfDates = featuredPicks[0].getElementsByTagName("date").length;
    var treeDate;

    setReadXMLLimit(noOfDates); // Sets the the number of loops!

    // For every date, dynamically add a date into the Featured-Spotlight-Add ID.
    for (dateCount = 0; dateCount < curReadXMLLimit; dateCount++)
	{
		treeDate = featuredPicks[0].getElementsByTagName("date")[dateCount];
		curDate = treeDate.getAttribute("day");
		curTitle = treeDate.getElementsByTagName("title")[0].childNodes[0].nodeValue;
		curCategory = treeDate.getElementsByTagName("category")[0].childNodes[0].nodeValue;
		curCountry = treeDate.getElementsByTagName("country")[0].childNodes[0].nodeValue;
		curAuthor = treeDate.getElementsByTagName("author")[0].childNodes[0].nodeValue;
		curDesc = treeDate.getElementsByTagName("desc")[0].childNodes[0].nodeValue;
		curExt = treeDate.getElementsByTagName("type")[0].childNodes[0].nodeValue;
		
		// For the category - Parses out any non-whitespace letters from the URL title.
		curCategory = curCategory.replace(/[,'!?:]/gi,"");
		// Copies the curCategory without dashes (with the space still in).
		//tempCategory = curCategory;
		
		// Copies the curCountry without dashes (with the space still in).
		tempCountry = curCountry;
		
		var featuredClassAdd = document.createElement('div');
		featuredClassAdd.className = "Featured-Spotlight-list";
		
		var hrefLink;
		var parseDate;
		var dateToURL;
		
		// Turns curDate into a date format.
	    parseDate = new Date(curDate.split('/')[2], curDate.split('/')[0], curDate.split('/')[1]);
	    // Adds one month to the parseDate because in a XML format, dates are one month behind.
	    parseDate = parseDate.getMonth()+1 + "/" + parseDate.getDate() + "/" + parseDate.getFullYear();	
										
		dateToURL = parseDate.replace(/\//gi, "-"); 
		
		curDateFeaturedSpotlight = parseDate; // global
		
		if ((featuredSpotlightType.toLowerCase() == "index") && (dateCount == 0))
	    {
		  var featuredSpotlightUpdatedLabel = document.getElementById("featuredSpotlightUpdated");		  
		  featuredSpotlightUpdatedLabel.innerHTML = "Updated: " + parseDate;

	    }
				
		// If the curFeaturedType is "intro" (e.g. featured-spotlight-intro.html)
		if (featuredSpotlightType.toLowerCase() == "intro")
		{
		    extractFeaturedSpotlights_Intro(featuredSpotlightsFile, featuredClassAdd, dateToURL, featuredPicks, parseDate);
		}
		else if (featuredSpotlightType.toLowerCase() == "dropdown")
		{
			extractFeaturedSpotlights_DropDownBox(featuredSpotlightsFile, featuredClassAdd, dateToURL, featuredPicks, parseDate, curTitle);
		}
		
		curFeaturedSpotlights.arrayOfTitles[addToFeaturedSpotlight] = curTitle;
		curFeaturedSpotlights.arrayOfURLs[addToFeaturedSpotlight] = dirRoot + "Media/Featured-Spotlight/" + "Featured-Spotlight-" + dateToURL + "." + curExt;
		
		setupArticle("featured-spotlight");
				
		addToFeaturedSpotlight++;	
	}	
	
	tallyArticleTotals("featured-spotlight");
		
}

/* For any featured-spotlight with a dropdown box */
function extractFeaturedSpotlights_DropDownBox(featuredSpotlightsFile, featuredClassAdd, dateToURL, featuredPicks, parseDate, curTitle)
{
	var curText = parseDate + " --- " + curTitle;
	
	var featuredPicks = xmlDoc3.getElementsByTagName("spotlightsList");
	var noOfDates = featuredPicks[0].getElementsByTagName("date").length;
		
	var addToSelectList = document.getElementById("selectFeaturedList");
		
	// Adds to the list.
	addToSelectList.options[dateCount] = new Option(curText);
		
	// Replace the slash with a dash for the URL link.
	// the \ tells Javascript that the following / is an actual / and not the end of the regular expression
	var dateToURL = parseDate.replace(/\//gi, "-"); 
				
	// Adds the URL to the used array.
	arrayUsed[dateCount] = 	featuredSpotlightText + "-" + dateToURL + "." + curExt;
	
	// Sets the selectedIndex.
	finalIndex = (noOfDates - 1) - featuredSpotlightLevel;
    document.getElementById("selectFeaturedList").selectedIndex = finalIndex;
	
}

/* For the featured-spotlight-intro.html */
function extractFeaturedSpotlights_Intro(featuredSpotlightFile, featuredClassAdd, dateToURL, featuredPicks, parseDate)
{
			  
	  // var hrefLink = "Featured-Spotlight-" + dateToURL + ".html";
	  var hrefLink = "Featured-Spotlight-" + dateToURL + "." + curExt;
	  
	  var addHrefLink = document.createElement('a');
	  addHrefLink.setAttribute('href', hrefLink);
	  
	  var image = document.createElement('img');
	  var picturesPath = setCurPath(featuredSpotlightsPictures);
	  picturesPath = picturesPath + "-" + dateToURL + ".jpg";
	  image.setAttribute('src', picturesPath);
	  
	  var header = document.createElement('h3');
	  header.innerHTML = featuredPicks[0].getElementsByTagName("title")[dateCount].childNodes[0].nodeValue;
			  
	  var paraAuthor = document.createElement('a');
	  paraAuthor.id = "paraAuthor";
	  paraAuthor.innerHTML = featuredPicks[0].getElementsByTagName("author")[dateCount].childNodes[0].nodeValue + "&nbsp;&nbsp;&nbsp;";
	  	  
	  var paraDate = document.createElement('a');
	  paraDate.id = "paraDate";
	  paraDate.innerHTML = parseDate;
	  
	  var paraDesc = document.createElement('p');
	  paraDesc.innerHTML = featuredPicks[0].getElementsByTagName("desc")[dateCount].childNodes[0].nodeValue;
	  
	  // Adds everything in the HTML file dynamically.
	  var spanAppend = document.getElementById("Featured-Spotlight-Add");
	  spanAppend.appendChild(featuredClassAdd);
	  
	  featuredClassAdd.appendChild(addHrefLink);
	  addHrefLink.appendChild(image);
	  
	  featuredClassAdd.appendChild(addHrefLink);
	  addHrefLink.appendChild(header);
	  
	  featuredClassAdd.appendChild(paraAuthor);
	  featuredClassAdd.appendChild(paraDate);
	  featuredClassAdd.appendChild(paraDesc);

}

function setReadXMLLimit(noOfDates)
{
	if (curType.toLowerCase() != "articles" || featuredSpotlightType.toLowerCase() == "intro")
	{
		curReadXMLLimit = noOfDates; // If it's the master directory or the Featured Spotlight intro...
	}
	else
	{
		curReadXMLLimit = latestContentNum;	// For everything else
	}
}




/* Used to parse the Top-Articles.xml file - the articles displayed on the left side. */
function extractArticles(topArticlesFile)
{	
	/* Sets the ranges. */
	startSettings();

	var articles = xmlDoc.getElementsByTagName("articles");
	
	// Checks if there are any date tags
	var noOfDates = articles[0].getElementsByTagName("date").length;

	if (noOfDates == 0)
	{
	    return; // Exits the function	
	}
	
	setReadXMLLimit(noOfDates);

	// Gets the very first element
    var treeDate = articles[0].getElementsByTagName("date")[0];  // Moves down to the date element tag
	curDate = treeDate.getAttribute("day");
					
	// Format when parsing is year/month/day -- [2],[0],[1] arrays
	var parseDate = new Date(curDate.split('/')[2], curDate.split('/')[0], curDate.split('/')[1]);
	curDate = parseDate;
	
	var dateLimit = 0;
	curArticles = new arrayOfArticles();
	
	var curLoopCount = 0; // the counter for the outer_For_Loop
	
	// Looks for each date elements.
	outer_For_Loop:
	do
	{
		var noOfTitles = treeDate.getElementsByTagName("title").length;
		var titleCount = 0;
		
		for (titleCount = 0; titleCount < noOfTitles; titleCount++)
		{	
			// Stores the current category, country, and author within the title parent	(curTitle)
			var treeTitle = treeDate.getElementsByTagName("title");  // Moves down to the title element tag
			curTitle = treeTitle[titleCount].getAttribute("name");  
			curCategory = treeTitle[titleCount].getElementsByTagName("category")[0].childNodes[0].nodeValue;
			curCountry = treeTitle[titleCount].getElementsByTagName("country")[0].childNodes[0].nodeValue;
			curAuthor = treeTitle[titleCount].getElementsByTagName("author")[0].childNodes[0].nodeValue;
		    curDesc = treeTitle[titleCount].getElementsByTagName("desc")[0].childNodes[0].nodeValue;
		    curExt = treeTitle[titleCount].getElementsByTagName("type")[0].childNodes[0].nodeValue;
		
			// Adds the current title to the list queue from the XML file.
			curArticles.arrayOfTitles[addToArticles] = curTitle;
			
			// For the category - Parses out any non-whitespace letters from the URL title.
			curCategory = curCategory.replace(/[,'!?:]/gi,"");
			// Copies the curCategory without dashes (with the space still in).
			tempCategory = curCategory;
			// Replaces any whitespace letters with dashes.
			curCategory = curCategory.replace(/ /gi, "-");
			
			// For the country - Parses out any non-whitespace letters from the URL title.
			curCountry = curCountry.replace(/[,'!?:]/gi,"");
			// Copies the curCountry without dashes (with the space still in).
			tempCountry = curCountry;
			// Replaces any whitespace letters with dashes.
			curCountry = curCountry.replace(/ /gi, "-");
			
			// For the title - Parses out any non-whitespace letters from the URL title.
			curTitle = curTitle.replace(/[,'!?:]/gi,"");
			// Replaces any whitespace letters with dashes.
			curTitle = curTitle.replace(/ /gi, "-");
									
			// From the root directory, gets the webpage   "./"	
		    // curArticles.arrayOfURLs[addToArticles] = dirRoot + curCategory + "/" + curCountry + "/" + curTitle + ".html";
			curArticles.arrayOfURLs[addToArticles] = dirRoot + curCategory + "/" + curCountry + "/" + curTitle + "." + curExt;
			
			// Grabs the current date tag
			var treeDate = articles[0].getElementsByTagName("date")[dateLimit];  // Moves down to the date element tag.  Look to the future date tag.
			curDate = treeDate.getAttribute("day");
			
			// Format when parsing is year/month/day -- [2],[0],[1] arrays
			var parseDate = new Date(curDate.split('/')[2], curDate.split('/')[0], curDate.split('/')[1]);
			curDate = parseDate.getMonth()+1 + "/" + parseDate.getDate() + "/" + parseDate.getFullYear();;  // Sets the curDate for comparison
			curDateArticles = curDate; // To be used as the current date for articles.
					
			setupArticle("articles"); // Creates the article now.
						
			// tempCategory and tempCountry are used to compare against curType and curSubType with their spaces still in.
            // If the curType = "master" then accept all topics.			
			if (curType.toLowerCase() == "master")
			{	
				createTopicList(curDate, insertMasterList, "articles"); // For the master list, just list all the articles
			}
		
			/* If an article (e.g. left accordion article or music, movie, gaming one) has been added, increment addToArticles*/
			if (addToFlag == 1)
			{
				addToArticles++;
				addToFlag = 0; // Resets the flag
			}
	
		} // End of title-loop.
						
		dateLimit++;
		
		// Checks if it's at the end of file before incrementing the dateLimit
		// noOfDates must be -1 because the dateLimit starts at 0.
		if (dateLimit > noOfDates - 1)
		{
			break;	
		}
		else // The dateLimit is still less than the total noOfDate tags in the XML file.
		{
		  // The dateLimit determines which date tag to look at.
		  var treeDate = articles[0].getElementsByTagName("date")[dateLimit];  // Moves down to the next date element tag in the XML file.  Important!
		}
		
		
		curLoopCount++;
						
	} while (dateLimit < curReadXMLLimit) //(dateLimit < latestContentNum - 1)

	tallyArticleTotals("articles"); 

	if (noOfMusic > 0)
	{
		tallyArticleMusic();
	}

    if (curType.toLowerCase() == "master")
	{
		tallySubTypes();
	}
	
}


function setupArticle(curXMLParse)
{
	// This if-statement will check if the 1st accordion tab date (currently 3 days) will output the current article link.
	// If this is setting up the articles in the accordion.
	var checkRange = new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate()-0+secondInterval);
			
	if(curXMLParse == "articles")
	{
		
		if (noOfArticles_1 <= latestContentNum - 1) // After the 6th article, do not put anymore in the left list
		{
			// For the articles list.		
		    createLeftList("add-Content-1st", "Article");
		    noOfArticles_1++;

			// If it's the main page loading.  Loads the thumbnail and info on the main page.
			// Makes sure it's only the main page, and not the master directory (e.g. != master).
			if(passIndex == "index")
			{
				createArticleThumbnail("top-articles-main", "top-articles-section", curArticles.arrayOfTitles[addToArticles], curArticles.arrayOfURLs[addToArticles], curXMLParse);
			}
			
		} // End of if statement.
		
		//  For the top bar.  Targets only certain articles, such as "Music" from "Japan".
		//  Goes past the 5 article limit.
		if ((curType.toLowerCase() != "articles" && curType.toLowerCase() != "master") && curSubType.toLowerCase() != "none")
		{
			
			if ((curCategory.toLowerCase() == curType.toLowerCase()) && (curCountry.toLowerCase() == curSubType.toLowerCase())) 
			{
				createTopicList(curDate, insertToArticlesList, curXMLParse);
				totalArticlesList++;
				
				var numOfListsLabel = document.getElementById(nameArticlesList);  // For the articles
	            numOfListsLabel.innerHTML = totalArticlesList + " posts";
			}
			
		}
		
	}
	else if(curXMLParse == "featured-spotlight")
	{
		// Only post five featured spotlights max
		if (noOfArticles_2 <= latestContentNum - 1)
		{
			// For the articles list.		
			createLeftList("add-Content-2nd", "FeaturedSpotlight");
			noOfArticles_2++;
			
			// If it's the main page loading.  Loads the thumbnail and info on the main page.
			// Makes sure it's only the main page, and not the master directory (e.g. != master).
				
			if(passIndex == "index")
			{
				createArticleThumbnail("featured-spotlight-main", "featured-spotlight-section", curFeaturedSpotlights.arrayOfTitles[addToFeaturedSpotlight], curFeaturedSpotlights.arrayOfURLs[addToFeaturedSpotlight], curXMLParse);
			}
			
		}
		
		//  For the top bar.  Targets only certain articles, such as "Music" from "Japan".
		//  Goes past the 5 article limit.
		if ((curType.toLowerCase() != "articles" && curType.toLowerCase() != "master") && curSubType.toLowerCase() != "none")
		{
			
			/*alert(curCategory + " " + curType + "\n" +
			      curCountry + " " + curSubType);*/
			
			if ((curCategory.toLowerCase() == curType.toLowerCase()) && (curCountry.toLowerCase() == curSubType.toLowerCase())) 
			{
				createTopicList(curDateFeaturedSpotlight, insertToFeaturedSpotlightList, curXMLParse);
				totalFeaturedSpotlightList++;
				
				var numOfListsLabel = document.getElementById(nameFeaturedSpotlightList);  // For the articles
	            numOfListsLabel.innerHTML = totalFeaturedSpotlightList + " lists";
			}
			
		}
		
	}
	else if(curXMLParse == "music-lists")
	{
		
		if (noOfArticles_3 <= latestContentNum - 1)
		{
			// For the articles list.		
			createLeftList("add-Content-3rd", "MusicLists");
			noOfArticles_3++;
		}
	}
	

	addToFlag = 1;
}

/* Used for the differing sections - e.g. J-music, K-music, anime, etc.  */
function createTopicList(curDate, insertToList, curXMLParse)
{	
	var tr = document.createElement('tr');  // Sets the row
	var th = document.createElement('th');  // Header
	var myArticle = document.createElement('a'); // Article name
	var href = document.createAttribute('href'); // Creates a link attribute within the anchor tag
	var divTag = document.createElement('div'); // Creates a div id 'main-body'
	var img = document.createElement('img');  // Creates an image tag.
	/*var imgSrc = document.createAttribute('src');*/  // Creates an image source attribute.
	
	// Sets the id tag for the proper CSS topic image.  E.g. id=music will have a music icon.
	tr.className = curCategory.toLowerCase();
	
	// Currently, the music icon is tied to the background in CSS.  Need to replace that with the topic image.
	if (curXMLParse == "articles")
	{
		myArticle.setAttribute('href', curArticles.arrayOfURLs[addToArticles]);
		myArticle.innerHTML = curArticles.arrayOfTitles[addToArticles];
	}
	else if (curXMLParse == "featured-spotlight")
	{
		myArticle.setAttribute('href', curFeaturedSpotlights.arrayOfURLs[addToFeaturedSpotlight]);
		myArticle.innerHTML = curFeaturedSpotlights.arrayOfTitles[addToFeaturedSpotlight];
	}
	
	var td1 = document.createElement('td'); // Author
	td1.innerHTML = curAuthor;
	
	var td2 = document.createElement('td'); // Date
	td2.innerHTML = curDate;
	
	var td3 = document.createElement('td'); // Country
	
	/* Changes "social issues" to none if video games. */
	if (tempCountry.toLowerCase() == "social issues")
	{
		td3.innerHTML = "Social";
	}
	else /* 95% of the time, just set the tempCountry.*/
	{
	    td3.innerHTML = tempCountry;
	}
	
	divTag.id = "main-body";
	divTag.className = "main-body";
	
	var spanAppend = document.getElementById(insertToList);
	
	spanAppend.appendChild(tr);  // Create a list first.
	tr.appendChild(th);         // Then tie the image tag to the list.
	th.appendChild(myArticle);   // Also tie the a href tag to the list as well, so both are children to the list.
	tr.appendChild(td1);
	tr.appendChild(td2);
	tr.appendChild(td3);
	
	spanAppend.appendChild(divTag);
	/*divTag.appendChild(img);*/
	
	noOfMusic++;
	addToFlag = 1;
	
	// Records the individual sections (e.g. Japanese music, Chinese culture, etc.)
	if (curType.toLowerCase() == "master")
	{
		getSubTypeMusic();
	}
		
}


function createArticleThumbnail(addContent, addSection, addArray, addURL, curXMLParse)
{
	var topArticlesClassAdd = document.createElement('div');
	topArticlesClassAdd.className = addSection;
		
	// Creates the article links dynamically.
	var img = document.createElement('img');  // Creates an image tag.

	var typeOfImage = setThumbnailImage(addArray);  // Gets the type based on the tag's category.
	img.setAttribute('src', typeOfImage);
	
	var myArticle = document.createElement('a');  // Creates an anchor tag.
	myArticle.setAttribute('href', addURL);  // Creates a link attribute within the anchor tag.
	myArticle.id ="paraTitle";
	myArticle.innerHTML = addArray + "<br>";
	
	var paraAuthor = document.createElement('a');
	paraAuthor.id = "paraAuthor";
	paraAuthor.innerHTML = "Author: " + curAuthor;
	
	var paraDate = document.createElement('a');
	paraDate.id = "paraDate";
	
	if (curXMLParse == "articles")
	{
	   paraDate.innerHTML = "Date: " + curDateArticles;
	}
	else if (curXMLParse == "featured-spotlight")
	{
		paraDate.innerHTML = "Date: " + curDateFeaturedSpotlight;
	}
	
	var paraDesc = document.createElement('p');
	paraDesc.innerHTML = curDesc;
	
	var paraSpace = document.createElement('br');
	
	var spanAppend = document.getElementById(addContent); // Adds to the top-articles-main class that's already in the code.
	spanAppend.appendChild(topArticlesClassAdd);
	
	topArticlesClassAdd.appendChild(myArticle);
	//topArticlesClassAdd.appendChild(paraSpace); // Extra space
	topArticlesClassAdd.appendChild(paraAuthor);
	topArticlesClassAdd.appendChild(paraDate);
	//topArticlesClassAdd.appendChild(paraSpace); // Extra space
	topArticlesClassAdd.appendChild(img);
	topArticlesClassAdd.appendChild(paraDesc);
}


// Used to create the content lists on the left side.
function createLeftList(addContent, contentType)
{	
	// Creates the article links dynamically.
	var li = document.createElement('li');  // Creates a list tag.
	var img = document.createElement('img');  // Creates an image tag.

	if (contentType == "MusicLists") {
		var typeOfImage = musicImage; // Automatically set the image to the music icon, since all music lists are music
	} else {
		var typeOfImage = setTypeOfImage();  // Gets the type based on the tag's category.
	}
	img.setAttribute('src', typeOfImage);
	
	var myArticle = document.createElement('a');  // Creates an anchor tag.
	if (contentType == "Article") {
		myArticle.setAttribute('href', curArticles.arrayOfURLs[addToArticles]);
		var newArticle = checkLength(curArticles.arrayOfTitles[addToArticles].length, curArticles.arrayOfTitles[addToArticles]); /* Checks to see if the title is too long for one title. */
	}
	else if (contentType == "FeaturedSpotlight") {
		myArticle.setAttribute('href', curFeaturedSpotlights.arrayOfURLs[addToFeaturedSpotlight]);
		var newArticle = checkLength(curFeaturedSpotlights.arrayOfTitles[addToFeaturedSpotlight].length, curFeaturedSpotlights.arrayOfTitles[addToFeaturedSpotlight]);
	}
	else if (contentType == "MusicLists") {
		myArticle.setAttribute('href', curMusicLists.arrayOfURLs[addToMusicLists]);
		var newArticle = checkLength(curMusicLists.arrayOfTitles[addToMusicLists].length, curMusicLists.arrayOfTitles[addToMusicLists]);
	}
	else {
		alert("Invalid createLeftList contentType");
	}
	
	myArticle.innerHTML = newArticle;
	
	var spanAppend = document.getElementById(addContent);
	
	if (spanAppend.firstChild == null) {
		var ol = document.createElement('ol');
		spanAppend.appendChild(ol);
	} 
	spanAppend.firstChild.appendChild(li);  // Create a list first.
	li.appendChild(img);         // Then tie the image tag to the list.
	li.appendChild(myArticle);   // Also tie the a href tag to the list as well, so both are children to the list.
}

function checkLength(curArticleLength, curArticle)
{
	/* Checks if more than one line is needed. */
	/* Rounds down - floor */
	var lines = Math.floor(curArticleLength / lettersPerLine);

	var beginCount = 0; // Counter to see which line the while-loop is at.
	var beginPos = 0;
	var curPos = lettersPerLine;
	var newArticle = curArticle; // This will be the new curArticle.
    

	while(beginCount < lines)
	{		
		/* Grabs the first 35 letters and finds the last space */
		var curLine = curArticle.substr(beginPos, lettersPerLine);   // if this is -1, there is only one word.
		var lastSpacePos = curLine.lastIndexOf(' ');
		
		newArticle = curArticle.substr(beginPos, lastSpacePos) + newLineString + curArticle.substr(lastSpacePos, curArticleLength);
				
		beginPos += curArticleLength; // Starts at the next word after the line break.
		curPos += lettersPerLine; // Moves to the next line's maximum number of words.
		beginCount++;	
	}
	
	return newArticle;
	
}


function setThumbnailImage(addArray)
{
	var nameImage = mainPageThumbnails + addArray + "-thumbnail.jpg"; // Looks in the main-page-thumbnails path.
	nameImage = nameImage.replace(/[,'!?:]/gi,""); // Replaces any non space characters and deletes them.
	nameImage = nameImage.replace(/ /gi, "-"); // Adds the dashes back in for the name.

    var typeOfImage = setCurPath(nameImage);

	return typeOfImage;
}





function setTypeOfImage()
{
	var typeOfImage;
	
	var lowerCaseCategory = curCategory.toLowerCase();

	if (lowerCaseCategory == "music")
	{
		typeOfImage = musicImage;
	}
	else if(lowerCaseCategory == "movies")
	{
		typeOfImage = movieImage;	
	}
	else if(lowerCaseCategory == "anime" || lowerCaseCategory == "comics")
	{
		typeOfImage = animeImage;	
	}
	else if(lowerCaseCategory == "video-games") // no dash in video games.
	{
		typeOfImage = gamesImage;	
	}
	else if(lowerCaseCategory == "culture")
	{
		typeOfImage = cultureImage;	
	}
	else if(lowerCaseCategory == "tvdramas")
	{
		typeOfImage = TVDramasImage;
	}
	else if (isMusicListIcon == "true") // If the program is reading the GTG music list, the jpop list, or the kpop list.
	{
		typeOfImage = musicImage;
	}
	else  // Default
	{
		typeOfImage = musicImage;
	}

	return typeOfImage;
}


// Only two categories right now.
function getSubTypeMusic()
{
    /* The "temp" variables represent the curCategory and curCountry in its original form without the dashes for URL format. */
    var lowerCaseCategory = tempCategory.toLowerCase();
	var lowerCaseCountry = tempCountry.toLowerCase();

    /* alert(lowerCaseCategory + "\n" + lowerCaseCountry); */

    if (lowerCaseCategory == "music")
	{
		if (lowerCaseCountry == "japanese")
		{
			noOfJapaneseMusic++;
		}
		else if (lowerCaseCountry == "korean")
		{
			noOfKoreanMusic++;
		}
    }
	else if (lowerCaseCategory == "movies")
	{
		if (lowerCaseCountry == "japanese")
		{
			noOfJapaneseMovies++;
		}
		else if (lowerCaseCountry == "korean")
		{
			noOfKoreanMovies++;
		}
		/*
		else if (lowerCaseCountry == "asian")
		{
			noOfAsianMovies++;
		}
		*/
	}
	else if (lowerCaseCategory == "culture")
	{
		if (lowerCaseCountry == "japanese")
		{
			noOfJapaneseCulture++;
		}
		else if (lowerCaseCountry == "korean")
		{
			noOfKoreanCulture++;
		}
		else if (lowerCaseCountry == "chinese")
		{
			noOfChineseCulture++;
		}
		else if (lowerCaseCountry == "filipino")
		{
			noOfFilipinoCulture++;
		}
	}
	else if (lowerCaseCategory == "video games")
	{
		noOfVideoGames++;
	}
	else if (lowerCaseCategory == "anime")
	{
		noOfAnime++;
	}
	else if (lowerCaseCategory == "comics")
	{
		noOfComics++;
	}
	
}

function tallyArticleMusic()
{
	var musicTotal = document.getElementById("noOfMusic");
	musicTotal.innerHTML = noOfMusic + " articles";
}

// For the master directory.
function tallySubTypes()
{
		
	var typeToChange = document.getElementById("noOfJapaneseMusic");
	typeToChange.innerHTML = noOfJapaneseMusic + " articles";
	
	typeToChange = document.getElementById("noOfKoreanMusic");
	typeToChange.innerHTML = noOfKoreanMusic + " articles";
	
	typeToChange = document.getElementById("noOfJapaneseMovies");
	typeToChange.innerHTML = noOfJapaneseMovies + " articles";
	
	typeToChange = document.getElementById("noOfKoreanMovies");
	typeToChange.innerHTML = noOfKoreanMovies + " articles";
	
	typeToChange = document.getElementById("noOfAnime");
	typeToChange.innerHTML = noOfAnime + " articles";
	
	typeToChange = document.getElementById("noOfVideoGames");
	typeToChange.innerHTML = noOfVideoGames + " articles";
	
	typeToChange = document.getElementById("noOfChineseCulture");
	typeToChange.innerHTML = noOfChineseCulture + " articles";
	
	typeToChange = document.getElementById("noOfJapaneseCulture");
	typeToChange.innerHTML = noOfJapaneseCulture + " articles";
	
	typeToChange = document.getElementById("noOfKoreanCulture");
	typeToChange.innerHTML = noOfKoreanCulture + " articles";
	
	/* typeToChange = document.getElementById("noOfComics");
	typeToChange.innerHTML = noOfComics + " articles"; */
	
	/*typeToChange = document.getElementById("noOfFilipinoCulture");
	typeToChange.innerHTML = noOfFilipinoCulture + " articles";*/
	
}

function tallyArticleTotals(typeOfXML)
{
	
	if (typeOfXML == "articles")
	{
		outArticles = noOfArticles_1;
		idHeader = "article-total-1";
		innerHTMLLabel = "articles";
	}
	else if (typeOfXML == "featured-spotlight")
	{
		outArticles = noOfArticles_2;
		idHeader = "article-total-2";
		innerHTMLLabel = "featured spotlights";
	}
	else if (typeOfXML == "music-lists")
	{
		outArticles = noOfArticles_3;
		idHeader = "article-total-3";
		innerHTMLLabel = "music lists";
	}
	
	var para = document.createElement('p');  // Creates a paragraph tag.
	para.innerHTML = "Latest " + innerHTMLLabel + ": " + "&nbsp;&nbsp;&nbsp;" + outArticles;
	var spanAppend = document.getElementById(idHeader);
	spanAppend.appendChild(para);  // Create a list first.
	
}

/* For pages that have the Article-Bar on top -- represents the hover-msg */
function changeHoverMsg(msg) 
{
   /* Changes the message to the current hovered number link */
   document.getElementById("hover-msg").innerHTML="Skip to:" + "&nbsp;&nbsp;&nbsp;" + msg;
}

function emailHoverMsg(msg)
{
	 /* Changes the message to the current hovered number link */
   document.getElementById("hover-msg").innerHTML="Email at:" + "&nbsp;&nbsp;&nbsp;" + msg;
}

/* Jumps to a subpage */
function SubpageHoverMsg(msg) 
{
   /* Changes the message to the current hovered number link */
   document.getElementById("hover-msg").innerHTML="Go to subpage:" + "&nbsp;&nbsp;&nbsp;" + msg;
}

function resetHoverMsg()
{
   /* Resets the message */
   document.getElementById("hover-msg").innerHTML="";	
}

/* For Music of Japan section */
/* The intro page */
/* MusicToggle function reused for all functions in the Music of Japan section. */
function japanMusicToggle(block, prevDisplay)
{
	
	if (block != prevDisplay) // Makes sure the selection is different
	{
		
		
		document.getElementById(block).style.display="block";
		document.getElementById(prevDisplay).style.display="none";
		window.prevDisplay = block; // uses window. to tie it to the global prevDisplay variable
		
		fade(block);
	}
}

function japanMusicToggle_Answer(block, showAnswer)
{	
	if (showAnswer == "false")
	{
	    document.getElementById(block).style.display="block";	
		window.showAnswer = "true";  // uses window. to tie it to the global showAnswer variable
	}
	else
	{
		document.getElementById(block).style.display="none";	
		window.showAnswer = "false";
	}
}

/* Fading function for the Intro of Music of Japan section. */
var TimeToFade = 1000.0;

function fade(eid)
{
  var element = document.getElementById(eid);
  if(element == null)
    return;
   
  /*if(element.FadeState == null)
  {
    if(element.style.opacity == null 
        || element.style.opacity == '' 
        || element.style.opacity == '1')
    {
      element.FadeState = 2;
    }
    else
    {
      element.FadeState = -2;
    }
  }*/
	
   element.FadeState = -2;	// Always will fade in the new section.
	
  if(element.FadeState == 1 || element.FadeState == -1)
  {
    element.FadeState = element.FadeState == 1 ? -1 : 1;
    element.FadeTimeLeft = TimeToFade - element.FadeTimeLeft;
  }
  else
  {
    element.FadeState = element.FadeState == 2 ? -1 : 1;
    element.FadeTimeLeft = TimeToFade;
    setTimeout("animateFade(" + new Date().getTime() + ",'" + eid + "')", 1);
  }  
}

function animateFade(lastTick, eid)
{  
  var curTick = new Date().getTime();
  var elapsedTicks = curTick - lastTick;
  
  var element = document.getElementById(eid);
 
  if(element.FadeTimeLeft <= elapsedTicks)
  {
    element.style.opacity = element.FadeState == 1 ? '1' : '0';
    element.style.filter = 'alpha(opacity = ' 
        + (element.FadeState == 1 ? '100' : '0') + ')';
    element.FadeState = element.FadeState == 1 ? 2 : -2;
    return;
  }
 
  element.FadeTimeLeft -= elapsedTicks;
  var newOpVal = element.FadeTimeLeft/TimeToFade;
  if(element.FadeState == 1)
    newOpVal = 1 - newOpVal;

  element.style.opacity = newOpVal;
  element.style.filter = 'alpha(opacity = ' + (newOpVal*100) + ')';
  
  setTimeout("animateFade(" + curTick + ",'" + eid + "')", 1);
}







function hoverTypeMusicJapan(type)
{
	if (type.toLowerCase() == "intro")
	{
		displayCurrentMusicJapan("block", "none", "none", "none", "none", "none", type);
		document.getElementById("subcaption").src = "/Music-Japanese-Pictures/Japanese-Words-subcaption-intro.jpg";
	}
	else if (type.toLowerCase() == "influences")
	{
		displayCurrentMusicJapan("none", "block", "none", "none", "none", "none", type);
		document.getElementById("subcaption").src ="/Music-Japanese-Pictures/Japanese-Words-subcaption-influences.jpg";
	}
	else if (type.toLowerCase() == "favorites")
	{
		displayCurrentMusicJapan("none", "none", "block", "none", "none", "none", type);
		document.getElementById("subcaption").src ="/Music-Japanese-Pictures/Japanese-Words-subcaption-favorites.jpg";
	}
	else if (type.toLowerCase() == "articles")
	{
		displayCurrentMusicJapan("none", "none", "none", "block", "none", "none", type);
		document.getElementById("subcaption").src ="/Music-Japanese-Pictures/Japanese-Words-subcaption-articles.jpg";
	}
	else if (type.toLowerCase() == "feedback")
	{
		displayCurrentMusicJapan("none", "none", "none", "none", "block", "none", type);
		document.getElementById("subcaption").src ="/Music-Japanese-Pictures/Japanese-Words-subcaption-feedback.jpg";
	}
	
	// 2nd row
	else if (type.toLowerCase() == "quizzes")
	{
		displayCurrentMusicJapan("none", "none", "none", "none", "none", "block", type);
		document.getElementById("subcaption").src ="/Music-Japanese-Pictures/Japanese-Words-subcaption-feedback.jpg";
	}
	
}

/* For About-Us */
function hoverType(type, staffName, preLoadNum)
{
	curPreLoadNum = preLoadNum;
	
	if (type.toLowerCase() == "intro")
	{
		displayCurrent("block", "none", "none", "About Us - Intro");
	}
	else if (type.toLowerCase() == "purpose")
	{
		displayCurrent("none", "block", "none", "About Us - Purpose");
	}
	/* If the user hovers on a staff member, get their info. */
	else if (type.toLowerCase() == "staffbio")
	{
		displayCurrent("none", "none", "block", "About Us - Staff Bios");
		/* Toggles the staff desc back on. */		
		staffBio(staffName);
	}
	
	
	/* Sets the new right, left, and bottom height positions. */
	setLeftSideHeight();
}

/* For Contact-Us */
function hoverTypeContactUs(type)
{
	if (type.toLowerCase() == "contactus")
	{
		displayCurrentContactUs("block", "Contact Us - contact us");
	}
}

/* For Advertise */
function hoverTypeAdvertise(type)
{	
	if (type.toLowerCase() == "services")
	{
		displayCurrentAdvertise("block", "none", "none", "Advertise - Services");
	}
	else if (type.toLowerCase() == "gtgart")
	{
		displayCurrentAdvertise("none", "block", "none", "Advertise - GTG ads");
	}
	/* If the user hovers on a staff member, get their info. */
	else if (type.toLowerCase() == "contactus")
	{
		displayCurrentAdvertise("none", "none", "block", "Advertise - Contact us");
	}	
}

/* For Join-GTG */
function hoverTypeJoinGTG(type)
{	
	/* intro, lookingFor, positions, howToApply, benefits, faq */
	if (type.toLowerCase() == "intro")
	{
		displayCurrentJoinGTG("block", "none", "none", "none", "none", "none", "Join GTG - Intro");
	}
	else if (type.toLowerCase() == "requisites")
	{
		displayCurrentJoinGTG("none", "block", "none", "none", "none", "none", "Join GTG - Requisites");
	}
    else if (type.toLowerCase() == "positions")
	{
		displayCurrentJoinGTG("none", "none", "block", "none", "none", "none", "Join GTG - Open Positions");
	}
    else if (type.toLowerCase() == "benefits")
	{
		displayCurrentJoinGTG("none", "none", "none", "block", "none", "none", "Join GTG - Benefits");
	}
	else if (type.toLowerCase() == "faqs")
	{
		displayCurrentJoinGTG("none", "none", "none", "none", "block", "none", "Join GTG - Frequently Asked Questions");
	}
    else if (type.toLowerCase() == "apply")
	{
		displayCurrentJoinGTG("none", "none", "none", "none", "none", "block", "Join GTG - How to Apply");
	}
    
	/* Sets the new right, left, and bottom height positions. */
	setLeftSideHeight();
	
}

/* For Media Intro   11/16/2010 */
function hoverTypeMediaIntro(type, staffName)
{
	//curPreLoadNum = preLoadNum;	
	
	if (type.toLowerCase() == "gtgmusiclistblock")
	{
		displayCurrentMediaIntro("block", "none", "none", "none", "GTGMusicList");
	}
	else if (type.toLowerCase() == "japanesemusiclistblock")
	{
		displayCurrentMediaIntro("none", "block", "none", "none", "japaneseMusicList");
	}
	/* If the user hovers on a staff member, get their info. */
	else if (type.toLowerCase() == "koreanmusiclistblock")
	{
		displayCurrentMediaIntro("none", "none", "block", "none", "koreanMusicList");
		/* Toggles the staff desc back on. */		
		//staffBio(staffName);
	}
	else if (type.toLowerCase() == "vocaloidmusiclistblock")
	{
		displayCurrentMediaIntro("none", "none", "none", "block", "vocaloidMusicPicks");
	}
	
	/* Sets the new right, left, and bottom height positions. */
	setLeftSideHeight();
}




// Global - do not use var for globals.
var curPicNum = 1;
var curPicMax;

// Passes the curPicMax.
function forwardArrowClick(curPicMax, picID)
{
	curPicNum++;
	
	// Wraps around back to the 1st image.
	if(curPicNum > curPicMax)
		curPicNum = 1;
 
	// Decides which pic ID this is and calls the correct show function.
	whichPic(picID);	
		
    // Calls the showNewPic function to get the new picture.
	// showNewPic();	
}

function backArrowClick(curPicMax, picID)
{
	curPicNum--;
	// Wraps around back to the last image.
	if(curPicNum < 1)
		curPicNum = curPicMax;
				
    // Decides which pic ID this is and calls the correct show function.
	whichPic(picID);
}

function whichPic(picID)
{
	
	if (picID == "news")
	{
		showNewPic(curPicNum);
	}
	else if (picID == "ad")
	{
		showNewAd(curPicNum);
	}
	
	
}


function showNewPic(curPicNum)
{
	
	if(curPicNum == 1)
	{
		document.getElementById("comic").src="/News-Holder-Pictures/comic-1.jpg";
		document.getElementById("comicPage").innerHTML='1 / 3';
	}
	else if(curPicNum == 2)
	{
		document.getElementById("comic").src="/News-Holder-Pictures/comic-2.jpg";
		document.getElementById("comicPage").innerHTML='2 / 3';
	}
	else  
	{
		document.getElementById("comic").src="/News-Holder-Pictures/comic-3.jpg";
		document.getElementById("comicPage").innerHTML='3 / 3';
	}
	
}

function showNewAd(curPicNum)
{	
    if(curPicNum == 1)
	{		
		<!--document.getElementById("ad").src= adImages[curPicNum-1];-->
		document.getElementById("ad").src= adImages[curPicNum-1].src;
		document.getElementById("picName").innerHTML="GTG Idol";
		document.getElementById("artistName").innerHTML="Drawn by <a href='http://kl-chan.deviantart.com/' target='_blank'>KL-Chan</a>";
		document.getElementById("adPage").innerHTML='1 / 5';
		//document.getElementById("adPage").innerHTML=curPicNum + ' / ' + curPicMax;
	}
	else if(curPicNum == 2)
	{
		document.getElementById("ad").src= adImages[curPicNum-1].src;
		document.getElementById("picName").innerHTML="Japanese music background";
		document.getElementById("artistName").innerHTML="Drawn by <a href='http://pureazn.deviantart.com/' target='_blank'>PureAZN</a>";
		document.getElementById("adPage").innerHTML='2 / 5';
		//document.getElementById("adPage").innerHTML=curPicNum + ' / ' + curPicMax;
	}
	else if(curPicNum == 3)
	{
		document.getElementById("ad").src= adImages[curPicNum-1].src;
		document.getElementById("picName").innerHTML="Korean music background";
		document.getElementById("artistName").innerHTML="Drawn by <a href='http://pureazn.deviantart.com/' target='_blank'>PureAZN</a>";
		document.getElementById("adPage").innerHTML='3 / 5';
		//document.getElementById("adPage").innerHTML=curPicNum + ' / ' + curPicMax;
	}
	else if(curPicNum == 4)
	{
		document.getElementById("ad").src= adImages[curPicNum-1].src;
		document.getElementById("picName").innerHTML="GTG Anime Expo 2010 promotions";
		document.getElementById("artistName").innerHTML="Drawn by <a href='http://lucchan.deviantart.com/' target='_blank'>Lucchan</a>, <a href='http://nikkiecole.deviantart.com/' target='_blank'>NikkieCole</a>, and <a href='http://pureazn.deviantart.com/' target='_blank'>PureAZN</a>";
		document.getElementById("adPage").innerHTML='4 / 5';
		//document.getElementById("adPage").innerHTML=curPicNum + ' / ' + curPicMax;
	}
	else if(curPicNum == 5)
	{
		document.getElementById("ad").src= adImages[curPicNum-1].src;
		document.getElementById("picName").innerHTML="GTG's version of Wedding Dress";
		document.getElementById("artistName").innerHTML="Drawn <a href='http://blue-lied.deviantart.com/'target='_blank'>Blue-Lied</a>, designed by Coopa";
		document.getElementById("adPage").innerHTML='5 / 5';
		//document.getElementById("adPage").innerHTML=curPicNum + ' / ' + curPicMax;
	}
	else  
	{
		document.getElementById("ad").src=adImages[0].src;
		document.getElementById("adPage").innerHTML='1 / 5';
		//document.getElementById("adPage").innerHTML=curPicNum + ' / ' + curPicMax;
	}
	
}


/* For Music of Japan section*/
function displayCurrentMusicJapan(intro, influences, favorites, articles, feedback, quizzes, type)
{
	/* Only loads the toggle change if the block is different. */
	/*fade(type);*/
	
	document.getElementById("intro").style.display=intro;
	document.getElementById("influences").style.display=influences;
	document.getElementById("favorites").style.display=favorites;
	document.getElementById("articles").style.display=articles;
    document.getElementById("feedback").style.display=feedback;

    // 2nd row
	document.getElementById("quizzes").style.display=quizzes;

}

/* The first three are toggle switches to display each block.  The last one is what the header will display. */
/* For About Us */
function displayCurrent(intro, purpose, staffdesc, title)
{
	/* Only loads the toggle change if the block is different. */
	if (document.getElementById("about-us-title").style.display != title)
	{
		document.getElementById("intro").style.display=intro;
		document.getElementById("purpose").style.display=purpose;
		document.getElementById("staffdesc").style.display=staffdesc;
		document.getElementById("about-us-title").innerHTML=title;
	}
}

function displayCurrentContactUs(contactus, title)
{
	document.getElementById("Contact-Us-Contact-Us").style.display=contactus;
	
	/* The title name that appears on the green bar. */
	document.getElementById("contact-us").innerHTML=title;
}

function displayCurrentJoinGTG(intro, requisites, positions, benefits, FAQs, apply, title)
{
	document.getElementById("Join-GTG-intro").style.display=intro;
	document.getElementById("Join-GTG-requisites").style.display=requisites;
	document.getElementById("Join-GTG-positions").style.display=positions;
	document.getElementById("Join-GTG-benefits").style.display=benefits;
	document.getElementById("Join-GTG-FAQS").style.display=FAQs;
	document.getElementById("Join-GTG-apply").style.display=apply;
	
	/* The title name that appears on the green bar. */
	document.getElementById("join-gtg").innerHTML=title;
}

function displayCurrentAdvertise(services, GTGArt, contactUs, title)
{
	document.getElementById("Advertise-services").style.display=services;
	document.getElementById("Advertise-GTGArt").style.display=GTGArt;
	document.getElementById("Advertise-contactUs").style.display=contactUs;
	
	/* The title name that appears on the green bar. */
	document.getElementById("advertise").innerHTML=title;
}

/* For the Media intro   11/16/2010  */
function displayCurrentMediaIntro(GTGMusicList, japaneseMusicList, koreanMusicList, vocaloidMusicPicks, entry)
{
	/* Only loads the toggle change if the block is different. */
	//if (document.getElementById("about-us-title").style.display != entry)
	//{
		
		document.getElementById("GTGMusicListBlock").style.display=GTGMusicList;
		document.getElementById("japaneseMusicListBlock").style.display=japaneseMusicList;
		document.getElementById("koreanMusicListBlock").style.display=koreanMusicList;
		document.getElementById("vocaloidMusicListBlock").style.display=vocaloidMusicPicks;
	//}	
}

// --------------------------------------


function dateGTGPicksOnChange(dropdown)
{	
	var myIndex  = dropdown.selectedIndex;
    var SelValue = dropdown.options[myIndex].value;
		
	// Goes to the index in the arrayUsed.
	top.location.href = arrayUsed[myIndex];
		
    return true;
}

function setLeftSideHeight()
{	
	var bottomBuffer = 45; // the space between the right side and the bottom.
    var shortCutHeight;
	
	// Sees if there are shortcut tabs above.
	var shortCutHeight = document.getElementById("right-shortcuts");
	
	if (shortCutHeight != null)
	{
		shortCutHeight = shortCutBuffer; // Currently 35 to offset the tool bar section's height.	
	}
	else
	{
	    shortCutHeight = 0; // None.	
	}
						
	var rightHeight = document.getElementById("right-height").offsetHeight;
	
	// Sets the left height equal to the right side's height.  Adds shortCutHeight if the window has a tool bar to
	// keep the left side even with the right side.
	document.getElementById("left-height").style.height = rightHeight + shortCutHeight +"px";
	
	// Sets the center-pos equal to the right side's height.  Adds shortCutHeight if the window has a tool bar to
	// increase the whole center-pos accordingly.
	document.getElementById("center-pos-height").style.height = rightHeight + shortCutHeight + bottomBuffer +"px";
    	 	 
	// Unhide the bottom.
	document.getElementById("bottom-height").style.display="block";
}

// Only used for functions that need to add height dynamically.
function setLeftSideHeightChange(addHeight)
{	
	var bottomBuffer = 45; // the space between the right side and the bottom.
    var shortCutHeight;
	
	// Sees if there are shortcut tabs above.
	var shortCutHeight = document.getElementById("right-shortcuts");
	
	if (shortCutHeight != null)
	{
		shortCutHeight = shortCutBuffer; // Currently 35 to offset the tool bar section's height.	
	}
	else
	{
	    shortCutHeight = 0; // None.	
	}
						
	var rightHeight = document.getElementById("right-height").offsetHeight;
	rightHeight += addHeight +"px";
	<!--alert("right Height: " + rightHeight);-->
	
	// Sets the left height equal to the right side's height.  Adds shortCutHeight if the window has a tool bar to
	// keep the left side even with the right side.
	document.getElementById("left-height").style.height = rightHeight + shortCutHeight +"px";
	
	<!--alert("left Height: " + document.getElementById("left-height").style.height);-->
	
	// Sets the center-pos equal to the right side's height.  Adds shortCutHeight if the window has a tool bar to
	// increase the whole center-pos accordingly.
	document.getElementById("center-pos-height").style.height = rightHeight + shortCutHeight + bottomBuffer +"px";
    
    <!--alert("center Pos Height: " + document.getElementById("center-pos-height").style.height);-->
		 	 
	// Unhide the bottom.
	document.getElementById("bottom-height").style.display="block";
		
}

// Part of the Disqus comment box Asynchronous Loading
/*function initAddThis() 
{
   addthis.init();
}*/

function setDisqusCommentsArea()
{
	var spacePerComment = 150; // For the comment section when alloting extra buffer space.
	/*var startingHeight = 1000;*/
		
    // Sees if there's a comment box in this article.
	if(document.getElementById("Disqus") != null)
	{	

		//var numOfDisqusComments = document.getElementById("num-of-disqus-comments").innerHTML.split(" ");

        var disqusTest = document.getElementById("Disqus");
		var disqusHeight = disqusTest.offsetHeight;

		document.getElementById("Disqus").style.height = disqusHeight + spacePerComment; // Finds the total height dynamically and adjusts the window accordingly

	}	
}


function featuredSpotlightOnChange(dropdown)
{
	var myIndex  = dropdown.selectedIndex;
    var SelValue = dropdown.options[myIndex].value;
	
	// Goes to the index in the arrayUsed.
	top.location.href = arrayUsed[myIndex];
		
    return true;
}


//plugin
function backToTop()
{
	
	jQuery.fn.topLink = function(settings) {
		settings = jQuery.extend({
			min: 1,
			fadeSpeed: 200,
			ieOffset: 50
		}, settings);
		return this.each(function() {
			//listen for scroll
			var el = $(this);
			el.css('display','none'); //in case the user forgot
			$(window).scroll(function() {
				if(!jQuery.support.hrefNormalized) {
					el.css({
						'position': 'absolute',
						'top': $(window).scrollTop() + $(window).height() - settings.ieOffset
					});
				}
				if($(window).scrollTop() >= settings.min)
				{
					el.fadeIn(settings.fadeSpeed);
				}
				else
				{
					el.fadeOut(settings.fadeSpeed);
				}
			});
		});
	};

	
	//usage w/ smoothscroll
	$(document).ready(function() {
	 //set the link
		 $('#top-link').topLink({
			 min: 400,
			 fadeSpeed: 500
		 });
		 //smoothscroll
		 $('#top-link').click(function(e) {
             e.preventDefault();
			 $.scrollTo(0,300);
		 });
	});
	
}


function staffBio(staffName)
{	
	var picHeader;
	var role;
	var favMusic;
	var favAnime;
	var favMovies;
	var favTVDrama;
	var favGames;
	var favHobbies;
	var howAsian;
	
	picHeader = adImages[curPreLoadNum].src;
	
	if(staffName.toLowerCase() == "jonas")
	{
		//picHeader = "About-Us-Pictures/Jonas-Header.png";
		role = "Manages all people within the video games section, writer, events correspondant";
		favMusic = "Epik High, DJ Doc, Clon";
		favAnime = "Elfen Lied, Gurren Lagann, Azumanga Daioh!, Pani Poni Dash!, Minami-Ke (1st Season)";
		favMovies = "Ong Bak, Ong Bak 2, Ju On, Crouching Tiger Hidden Dragon";
		favTVDrama = "Super Rookie, My Name is Kim Samsoon";
		favGames = "Lumines, Advance Wars (Series), Pump It Up, DJ Max Technika, Seiken Densetsu, Final Fantasy IV, Mega Man (Series).";
		favHobbies = "";
		howAsian = "Besides being Asian, I wanted to broaden my knowledge of my heritage and not be ashamed of it. I took an interest in studying the subject when Network Cable television and the Internet became widespread in the mid-late 1990's. It did not cost money to simply view the material, so I was able to peruse all of the information I desired. As an independent thinker, immune to the majority of public opinion, I thought that learning the culture was a way to differentiate myself from being someone who just likes everything domestic. Not that there's anything wrong with the alternative, but I prefer to have a variety of interests.";		
	}
	else if(staffName.toLowerCase() == "driftjunky13")
	{
		//picHeader = "About-Us-Pictures/Jonas-Header.png";
		role = "Writing and reviewing Japanese movies and TV shows, as well as Japanese special effects '\tokusatsu'\ shows.";
		favMusic = "Iwasaki Taku, M-Flo, Super Junior, Project R, TM Revolution, EXILE.";
		favAnime = "Initial D, Katanagatari, Soul Eater, Eyeshield 21, YuYu Hakusho.";
		favMovies = "Death Game Park, Kamen Rider Ryuki: Episode Final, Kamen Rider Kabuto: God Speed Love.";
		favTVDrama = "Shibatora, Kamen Rider Den-O, Samurai Sentai Shinkenger.";
		favGames = "Marvel vs Capcom Series, Pokemon Series, The World Ends With You, Street Fighter Series.";
		favHobbies = "Drawing, watching tokusatsu shows, driving at night.";
		howAsian = "I got into Asian pop culture at a young age, when i first started reading YuYu Hakusho and a few other manga when I was 5 years old in the Philippines. I also watched the Filipino dub of Kamen Rider Black RX during that time, as well as Power Rangers. Things escalated when I moved to America, where I was immersed in the pop culture phenomenon. Living in the heavily Filipino and Chinese populated city of Daly City, I began to listen to newer genres of music, and in high school, I was introduced to J-Dramas and K-Dramas through friends in my Anime Club.";		
	}
	else if(staffName.toLowerCase() == "dear8lue")
	{
		role = "I will be primarily based in the Asian Film department - with a focus on Japanese and Korean cinema - hopefully writing on subjects of nominal interest, related in varying degrees. I have no illusions that these cobbled together words will resolve any deep mysteries or bring to light any grand epiphanies. They are merely the jotted down observations of an errant wanderer on the road (much like the rest of us). But at the least, I hope that they might provide an occasional humerous anecdote or serve as a minor intriguing diversion along the way :)";
		favMusic = "くるり Quruli (JP), 菅野 よう子 Kanno Yoko (JP), 宇多田ひかる Utada Hikaru (JP), レミオロメン Remioromen (JP), ザ・ブリリアント・グリーン The Brilliant Green (JP), The Postal Service (US), Belle and Sebastian (UK)";
		favAnime = "秒速５センチメートル 5 Centimetres Per Second: A Chain Of Short Stories About Their Distance, 雲の向こう、約束の場所 The Place Promised In Our Early Days (anything by Shinkai Makoto), 耳をすませば Whisper of the Heart, おもひでぽろぽろ Only Yesterday (anything by Studio Ghibli, and not necessarily by Miyazaki Hayao), カウボーイビバップ Cowboy Bebop, 新世紀エヴァンゲリオン Neon Genesis Evangelion, マクロス Macross (series)";
		favMovies = "Love Letter (JP) (anything by Iwai Shunji), リンダ、リンダ、リンダ Linda, Linda, Linda (JP), すきだ Su-ki-da (JP), 시월애 Il Mare (KR), 고양이를 부탁해 Take care of my cat (KR), Before Sunrise (US), Quiet City (US)";
		favTVDrama = "1リットルの涙 1 Litre of Tears (JP), 겨울연가 Winter Sonata (KR), Battlestar Galactica (US), Stargate (US), West Wing (US), Freaks and Geeks (US), Scrubs (US)";
		favGames = "Final Fantasy (series), Ico, Shadow of Colossus, Chrono Trigger/Cross, Lunar: Silver Star Story/Lunar 2: Eternal Blue, Starcraft (series)";
		favHobbies = "Watching moving pictures, reading words, collecting stories, randomly wandering, getting lost - it is the only way to find the things and places you never even knew you were looking for in the first place, after all :), and generally making things up as I go along...";
		howAsian = "None of this is real, if it makes you feel any better. The tale that I now spin is in no way true, but based on just a fiction... Yet let this be my story, when the stories are all told...<br<br> I suppose my greatest tragedy, is my decided lack thereof... Having an altogether uncomplicated existence in middle-class suburbia. Like any nerdy kid (and arguably now – a socially awkward 'adult' :)), I had/have a tendency to get lost in my own mind. Manifesting in reading copious amounts of novels and comic books, watching an endless cavalcade of films and spending innumerable hours playing video games... I was always setting out on grand adventures, travelling to forgotten lands, discovering distant galaxies, gaining fantastical powers, piloting giant robots and generally saving the world :)..... all while sitting in the comfort of my own home. Then I would close the book, turn off the projector or save the game... and return to the mundane reality of my everyday existence. And that is pretty much where my story ends. An unremarkable life, much like any other, unlike any other... lived vicariously through other peoples' imaginations. It was only later, when I took a step back, that I came to realise that more and more of the works that resonated most strongly, were stemming from an increasingly Asian influence. <br><br> As such I thought it was about time to open my eyes to the world waiting just outside the door, and embark on that one great adventure that still eluded me - that I have on occasion overheard people call 'real' life :) And as I set out on this journey, still searching for a destination... I thought it might be prudent to collect my thoughts and gather my words, about what I have seen and heard along the way.... I still occasionally escape back into the unreal lands and imagined places I once understood so well, but I think I may have just discovered a 'real' world that I knew nothing about... and it is a fabulous world after all... :) <br><br> Yet as I said from the start, even this is an imaginary story... aren't they all?";	
	}
	else if(staffName.toLowerCase() == "elliot-g")
	{
		role = "Surrounded by odd and exotic video games in the land of Japan, Elliot takes it upon himself to look at the weird, exciting and mind blowing software that comes out of the east. It's pretty safe to say that eventually he will fall victim to this daunting task, but he doesn't intend to give up. Not until he dies at least. Or something dramatic along those lines. Use your imagination!";
		favMusic = "Boom Boom Satellites (JP), Theory of Relativity (JP), School Food Punishment (JP), Yoko Kanno (JP), Nobuo Uematsu (US), Gorillaz (UK), Hatsune Miku (JP).";
		favAnime = "Tengen Toppa Gurren Lagann, FLCL, Arakawa Under the Bridge, Baccano!, Gunbuster, Durarara!!, Slayers.";
		favMovies = "Summer Wars, Battle Royale, Shawshank Redemption, Back to the Future, Empire Strikes Back, Children of Men, Scott Pilgrim vs The World.";
		favTVDrama = "The Walking Dead, Garo, Cutie Honey The Live, Sh15uya, True Blood, Lost, Great Teacher Onizuka.";
		favGames = "Chrono Trigger, Final Fantasy VI, Final Fantasy IV, The World Ends With You, Persona 3, Valkyria Chronicles, Resident Evil 2.";
		favHobbies = "Practicing Kungfu, writing about the things I love, making short films, speaking Japanese, pretending I know how to sing and of course, hanging out with my friends.";
		howAsian = " It all started thousands of years ago, when my mother force fed me Godzilla films as a small child. Everything since then has been history. Through Godzilla and his adversaries, the world of East Asia was opened up to me in the form of music, film, games and even literature. I've become fascinated with life over here, and there isn't a moment when I'm not thinking about some cultural difference or similarity and its relevance on modern day social relations. Of course, college presented me the opportunity to become skilled enough at Japanese so that I can now pretend I'm fluent even if I'm not. One day though... one day!";	
	}
	else if(staffName.toLowerCase() == "kizxm")
	{
		//picHeader = "About-Us-Pictures/kizxm-Header.png";
		role = "Following Japanese music trends, Producing articles about J-pop, and Listening to all the classics.";
		favMusic = "Vocaloid (JP,) Perfume (JP,) Gackt (JP,) Classical Piano.";
		favAnime = "Code Geass, Bounen no Xamdou, Gundam 00.";
		favMovies = "How to Train Your Dragon, Ghost Writer.";
		favTVDrama = "As The World Turns, America's Next Top Model.";
		favGames = "Fragile, Pokemon, Team Fortress 2.";
		favHobbies = "Drawing, Writing, Mumbling to Lyrics to.";
		howAsian = "I basically tumbled into Asian Pop Culture, my dad used to read to me stories in Cantonese (a dialect of Chinese.) Which I suppose was my first 'exposure' to Asian culture, although not very world changing. After this I attended a private school where they put a ban on things like chocolate chips (seriously!) and Pokemon cards. Because of their 'illegal' quality, Pokemon cards were everybody's favorite thing, which in turn lead to the TV show and merchandise.<br><br>  As I got older and when we finally got cable, anime became a routine. With it and a growing love for the internet, Japan and basically all Asia. Asia just seemed like a home away from home (I am half-Asian) stuff just made more sense and things just all sort of lead to one and another. I feel by around 8th grade I was basically surrounded by Asian culture. I'm not that exciting of a person, just have a passion for what seems good. <br><br>  Currently, I am learning Japanese to further my knowledge (and for personal pleasure!) I also plan to be attending many anime conventions, as well as going to local get to-gethers.<br><br>  I am now very excited to now be a part of the Green Tea Graffti crew, learn new things and hopefully have a blast.";	
	}
	else if(staffName.toLowerCase() == "tsubaki")
	{
		//picHeader = "About-Us-Pictures/tsubaki-Header.png";
		role = "Listening and enjoying Japanese music, observing its history and trends, and writing about it.";
		favMusic = "Ikimonogakari (JP,) m-flo (JP,) YUI (JP,) EXILE (JP,) Aoyama Thelma (JP.)";
		favAnime = "Hayate no Gotoku!, K-ON!, Angel Beats, Ouran High School Host Club, WORKING!!, and like several dozen more in every genre :P.";
		favMovies = "Castle in the Sky (watched it at least a dozen times.)";
		favTVDrama = "Nodame Cantabile, Hi My Sweetheart, Great Teacher Onizuka.";
		favGames = "Starcraft, Touhou, Diablo, Modern Warfare, Final Fantasy.";
		favHobbies = "Besides the obvious, I learn Japanese and Korean, compose music, play violin, draw, and play go (weiqi/igo/baduk), Chinese chess (xiangqi), and Japanese chess (shougi).";
		howAsian = "I was born in Taipei, Taiwan and lived there for seven years. In short, East Asian pop culture was all that I knew (Card Captor Sakura and Yu Yu Hakusho, both shown in Taiwan, were my childhood heroes); I did not know that much about American rappers or American hip-hop until I moved to America around when I was eight years old, at the end of my first year in elementary school. I've always enjoyed Taiwanese singers and Japanese animation and manga.<br><br> The first few years in America isolated me, and I found it difficult to keep up with what went on in East Asia. But through the advent of the internet boom and the information age, access to it all became instantaneous. Around when I turned ten years old, I began listening to an abundance of Japanese and Korean music instead of just Chinese music. The internet also drew me back into anime, and I saw that subculture grow through the years, too. I started learning Japanese in 2008, and in 2010 I started learning Korean. <br><br> I'm obsessed with East Asian pop culture; I listen to the music (which includes VOCALOID), watch drama, watch TONS of anime, learn the language, and play go/xiangqi/shougi.";		
	}
	else if(staffName.toLowerCase() == "frank")
	{
		//picHeader = "About-Us-Pictures/Frank-Header.png";
		role = "Responsible for the tone and quality of the site.  So yes, if you want to call any of our writers a newb, I'll be the one responding to your message.  That said, if you LIKE an article on the site, you can let me know too.  I wouldn't mind reading some good news.";
		favMusic = "Epik High's \"Map the Human Soul,\" Eternal Morning's (Pe2ny and Tablo) \"Soundtrack to a Lost Film,\" Yoshida Brothers\" \"Prism,\" Shonen Knife's \"Rock Animals,\" Radiohead's \"In Rainbows,\" anything I can find of the faster rapper (who actually raps) Korea's Outsider.  And also Kara's \"Honey\" and SNSD's \"Gee.\"  I know.  I know.  Don't send me hate mail about it.";
		favAnime = "Cowboy Bebop, Keno's Journey, Miyazaki films (particularly \"Princess Mononoke,\") FLCL, Vampire Hunter D, and hey, the original Dragonball is money!  Go Oolong!  NOTE: This selection may tell the enlightened anime fan that I need to watch more Anime.  This is fact.";
		favMovies = "Tale of Two Sisters, My Sassy Girl, Always Sunset on 3rd Street (and the sequel,) Slimido, The Protector, Five Deadly Venoms, Chinese Kung Fu films by the big three (Lee, Li and Chan)";
		favTVDrama = "I stopped watching TV except for NFL Football on Sunday.  That said, my friends have DVR, and they assure me that Dexter is a really good show.  I would also suggest watching any HBO series since the mid-90s, particularly Oz.  Given, I grew up watching the jail special while an adolescent...but yeah! Don't judge me and my Adebisi worship!";
		favGames = "Final Fantasy VI, Tecmo Super Bowl, Smash Bros., Myth: The Fallen lords, Starcraft, Tetrinet.";
		favHobbies = "Writing, Basketball, Reading, Freestyling parody lyrics about other GTG members over bad hip-hop songs, Dividing by Zero, Talking.";
		howAsian = "So how does a Cuban/Mexican/mixed European blooded, full American bred boy get into Asian pop culture?  Admittingly, it didn't begin with Seo Taiji and Boys, or Crazy Ken Band, a Kurosawa film, or even an unarticulated obsession with samurai culture. <br><br> It started with an appearance by Jushin Thunder Liger on WCW television.  Liger was a renowned light-heavyweight wrestler, knwon for his flashy style and crazy off the top rope spinny splashes.  Liger hit the first \"450\" I ever saw on TV, an appropriately named wrestling move, for it involves front-flipping 450 degrees onto an opponent. <br><br> Basically, he skull-rammed my world view.  Pretty soon, all of my Teenage Mutant Ninja Turtle action figures were contorting themselves at light speeds in my flolloping fingertips, to crash with centrifugal finality into plastic Hulk Hogans. <br><br> And Liger's theme music was just as eye opening as his acrobatics.  The J-rock/pop that always led to his pyrotechnic entrance made me wonder why all I listened to was country music and the occassional Bone Thugz \"n\" Harmony track when my parents weren't around. <br><br> Not as much as the Tao te Ching would tell me on my first read of it at age 15, when I started listening to Jimi Hendrix and The Doors, or the short stories of Jorge Luis Borges' labyrinths at 17, accompanying the 90's grunge scene and electronic-rock, which would lead to a renewed interest in underground hip-hop and The Mars Volta a year later- <br><br> ...which all has served as a nice fat palate of Americana from which to understand the burgeoning, at times genre-defying Asian music scene, having been re-introduced to the topic with my discovery of Shonen Knife's \"Brand New Knife\" album. <br><br> Since then, I've leapt into Korean and Japanese movies, hip-hop, and the casual romp trhough a Murakami novel. And, for old time's sake, I replay the greatest wrestling match of all time, Toshiaki Kawada versus the late, great Mitsuhara Misawa in the Tokyo Egg Dome. Because you gotta go back to your roots, y'know?";	
	}
	else if(staffName.toLowerCase() == "pineapplepocky")
	{
		//picHeader = "About-Us-Pictures/PineapplePocky-Header.png";
		role = "Drawing illustrations, merchandising such as creating buttons and stickers, bookmarks, or tshirts.";
		favMusic = "Bonnie Pink (JP), Naganuma Hideki (JP) , Cibo Matto, ellegarden.";
		favAnime = "Gintama, FLCL.";
		favMovies = "Dead Leaves.";
		favTVDrama = "Don't really watch much tv to know.";
		favGames = "I barely play video games, but I'd say Little Big Planet.";
		favHobbies = "Drawing, manga, anime.";
		howAsian = "Well, first off I'm Chinese. So I sometimes hear about daily news of asia from my parents during dinner about what they read in the Chinese news that day. My sister got me listening to japanese music when I was in highschool, and that lead to anime, and then I learned about manga and dived into that stuff. I am shunned from reality mostly because of this, so the 'culture' I learn is all from reading manga all day. Occasionally a great movie from Asia comes and my brother and I watch it together. After listening to just japanese music, I began to expand my tastes by starting to listen to cantonese and mandarin music a while ago too.";	
	}
	else if(staffName.toLowerCase() == "dallas")
	{
		//picHeader = "About-Us-Pictures/Dallas-Header.png";
		role = "To review, analyze and write about Japanese film, anime and other forms of Asian pop culture.";
		favMusic = "Classical music is a favorite of mine especially films scores. Asian Kung-Fu Generation (JP), Mihamaru GT (JP), Beatles (ENG), Coheed and Cambria (ENG), Jimi Hendrix (JP).";
		favAnime = "Neon Genesis Evangelion, Code Geass: Lelouch of the Rebellion, Nadia: Secret of Blue Water, Full Metal Alchemist, Now and Then Here and There, Mobile Suit Gundam 0079, The Vision of Escaflowne (To name a few).";
		favMovies = "Plan 9 From Outer Space, Battle Royale, Speed Racer, Curse of the Golden Flower, Oldboy, The Sea Prince and the Fire Child, My Neighbor Totoro.";
		favTVDrama = "The Big Bang Theory, Akihabara@Deep, Samurai High School, Densha Otoko, Family Guy, Twilight Zone.";
		favGames = "BlazBlue: Calamity Trigger, Final Fantasy 7, Legend of Zelda: Link to the Past, Disgaea: Hour of Darkness, Battle Moon Wars, Persona 3.";
		favHobbies = "Hiking, writing.";
		howAsian = "While I was growing up I had a lot of Asian childhood friends so I guess it rubbed off on me. What was a true breakthrough for me was when I was ten, that was the year when I discovered anime. I became a huge fan and that love for anime not only branched me off into Japanese film and television in general, but also into other areas of foreign cinema as well. Through the power of fansubbing, I began to watch more and more anime and Japanese movies. As my passion grew, I began to delve into manga and as the years went by I began to write and critique anime and Japanese film. Thus, leading me to Green Tea Graffiti, and it's great to be here!";	
	}
	
	
	else if(staffName.toLowerCase() == "deshi")
	{
		//picHeader = "About-Us-Pictures/Deshi-Header.png";
		role = " Drawing, designing and working with other artists to make pretty art for GTG ;D.";
		favMusic = "DBSK, U-kiss, After School, Ze:A, and Utada Hikaru.";
		favAnime = "One Piece.";
		favMovies = "Brave Story, Tekkonkinkreet, FFAC Complete, and Alice in Wonderland.";
		favTVDrama = "Gokusen.";
		favGames = "Ragnarok Online and Golden Sun";
		favHobbies = "Being Lazy =).";
		howAsian = "I think in elementary school I was into anime like Sailor Moon, Pokemon, Gundam Wing and Digimon. Then it grew further into less mainstream anime and their theme songs then when I started high school BANG! Hallyu wave! Now I'm just into everything.";
	}
	else if(staffName.toLowerCase() == "hai")
	{
		//picHeader = "About-Us-Pictures/DaveyD-Header.png";
		role = "Writing articles relating to anime, brainstorming for GTG events and site layout.";
		favMusic = "Vocaloid/Nico Utaite (DECO*21, Guriri, Yoppei, *Toriko, etc.), music/songs that have 'themes' and tell stories." ;
		favAnime = "Code Geass series, Sola, Chrono Crusade, Air, and more.";
		favMovies = "n/a";
		favTVDrama = "n/a";
		favGames = "Okami, Harvest Moon, The World Ends With You.";
		favHobbies = "Drawing anime/manga style, singing/karaoke, watching anime/reading manga.";
		howAsian = "I've always loved to draw since I was little and thought anime-style girls were really pretty and wanted to draw them all the time.   I started to copy any drawing I could find that was in anime style. The only animes I had seen at that time (elementary school) were a few movies of Sailor Moon and Shaman King, so I started to draw fanarts of Shaman King in my sketchbook.  When I was in middle school, I had become fully aware of what anime was and started watching Naruto on Toonami/Cartoon Network.  <br><br> Eventually, I started to watch the series in Japanese online, which opened the door to many other animes/mangas and the online community. To this day, I still love both drawing and anime greatly and have now seen over 200 series and have read countless Shoujo manga titles.  Both anime and drawing have caused me to also love Japanese anime and Vocaloid music.  Almost all my interests and dreams in life are related to Japan/anime in some way.  In short, my love for drawing and a chance encounter is what launched me into a world that has brought me enjoyment, motivation, and aspiration.";

	}
	else if(staffName.toLowerCase() == "noko")
	{
		//picHeader = "About-Us-Pictures/Matthias-Header.png";
		role = "Writing on Artists, Bands, etc., Observing Japanese music and trends ...";
		favMusic = "J-Pop (NEWS, Kobukuro,...), J-Rock (UVERworld, ONE OK ROCK,...), VOCALOID + Niconico, Douga Utattemitas.";
		favAnime = "Favorite anime: Baccano!, Black Cat, Mononoke, Ghost Hunt, Jigoku Shoujo, Ueki no Housoku (The Law of Ueki), and a lot, lot more.";
		favMovies = "Stranger Mukou Hadan (Sword of the Stranger), 5 Centimeters per Second, Spirit: Stallion of the Cimmaron, The Italian Job.";
		favTVDrama = "SPEC, Kiina, Gokusen, Bloody Monday, Godhand Teru.";
		favGames = "Pokémon, Castlevania, Saru Getchu, Metal Gear Solid.";
		favHobbies = "Doodling, Taking pictures, Photo manipulating, Watching anime, Listening to music, Organizing big chunks of data/info.";
		howAsian = "The first time I 'officially' encountered Asian pop culture would be when I watched One Litre of Tears with my cousin one summer when I was back in Taiwan on vacation. A while after that, I was introduced to YouTube and began to watch Inuyasha. I liked it so much, I watched the series over three times. After that, I got curious about anime and I began to watch more and more other animes. I also began to watch more dramas, mostly Japanese, but I watched some Korean dramas as well. <br><br>That eventually led me to listening to Japanese music, mostly J-Pop - my first group being either Arashi or AAA. Ever since then, I've been obsessed, if I may say, over Japan and it's music, anime, culture, whatever else there is. I got myself into Japanese variety shows, comedy duos, and anything else I could get my hands on. Even now, I am still digging ever more deeper into Japanese music and other forms of entertainment.";
	}
	else if(staffName.toLowerCase() == "matthias")
	{
		//picHeader = "About-Us-Pictures/Matthias-Header.png";
		role = "Analyzing and writing topics of culture, to understand and promote the whats, wheres, and hopefully whys of Asian culture.  Basically, I'm going to dive in and explore this wonderful world of Asian culture, and share my findings in a hopefully largely coherent fashion, with a minimum of sidetracking and tangents. (Read: Tangents and sidetracking may happen often.)";
		favMusic = "Classic/alternative/pretty much any kind of rock, soul, jazz, classical, Film and game soundtracks (pretty much anything by John Williams, Ennio Morricone and Yoko Kanno).";
		favAnime = "Cowboy Bebop, The Girl Who Leapt Through Time, Toradora!, Full Metal Alchemist, Outlaw Star.";
		favMovies = "The Shawshank Redemption, The Seven Samurai, The Good The Bad and the Ugly, The Magnificent Seven, Kiss Kiss Bang Bang.";
		favTVDrama = "NCIS, The Big Bang Theory, M*A*S*H, The Avengers (the Emma Peel portion, anyway), a whole bunch of cartoons that are far too numerous to list here.";
		favGames = "Suikoden, Megaman Legends/Rockman DASH, Final Fantasy IX, Persona 4, Resident Evil 3, Wild Arms 3.";
		favHobbies = "I'm a big time media junkie, so I'd have to say a primary part of my free time is spent reading books, graphic novels, comics, and manga, playing video games, watching movies, listening to music, etc. etc.  When not occupied with this, I like to cook, attempt to draw except not on a level comparable to anything professional, write fiction and create far more characters than I will ever use, find ways to incorporate dialogue from movies into everyday conversations, and bash my head into door frames for the amusement of others.";
		howAsian = "I suppose a small interest in Asian culture in general has always been part of my life - my father had an appreciation, a huge respect, for the Japanese and Chinese culture.  I could use chopsticks before I could tie my shoes, it seemed.  So it could be said my first foray into the world of asian culture was via my stomach, I quickly acquired taste for various kinds of asian cuisines - even the sushi my dad wouldn't eat (there is nothing wrong with octopus, you know!) <br><br>Like a lot of American kids, my first exposure to truly Asian pop culture were video games and the ported Japanese shows that I didn't realize WERE ported Japanese shows until a bit later in life - Mario, Zelda, Speed Racer, Power Rangers/Sentai,l and Sailor Moon.  (It's great that I can finally admit to watching Sailor Moon without having to pretend it just \"accidentally came on.\")  Around the time of my transition into middle school, is when I began to actively watch and understand, this was material from a different place entirely - I'd recognized a distinct visual difference between say, Sailor Moon and a western cartoon, and that intrigued me.  Of course around middle school was the time when one word dominated the field of both japan and the world: POKEMON. <br><br>I played the games, watched the show, read the comic, etc. etc.  Pokemon opened to door to me being completely obsessed with anime culture.  That fandom would be sealed by my watching of one particular series at the beginning of my high school life - Cowboy Bebop.  I was forever hooked from that point on - this fantastic, ambrosic blend of sci-fi, western, jazz and blues convinced me anime was awesome. <br><br> But I found something as I went along - I became more and more interested in the stories behind the stories, what exactly made this media distinctly Asian.  I'm the guy who went out and read a copy of Romance of the Three Kindgoms after playing Dynasty Warriors 3 - all 3,000+ pages of it.  I learned what I could about the subject in high school and in college, taking asian/pacific american studies classes, capping with me writing my final paper for my film and media studies minor on the implications anime made about masculinity.  It's a journey that all started from my dad giving mee a piece of tekka maki when I was 5.";
	}
	else if(staffName.toLowerCase() == "raymaru")
	{
		//picHeader = "About-Us-Pictures/Raymaru-Header.png";
		role = "Leading the Japanese music section, managing the staff within this area, directing the theme of the Japanese section, contributing writing to the area.";
		favMusic = "B'z (JP), Bonnie Pink (JP), EXILE (JP), YUI (JP), Joe Hisaishi (JP), Jake Shimabukuro (US), Nujabes (JP).";
		favAnime = "GTO (JP), Azumanga Daioh (JP), Tengen Toppa Gurren Lagann (JP), Gunbuster (JP), Ranma 1/2 (JP), Samurai Champloo (JP).";
		favMovies = "Tada Kimi wo Aishiteru (JP), Swing Girls (JP), My Sassy Girl (KR), Hard Boiled (CH), Shichinin no Samurai (JP), Pirates of the Caribbean (US), Red Cliff (CH).";
		favTVDrama = "Kamen Rider Series (JP), Super Sentai Series (JP), Garo (JP), Super Rookie (KR), Battlestar Galactica (US), Lost (US).";
		favGames = "Gyakuten Saiban series, Metal Gear series, Final Fantasy series, Street Fighter series, Advance Wars series, Shin Megami Tensei series, Pokemon series.";
		favHobbies = "Other than the aforementioned 'favorites' topics, I enjoy photography (both digital and analog), karaoke, Japanese language, dance, analyzing film and all other works of art, having fun with the words 'henshin' and 'gattai', and saving the world from super powered villains.";
		howAsian = "My interest in East Asian pop culture has been around since I was a kid. I was a fan of Godzilla and Ranma 1/2, and even my father was a fan of Bruce Lee and Akira Kurosawa. What started off as hobbies and interests evolved into a college career, where I was further exposed to many layers of East Asian culture, from film and music to history and literature. Where has it taken me at this point? I currently live in Nagasaki Prefecture, Japan, teaching English in public schools as part of the JET Program.";
	}
	else if(staffName.toLowerCase() == "jangta")
	{
		//picHeader = "About-Us-Pictures/jangta-Header.png";
		role = "Overall designer of the GTG website, coding and fixing bugs and errors, handling the business aspects of the site, delegating team leaders to focus on GTG's vision, leading the Korean music and Korean movie sections, doing HR, and translating. Originally, I wanted to just be the GTG jester, but the team quickly shot that idea down.  But I still love my job, and I wear the multi-pointed jingle bell hat whenever I want: I'm in charge! (Yeah! Yeah!  But seriously, it's a lot of responsibility!)";
		favMusic = "M-Flo(JP), EXILE(JP), Brown Eyes(KR), SES(KR), Epik High(KR), 3rd Coast(KR), and David Tao(TWN).";
		favAnime = "Ranma 1/2, GTO, and Cowboy Bebop.";
		favMovies = "Letters from Iwo Jima(USA/JP), A Tale of Two Sisters(KR), Oldboy(KR), Always Sunset On Third Street and its sequel (JP), Welcome to Dongmakgol (KR), Fearless(CHN), Taegukgi(KR). ";
		favTVDrama = "Super Rookie (KR - drama), My Name is Kim Samsoon (KR - drama), Full House (KR - drama) Pops In Seoul (KR - TV), J-Melo (JP - TV), Star Golden Bell (KR - TV).";
		favGames = "Starcraft, Persona 4, Final Fantasy IV, Final Fantasy VI, Civilization II, XCOM: UFO Defense, Chrono Trigger.";
		favHobbies = "Besides the above activies above, I like working out, learning Asian languages, dating, programming, talking, Hip-Hop dance/choreography, watching pro Korean Starcraft games.";
		howAsian = "I remember exposing myself to Asian pop culture as a teen living in Japan.  Having lived in Japan for seven years because of my dad's job, I slowly got into the music of Asia through game shows and MTV Asia.  Instead of \"Downtown\" Julie Brown in American MTV in the mid 1990s, I was exposed to MTV Asia's attempt of \"Learning English slang with VJ David.\"  <br><br> Although learning \"yo dawg\" from Taiwanese-American VJ David was an interesting experience, I first learned of a huge Asian music market.  Japanese game shows featuring artists, such as newcomer Utada Hikaru, popular Okinawian Namie Amuro, and Shiina Ringo in her nurse outfit in \"Honnou\" exposed me to some awesome pop sounds outside the US.  The turning point came when I discovered a then-underground multigenre group called M-flo. <br><br> After hearing \"How you like me now\" and buying their first M-flo CD in a local Japanese store, I was truly sold.  I decided to do research in the Asian music scene.  The learning and exposure of new boy bands, girl groups, solo singers, and underground artists flooded my thoughts.  <br><br> From overseas in Korea came popular girl group, SES, and their new dance-poppy beats from \"Dreams Come True\" and \"Love\".  Shinhwa, HOT, Sech Keis, and GOD represented the new Korean boy bands that had slick cheoreography, great dance tunes, and a lifelong of memories.  Korean-American duo, Jinusean, did the unthinkable - namely, recreate the Bee Gee's \"How Deep is your Love\" with rap - and made me enjoy the song.  Edgy and new Hip-Hop group, Drunken Tiger, made me appreciate the new emerging Hip-Hop movement in Asia.  And David Tao and Faye Wong represented the ever-growing Chinese music market and what they had to offer, as I had many of their tunes on repeat. <br><br> It's pretty funny actually; at first, I really didn't want to take Japanese when I attended various International and American high schools in Japan; I chose Spanish instead.  However, when the Spanish class filled up, I was forced to learn Japanese.  That was one of my best non-decisions of my life.  <br><br> Now learning Asian languages has been a passion ever since taking beginning Japanese.  From learning the craziness that is Japanese and Chinese kanji, mastering Korean Hangul, not getting tripped up on Japanese grammar, and pronouncing Chinese accents correctly, the Asian pop culture learning has been a great ride. <br><br> Now you, the reader, know my story into the Asian pop scene.  However, this story is nothing special; there are millions of testimonies like this.  I'm sure many GTGers and vistors of the site have their own interesting and exciting stories on how they got into this niche.  I welcome anyone to come and talk to me about their passion of Asian pop culture in the forums, as I would be honored to hear how you first got into the fun called Asian pop culture.";	
	}

    // Changes the text value
	document.getElementById("staff-header").src=picHeader;
	document.getElementById("role").innerHTML=role;
	document.getElementById("fav-music").innerHTML=favMusic;
	document.getElementById("fav-anime").innerHTML=favAnime;
	document.getElementById("fav-movies").innerHTML=favMovies;
	document.getElementById("fav-TV-drama").innerHTML=favTVDrama;
	document.getElementById("fav-games").innerHTML=favGames;
	document.getElementById("fav-hobbies").innerHTML=favHobbies;
	document.getElementById("how-asian").innerHTML=howAsian;
}
