function openNew(file, name, options)
{
  if (options == 'standard')
    linkWin=window.open(file, name, 'toolbar=yes,menubar=yes,status=yes,location=yes,scrollbars=yes,resizable=yes,width=800,height=450,top=50,left=50');
  else
    linkWin=window.open(file, name, options);
    
  linkWin.focus();
}

function showBox(boxname)
{
  document.getElementById(boxname).style.display = "block";
}

function hideBox(boxname)
{
  document.getElementById(boxname).style.display = "none";
}

function preloadImages()
{
	var menuoption = new Array();
	menuoption[0] = "home";
	menuoption[1] = "novel";
	menuoption[2] = "author";
	menuoption[3] = "reviews";
	menuoption[4] = "photos";
	menuoption[5] = "cover";
	menuoption[6] = "publisher";
	menuoption[7] = "buy";
	menuoption[8] = "events";
	menuoption[9] = "comments";
	
	var pics = new Array();
	
	if (document.images)
	{
		for(var i=0; i<menuoption.length; i++) {
			pics[i] = new Array();
			pics[i][0] = new Image(77,23);
			pics[i][0].src = "images/menuline/" + menuoption[i] + "_curr.gif";
			pics[i][1] = new Image(77,23);
			pics[i][1].src = "images/menuline/" + menuoption[i] + "_normal.gif";
			pics[i][2] = new Image(77,23);
			pics[i][2].src = "images/menuline/" + menuoption[i] + "_over.gif";
		}
	}
}

function enlargeImage(title, filename, width, height, caption)
{
  var generator=window.open('','imageWindow','height='+height+',width='+width+',top=50,left=50');
  
  generator.document.write('<html><head><title>'+title+'</title></head><body style="margin: 10px; background-color: white;">');
  generator.document.write('<center><img src="images/'+filename+'.jpg">');
  generator.document.write('<p style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; color: black; text-align: center; line-height: 18pt; margin-top: 5px;">'+caption+'</p>');
  generator.document.write('</center></body></html>');
  generator.document.close();
  generator.focus();
}

var mainbodyWidth = 770;

function openPopupImage(filename, caption, popupWidth, popupHeight)
{
	var popupOuter = document.getElementById("popupOuterWrapper");
	var popupInner = document.getElementById("popupInnerWrapper");
	var imageHolder = document.getElementById("imageHolder");
	var captionHolder = document.getElementById("captionHolder");
	
	popupOuter.style.left = parseInt((document.body.clientWidth - mainbodyWidth)/2 + 20)+'px';
	popupOuter.style.width = parseInt(popupWidth)+'px';
	popupOuter.style.height = parseInt(popupHeight)+'px';
	popupInner.style.width = parseInt(popupWidth-18)+'px';
	popupInner.style.height = parseInt(popupHeight-28)+'px';
	
	imageHolder.innerHTML = '<img src="images/' + filename + '">';
	captionHolder.innerHTML = caption;	
	
	popupOuter.style.display = "block";
}

function closePopupImage()
{
	var popup = document.getElementById("popupOuterWrapper");
	
	popup.style.display = "none";
}