var curPic = 0;

//-----------------------------------------------------------------------------------------------
function showPic (picNr) {
	document.getElementById('galPic').src = gal['pic'][picNr];
	document.getElementById('outlinePic').src = gal['outline'][picNr];
	lastOutline = gal['outline'][picNr];
	document.getElementById('myCaption').innerHTML = gal['caption'][picNr];
	curPic = picNr;

	if (curPic <= 0 ) document.getElementById("tp").style.display = "none";
	else document.getElementById("tp").style.display = "block";
	
	nrPics = gal['pic'].length;
	if (curPic >= (nrPics - 1)) document.getElementById("tn").style.display = "none";
	else document.getElementById("tn").style.display = "block";
	
	switchThumbRow(gal['thumbpage'][picNr]);
}
//-----------------------------------------------------------------------------------------------
function nextPic () {
	nrPics = gal['pic'].length;
	if (curPic >= (nrPics - 1)) return;
	showPic(curPic + 1);
}
//-----------------------------------------------------------------------------------------------
function prevPic () {
	if (curPic <= 0) return;
	showPic(curPic - 1);
}
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------
function switchThumbRow(curNr) {
	for (i=1; i<6; i++) {
		if (i == curNr) {
			document.getElementById("div"+i).style.display = "block";
			document.getElementById("flip"+i).className = "selected";
		}
		else {
			document.getElementById("div"+i).style.display = "none";
			document.getElementById("flip"+i).className = "";
		}
	}
}
//-------------------------------------------------------------------------------
function LastPreviewedPlan (projectname, nr, subnr) {
//alert ("hall LastreviewdPlan Object setting");
  this.projectname = projectname;
  this.nr = nr;
  this.subnr = subnr;
}

var lastPreviewedPlan = new LastPreviewedPlan("","","");

function previewPlan(projectname, nr, subnr)
{
  document.grundriss.src = String("images/projects/"+projectname+"_"+nr+"_"+subnr+"_riss.gif");
  lastPreviewedPlan = new LastPreviewedPlan(projectname,nr,subnr);
}

function resetPlan(projectname, nr, subnr)
{
  document.grundriss.src = String("images/projects/"+projectname+"_"+nr+"_"+subnr+"_riss.gif");
}

function showLastPreviewedPlan()
{
  if (lastPreviewedPlan.projectname != "") {
    document.grundriss.src =
                    String("images/projects/"+lastPreviewedPlan.projectname+"_"+
                                              lastPreviewedPlan.nr+"_"+
                                              lastPreviewedPlan.subnr+"_riss.gif");
  }
}


function rollover(name, file)
{
  document[name].src = String("assets/templates/geisendoerfer/images/"+file);
}

