var showingPicture = "instructions";
var showingCategory = "prettyfaces";

function LoadSelect(cat,poster){
	if(showingPicture=="instructions")
		Select(cat,poster);
}

function HideContent(d) {
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "block";
}
function ReverseContentDisplay(d) {
	if(d.length < 1) { return; }
	if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
	else { document.getElementById(d).style.display = "none"; }
}
function AddBracket(d)  {
  if(d.length < 1) { return; }
  document.getElementById(d).style.borderColor = "rgb(114,114,114)";
}
function RemoveBracket(d) {
  if(d.length < 1) { return; }
  document.getElementById(d).style.borderColor = "white";
}

function ClearAll(){
  var links = new Object();
  var link_name;
  var gal_name;
  links['prettyfaces'] = 0;
  links['oddsandends'] = 1;
  links['touchups'] = 2;
  links['contact'] = 3;
  
  for(link in links){
    link_name = link + '_link';
    gal_name = link + '_pane';
    RemoveBracket(link_name);
    HideContent(gal_name);
  }
}

function ClearAllBrackets(){
  var links = new Object();
  links['prettyfaces'] = 0;
  links['oddsandends'] = 1;
  links['touchups'] = 2;
  links['contact'] = 3;
  
  for(link in links){
    if(link!=showingCategory)
      RemoveBracket(link + '_link');
  }
}
function Select(d,poster) {
	ClearAllBrackets();
  AddBracket(d + '_link');
	showingCategory = d;
  if(d!='contact' && d!='testimonials'){
  	if(d=='touchups'){
  		frames['main_content'].location.href = 'repictures/to/' + poster;
  		frames['gallery_frame'].location.href = 'touchups/to/';
  		document.getElementById('loading').style.display = 'block';
  	}else{
		  frames['main_content'].location.href = 'pictures/' + d + '/' + poster;
		  frames['gallery_frame'].location.href = 'galleries/' + d;
		  document.getElementById('loading').style.display = 'block';
		}
	}else
		document.getElementById('loading').style.display = 'none';
}

function hidePicture(d) {
  //document.getElementById('full_picture_' + d).style.display = "none";
}
