
//handle netscape's quirks
//if (!document.all) {
//window.onload=loadImages();
//}


		  var w;		  var infodivName;
var isSmock=false;
var isCamicia=false;
var isCorset=false;
var isFarthingale=false;
var isSmockTop= false;
var isCamiciaTop= false;
var isBumroll=false;
var isPartlet=false;
var isShirt=false;
var isPetBod=false;
var isDressed=false;
var isPetticoat=false;
var isKirtle=false;
var isGown=false;
var isSleeves=false;
var isForepart=false;
var curgown="";
//////////////////////////////////////////////// Camicia//////////////////////////////////////////////
function clickCamicia() {	if (isCamicia) {
		if (isDressed) {
			alert('Thou must remove my dress before taking off my smock.  To switch to a different smock, click on the alternate smock you wish me to wear.');
			return;
		}
		if (isCorset) {
			alert('I cannot remove my smock, without first removing my corset.  To switch to a different smock, click on the alternate smock you wish me to wear.');
			return;
		}		//DON'T WEAR SHIRT OVER HIGH-NECKED SMOCK
		if (isShirt) {
			alert('With a high-necked smock and a shirt to boot, I should be very hot.  I pray you, remove my shirt ere changing me to a high-necked smock.'); 
			return;
		}
		hideSmock();		hideCamicia();
	}
	else
	{
		showCamicia();
	}}
function showCamicia() {		hideSmock();
	if ((isDressed) || (isCorset)) {
		showhide('camiciatop','show');
		showhide('camicia','hide');	} else {
		showhide('camicia','show');		showhide('camiciatop','hide');
	}
	isCamicia=true;
	switchPic('camicia-sm','on');}
function hideCamicia() {	showhide('camicia','hide');
	showhide('camiciatop','hide');	switchPic('camicia-sm','off');	isCamicia=false;}
//////////////////////////////////////////// SMOCK//////////////////////////////////////////
function clickSmock() {
	if (isSmock) 		{
		if (isDressed) 		{
			alert('Thou must remove my dress before taking off thy smock.  To switch to a different smock, click on the alternate smock you wish me to wear.');
			return;
		}
		if (isCorset) {
			alert('I cannot remove my smock, without first removing my corset.  To switch to a different smock, click on the alternate smock you wish me to wear.');
			return;
		}		if (isFarthingale) {
			alert('Tis indeed a task, to remove my smock when in a farthingale! I pray thee, remove my farthingale first. To switch to a different smock, click on that smock you wish me to wear.');
			return;
		}				hideSmock();		hideCamicia();
		} 	else {
		showSmock();	}
}

function showSmock() {
	hideCamicia();	
	if ((isDressed) || (isCorset)) {
		showhide('smocktop','show');		showhide('smock','hide');
		} 	else 		{
		showhide('smock','show');		showhide('smocktop','hide');
		}
	isSmock=true;	switchPic('smock-sm','on');
}
function hideSmock() {	showhide('smocktop','hide');
	showhide('smock','hide');
	switchPic('smock-sm','off');
	isSmock=false;}///////////////////////////////
// CORSET
///////////////////////////////
function clickCorset() {
	if (isCorset) 	{
		//CAN'T REMOVE CORSET IF DRESSED
		if (isDressed)  {
			alert('Alas, I must first be undressed before I can cast off my corset.  Prithee remove my gown.');
			return;
		}		hideCorset();
	}
	else 	{
		//CAN'T ADD CORSET IF ALREADY DRESSED
		if (isDressed) {
			alert('La! I must first be undressed before lacing into my corset.  Prithee remove my gown.');
			return;
		}
		//CAN'T PUT ON CORSET WITHOUT SMOCK
		if ((!isSmock) && (!isCamicia)) {
			alert('A Lady always wears a smock under her corset.  Please pick  a smock for me first.');
			return;
		}
		showCorset();
	}}function hideCorset() {

//SHOW FARTHINGALE WITHOUT CORSET, IF A FARTHINGALE IS ON
if (isFarthingale) {
showhide('farthingale','hide');
showhide('farthingale-nc','show');
}

//HIDE THE SMOCK TOPS & SHOW WHOLE SMOCK
	if (isSmock) {
		showhide('smocktop','hide');
		showhide('smock','show');
	} 
else if (isCamicia) {
		showhide('camiciatop','hide');
		showhide('camicia','show');
	}

//REMOVE BUMROLL
if ((isBumroll) && (!isFarthingale)) {
showhide('bumroll','hide');
isBumroll=false;
}

//HIDE THE CORSET
	showhide('corset','hide');
	isCorset=false;
	switchPic('corset-sm','off');
}
function showCorset() {
	//HIDE THE WHOLE SMOCK & SHOW SMOCK TOPS
		if (isSmock) {
			showhide('smocktop','show');
			showhide('smock','hide');
		} else if (isCamicia) {
			showhide('camiciatop','show');
			showhide('camicia','hide');
		}

	//SHOW FARTHINGALE WITH CORSET
	if (isFarthingale) {
	showhide('farthingale-nc','hide');
	showhide('farthingale','show');
	}

	//SHOW CORSET
		showhide('corset','show');
		isCorset=true;		switchPic('corset-sm','on');
}

