// owenfreeman.com website variables

// ILLUSTRATION ORDER
// this is the list of illustration pieces. each name corresponds the the name of the jpg exactly.
// thumbnails should be named identically, with a single underscore after the filename, before the dot and extension. example: meric_.jpg
// the order of the list determines the order of the thumbnails.
var illustrationList =  ['treme', 'visiting', 'eminem', 'january', 'suicide_watch', 'conchords', 'ladigitale', 'malibu_creek', 'tempest', 'chinatown', 'in_from_the_cold', 'morello', 'waiting', 'litany', 'brutal_lemmy', 'tanker', 'meric', 'surge', 'envy', 'aqualad', 'silkyshark', 'fenced', 'sp_soccer', 'clapped', 'chandler', 'bronzed', 'hollowmen', 'somuchwater'];

// SKETCHBOOK ORDER
// this is the list of sketchbook pieces. each name corresponds the the name of the jpg exactly.
// thumbnails should be named identically, with a single underscore after the filename, before the dot and extension. example: meric_.jpg
// the order of the list determines the order of the thumbnails.
var sketchbookList = ['natural_history', 'marlowe', 'courtyard', 'royal', 'fiftyfive', 'dustbowl_1', 'bogey', 'notebook05', 'dustbowl_2', 'birds', 'lecture', 'chinos', 'mels', 'one', 'dan_gerous', 'phantom', 'make_up', 'corner_man', 'forget_me_not', 'j_connor', 'obe', 'thunder', 'tony_bahama', 'draculaspajamaparty', 'charm', 'ad'];

// ILLUSTRATION DESCRIPTIONS
treme = "<strong>Treme</strong>, illustration for <em>The Washington Post</em> Style section preview of the HBO series &quot;Treme.&quot;";
visiting = "<strong>Visiting</strong>, illustration for a short story in <em>The Atlantic</em> about a father taking a trip with his estranged son.";
eminem = "<strong>Eminem</strong>, portrait illustration for the Rolling Stone music review of the &quot;Recovery&quot; album.";
january = "<strong>January Jones</strong>, illustration for HeflinReps promotional series.";
suicide_watch = "<strong>Suicide Watch</strong>, illustration for UCLA magazine on rising suicide rates in America.";
conchords = "<strong>Conchords</strong>, portrait of New Zealands' fourth most popular guitar-based digi-bongo acapella-rap-funk-comedy folk duo.";
ladigitale = "<strong>La Digitale</strong>, book cover illustration for ActuSF Publishing.";
malibu_creek = "<strong>Malibu Creek</strong>, Hollywood inspired illustration for the LA Weekly.";
tempest = "<strong>Tempest</strong>, Los Angeles inspired illustration for the LA Weekly.";
chinatown = "<strong>Chinatown</strong>, Chinatown inspired illustration for LA Weekly.";
in_from_the_cold = "<strong>In from the Cold</strong>, illustration for an article about the authors brush with death for Runner's World magazine.";
morello = "<strong>First Family</strong>, illustrating the brutal rise and fall of Giuseppe Morello for FHM London.";
waiting = "<strong>Waiting</strong>, illustration based on the daily risks in the lives of sex workers.";
litany = "<strong>Litany</strong>, promotional illustration.";
brutal_lemmy = "<strong>BrŸtal Lemmy</strong>, illustration for interview with Lemmy Kilmister in Nylon Guys magazine.";
tanker = "<strong>Tanker</strong>, based on the New York Times article on the uptick of pirate attacks along the coast of Somalia.";
meric = "<strong>Meric</strong>, figurative/gestural portrait.";
surge = "<strong>Surge</strong>, poster reflecting the ocean's direct influence on weather and climate.";
envy = "<strong>Envy</strong>, reinterpretation of contemporary men's fashion spreads.";
aqualad = "<strong>Aqualad</strong>, figurative/gestural portrait.";
silky_shark = "<strong>Silky Shark</strong>, silkscreen love note to Los Angeles.";
fenced = "<strong>Fenced</strong>, illustration proposal based on accounts of life in suburban America.";
sp_soccer = "<strong>Soccer</strong>, excerpt from a series juxtaposing daily life in Baghdad against the backdrop of war.";
clapped = "<strong>Clapped</strong>, interpretation based on a collection of articles on killings in self-defense.";
chandler = "<strong>Chandler</strong>, portrait inspired by the life and marriage of the pulp author, Raymond Chandler.";
bronzed = "<strong>Bronzed</strong>, daily sketchbook illustration.";
hollowmen = "<strong>The Hollow Men</strong>, narrative illustration based on the poem by T.S. Eliot.";
somuchwater = "<strong>So Much Water</strong>, illustration based on the short story by Raymond Carver.";


