/*
 * MINE
 */

var galleryArray = new Array(
	["l", "2004", "pb038.jpg",     "pb038_t.jpg",     "550", "550", "<strong>Speed painting / Stream of conciousness</strong> 30 minutes"],
	["o", "2003", "pb037.jpg",     "pb037_t.jpg",     "750", "500", "Reference [<a class=imageLink href='http://www.sketchbooksessions.com/shanesboard/viewtopic.php?t=10990'>Josh Cadwising</a>]"],
	["o", "2003", "pb036.jpg",     "pb036_t.jpg",     "600", "300", "<strong>Speed painting</strong> 30 minutes"],
	["o", "2003", "pb035.gif",     "pb035_t.gif",     "325", "596", "<strong>Afterglow</strong> <br />Painter 6, Dry Ink brush and Scratchboard Rake brush"],
	["o", "2003", "pb034.gif",     "pb034_t.gif",     "325", "596", "<strong>Afterglow</strong> <br />Painter 6, Dry Ink brush"],
	["o", "2003", "pb033.jpg",     "pb033_t.jpg",     "325", "596", "<strong>Afterglow</strong> <br />Reference [<a class=imageLink href='http://www.shaneglines.net/'>Shane Glines\'</a> &gt; <a class=imageLink href='http://www.sketchbooksessions.com/shanesboard/'>Drawing Jam</a> &gt; <a class=imageLink href='http://www.sketchbooksessions.com/shanesboard/viewtopic.php?t=8672&start=0'>Aug 8, 2003</a>]"],
	["o", "2003", "pb032.jpg",     "pb032_t.jpg",     "467", "500", "<strong>Speed painting</strong> 30 minutes"],
	["o", "2003", "pb031.gif",     "pb031_t.gif",     "312", "500", "<strong>Speed painting</strong> 20 minutes"],
	["o", "2003", "pb030.jpg",     "pb030_t.jpg",     "500", "500", "<strong>Pain</strong>"],
	["o", "2003", "pb029.jpg",     "pb029_t.gif",     "500", "500", "I have found [<a class=imageLink href='http://www.ashleywoodartist.com/'>Ashley Wood</a>], and am inspired :)"],
	["o", "2003", "pb028.gif",     "pb028_t.gif",     "400", "435", "You know, I don't even like abstract. And yet..."],
	["o", "2003", "pb027.jpg",     "pb027_t.gif",     "600", "289", "<strong>\"Leeloo\"</strong> Reference [<a class=imageLink href='http://www.shaneglines.net/'>Shane Glines\'</a> &gt; <a class=imageLink href='http://pub127.ezboard.com/fcartoonandillustrationparadise66133frm2.showMessageRange?topicID=5461.topic&start=1&stop=40'>Leeloo Dallas Mooltipass!</a>]"],
	["o", "2003", "pb026.gif",     "pb026_t.gif",     "500", "500", "Homage to Craig Mullins [<a class=imageLink href='http://www.goodbrush.com/'>GoodBrush</a>]<br>Reference [<a class=imageLink href='http://forums.sijun.com/viewtopic.php?t=33148&postdays=0&postorder=asc&start=0'>Sijun\'s Draw Club #9</a>]"],
	["o", "2003", "pb025.gif",     "pb025_t.gif",     "500", "500", "Playing with the Painter 8 Demo"],
	["o", "2003", "pb024.gif",     "pb024_t.gif",     "600", "600", "Reference [<a class=imageLink href='http://www.shaneglines.net/'>Shane Glines\'</a> &gt; <a class=imageLink href='http://pub54.ezboard.com/fcartoonandillustrationparadise66133frm18'>Drawing Jam</a> &gt; <a class=imageLink href='http://pub54.ezboard.com/fcartoonandillustrationparadise66133frm18.showMessage?topicID=114.topic'>Feb 10, 2003</a>]"],
	["o", "2003", "pb_sk_019.gif", "pb_sk_019_t.gif", "600", "255", "<strong>Experimental</strong>"],
	["o", "2003", "pb023.gif",     "pb023_t.gif",     "400", "600", "<strong>Speed Painting</strong> 1 hour"],
	["o", "2003", "pb022.gif",     "pb022_t.gif",     "400", "600", "<strong>\"Eileen\"</strong> Reference [<a class=imageLink href='http://www.shaneglines.net/'>Shane Glines\'</a> &gt; <a class=imageLink href='http://pub54.ezboard.com/fcartoonandillustrationparadise66133frm18'>Drawing Jam</a> &gt; <a class=imageLink href='http://pub54.ezboard.com/fcartoonandillustrationparadise66133frm18.showMessage?topicID=112.topic'>Jan 24, 2003.</a>]"],
	["o", "2003", "pb021.gif",     "pb021_t.gif",     "600", "354", "<strong>Out of the fog</strong>"],
	["o", "2003", "pb_sk_018.gif", "pb_sk_018_t.gif", "640", "272", "<strong>Speed painting</strong> 20 minutes<br />Inspired by HellboyOne's personal icon at [<a class=imageLink href='http://pub54.ezboard.com/bcartoonandillustrationparadise66133'>The Drawing Board</a>]"],
	["o", "2003", "pb020.gif",     "pb020_t.gif",     "447", "600", "<strong>\"Ami\'s Angels\"</strong> Reference [<a class=imageLink href='http://www.shaneglines.net/'>Shane Glines\'</a> &gt; <a class=imageLink href='http://pub54.ezboard.com/fcartoonandillustrationparadise66133frm18'>Drawing Jam</a> &gt; <a class=imageLink href='http://pub54.ezboard.com/fcartoonandillustrationparadise66133frm18.showMessage?topicID=109.topic'>Jan 9, 2003</a>]"],
	["o", "2002", "pb_sk_016.gif", "pb_sk_016_t.gif", "600", "342", "<strong>Speed painting</strong> 30 minutes<br />I don't know where these nature images are coming from. Really."],
	["o", "2002", "pb019.gif",     "pb019_t.gif",     "500", "500", "<strong>Stream of conciousness</strong> 15 minutes + color correction<br />I think I miss summer."],
	["o", "2002", "pb018.gif",     "pb018_t.gif",     "500", "500", "<strong>Stream of conciousness</strong> 15 minutes"],
	["o", "2002", "pb_sk_015.gif", "pb_sk_015_t.gif", "600", "300", "<strong>Speed painting</strong> 15 minutes. Reference [<a class=imageLink href='http://pub115.ezboard.com/bebonykeep'>Ebony Keep</a> &gt; <a class=imageLink href='http://pub115.ezboard.com/febonykeepfrm20.showMessage?topicID=165.topic'>Exercise</a>]"],
	["o", "2002", "pb_sk_014.gif", "pb_sk_014_t.gif", "600", "300", "<strong>Stream of conciousness</strong> Speed painting: 5 minutes."],
	["o", "2002", "pb_sk_013.gif", "pb_sk_013_t.gif", "600", "239", "<strong>Boris Karloff</strong> Reference [<a class=imageLink href='http://www.shaneglines.net/'>Shane Glines\'</a> &gt; <a class=imageLink href='http://pub54.ezboard.com/fcartoonandillustrationparadise66133frm18'>Drawing Jam</a> &gt; <a class=imageLink href='http://pub54.ezboard.com/fcartoonandillustrationparadise66133frm18.showMessage?topicID=96.topic'>Oct 17, 2002</a>]"],
	["o", "2002", "pb_sk_012.gif", "pb_sk_012_t.gif", "600", "300", "<strong>Speed painting</strong> 15 minutes"],
	["o", "2002", "pb_sk_011.gif", "pb_sk_011_t.gif", "350", "350", "Reference [<a class=imageLink href='imagery/pb_sk_011_r.gif'>Internet</a>]<br /> Model: Sally Yoshino"],
	["o", "2002", "pb_sk_010.gif", "pb_sk_010_t.gif", "400", "400", "<strong>Experimental</strong>"],
	["o", "2002", "pb017.gif",     "pb017_t.gif",     "700", "350", "<strong>Goddess of Spring</strong> Reference [<a class=imageLink href='http://eatpoo.com/'>Roundeye\'s</a> &gt; <a class=imageLink href='http://www.eatpoo.com/phpBB2/index.php'>eatpoo forums</a> &gt; <a class=imageLink href='http://www.eatpoo.com/phpBB2/viewtopic.php?t=2304'>Sun Goddess thread</a>]"],
	["o", "2002", "pb016.gif",     "pb016_t.gif",     "414", "600", "Reference [<a class=imageLink href='imagery/pb016_r.jpg'>Internet</a>]<br /> Model: Asaoka Ayane"],
	["o", "2002", "pb014.gif",     "pb014_t.gif",     "300", "600", "Reference [<a class=imageLink href='http://creative.gettyimages.com/source/home/home.asp' target='_blank'>Getty Images</a>]<br /> Photographer: Stephen Simpson"],
	["o", "2002", "pb013.jpg",     "pb013_t.jpg",     "350", "350", "<strong>Speed painting</strong> 15-20 minutes"],
	["o", "2002", "pb012.jpg",     "pb012_t.jpg",     "300", "400", "<strong>Stream of conciousness</strong> Started as a scribble."],
	["o", "2002", "pb_sk_009.gif", "pb_sk_009_t.gif", "400", "400", "<strong>Experimental</strong>"],
	["o", "2001", "pb002.jpg",     "pb002_t.jpg",     "400", "400", "Reference [<a class=imageLink href='imagery/pb002_r.jpg'>Internet</a>]<br /> Model: Adriana Sklenarikova"],
	["o", "2001", "pb011.jpg",     "pb011_t.jpg",     "400", "480", "<strong>Merry Christmas 2001</strong><br /> Reference image [<a class=imageLink href='http://creative.gettyimages.com/source/home/home.asp' target='_blank'>Getty Images</a>]<br /> Photographer: Neil Mcintre"],
	["o", "2001", "pb_sk_008.jpg", "pb_sk_008_t.jpg", "324", "189", "<strong>Experimental</strong>"],
	["o", "2001", "pb_sk_007.jpg", "pb_sk_007_t.jpg", "400", "400", "<strong>Experimental</strong>"],
	["o", "2001", "pb_sk_006.gif", "pb_sk_006_t.gif", "400", "400", "<strong>Experimental</strong>"],
	["o", "2001", "pb_sk_005.jpg", "pb_sk_005_t.jpg", "312", "480", "<strong>Experimental</strong>"],
	["o", "2001", "pb_sk_004.jpg", "pb_sk_004_t.jpg", "400", "400", "<strong>Experimental</strong>"],
	["o", "2001", "pb_sk_003.jpg", "pb_sk_003_t.jpg", "400", "400", "<strong>Experimental</strong>"],
	["o", "2001", "pb_sk_002.gif", "pb_sk_002_t.gif", "400", "400", "<strong>Experimental</strong>"],
	["o", "2001", "pb_sk_001.gif", "pb_sk_001_t.gif", "400", "510", "<strong>Experimental</strong>"],
	["o", "2000", "pb015.jpg",     "pb015_t.jpg",     "535", "350", "<strong>The Crow</strong> Minion of the Dark One [WOT]"]
);

