
/*  gallery arrays */

var digital = new Array('Sorcerer',
			'chess_queen',
			'ot3p_tribute',
			'B14SPH3MY',
			'D1ZZY',
			'OfFireAndSoul',
			'Rapture',
			'takemyfleshandblood');

var traditional = new Array('CrowQueen',
			'a_gown',
			'LadyPlanet');
var threedee = new Array('Luthier_BeautyShot',
			'Luthier_AngleShots',
			'Luthier_Hipoly',
			'Luthier_Construction',
			'Irnu_UpperBody',
			'Irnu_FullBody',
			'SaladBust',
			'SaladBust_Back',
			'SaladBust_Con');

var gallery = threedee.concat(digital, traditional);

var arraylist = new Array();

var arraynames = new Array('threedee',
			'digital',
			'traditional');

/*  General Properties */

var count = 0;
var col = 3;

var pick = 0;

var opincrease = 0.25;

var f = '.jpg';
var t = '_thumb';

var timecounter = 0;
var timeron = 0;
	
var thumbw = 80;
var thumbh = 140;

function loadthumbs()
{
	var batchdigital = new Array();
	var batchtraditional = new Array();
	var batchthreedee = new Array();
	var disth = 0;
	var distw = 0;
	var newrow = 0;

	/* Generate Thumb List */

	for(count = 0; count < gallery.length; count++)
	{
		if(count < threedee.length)
		{	
			batchthreedee.push('<input type="image" id="' + count + '" onclick="showoff(' + count + ')" src="gallery/thumbs/' + gallery[count] + t + f + '" />');
		}
		else if(count < digital.length + threedee.length)
		{
			batchdigital.push('<input type="image" id="' + count + '" onclick="showoff(' + count + ')" src="gallery/thumbs/' + gallery[count] + t + f + '" />');
		}
		else if(count < digital.length + threedee.length + traditional.length)
		{
			batchtraditional.push('<input type="image" id="' + (count) + '" onclick="showoff(' + (count) + ')" src="gallery/thumbs/' + gallery[count] + t + f + '" />');			
		}
	}

	arraylist.push(batchthreedee.join(''), batchdigital.join(''), batchtraditional.join(''));

	/* Write Thumbs */
	for(count = 0; count < arraylist.length; count++)
	{		
		document.getElementById(arraynames[count]).innerHTML = arraylist[count];	
	}	
}

function showoff(id)
{	
	document.getElementById('container').innerHTML = '<div id="curtain" class="curtain" onclick="closeimage()"></div><div id="createshow" class="showoff"><input type="image" src="arrow_left.gif" class="arrowleft button" onclick="changeimage(-1)" /><input type="image" src="arrow_right.gif" class="arrowright button" onclick="changeimage(1)" /><img id="imageshow" onload="posimage()" src="gallery/' + gallery[id] + f + '" /><input type="image" src="arrow_cross.gif" class="cross button" onclick="closeimage()" /></div>';
		
	pick = id;
	
	return id;
}

function posimage()
{
	document.getElementById('createshow').style.left = 50 + '%';
	
	newpos = -(document.getElementById('imageshow').width/2);

	document.getElementById('createshow').style.marginLeft = newpos + 'px';

	document.getElementById('createshow').style.opacity = 1;

	//fadeimage();
}

function timeimage()
{

	if(timeron == 0)
	{
		timeron = 1;
		fadeimage();
	}
}

function fadeimage()
{
	document.getElementById('imageshow').style.opacity = opincrease;

	if(opincrease == 1)
	{
		timecounter = 0;
		opincrease = 0.25;
		timeron = 0;
		
	}
	else
	{
		opincrease += opincrease;
		timecounter = setTimeout('fadeimage()',50);
	}
}

function closeimage()
{
	document.getElementById('container').innerHTML = '';
}

function changeimage(c)
{
	pick += c;

	if(pick < 0)
	{
		pick = gallery.length - 1;
	}
	else if(pick >= gallery.length)
	{
		pick = 0;
	}
	
	document.getElementById('imageshow').src = 'gallery/' + gallery[pick] + f;
	
	return c;
}

