function changePage(){
	if(pages[navbar.selectedIndex].name!="Shopping Cart")purchasePageIndex=0;
	if(pages[navbar.selectedIndex].name=="Shopping Cart")createPurchasePage();

	previousPageIndex=currentPageIndex;
	previousPage=currentPage;
	currentPageIndex=navbar.selectedIndex;
	//if(currentPage.name=="CD Panel"&&navbar.selectedIndex==3)currentPage=seminarsPage;
	//if(currentPage.name=="CD Panel"&&navbar.selectedIndex==0)currentPage=studioPage;
	currentPage=pages[currentPageIndex];
	document.title="Jane Darin Studio [ "+currentPage.name+" ]";
	setTimeout("pageFrame.location.reload()",PAGE_SPEED);
}
function checkAddToFavorites(){
	if(ge("chk1").checked)
		if(favorites.addFavorite(currentItem))
			serialize();
}
function closeInfowin(){
	if(infowin!=null&&!infowin.closed)infowin.close();
}
function ge(element){
	return pageFrame.document.getElementById(element);
}
function openInfowin(infoToShow){
	var iwWidth;var iwHeight;
	if(infoToShow=="info"){iwWidth=600;iwHeight=450;}
	else if(infoToShow=="poem"){iwWidth=700;iwHeight=650;}
	else if(infoToShow=="printable order"){iwWidth=650;iwHeight=650;}
	var iwLeft=(screen.width-iwWidth)/2;
	var iwTop=(screen.height-iwHeight)/3;
	var iwPrefs="left="+iwLeft+",top="+iwTop+
	",width="+iwWidth+",height="+iwHeight+",scrollbars=yes,resizable=yes";
	if(infowin==null||infowin.closed)infowin = window.open("", "infowin", iwPrefs);
	with(infowin.document){
		open();
		var item=currentItem;
		write("<html><head>");
		write("<title>Jane Darin Studio [ "+item.label+" ]</title>");
		write("<style type='text/css'>");
		write("p{font:normal 9pt Arial, Helvetica, sans-serif;}");
		write("td{font:normal 9pt Arial, Helvetica, sans-serif;}");
		write("vertical-align:top;}");
		write("</style></head><body>");
		if(infoToShow=="info"||infoToShow=="cd")createInfoHtml()
		else if(infoToShow=="poem"){
			write("<table cellspacing=10 cellpadding=0 align=center>");
			write("<tr><td valign=top>");
			write("<img src='"+tPath+item.thumbnail+"'>");
			write("</td><td valign=top>");
			write(item.poem.getHtml());
			write("</td></tr></table>");
			infowin.document.body.style.backgroundColor=LIGHT_COLOR;
		}
		else if(infoToShow=="printable order")createInfoOrderHtml();
		write("</body></html>");
		close();
	}
	infowin.focus();
}
function highlightElement(element){
	element.style.color="white";
	element.style.backgroundColor=LIGHT_COLOR;
}
function unhighlightElement(element){
	element.style.color="blue";
	element.style.backgroundColor="transparent";
}
function showFloatingPage(pageToShow){
	var pre="Jane Darin Studio [ ";
	previousPage=currentPage;
	if(pageToShow=="Image Panel")createImagePage(pageToShow);
	else if(pageToShow=="biography"){
		currentPage=bioPage;
		document.title=pre+"Biography ]";
	}
	else if(pageToShow=="collectors"){
		currentPage=collectorsPage;
		document.title=pre+"Collectors Advice ]";
	}
	else if(pageToShow=="seminars"){
		currentPage=seminarsPage;
		document.title=pre+"Seminars ]";
	}
	else if(pageToShow=="foundry"){
		currentPage=foundryPage;
		foundryPage.selectedIndex=0;
		document.title=pre+"A Tour of the Foundry ]";
	}
	else if(pageToShow=="faq"){
		currentPage=faqPage;
		faqPage.selectedIndex=0;
		document.title=pre+"Frequently Asked Question ]";
	}
	else if(pageToShow=="commissions"){
		currentPage=portraitPage;
		document.title=pre+"Commissions ]";
	}
	else if(pageToShow=="sponsor"){
		currentPage=sponsorsPage;
		document.title=pre+"Become a Sponsor ]";
	}
	else if(pageToShow=="visit"){
		currentPage=visitPage;
		document.title=pre+"Visit My Studio ]";
	}
	else if(pageToShow=="events"){
		currentPage=calendarPage;
		document.title=pre+"Calendar of Events ]";
	}
	else if(pageToShow=="links"){
		currentPage=linksPage;
		document.title=pre+"My Favorite Links ]";
	}
	else if(pageToShow=="CD Panel")createCDPage(pageToShow);
	else if(pageToShow=="emailContactPage")currentPage=emailContactPage;
	else if(pageToShow=="questionaire")currentPage=questionairePage;
	else if(pageToShow=="profile"){
		createProfilePage();
		currentPage=profilePage;
		document.title=pre+"My Profile ]";
	}
	else if(pageToShow=="edit profile"){
		createProfileEdit();
		currentPage=editProfilePage;
		document.title=pre+"Edit My Profile ]";
	}
	else if(pageToShow=="favorites")createFavoritesPage();
	if(pageToShow=="email"){
		if(currentPage.name=="Email")return;
		previousPageIndex=currentPageIndex;
		if(currentPageIndex!=1)artList.selectedIndex=-1;
		currentPage=emailPage;
	}
	setTimeout("pageFrame.location.reload()",PAGE_SPEED);
}
function toggleAwardsBox(element){
	var aBox=pageFrame.document.getElementById("awardsBox");
	if(element.checked)aBox.style.visibility = "hidden";
	else aBox.style.visibility = "visible";
}