/////////////////////////////////////////
// FARTHINGALE
//////////////////////////////////
function clickFarthingale() {
	if (isFarthingale) 	{
		if (isDressed) {
			alert('Thou needs must remove my gown before removing my farthingale.');
			return;
		}
		hideFarthingale();
	} 
	else 	{
		if (isDressed) 		{
			alert ('Wouldst have me wear my farthingale over thy clothing? Nay, thou must first remove thy gown.');
			return;
		}
		showFarthingale();
   	}

}function showFarthingale() {	if (isCorset) {
		showhide('farthingale','show');		showhide('farthingale-nc','hide');
	}else {
		showhide('farthingale-nc','show');		showhide('farthingale','hide');
	}
	isFarthingale=true;
	switchPic('farthingale-sm','on');}function hideFarthingale() { 	showhide('farthingale','hide');
	showhide('farthingale-nc','hide');
	isFarthingale=false;
	switchPic('farthingale-sm','off');}
///////////////////////////
// BUMROLL
//////////////////////////
function clickBumroll() {
	if (isBumroll) 	{
		if (isDressed) {
			alert('Prithee undress me from my gown before removing my bumme-roll');
			return;
		}		hideBumroll();
	} 
	else 	{
		if ((!isCorset) && (!isFarthingale)) {
			alert("I should wear a corset or farthingale, ere I put on my bumme-roll.  Prithee put these on me first.");
			return;
			}
		if (isDressed) {
			alert('Prithee undress me from my gown before putting on a bumme-roll');
			return;
		}
		showBumroll();
	}
}
	 		function hideBumroll() {	showhide('bumroll','hide');
	isBumroll=false;
	switchPic('bumroll-sm','off');}   function showBumroll() {	showhide('bumroll','show');
	isBumroll=true;
	switchPic('bumroll-sm','on');} 			 
///////////////////////////
// Partlet
//////////////////////////
function clickPartlet() {
	if (isPartlet) 	{
		hidePartlet();
	} 	else 	{
		if (isShirt) {
			alert('Odds bodkins!  A shirt over a partlet is mightily uncomfortable.  Prithee remove my shirt first.');
			return;
		}
		if (isCamicia) {
			alert('With a high-necked smock and partlet to boot, I shall sweat like a horse...canst thou first change me to a low-necked smock?'); 
			return;
		}
		showhide('partlet','show');
		isPartlet=true;		switchPic('partlet-sm','on');
	}
}
function hidePartlet() { 	showhide('partlet','hide');
	isPartlet=false;	switchPic('partlet-sm','off');}///////////////////////////
// SHIRT
//////////////////////////
function clickShirt() {

// REMOVE SHIRT
	if (isShirt) 	{
		hideShirt();
	} 	else 	{
		//DON'T WEAR SHIRT OVER PARTLET
		if (isPartlet) {
			alert('Odds bodkins!  A shirt over a partlet is mightily uncomfortable.  Prithee remove my partlet first.');
			return;
		}

		//DON'T WEAR SHIRT OVER HIGH-NECKED SMOCK
		if (isCamicia) {
			alert('With a high-necked smock and shirt, I can scarcely breathe.  Change me to a low-necked smock first, I pray you.'); 
			return;
		}

		//SHOW THE SHIRT
		showhide('shirt','show');
		isShirt=true;		switchPic('shirt-sm','on');
	}
}
function hideShirt() {		showhide('shirt','hide');
		isShirt=false;		switchPic('shirt-sm','off');}
		  
/////////////////////////////
// PETTICOAT
////////////////////////////
function clickPetticoat() {
	if (isPetticoat) {		hidePetticoat();
	} else 	{		 
		hidePetticoat();
		showPetticoat();
	}
}
function showPetticoat() {
	if (isFarthingale) {
		if (isBumroll) 		{
			showhide('petticoat-wb','show');
		} else 		{
			showhide('petticoat-nb','show');
		}
	}	else {	 showhide('petbod-nocorset','show');	}

	isPetBod=false;
	isPetticoat=true;
	isDressed=true;
	switchPic('petticoat-sm','on');}
function hidePetticoat() {	 //REMOVE ALL BODICES & SKIRTS
	showhide('petbod-nocorset','hide');
	showhide('petbod-w-corset','hide');
	showhide('petbod-bodice','hide');
	showhide('petbod-bodice-nc','hide');
	showhide('petticoat-wb','hide');
	showhide('petticoat-nb','hide');
	isPetBod=false;
	isPetticoat=false;
	isDressed=false;
	switchPic('petticoat-sm','off');}
