/* author: coyotebd@hotmail.com */
/* Generated by AceHTML Freeware http://freeware.acehtml.com */
/* Creation date: 25/02/2006 */


/*****************************************************
* This is the function that loads the links into the appropriate spot
*/

function eMailAdd()
{
	// By Joseph McLean <flux at thecentre.com> - Thank you Joseph for this code I stole from you.
	var linktext = "Webmaster";
	var email1 = "tyler";
	var email2 = "provick.ca";
	document.write("Contact the <a href=" + "mail" + "to:" + email1 + "@" + email2 + ">" + linktext + "</a>")
}

function doThis(v)
{
	window.alert(v);
}

function checkGalDate(j)
{
	dateAdded = galImg[j][8].substr(0,2);
	monthAdded = galImg[j][8].substr(2,2);
	yearAdded = galImg[j][8].substr(4,4);
	//window.alert(yearAdded);
	artDay = new Date();
	artDay.setFullYear(yearAdded,--monthAdded,dateAdded);
	//window.alert(artDay);
	theDay = new Date();
	//window.alert(theDay);
	if (artDay <= theDay)
	{
		//window.alert('yes');
		return 1;
	}
	else
	{
		//window.alert('no');
		return 0;
	}
}
 
function checkDate(j)
{
	dateAdded = articleList[j][6].substr(0,2);
	monthAdded = articleList[j][6].substr(2,2);
	yearAdded = articleList[j][6].substr(4,4);
	artDay = new Date();
	artDay.setFullYear(yearAdded,--monthAdded,dateAdded);
	//window.alert(artDay);
	theDay = new Date();
	//window.alert(theDay);
	if (artDay <= theDay)
	{
		//window.alert('yes');
		return 1;
	}
	else
	{
		//window.alert('no');
		return 0;
	}
	/*
	window.alert('Date: ' + dateAdded);
	window.alert('Month: ' + monthAdded);
	window.alert('Year: ' + yearAdded);
	*/
}

function findMonths(j)
{
	monthAdded = exLink[j][4].substr(0,2);
	yearAdded = exLink[j][4].substr(2,4);
	theMonth = new Date();
	theMonth = theMonth.getMonth();
	theMonth += 1; //Because it gives a value between 0 and 11 otherwise
	theYear = new Date();
	theYear = theYear.getFullYear();
	if (yearAdded == theYear) //checks if it's the same year as the link was added
		theDiff = (theMonth - monthAdded);
	if ((theYear - yearAdded) == 1) //checks if it was added last year
		theDiff = ((12 - monthAdded) + theMonth);
	if ((theYear - yearAdded) > 1)
		theDiff = 200;
	return theDiff;
}

function findGalMonths(j)
{
	//window.alert(galImg[j][1]);
	monthAdded = galImg[j][8].substr(2,2);
	//window.alert(monthAdded);
	yearAdded = galImg[j][8].substr(4,4);
	//window.alert(yearAdded);
	theMonth = new Date();
	theMonth = theMonth.getMonth();
	theMonth += 1; //Because it gives a value between 0 and 11 otherwise
	//window.alert(theMonth);
	theYear = new Date();
	theYear = theYear.getFullYear();
	//window.alert(theYear);
	if (yearAdded == theYear) //checks if it's the same year as the link was added
		theDiff = (theMonth - monthAdded);
	if ((theYear - yearAdded) == 1) //checks if it was added last year
		theDiff = ((12 - monthAdded) + theMonth);
	if ((theYear - yearAdded) > 1)
		theDiff = 200;
	return theDiff;
}