// SKETCHBOOK DESCRIPTIONS
natural_history = "<strong>Natural History,</strong> pen/ink";
marlowe = "<strong>Marlowe,</strong> digital";
courtyard = "<strong>Courtyard,</strong> pen/ink";
royal = "<strong>Royal,</strong> ink/wash";
fiftyfive = "<strong>55,</strong> ink/wash";
dustbowl_1 = "<strong>Dustbowl 1,</strong> pencil/digital.";
bogey = "<strong>Dixon,</strong> crowquill/watercolor.";
notebook05 = "<strong>5.31,</strong> ink/watercolor.";
dustbowl_2 = "<strong>Dustbowl 2,</strong> pencil/digital.";
birds = "<strong>Birds,</strong> two-color etching/aquatint.";
lecture = "<strong>Lecture,</strong> ink.";
chinos = "<strong>Chinos,</strong> digital.";
mels = "<strong>Mel's,</strong> ink.";
one = "<strong>One,</strong> ink/wash.";
dan_gerous = "<strong>Dan Gerous,</strong> ink/digital.";
phantom = "<strong>Phantom,</strong> digital.";
make_up = "<strong>Make Up,</strong> ink/wash.";
corner_man = "<strong>Corner Man,</strong> digital";
forget_me_not = "<strong>Forget Me Not,</strong> ink/digital.";
j_connor = "<strong>J. Connor,</strong> digital.";
obe = "<strong>Old Blue Eyes,</strong> ink/digital.";
thunder = "<strong>Thunder,</strong> pastel.";
tony_bahama = "<strong>Tony Bahama,</strong> ink.";
draculaspajamaparty = "<strong>Dracula's Pajama Party,</strong> etching/aquatint.";
charm = "<strong>Charm,</strong> ink/digital.";
ad = "<strong>AD,</strong> ink/wash.";


// DO NOT EDIT ANYTHING BELOW HERE
//
// functions
//

//
function slider() {
animatedcollapse.addDiv('illustration', 'fade=0,speed=300,group=art')
animatedcollapse.addDiv('sketchbook', 'fade=0,speed=300,group=art,hide=1')
animatedcollapse.addDiv('info', 'fade=0,speed=300,group=info,hide=1')
animatedcollapse.addDiv('contact', 'fade=0,speed=300,group=contact')
animatedcollapse.addDiv('representation', 'fade=0,speed=300,group=representation')
animatedcollapse.init()
}

//
function illustrationThumbs() {
for (var i=0; i<illustrationList.length; i++)
{document.write('<a href="#'+illustrationList[i]+'" onclick="changeDiv(illustrationList['+i+'])"><img src="illustration/'+illustrationList[i]+'_.jpg" width="36" height="36" /></a>');}
}

//
function sketchbookThumbs() {
for (var i=0; i<sketchbookList.length; i++)
{document.write('<a href="#'+sketchbookList[i]+'" onclick="changeDivTwo(sketchbookList['+i+'])"><img src="sketchbook/'+sketchbookList[i]+'_.jpg" width="36" height="36" /></a>');}
}