////////////////////////////
// PETTICOAT BODIES
///////////////////////////
function clickPetBod() {
	if (isPetBod) {
		hidePetBod();	} 
	else 	{
		//MUST WEAR SMOCK FIRST
		if ((!isSmock) && (!isCamicia)) {
			alert('A Lady always wears a smock under her petticoat bodies.  Please pick one for me.');
			return;
		}		showPetBod();	}
}

function showPetBod() {
		hidePetticoat();
		isPetBod=true;	isDressed=true;	
//REPLACE WHOLE SMOCK WITH TOP	if (isSmock) {
		showSmock();	} else if (isCamicia) {
		showCamicia();
	}

//PETTICOAT SKIRT
	if (isFarthingale) {
		showhide('farthingale-nc','hide');
		showhide('farthingale','show');		if (isBumroll) {
			showhide('petticoat-wb','show');
		} 		else {
			showhide('petticoat-nb','show');
		}
	}
	else 	{
		showhide('petbod-nocorset','show');
	}
	 //PETTICOAT BODICE
	if (isCorset) {
		showhide('petbod-bodice','show');
	} else {
		showhide('petbod-bodice-nc','show');
	}

isDressed=true;
switchPic('petbod-sm','on');


}function hidePetBod() {	isPetBod=false;		isDressed=false;
	//REMOVE ALL BODICES & SKIRTS
	showhide('petbod-nocorset','hide');
	showhide('petbod-w-corset','hide');
	showhide('petbod-bodice','hide');
	showhide('petbod-bodice-nc','hide');
	hidePetticoat();
	//if only a farthingale's under here, show correct picture
	if (isFarthingale) {		showFarthingale();
	}
		//SHOW SMOCK
	if (isSmock) {
		showSmock();
	} else if (isCamicia) {
		showCamicia();
	}	switchPic('petbod-sm','off');	
}
///////////////////////////////
// KIRTLE
///////////////////////////////
function clickKirtle() {
	if (isKirtle) 	{
		hideKirtle();
	}	else 	{
		//CAN'T WEAR KIRTLE WITHOUT FARTHINGALE
		if (!isFarthingale) {
			alert('La!  I cannot wear this kirtle without a farthingale beneath it.  Prithee put on a farthingale first.');
			return;
		}

		//CAN'T WEAR KIRTLE OVER GATHERED PETTICOAT
		if ((isPetBod) || (isPetticoat)) {
			alert('My fitted kirtle looks passing strange when worn over a gathered petticoat; it doth not fit smoothly and evenly over so much petticoat fabric.  Remove my petticoat ere dressing me in a kirtle.'); 
			return;
		}
		showKirtle();
	}
}
function hideKirtle() {	hideForepart();
	showhide('kirtle-nb','hide');
	showhide('kirtle-wb','hide');
	isKirtle=false;
	switchPic('kirtle-sm','off');
	if (!isGown) {
		isDressed=false;
	}
}
function showKirtle() {
	if (isBumroll) {
		showhide('kirtle-wb','show'); 
	} else {
		showhide('kirtle-nb','show');
	}
	switchPic('kirtle-sm','on');
	isKirtle=true;
	isDressed=true;}
function clickForepart() {
	if (isForepart) {
		hideForepart();	} 	else 	{
		if (!isKirtle && !isFarthingale) {
			alert('I must needs have a kirtle or farthingale to fix my forepart too.  Prithee put one on.');
			return;
		}		showForepart();
	}
}function showForepart() {	showhide('forepart','show');
	isForepart=true;	switchPic('forepart-sm','on');}
function hideForepart() {	showhide('forepart','hide');	isForepart=false;	switchPic('forepart-sm','off');
}
/////////////////////////////////////////
// GOWN
////////////////////////////////////////////
function clickGown(gowntype) {
	
	if (isGown) {	hideGown();
		if (curgown != gowntype) {
			showGown(gowntype);			return;
		}
	} 	else 	{	hideGown();
		//MUST WEAR A CORSET FIRST
		if (!isCorset) {
			alert('All fashionable ladies at court wear a corset neath their French gown; please lace me into my corset first.');
			return;
		}

		//MUST WEAR A FARTHINGALE FIRST
		if (!isFarthingale) {
			alert('A French court gown without a farthingale?  I should be laughed at, certes.  Prithee put on my farthingale before lacing on my gown.');
			return;
		}
		showGown(gowntype);
	}
}

