// JavaScript Document
// Menu creation using ajax

//T1 is the main display area
// thumbnail imgs are in ./thumbs
// fullsized imgs are in ./imgs

//load data str's for thumbnail menu
var imgbegin1 = "<a  href='";
var imgbegin2 = "'>"; 
var imgbegin3 = "<img  src='./thumbs/";
var imgend1 = "' width=85 target='T1'>" ;
var imgend2 = "</a>";

var AllMenuStr= "";
var fname = 0;
var title = 1;
	
//-----------------------------------
var img2begin1 = "<a class=menuimg   href=" + '"' + "javascript:showpting('";
var img2end1 = "')" + '"' + ">" ;

function thumbMenuf( swhich ){
	//alert(swhich);
	AllMenuStr= "<table width=80px><tr><td>";
	
	switch( swhich ){
		case plwhich:
			for( i=0; (i < pl.length ); i++) {
			AllMenuStr += img2begin1 + swhich + "', '"+ i + img2end1 + 
						imgbegin3 + pl[i][fname] + imgend1 + "</td> </tr><tr><td>";
			}
			break;
		
		default:
			for( i=0; i < gfxl.length; i++){
			AllMenuStr += img2begin1 + swhich + "', '" + i + img2end1 + 
						imgbegin3 + gfxl[i][fname] + imgend1 + "</td> </tr><tr><td>";
			}
			break;
	}
	
	AllMenuStr += "&nbsp;</td></tr></table>";
	//alert(AllMenuStr);
	document.getElementById('thumbnMenu').innerHTML = AllMenuStr;	
}

function showpting(swhich, itemnumber ){
	//alert("show:" + swhich);
	if( swhich == plwhich){
		//img
		imgstr = "<img src='./imgs/" + pl[itemnumber][fname] + "' align=center>" ;
		//title caption
		imgstr = imgstr + "<br><br>" + pl[itemnumber][title] + "<br /><br />";
		//alert(imgstr);
	}
	else {
		//img
		imgstr = "<img src='./imgs/" + gfxl[itemnumber][fname] + "'>" ;
		//title caption
		imgstr = imgstr + "<br />" + gfxl[itemnumber][title] + "<br /><br />";
		//alert(imgstr);
	}
	document.getElementById('T1').innerHTML = imgstr;
}


function disptxt( txtstr ){
	//alert(txtstr);
	document.getElementById('T1').innerHTML = txtstr;
}
