// JavaScript Document


// random splash generator

function randomSplash()

{
var splashImage=new Array()

// location of images in this array
splashImage[1]="images/dick.jpg";
splashImage[2]="images/redeemer.jpg";
splashImage[3]="images/franks.jpg";
splashImage[4]="images/immigration.jpg";
splashImage[5]="images/events.jpg";

var splashCaption=new Array()

// captions
splashCaption[1]="Dick";
splashCaption[2]="Redeemer Elementary";
splashCaption[3]="Frank's Barber Shop";
splashCaption[4]="Immigration Direct";
splashCaption[5]="140 Character Conference";

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

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

document.write('<p>'+splashCaption[getRan]+'<br \/>');
document.write('Check out our video samples in <a href=\"work.html\">work<\/a><\/p>');
}

function randomSplash3()

{
var splashImage=new Array()

// location of images in this array
splashImage[1]="images/pack_site_banner_01.jpg";
splashImage[2]="images/pack_site_banner_02.jpg";
splashImage[3]="images/pack_site_banner_03.jpg";
splashImage[4]="images/pack_site_banner_04.jpg";
splashImage[5]="images/pack_site_banner_05.jpg";
splashImage[6]="images/pack_site_banner_06.jpg";


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

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

}


// 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;
}*/
