// JavaScript Document


// random splash generator

function randomSplash()

{
var splashImage=new Array()

// location of images in this array
splashImage[1]="images/print_01.jpg";
splashImage[2]="images/print_02.jpg";
splashImage[3]="images/print_03.jpg";
splashImage[4]="images/print_04.jpg";
splashImage[5]="images/print_05.jpg";
splashImage[6]="images/logo_01.jpg";
splashImage[7]="images/logo_02.jpg";
splashImage[8]="images/logo_03.jpg";
splashImage[9]="images/logo_04.jpg";
splashImage[10]="images/logo_05.jpg";

var splashCaption=new Array()

// captions
splashCaption[1]="Overcoming Going Under Poster";
splashCaption[2]="Age Of Kali Poster";
splashCaption[3]="The Dance of Angels Poster";
splashCaption[4]="AWEA Stationary System";
splashCaption[5]="Batterhead Down CD";
splashCaption[6]="The Free Project Logo System";
splashCaption[7]="Kindred Spirits Logo";
splashCaption[8]="American Wind Energy Association Logo";
splashCaption[9]="Franks Girl Productions Logo";
splashCaption[10]="Monkeyduck.com Logo";

var getRan=Math.floor(Math.random()*splashImage.length)
if (getRan==0)
getRan=1

document.write('<p><img src=\"'+splashImage[getRan]+'\" alt=\"Sprixel Design\" title=\"Sprixel Design\" width=\"400\" \/>');

document.write('<p>'+splashCaption[getRan]+'<br \/>');
document.write('View more images in <a href=\"projects.html\">projects<\/a><\/p>');
}


// NEW swap image and caption. Written by Micah Rich

   function swapPhoto(photoSRC,theCaption,theLink) {
     
    var displayedImage = document.getElementById("thephoto");
    var displayedCaption = document.getElementById("caption");
    
// to make the link go to a new window, i just added 'target="_blank"' to both links below. 
// target is just an attribute of the a tag in html
//
// however, i added a conditional to the image & link replacers. 
// it says that if there is no third variable, there won't be any links. it's written as follows:
// variableX=(variableY==null)? 'option1' : 'option2'
// which, in english, reads as:
// if variableY is null (i.e. there is no variableY), then put option1. otherwise, put option2.
// make sense?

   	displayedImage.innerHTML=(theLink==null)?('<img width="400" border="0" alt="' + theCaption + '" src="'+ "images/" + photoSRC + '"/>') : ('<a href="' + theLink + '"target="_blank"><img width="400" border="0" alt="' + theCaption + '" src= "'+ "images/" + photoSRC + '"/></a>');
   	displayedCaption.firstChild.nodeValue = theCaption;
// we can get rid of the extra link section, if we're gonna combine the caption & the URL into one.
// so below i'm using theLink inside the href attribute, same as before, but theCaption inside.
// before it was <a href="theLink">theLink</a>
// and now it's     <a href="theLink">theCaption</a>
// dig?
   	displayedCaption.innerHTML=(theLink==null)? ('<p>' + theCaption + '</p>'): ('<a href="' + theLink + '" target="_blank">' + theCaption + '</a>');
	 
}

// OLD swap image and caption 

/*function swapPhoto(photoSRC,theCaption,thePrice) {

	var displayedCaption = document.getElementById("caption");
	
	displayedCaption.firstChild.nodeValue = theCaption;

    document.images.imgPhoto.src = "images/" + photoSRC;
}*/