function navGallery(i){
	if (galleryArray[i][0] == "l") { 
		c = ": Latest image";
	} else if (galleryArray[i][0] == "r") { 
		c = ": Recent";
	};
	document.getElementById("image").innerHTML = 
		"<img src='imagery/o.gif' height='10' />"+
		"<div style='text-align:center; height:20;'>CLICK IMAGE TO CLOSE</div>"+
		"<img class=imageDisplay src='imagery/" + galleryArray[i][2] + "' onclick='clearImage();' />"+
		"<div class=imageNotesContainer style='width:"+galleryArray[i][4]+";'>"+
		"<div class=imageNotes>"+galleryArray[i][6]+"</div>"+
		"</div>";

	setIdProperty("image", "display", "block");
};

function clearImage(i){
	document.getElementById("image").innerHTML = "";
	setIdProperty("image", "display", "none");
};

function listThumbs(a){
	var c, d, i;
	for (i=0; i<galleryArray.length; i++){
		if (galleryArray[i][1] == a) {
			if (galleryArray[i][0] == "l") { 
				c = "Latest image"; // alt tag
				d = "latest"; // completes thumb file name "imagery/_t_'+d+'.gif"
			} else if (galleryArray[i][0] == "r") { 
				c = "Recent"; // alt tag
				d = "recent"; // completes thumb file name "imagery/_t_'+d+'.gif"
			} else if (galleryArray[i][0] == "o") { 
				c = ""; // alt tag
				d = "old"; // completes thumb file name "imagery/_t_'+d+'.gif"
			};
			this.document.writeln('<a href="javascript:void(0)" onmouseover="preview.src=\'imagery/'+galleryArray[i][3]+'\'" onmouseout="preview.src=\'imagery/_t_preview.gif\'" onclick="navGallery('+i+'); return false; "><img class="thumb" src="imagery/_t_'+d+'.gif" width="8" height="8" align=middle alt="'+c+'"></a>');
		}
	};
};