function genBibList ()
{
	//window.alert('test');
	var theCode 	 = '<div id=\"bibList\">';
	theCode 		+= '<ul>';
	
	for (i=0; i<bibPeriods.length; i++) // Loop for each period
	{
		var isPeriod = 0;
		//window.alert(isPeriod);
		for (j=0; j<bibArray.length; j++) //Loop for each entry in the booklist
		{
			for (k=0; k<bibArray[j][5].length; k++)
			{
				
				//window.alert(bibPeriods[i][1] + '=' + bibArray[j][5][k]);
				//window.alert(isPeriod);
				if (bibPeriods[i][1] == bibArray[j][5][k]) //Is there an entry for this period. This makes sure that empty periods aren't written
				{
					isPeriod = 1;
					
				}
			}//window.alert(isPeriod);
		}	
		//window.alert(bibPeriods[i][1] + '=' + isPeriod);
		if (isPeriod == 1);
		{
			
			theCode += '<li>' + bibPeriods[i][0];
			theCode += '<ul>';
			var isRead = 0;
			var isRecom = 0;
			for (a=0; a<bibArray.length; a++)
			{
				for (b=0; b<bibArray[a][5].length; b++)
				{
				//window.alert(bibArray[a][4] + '= 1 & ' + bibArray[a][5][b] + '=' + bibPeriods[i][1]);
				if (bibArray[a][4] == 1 && bibArray[a][5][b] == bibPeriods[i][1]) //Checks if there are any recommended entries
				{
					isRecom = 1;
				}
				if (bibArray[a][4] == 0 && bibArray[a][5][b] == bibPeriods[i][1]) //checks if there are any read entries
				{
					isRead = 1;
				}
				}
			}
			//window.alert(bibPeriods[i][0] + ' ' + isRecom);
			if (isRead == 1)
			{
				
				theCode += '<li>Read';
				
				for (j=0; j<bibArray.length; j++)
				{
					//window.alert(i + ' ' + bibPeriods[i][1] + ' = ' + j + ' ' + bibArray[j][5] + ' + ' + bibArray[j][4] + ' = 0');
					for (a=0; a<bibArray[j][5].length; a++)
					{
					
					if (bibPeriods[i][1] == bibArray[j][5][a] && bibArray[j][4] == 0)
					{
						theCode += '<ul>';
						theCode += '<li class=\"bibTitle\">' + bibArray[j][0] + '<\/li>';
						theCode += '<li class=\"bibAuthor\">by ' + bibArray[j][1] + '<\/li><\/ul>';
						theCode += '<ul><li class=\"bibRating\">' + bibArray[j][2] + ' Star';
						if (bibArray[j][2]>1)
							theCode += 's';
						theCode += ' out of 5<\/li>';
						theCode += '<\/ul>';
						theCode += '<ul>';
						theCode += '<li class=\"bibDesc\">' + bibArray[j][3] + '<\/li>';
						theCode += '<\/ul>';
						
					}
					}
				}
				theCode += '<\/li>';
			}
			if (isRecom == 1)
			{
				
				theCode += '<li>Recommended';
				
				for (j=0; j<bibArray.length; j++)
				{
					for (a=0; a<bibArray[j][5].length; a++)
					{
					//window.alert(bibPeriods[i][1]);
					//window.alert(bibPeriods[i][1] + '=' + bibArray[j][5][a] + '&&' + bibArray[j][4] + '= 1');
					if (bibPeriods[i][1] == bibArray[j][5][a] && bibArray[j][4] == 1)
					{
						theCode += '<ul>';
						theCode += '<li class=\"bibTitle\">' + bibArray[j][0] + '<\/li>';
						theCode += '<li class=\"bibAuthor\">by ' + bibArray[j][1] + '<\/li><\/ul>';
						theCode += '<ul><li class=\"bibRating\">' + bibArray[j][2] + ' Vote';
						if (bibArray[j][2]>1)
							theCode += 's';
						theCode += '<\/li>';
						theCode += '<\/ul>';
						theCode += '<ul>';
						theCode += '<li class=\"bibDesc\">' + bibArray[j][3] + '<\/li>';
						theCode += '<\/ul>';
						
					}
					}
				}
				theCode += '<\/li>';
			}
			theCode += '<\/ul>';
			theCode += '<\/li>';
			
		}
	}
	theCode += '<\/ul>';
	theCode += '<\/div>';
	document.write(theCode);
	//window.prompt(theCode, theCode);
}

