var addFileWin;
var gallery;
var helpWin;
var previewWin;
var bioWin;
var guideWin;
var userWin;

function openUserWindow(url)
{
  if(userWin == null ||userWin.closed)
  {
	userWin = openCustomWindowReturn(url, 'userWin', 300, 375);
	userWin.focus();
  }
  else
  {
    userWin.document.location = url;
    userWin.focus();
  }
}

function openBio(url)
{
  if(bioWin == null ||bioWin.closed)
  {
	bioWin = openCustomWindowReturn(url, 'bioWin', 450, 375);
	bioWin.focus();
  }
  else
  {
    bioWin.document.location = url;
    bioWin.focus();
  }
}

function openGallery(url)
{
  if(gallery == null || gallery.closed)
	gallery = openCustomWindowReturn(url, 'gallery', 467, 510);
  else
  {
    gallery.document.location = url;
    gallery.focus();
  }
}

function openFileWindow(url)
{
  if(addFileWin == null || addFileWin.closed)
  {
    addFileWin = openCustomWindowReturn(url, 'addFileWin', 500, 400);
    addFileWin.focus();
  }
  else
  {
    addFileWin.document.location = url;
    addFileWin.focus();
  }
}

function openGuideWindow(url)
{
  if(guideWin == null || guideWin.closed)
  {
    guideWin = openCustomWindowReturn(url, 'guideWin', 453, 580);
    guideWin.focus();
  }
  else
  {
    guideWin.document.location = url;
    guideWin.focus();
  }
}


function openHelpWindow(url)
{
  if(helpWin == null || helpWin.closed)
  {
    helpWin = openCustomWindowReturn(url, 'helpWin', 650, 500);
    helpWin.focus();
  }
  else
  {
    helpWin.document.location = url;
    helpWin.focus();
  }
}

function openPreviewWindow()
{
  if(previewWin == null || previewWin.closed)
  {
    previewWin = openCustomWindowReturn('', 'previewWin', 450, 400);
  }
}

function closeFileWindow()
{
  if(!(typeof(addFileWin) == "undefined") && !addFileWin.closed)
    addFileWin.close();
}

function openCustomWindow(url, name, width, height)
{
  window.open(url, name, 'location=no,toolbar=no,menubar=no,directories=no,titlebar=no,status=yes,resizable=yes,scrollbars=yes,width=' + width + ',height=' + height)
}

function openCustomWindowReturn(url, name, width, height)
{
  return window.open(url, name, 'location=no,toolbar=no,menubar=no,directories=no,titlebar=no,status=yes,resizable=yes,scrollbars=yes,width=' + width + ',height=' + height)
}