function showDiv(n){
	// clear all
	for(var i=1; i<4; i++){ 
		setIdProperty("s" + i, "display", "none");
		}
	// set property
    setIdProperty("s" + n, "display", "block");
	}


function writemail(to, re){
	document.write("<a href=mai"+"lto:"+to+"@"+"paulba"+"lchin.co"+"m"+" >"+re+"</a>");
	}

/*
 * Browser version snooper; determines your browser
 * (Navigator 4, Navigator 6, or Internet Explorer 4/5)
 */

var isNav4, isNav6, isIE4;

//function setBrowser()
//{
    if (navigator.appVersion.charAt(0) == "4")
    {
        if (navigator.appName.indexOf("Explorer") >= 0)
        {
            isIE4 = true;
        }
        else
        {
            isNav4 = true;
        }
    }
    else if (navigator.appVersion.charAt(0) > "4")
    {
        isNav6 = true;
    }
//}

/*
 *
 * Given a selector string, return a style object
 * by searching through stylesheets. Return null if
 * none found
 *
 */
function getStyleBySelector( selector )
{
    if (!isNav6)
    {
        return null;
    }
    var sheetList = document.styleSheets;
    var ruleList;
    var i, j;

    /* look through stylesheets in reverse order that
       they appear in the document */
    for (i=sheetList.length-1; i >= 0; i--)
    {
        ruleList = sheetList[i].cssRules;
        for (j=0; j<ruleList.length; j++)
        {
            if (ruleList[j].type == CSSRule.STYLE_RULE &&
                ruleList[j].selectorText == selector)
            {
                return ruleList[j].style;
            }   
        }
    }
    return null;
}

