function loadContent(id,dot_num,load_it) {
	if (!id) {
		$("#paintingright").html('');
		$("#paintingdescription").html('');
		return;
	}
	var dot_index = (dot_num) ? dot_num : 1;
	if (load_it) {
		currentImage = id;
	}
	var section_letter = getLetter(id);

	//$("#paintingright").load("rpc.php?o="+id+"");
	$("#paintingright").html('<img src="images/' + currentPage + '/'+ section_letter + dot_index +'.jpg" />');
	$("#paintingdescription").load("descrip.php?o="+id+"");
}

/*
if (document.images)
{
	preload_image_object = new Image();
	// set image url
	image_url = new Array();
	image_url[0] = "http://mydomain.com/image0.gif";
	image_url[1] = "http://mydomain.com/image1.gif";
	image_url[2] = "http://mydomain.com/image2.gif";
	image_url[3] = "http://mydomain.com/image3.gif";

	var i = 0;
	for(i=0; i<=3; i++) { 
		preload_image_object.src = image_url[i];
	}
}
*/

function getLetter(numb) {
	var str="abcdefghijklmnop";
	return str[numb-1];
}

function getRolloverPath(idx) {
	return thumbnailIndices[idx];
}

function getNumber(lett) {
	return lett.charCodeAt(0) - 96;
}

function navClick(el,dot_num) {
	var nav_id = el.id;
	var matches = nav_id.match(/([0-9]+)/);
	var show_dot = (dot_num) ? dot_num : 1;
	loadContent(matches[1],dot_num,'loadPage');
	return false;
}

function showRollOver(el) {
	var matches = el.src.match(/([0-9]+).jpg$/);
	if (!matches) return;
	//alert(matches[1]);
	//el.src = 'images/' + currentThumbs + '/' + getLetter(matches[1]) + '.jpg';
	el.src = getRolloverPath(matches[1]-1); 
	//loadContent(matches[1]);
	
}

function showOriginal(el) {
	var image_num = currentImage ? currentImage : 0;
	//loadContent(image_num);

	var matches = el.id.match(/^thumbimage_([0-9]+)$/);
	if (!matches) return;
	var curNumb = matches[1];
	if (currentImage == curNumb) {
		return;
	} else {
		el.src = 'images/' + 'squares' + '/' + curNumb + '.jpg';
	}
}