function loadArtList(v, u)
{
	var i = v;
	var j = "";
	var k = "";
	if (u == 0)
	{
		//i = "0";
		j = "artBanL";
		k = "artBanLimg";
		l = "l1";
	}
	if (u == 1)
	{
		//i = "1";
		j = "artBanR";
		k = "artBanRimg";
		l = "l2";
	}
	if (u == 2)
	{
		//i = "2";
		j = "artBanL";
		k = "artBanLimg";
		l = "l3";
	}
	var isReady = 0;
	var notReady = 0;
	while (isReady==0)
	{
		isReady = checkDate(i);
		//window.alert('isReady? ' + isReady);
		if (isReady == 0)
		{
			i++;
		}
		if (i > articleList.length)
		{
			isReady = 1; //to break the while loop
			//notReady = 1; //to signify that there aren't any articles ready
		}
	}
	if (i > articleList.length)
		return;
	else
	{
	
	var theCode = "";
	theCode += '<div onMouseOver=\"document.' + articleList[i][7] + '.src=\'' + articleList[i][2] + '\'\"';
	theCode += ' onMouseOut=\"document.' + articleList[i][7] + '.src=\'' + articleList[i][1] + '\'\"';
	theCode += ' class=\"' + j + '\">';
	theCode += '<div class=\"' + k + '\"><a href=\"' + articleList[i][0] + '\"><img name=\"' + articleList[i][7];
	theCode += '\" title=\"' + articleList[i][3];
	theCode += '\" src=\"' + articleList[i][1];
	theCode += '\" \/><\/a><\/div><a href=\"' + articleList[i][0] + '\">'  + articleList[i][4] + '<\/a><\/div>';
	//window.alert(theCode);
	//window.prompt("blah", theCode);
	
	document.write(theCode);
	//window.alert(i);
	return ++i;
	}
}