/*
 *
 * Given an id and a property (as strings), return
 * the given property of that id.  Navigator 6 will
 * first look for the property in a tag; if not found,
 * it will look through the stylesheet.
 *
 * Note: do not precede the id with a # -- it will be
 * appended when searching the stylesheets
 *
 */
function getIdProperty( id, property )
{
    if (isNav6)
    {
        var styleObject = document.getElementById( id );
        if (styleObject != null)
        {
            styleObject = styleObject.style;
            if (styleObject[property])
            {
                return styleObject[ property ];
            }
        }
        styleObject = getStyleBySelector( "#" + id );
        return (styleObject != null) ?
            styleObject[property] :
            null;
    }
    else if (isNav4)
    {
        return document[id][property];
    }
    else
    {
        return document.all[id].style[property];
    }
}

/*
 *
 * Given an id and a property (as strings), set
 * the given property of that id to the value provided.
 *
 * The property is set directly on the tag, not in the
 * stylesheet.
 *
 */
function setIdProperty( id, property, value )
{
    if (isNav6)
    {
        var styleObject = document.getElementById( id );
        if (styleObject != null)
        {
            styleObject = styleObject.style;
            styleObject[ property ] = value;
        }
    }
    else if (isNav4)
    {
        document[id][property] = value;
    }
    else if (isIE4)
    {
         document.all[id].style[property] = value;
    }
}