// this loads content based on whether the URL has an anchor, tests to see which array that anchor is in
// and makes sure to not link to the next image if it is the last image in the array.
// FOR THE LOVE OF GOD, DON'T DELETE THIS FUNCTION!
function contentLoader(){
var loadedHash = document.location.hash.replace(/#/,"");
// if the page is loaded with an anchor
if (document.location.hash)
{
// if that anchor is an illustration
if (loadedHash in oc(illustrationList) ) {

if (illustrationList.indexOf(loadedHash)<[illustrationList.length-1]) {
document.write('<a href="#'+illustrationList[illustrationList.indexOf(loadedHash)+1]+'" onclick="changeDiv(illustrationList['+(illustrationList.indexOf(loadedHash)+1)+']);"><img src="illustration/'+document.location.hash.replace(/#/,"")+'.jpg" alt="" id="artspace" name="artspace" /></a><br />'+window[loadedHash]);
}
else {
document.write('<img src="illustration/'+document.location.hash.replace(/#/,"")+'.jpg" alt="" id="artspace" name="artspace" /><br />'+window[loadedHash]);

}
}
// if that anchor is a sketch
else
{

// (sketchbookList.indexOf(loadedHash)<[illustrationList.length-1])
if (sketchbookList.indexOf(loadedHash)<[sketchbookList.length-1]) {
document.write('<a href="#'+sketchbookList[sketchbookList.indexOf(loadedHash)+1]+'" onclick="changeDivTwo(sketchbookList['+(sketchbookList.indexOf(loadedHash)+1)+']);"><img src="sketchbook/'+document.location.hash.replace(/#/,"")+'.jpg" alt="" id="artspace" name="artspace" /></a><br />'+window[loadedHash]);
}
else {
document.write('<img src="sketchbook/'+document.location.hash.replace(/#/,"")+'.jpg" alt="" id="artspace" name="artspace" /><br />'+window[loadedHash]);
}
}


}
else
{
// write the main image if there is no URL anchor
document.write('<a href="#'+illustrationList[1]+'" onclick="changeDiv(illustrationList[1])"><img src="illustration/'+illustrationList[0]+'.jpg" alt="" id="artspace" name="artspace" /></a><br />'+window[illustrationList[0]]);
}
}
//
//


// this swaps the main div's content out with new content from the Illustration array
function changeDiv(thisPic){
if (illustrationList.indexOf(thisPic)<[illustrationList.length-1])
{
document.getElementById('image').innerHTML = '<a href="#'+illustrationList[illustrationList.indexOf(thisPic)+1]+'" onclick="changeDiv(illustrationList['+(illustrationList.indexOf(thisPic)+1)+']);"><img src="illustration/'+thisPic+'.jpg" alt="" id="artspace" name="artspace" /></a><br />'+window[thisPic];
}

else
{
document.getElementById('image').innerHTML = '<img src="illustration/'+thisPic+'.jpg" alt="" id="artspace" name="artspace" /><br />'+window[thisPic];
}
}


// this swaps the main div's content out with new content from the Sketchbook array
function changeDivTwo(thisPic){
if (sketchbookList.indexOf(thisPic)<[sketchbookList.length-1])
{
document.getElementById('image').innerHTML = '<a href="#'+sketchbookList[sketchbookList.indexOf(thisPic)+1]+'" onclick="changeDivTwo(sketchbookList['+(sketchbookList.indexOf(thisPic)+1)+']);"><img src="sketchbook/'+thisPic+'.jpg" alt="" id="artspace" name="artspace" /></a><br />'+window[thisPic];
}
else
{
document.getElementById('image').innerHTML = '<img src="sketchbook/'+thisPic+'.jpg" alt="" id="artspace" name="artspace" /><br />'+window[thisPic];
}
}

// tests to see if a string is in an array, returns true or false
function oc(a)
{
  var o = {};
  for(var i=0;i<a.length;i++)
  {
    o[a[i]]='';
  }
  return o;
}

// new preload script
function preLoadTwo() {
Array.each.delay(3000,this,[
	['/illustration/treme.jpg', '/illustration/visiting.jpg', '/illustration/eminem.jpg', '/illustration/january.jpg', '/illustration/suicide_watch.jpg', '/illustration/conchords.jpg', '/illustration/ladigitale.jpg', '/illustration/malibu_creek.jpg', '/illustration/tempest.jpg', '/illustration/chinatown.jpg', '/illustration/in_from_the_cold.jpg', '/illustration/morello.jpg', '/illustration/waiting.jpg', '/illustration/litany.jpg', '/illustration/brutal_lemmy.jpg', '/illustration/tanker.jpg', '/illustration/meric.jpg', '/illustration/surge.jpg', '/illustration/envy.jpg', '/illustration/aqualad.jpg', '/illustration/silkyshark.jpg', '/illustration/fenced.jpg', '/illustration/sp_soccer.jpg', '/illustration/clapped.jpg', '/illustration/chandler.jpg', '/illustration/bronzed.jpg', '/illustration/hollowmen.jpg', '/illustration/somuchwater.jpg', '/sketchbook/natural_history.jpg', '/sketchbook/marlowe.jpg', '/sketchbook/courtyard.jpg', '/sketchbook/royal.jpg', '/sketchbook/fiftyfive.jpg', '/sketchbook/dustbowl_1.jpg', '/sketchbook/bogey.jpg', '/sketchbook/notebook05.jpg', '/sketchbook/dustbowl_2.jpg', '/sketchbook/birds.jpg', '/sketchbook/lecture.jpg', '/sketchbook/chinos.jpg', '/sketchbook/mels.jpg', '/sketchbook/one.jpg', '/sketchbook/dan_gerous.jpg', '/sketchbook/phantom.jpg', '/sketchbook/make_up.jpg', '/sketchbook/corner_man.jpg', '/sketchbook/forget_me_not.jpg', '/sketchbook/j_connor.jpg', '/sketchbook/obe.jpg', '/sketchbook/thunder.jpg', '/sketchbook/tony_bahama.jpg', '/sketchbook/draculaspajamaparty.jpg', '/sketchbook/charm.jpg', '/sketchbook/ad.jpg'],
	function(src){var img = new Image();img.src = src;}
]);
}

// preload script - using mootools delayed preloader instead
// function preLoad(){
// for (var i=0; i<illustrationList.length; i++)
// {document.write('<img src="illustration/'+illustrationList[i]+'.jpg" class="hiddenPic" />');}
// for (var i=0; i<sketchbookList.length; i++)
// {document.write('<img src="sketchbook/'+sketchbookList[i]+'.jpg" class="hiddenPic" />');}
// }

// function for testing how the hell this all works
// function johnsFunStuff(){
// document.write('<br /><br />John\'s Fun Test Area!<br />');
// document.write('IllustrationList length = '+illustrationList.length+'<br />');
// document.write('sketchbookList length = '+sketchbookList.length+'<br />');
// document.writeln('index of loaded hash = ' + illustrationList.indexOf(loadedHash) + '<br />');
// document.write('key = ' + key + '; key2 = ' + key2);
// }