function loadGalList (v)
{
	var galListHTML = "";
	var a = "";
	var firstItem = 0; 
	var listItemNumber = 0;
	var fullCat = false;
	galListHTML += "<div id=\"topGalTitle\">"; 
	galListHTML += "<ul>";
	for (z=0;z<galCat.length;z++)
	{
		if (galCat[z][2] == v)
		{
			listItemNumber++;
		}
	} 
	for (z=0;z<galCat.length;z++) //Loops once for every catagory. This is loading the top navigation
	{
		if (galCat[z][2] == v) //v is the genre of the webpage. This makes sure only gallery items of that genre are pulled.
		{
			var halfListItemNumber = Math.ceil(listItemNumber/2); 
			fullCat = false;
			for (noEmpty = 0; noEmpty < galImg.length; noEmpty++)
			{
				if (galImg[noEmpty][5] == galCat[z][0] &&
					checkGalDate(noEmpty) == 1)
				{
					fullCat = true;	
				}
			}
			if (fullCat)
			{	 
				if (firstItem == halfListItemNumber)
				{
				 	galListHTML += "</ul><ul>";
				}
				galListHTML += "<li><a href=\"#" + galCat[z][0] + "\"><span style=\"white-space: nowrap;\">";
				galListHTML += galCat[z][1];
				isNew = 0
				for (zz=0;zz<galImg.length;zz++)
				{	
					if (galImg[zz][5] == galCat[z][0])
					{		
						monthsOld = findGalMonths(zz);
						if (monthsOld<=2)
						{
							if(checkGalDate(zz) == 1)
								isNew = 1;
						}
					}
				}
				if (isNew == 1)
				{
					galListHTML += ' <span class=\"galNewAge\">New<\/span> ';
				}
				galListHTML += "</span></a> </li>";
				firstItem++;
			} 
		}	
	}
	galListHTML += "</ul>";
	galListHTML += "<div class=\"clearAll\">&nbsp;</div></div>";
	for (z=0;z<galCat.length;z++) //Loops once for every catagory
	{
		fullCat = false;
		for (noEmpty = 0; noEmpty < galImg.length; noEmpty++)
		{
			if (galImg[noEmpty][5] == galCat[z][0] &&
				checkGalDate(noEmpty) == 1)
			{
				fullCat = true;	
			}
		}
		if (fullCat)
		{
			if (galCat[z][2] == v) //If the genre of the page (v) matches the genre of the current gallery catagory
			{
				galListHTML += '<div class=\"galCatBox\">';
				galListHTML += '<div class=\"galCatTitle\">';
				galListHTML += '<a name=\"' + galCat[z][0] + '\">'; 
				galListHTML	+= galCat[z][1];
				galListHTML += '</a><span class="toTop"><a href=\"#top\">Top</a></span><\/div>';
				galListHTML += '<div class=\"galMan2 hollyhack\">';
				galListHTML += '<ul class=\"galMan\">';
				for (y=0;y<manCat.length;y++) //loops once for every manufacturer
				{
					a = 0;
					for (x=0;x<galImg.length;x++) //loops once for every gallery page
					{
						if (galImg[x][4] == manCat[y][0] && //if the manufacturer of the figure matches the current manufacturer (y)
							checkGalDate(x) == 1)
						{
							b = 0;
							c = 0;
							for (f=0;f<galImg[x][6].length; f++) //for every gallery page
							{
								if (galImg[x][6][f] == v) //if the figure matches the genre
								{
									b = 1;
								}
							}
							for (f=0;f<galImg[x][5].length; f++) //for every gallery page
							{
								if (galImg[x][5][f] == galCat[z][0]) //if the figure falls within that catagory (back of beyond, etc)
								{
									c = 1;
								}
							}
							if (b == 1 && c == 1) //if the genre and catagory (back of beyond, lotr, etc) are both true
								a = 1;
						}
					}
					if (a==1)
					{
						galListHTML += '<li class="gallList">';
						galListHTML += manCat[y][1];
						galListHTML += '<\/li>';
						for (x=0;x<galImg.length;x++)
						{
							fullCat = false;
							if (checkGalDate(x) == 1)
							{
								fullCat = true;	
							}
							
							if (fullCat)
							{		
								if (galImg[x][6] == v &&
									galImg[x][5] == galCat[z][0] &&
									galImg[x][4] == manCat[y][0])
								{
									galListHTML += '<div class=\"genList\"';
									galListHTML += ' onClick=\"window.open(\'' + galImg[x][0] + '\', \'_self\')\"';
									galListHTML += ' onMouseOver=\"document.' + galImg[x][7] + '.src = \'' + galImg[x][2] + '\'\"';
									galListHTML += ' onMouseOut=\"document.' + galImg[x][7] + '.src = \'' + galImg[x][3] + '\'\">';
									galListHTML += '<div class=\"genListImg\">';
									galListHTML += '<img name=\"' + galImg[x][7] + '\"';
									galListHTML += ' title=\"' + galImg[x][1] + '\"';
									galListHTML += ' src=\"' + galImg[x][3] + '\">';
									galListHTML += '<div class=\"genListName\">';
									galListHTML += galImg[x][1];
									monthsOld = findGalMonths(x);
									if (monthsOld<=2)
									{
										galListHTML += ' <span class=\"galNewAge\">New<\/span>';
									}
									galListHTML += '<\/div>';
									galListHTML += '<\/div>';
									galListHTML += '<\/div>';
								}
							}
						}
					}
				}
				galListHTML += '<\/ul>';
				galListHTML += '<div class=\"clearAll\"><\/div>';
				galListHTML += '<\/div>';
				galListHTML += '<\/div>';

			}
		}
	}
	//window.prompt('blah', galListHTML);
	document.write(galListHTML);
}
	