/*
 *
 * Move a given id.  If additive is true,
 * then move it by xValue dots horizontally and
 * yValue units vertically.  If additive is
 * false, then move it to (xValue, yValue)
 *
 * Note: do not precede the id with a # -- it will be
 * appended when searching the stylesheets
 *
 * Note also: length units are preserved in Navigator 6
 * and Internet Explorer. That is, if left is 2cm and
 * top is 3cm, and you move to (4, 5), the left will
 * become 4cm and the top 5cm.
 *
 */
function generic_move( id, xValue, yValue, additive )
{
    var left = getIdProperty(id, "left");
    var top = getIdProperty(id, "top");
    var leftMatch, topMatch;

    if (isNav4)
    {
        leftMatch = new Array( 0, left, "");
        topMatch = new Array( 0, top, "");
    }
    else if (isNav6 || isIE4 )
    {
        var splitexp = /([-0-9.]+)(\w+)/;
        leftMatch = splitexp.exec( left );
        topMatch = splitexp.exec( top );
        if (leftMatch == null || topMatch == null)
        {
            leftMatch = new Array(0, 0, "px");
            topMatch = new Array(0, 0, "px");
        }
    }
    left = ((additive) ? parseFloat( leftMatch[1] ) : 0) + xValue;
    top = ((additive) ? parseFloat( topMatch[1] ) : 0) + yValue;
    setIdProperty( id, "left", left + leftMatch[2] );
    setIdProperty( id, "top", top + topMatch[2] );
}

/*
 *
 * Move a given id to position (xValue, yValue)
 *
 */
function moveTo( id, x, y )
{
    generic_move( id, x, y, false );
}

/*
 *
 * Move a given id to (currentX + xValue, currentY + yValue)
 *
 */
function moveBy( id, x, y)
{
    generic_move( id, x, y, true );
}

/*
 *
 * Function used when converting rgb format colors
 * from Navigator 6 to a hex format
 *
 */ 
function hex( n )
{
    var hexdigits = "0123456789abcdef";
    return ( hexdigits.charAt(n >> 4) + hexdigits.charAt(n & 0x0f) );
}

/*
 *
 * Retrieve background color for a given id.
 * The value returned will be in hex format (#rrggbb)
 *
 */ 
function getBackgroundColor( id )
{
    var color;

    if (isNav4)
    {
        color = document[id].bgColor;
    }
    else if (isNav6)
    {
        var parseExp = /rgb.(\d+),(\d+),(\d+)./;
        var rgbvals;
        color = getIdProperty( id, "backgroundColor" );
        if (color)
        {
            rgbvals = parseExp.exec( color );
            if (rgbvals)
            {
                color = "#" + hex( rgbvals[1] ) + hex( rgbvals[2] ) +
                    hex( rgbvals[3] );
            }
        }
        return color;
    }
    else if (isIE4)
    {
        return document.all[id].backgroundColor;
    }
    return "";
}

/*
 *
 * Return a division's document
 * 
 */
function getDocument( divName )
{
    var doc;

    if (isNav4)
    {
        doc = window.document[divName].document;
    }
    else if (isNav6)
    {
        doc = document;
    }
    else if (isIE4)
    {
        doc = document;
    }
    return doc;
}

