// JavaScript Document

var i=1;
var image_array;
var caption_array;
var counter = 0;
var gourls='';

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		id1_ImageMap_04_over = newImage("images/1-ImageMap_04_over.gif");
		id1_ImageMap_03_over = newImage("images/1-ImageMap_03_over.gif");
		id1_ImageMap_02_over = newImage("images/1-ImageMap_02_over.gif");
		id1_ImageMap_01_over = newImage("images/1-ImageMap_01_over.gif");
		preloadFlag = true;
	}
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}


function WM_preloadImages() {

/*
WM_preloadImages()
Loads images into the browser's cache for later use.

Source: Webmonkey Code Library
(http://www.hotwired.com/webmonkey/javascript/code_library/)

Author: Nadav Savio
Author Email: nadav@wired.com

Usage: WM_preloadImages('image 1 URL', 'image 2 URL', 'image 3 URL', ...);
*/

  // Don't bother if there's no document.images
  if (document.images) {
    if (typeof(document.WM) == 'undefined'){
      document.WM = new Object();
    }
    document.WM.loadedImages = new Array();
    // Loop through all the arguments.
    var argLength = WM_preloadImages.arguments.length;
    for(arg=0;arg<argLength;arg++) {
      // For each arg, create a new image.
      document.WM.loadedImages[arg] = new Image();
      // Then set the source of that image to the current argument.
      document.WM.loadedImages[arg].src = WM_preloadImages.arguments[arg];
    }
  }
}


function WM_imageSwap(daImage, daSrc){
  var objStr,obj;
  /*
    WM_imageSwap()
    Changes the source of an image.

    Source: Webmonkey Code Library
    (http://www.hotwired.com/webmonkey/javascript/code_library/)

    Author: Shvatz
    Author Email: shvatz@wired.com

    Usage: WM_imageSwap(originalImage, 'newSourceUrl');

    Requires: WM_preloadImages() (optional, but recommended)
    Thanks to Ken Sundermeyer (ksundermeyer@macromedia.com) for his help
    with variables in ie3 for the mac. 
    */

  // Check to make sure that images are supported in the DOM.
  if(document.images){
    // Check to see whether you are using a name, number, or object
    if (typeof(daImage) == 'string') {
      // This whole objStr nonesense is here solely to gain compatability
      // with ie3 for the mac.
      objStr = 'document.' + daImage;
      obj = eval(objStr);
      obj.src = daSrc;
    } else if ((typeof(daImage) == 'object') && daImage && daImage.src) {
      daImage.src = daSrc;
    }
  }
}



function image_switcher (image_array,caption_array,i,daImage){
	goodsrc = "images/" + image_array[i]
	WM_imageSwap(daImage, goodsrc);
	document.getElementById("caption").innerHTML=caption_array[i];
	};
	
function caption_switcher(caption_array,i){
	document.getElementById("caption").innerHTML=caption_array[i];
	document.getElementById("caption").style.visibility="visible";
	document.getElementById("signshadow").style.visibility="visible";
}
	
		
function biggieSizeIt (daImage){
	objStr = 'document.' + daImage;
    obj = eval(objStr);
    daSrc = obj.src;
	first_split = daSrc.split("images/");
	good_stuff = first_split[1];
	var goodsrc= "http://www.jonathanbourland.com/print/images/big" + good_stuff;
	window.open(goodsrc, "newwin", "menubar,status,scrollbars,resizable,toolbar,location,height=700,width=860");
}

function webbiggieSizeIt (daImage){
	objStr = 'document.' + daImage;
    obj = eval(objStr);
    daSrc = obj.src;
	first_split = daSrc.split("images/");
	good_stuff = first_split[1];
	var goodsrc= "http://www.jonathanbourland.com/web/images/big" + good_stuff;
	var win = window.open(goodsrc, "newwin", "menubar,status,scrollbars,resizable,toolbar,location,height=700,width=860");
	win.focus();
}



function gothere(gourl){
	
	if (gourls != '') {
		if(counter < 0){ 
			counter = gourls.length - 1;
		}
		if(counter > (gourls.length - 1)){ 
			counter = 0;
		}
		gourl = gourls[counter];
	}
	
	window.open(gourl, "newwin", "menubar,status,scrollbars,resizable,toolbar,location,height=800,width=950");
}

function nothingToSeeHere(mode, pref, mid){

	var suff;
	var place;
	
	switch (mode){
		case 1:
		suff = ".com";
		break;
		
		case 2:
		suff = ".net";
		break;
		
		case 3:
		suff = ".org";
		break;
	}
	
	place = pref + "@" + mid + suff;
	
	document.write(place);

}