function loadGenGalList ()
{
	genListHTML = "";
	
	/* Starts the loops which creates an item for each genre. Will add terrain later */
	for (a = 0; a < galGenCat.length; a++)
	{
		//genListHTML += '<div onClick="window.open(\"' + galGenCat[a][2] + '\", \"_self\")\" class=\"genList\">';
		
		/* This generates a new array with all the thumbnails for the genre [a] */
		ranGalImg = new Array();
		i = 0;
		for (b = 0; b < galImg.length; b++)
		{
			if (galImg[b][6] == galGenCat[a][0])
			{
				ranGalImg [i++] = new Array (galImg[b][3], galImg[b][2]); 	
			}
		}
		
		/* this generates a random number to pick the image from the array */
		var needRand = Math.floor(Math.random()*ranGalImg.length);
		//window.alert(needRand);
		//window.alert(ranGalImg[needRand]);
		genListHTML += '<div class=\"genList\"';
		genListHTML += 'onClick=\"window.open(\'' + galGenCat[a][2] + '\', \'_self\')\"';
		genListHTML += ' onMouseOver=\"document.' + galGenCat[a][0] + '.src = \'' + ranGalImg[needRand][1] + '\';\"';
		genListHTML += ' onMouseOut=\"document.' + galGenCat[a][0] + '.src = \'' + ranGalImg[needRand][0] + '\';\">';
		genListHTML += '<div class=\"genListName\">';
		genListHTML += galGenCat[a][1];
		genListHTML += '<div class=\"genListImg\">';
		genListHTML += '<img name=\"' + galGenCat[a][0] + '\"';
		genListHTML += ' src=\"' + ranGalImg[needRand][0] + '\">';
		genListHTML += '<\/div>';
		genListHTML += '<\/div>';
		genListHTML += '<\/div>';
		//genListHTML += '<\/div>';
	}
	//window.prompt(genListHTML, genListHTML);
	document.write(genListHTML);
}

function loadnav()
{
	var theLinks = "";
	var counter = "0";
	for (i=0;i<linkPages.length;i++)
	{
		theLinks += '<div class=\"toplinks\"';
		theLinks += 'onClick=\"window.open(\'' + linkPages[i][0] + '\', \'_self\')\">';
		//theLinks +=	'<a class=\"nav\" href=\"' + linkPages[i][0] + '\">';
		theLinks += linkPages[i][1];
		//theLinks += '<\/a>';
		theLinks += '<\/div>';
		if(linkPages[i][1] == 'Gallery')
		{
			
			var vGalSearch = /(galpages)|(gallery)|(hisgal)|(page_id\=612)|(scigal)|(fangal)\b/;
			//window.alert(window.location);
			//window.alert(vGalSearch.test(window.location));
			if (vGalSearch.test(window.location))
			{
				for(j=0;j<galGenCat.length;j++)
				{
					theLinks += '<div class=\"lowlinks\"';
					theLinks += 'onClick="window.open(\'' + galGenCat[j][2] + '\', \'_self\')\">';
					//theLinks += '<a href=\"' + galGenCat[j][2] + '\">';
					theLinks += galGenCat[j][1];
					//theLinks += '<\/a>';
					theLinks += '<\/div>';
				}
			}
		}
		
	}
	document.write(theLinks);
	
}

function loadpic()
{
	picnum = Math.floor(Math.random() * (navpic.length));
	document.write(navpic[picnum]);
	
}