function showGown(gowntype) {
	showhide('bodice','show');
	if (isBumroll) {
		if (gowntype=='open') {
			showhide('skirt-owb','show');
		} else {
			showhide('skirt-cwb','show');
		}
	} else {
		if (gowntype=='open') {
			showhide('skirt-onb','show');
		} else {
		showhide('skirt-cnb','show');
		}
	}
	isDressed=true;
	isGown=true;
	curgown=gowntype;
	if (gowntype=='open') {
		switchPic('opengown-sm','on');	
	}
	else if (gowntype=='closed') {		switchPic('closedgown-sm','on');
	}	
}
function hideGown() {	showhide('bodice','hide');
	showhide('skirt-owb','hide');
	showhide('skirt-cwb','hide');
	showhide('skirt-onb','hide');
	showhide('skirt-cnb','hide');
	isGown=false;	hideSleeves();
	if ((!isPetticoat) && (!isKirtle)) {
		isDressed=false;
	}	
	switchPic('closedgown-sm','off');	switchPic('opengown-sm','off');	}
function clickSleeves() {
	if (isSleeves) {
		hideSleeves();
	} 	else 	{
		if (!isGown) {
			alert('I must needs have a gown to lace my sleeves to. Please put on a gown first.');
			return;
		}
		if (isShirt) {
			alert('Odds bodkins! I should scarce be able to move my arms, with a shirt neath these sleeves.  Prithee remove my shirt ere putting on these sleeves.');
			return;
		}
		showSleeves();
	}
}

function showSleeves() {	showhide('sleeves','show')
	isSleeves=true;
	switchPic('sleeves-sm','on');}function hideSleeves() {	showhide('sleeves','hide')
	isSleeves=false;
	switchPic('sleeves-sm','off');}
///////////////////////////////////////
//  HIDE ALL ITEMS
////////////////////////////////////////
function clearClothes() {	hideSmock();	hideCamicia();	hideCorset();	hidePartlet();	hideFarthingale();	hideShirt();	hideBumroll();	hidePetticoat();
	hidePetBod();
	hideGown();
	hideKirtle();
	isDressed=false;
}
///////////////////////////////////////
// SHOWS & HIDES ITEMS
//////////////////////////////////////
function showhide(divID,action)  {
var x;
var showmsg=true;

    //Internet explorer
 if(document.all) {  	var divObject=document.all.item(divID).style;
	}
//Netscape
    else if(document.layers) {    	
    	var divObject = document.layers[divID];
	}
	if (divObject==null) {
	alert('the div ' + divID + ' cannot be found.');	return;
}	if (action=='show') {
        	divObject.visibility="visible";
		}
	else {
		divObject.visibility="hidden";
		}
   }


function loadImages() {
var numClothes=26;showhide('loadalert','show');
//initialize clothing picture arrayvar clothes = new Array(26);
for (i=0;i<numClothes;i++) {
	clothes[i]=new Image();
}
//assign valuesclothes[0].src = "body.gif";
clothes[1].src = "smock.gif";
clothes[3].src = "smocktop.gif";
showhide('smock-smdiv','show');
clothes[2].src = "camicia.gif";
clothes[4].src = "camiciatop.gif";showhide('camicia-smdiv','show');
clothes[5].src = "corset.gif";showhide('corsetbutton','show');
clothes[6].src="farthingale.gif";
clothes[7].src="farthingale-nc.gif";
showhide('farthingalebutton','show');
clothes[12].src="bumroll.gif";
showhide('bumrollbutton','show');
clothes[10].src="partlet.gif";
showhide('partletbutton','show');
clothes[11].src="shirt.gif";
showhide('shirtbutton','show');
clothes[13].src="forepart.gif";
showhide('forepartbutton','show');clothes[16].src="petticoat-nb.gif";
clothes[17].src="petticoat-wb.gif";
showhide('petticoatbutton','show');
clothes[18].src="kirtle-nb.gif";
clothes[19].src="kirtle-wb.gif";
showhide('kirtlebutton','show');
clothes[8].src="petbod-nocorset.gif";
clothes[9].src="petbod-w-corset.gif";
clothes[14].src="petbod-bodice.gif";
clothes[15].src="petbod-bodice-nc.gif";showhide('petbodbutton','show');

clothes[20].src="skirt-owb.gif";
clothes[22].src="skirt-onb.gif";
clothes[21].src="skirt-cwb.gif";
clothes[23].src="skirt-cnb.gif";
clothes[24].src="bodice.gif";
showhide('gownbutton','show');showhide('gownbutton2','show');
clothes[25].src="sleeves.gif";
showhide('sleevesbutton','show');
showhide('loadalert','hide');
showhide('body1','show');
}


function switchPic(imgName,action) {

 if(document.all) {  	var imgObject=document.all.item(imgName);
	if (action=='on') {
	imgObject.src=imgName + "-r.gif";
	}
	else {
	imgObject.src=imgName + ".gif";
	}
}
}