function mastArtList()
{
	var firstItem = 0;
	// Sorts the list alphabetically
	sortArticleList = new Array;
	//var ii = 0;
	for (ii=0;ii < articleList.length; ii++)
	{
	sortArticleList [ii] = new Array (articleList[ii][3], articleList[ii][0], articleList[ii][5], articleList[ii][6]);
	}
	//0: Target URL, 1: First Image, 2: MouseOver Image, 3: Title of image, 4: Blurb, 5: category, 6: date added (ddmmyyyy), 7: unique ID
	//0: Title of Article; 1: Target URL; 2: Category; 3: date added
		
	//window.alert(sortArticleList);
	//window.alert(sortArticleList.sort());
	var listHTML = '<ul class="mastArtList">';
	//window.alert(catArr.length);
	var listItemNumber = 0;
	var aNumber = 0;
	// Calculates the number of articles
	
	for (cats = 0; cats < catArr.length; cats++)
	{
		//window.alert(aNumber + ' Cats')
		for (arts = 0; arts < articleList.length; arts++)
		{
			if (articleList[arts][5] == catArr[cats][0])
			{
				var isReady = checkDate(arts);
				if (isReady == 1)
				{
					listItemNumber++
				}
			}
		}
	}
	//window.alert(listItemNumber);
	// Calculates the number of active catagories
	for (cats = 0; cats < catArr.length; cats++)
	{
		var catActive = false;
		//window.alert(cats);
		//window.alert(catArr[cats][0]);
		for (h = 0; h < sortArticleList.length; h++)
		{
			//window.alert(sortArticleList[h][2]+ ' == ' + catArr[cats][0]);
			if (sortArticleList[h][2] == catArr[cats][0])
			{
				catActive = true;
			}
		}
		if (catActive)
		{
			listItemNumber++;
			//window.alert(catActive);
		}
	}
	//window.alert(listItemNumber);
	//window.alert(listItemNumber);
	for (i = 0; i < catArr.length; i++) //a loop for every main article category
	{
		//window.alert(catArr[i][0]);
		var catActive = false; 		// sets catagory as inactive by default
		for (h = 0; h < sortArticleList.length; h++) //starts a loop for every article
		{
			//window.alert(h);
			//window.alert(sortArticleList[h][2] + ' = ' + catArr[i][0]);
			if (sortArticleList[h][2] == catArr[i][0])	// checks if the article matches the category
			{
				//window.alert(sortArticleList.length);
				h = sortArticleList.length;	//if it does, h becomes equal to the length of the article list
				h++;   //adds one to that number, to tell the loop that it's over
				catActive = true; //flags the catagory as active
				//window.alert(h);
				//window.alert('yes');
			}
		}
		var halfListItemNumber = Math.ceil(listItemNumber/2); 
			//window.alert(halfListItemNumber);
			//window.alert(halfListItemNumber + ' vs. ' + firstItem);
		if (firstItem >= halfListItemNumber)
		{
		 	listHTML += "<\/ul><ul>";
			//window.alert('yes');
			firstItem = 0;
		}
		if (catActive) //checks if the catagory is active
		{
			firstItem++;
			listHTML += '<li class=\"listHead\">' + catArr[i][1] + '<\/li>'; //writes in the catagory. If it isn't active, nothing is written. This may seem un-neccessary, but it makes things more modular and self-contained.
		}
		for (j = 0; j < sortArticleList.length; j++) // a loop for every article within the category
		{
			if (sortArticleList[j][2] == catArr[i][0]) // checks to see if the article fits the category
			{
				var isReady = checkDate(j);
				//window.alert('isReady? ' + isReady);
				if (isReady == 1)
				{
					listHTML += '<li class=\"listSub\">';
					listHTML += '<a href=\"' + sortArticleList[j][1] + '\">';
					listHTML += sortArticleList[j][0] + '<\/a><\/li>';
					firstItem++;			
				}
			/*listHTML += '<li class=\"listSub\">';
			listHTML += '<a href=\"' + articleList[j][0] + '\">';
			listHTML += articleList[j][3] + '<\/a><\/li>';
			*/
			} //endif article vs. category check
		} //end article loop
	
	} // end main article category loop
	listHTML += '<\/ul>';
	//window.alert(listHTML);
	//window.prompt(listHTML, listHTML);
	document.write(listHTML);
	/* This is the pre-sorted code, if needed to bring back, only uncomment blocks labelled as pre-sort code.
	//window.alert('test');
	var listHTML = '<ul>';
	//window.alert(catArr.length);
	for (i = 0; i < catArr.length; i++) //a loop for every main article category
	{
		//window.alert(catArr[i][0]);
		listHTML += '<li class=\"listHead\">' + catArr[i][1] + '<\/li>';
		for (j = 0; j < articleList.length; j++) // a loop for every article within the category
		{
			if (articleList[j][5] == catArr[i][0]) // checks to see if the article fits the category
			{
				var isReady = checkDate(j);
				//window.alert('isReady? ' + isReady);
				if (isReady == 1)
				{
					listHTML += '<li class=\"listSub\">';
					listHTML += '<a href=\"' + articleList[j][0] + '\">';
					listHTML += articleList[j][3] + '<\/a><\/li>';			
				}
				/*listHTML += '<li class=\"listSub\">';
				listHTML += '<a href=\"' + articleList[j][0] + '\">';
				listHTML += articleList[j][3] + '<\/a><\/li>';
				*/
				/* This was part of pre-sort code
			} //endif article vs. category check
		} //end article loop
	} // end main article category loop
	/* This was part of pre-sort code
	listHTML += '<\/ul>';
	//window.alert(listHTML);
	//window.prompt(listHTML, listHTML);
	document.write(listHTML);
	*/
}



function popExLinks() //Creates the list of Links on the links page.
{
	var linkHTML = '';
	for (i = 0; i < exLinkCat.length; i++) // Loops through each Link Catagory
	{
		linkHTML += '<div class=\"mainLinkBox\">';
		linkHTML += '<h3>' + exLinkCat[i][1] + ':<\/h3>';
	
		for (j = 0; j < exLink.length; j++) //Loops through each link
		{
			for (k = 0; k < exLink[j][3].length; k++) //Loops through each catagory assigned to the link
			{
				if (exLink[j][3][k] == exLinkCat[i][0]) //checks if the catagory matches
				{
					//window.alert(exLink[j][1] + exLink[j][3][k]);
					linkHTML += '<div class=\"linkBox\">';
					linkHTML += '<div class=\"linkName\">';
					monthsOld = findMonths(j);
					//window.alert(monthsOld);
					if (monthsOld==0)
					{
						linkHTML += '<span class=\"newAge\">New<\/span> ';
					}
					if (monthsOld==1)
					{
						linkHTML += '<span class=\"thisAge\">Last Month<\/span> ';
					}
					if (monthsOld<=6 && monthsOld>=2)
					{
						linkHTML += '<span class=\"oldAge\">Last 6 Months<\/span> ';
					}
					linkHTML += '<a target=\"_blank\" class=\"linksText\" href=\"' + exLink[j][0] + '\">';
					linkHTML += exLink[j][1];
					linkHTML += '<\/a>';
					linkHTML += '<\/div>';
					linkHTML += '<div class=\"linkDesc\">';
					linkHTML += exLink[j][2];
					linkHTML += '<\/div>';
					linkHTML += '<div class="clearLeft"><\/div>';
					linkHTML += '<\/div>';
				}
			}
		}
		linkHTML += '<\/div>';
	}
	//window.prompt(linkHTML, linkHTML);
	document.write(linkHTML);
}

function preLoadGenThumb (v)
{
	imageCache = new Array;
	imageCacheGen = new Array;
	/* This block was from pre-randomized Genre thumbs
	for (a=0; a < galGenCat.length; a++)
	{
		imageCache[a] = new Image();
		imageCache[a].src = galGenCat[a][4];
	}*/
	for (b=0; b < galImg.length; b++)
	{
		//if (v==galImg[b][6])
		//{
			imageCacheGen[b] = new Image();
			imageCacheGen[b].src = galImg[b][2];
		//}
	}
}

function returnImage(v)
{
	//window.alert("returnImage");
	if (v=="art1")
	{
		document.art1.src = articleList[0][1];
	}
	if (v=="art2")
	{
		document.art2.src = articleList[1][1];	
	}
	if (v=="art3")
	{
		document.art3.src = articleList[2][1];
	}
}

function swapImage(v)
{

	if (v=="art1")
	{


		document.art1.src = articleList[0][2];
	}
	if (v=="art2")
	{
		document.art2.src = articleList[1][2];	
	}
	if (v=="art3")
	{
		document.art3.src = articleList[2][2];
	}
}

function tyOpenImg(tSrc, w, h)
{
	w+=20;
	h+=30;
	if (navigator.appName=="Microsoft Internet Explorer")
	{
		w+=22;
		h+=20;
	}
	params = 'width=' + w + ', height=' + h + ', scrollbars=1, resizable=1';
	//window.alert('src='+tSrc+' width='+w+' height='+h);
	if (imgPop) imgPop.close();
	imgPop = window.open ('', 'imgPop', params);
	imgPop.document.write('<html>');
	imgPop.document.write('<head>');
	imgPop.document.write('<title>Click to Close</title>');
	imgPop.document.write('<link rel="stylesheet" href="/mystyle.css" type="text/css">');
	imgPop.document.write('</head>');
	imgPop.document.write('<body>');
	imgPop.document.write('<div onclick="window.close()">');
	imgPop.document.write('<img src="' + tSrc + '" >');
	imgPop.document.write('</div>');
	imgPop.document.write('</body>');
	imgPop.document.write('</html>');
	
	
}

