function init_bears() // initializes the page to prepare for image manipulation
{
	createOrderLayers(); // create the order layers for ie and ns7
	preload_bear_Img(); // preload the bear images
}
function displayBearTitle(BearType) // determine the title of the bear
{
	var tempTtl=''; // initialize the title to null
	
	tempTtl+="<center><table border='2' class='"+css_title+"'><tr><td>";

	// choose class based on the screen size
	
	tempTtl+=eval(BearType+'Title'); // set the title of the page
	
	// fill in the title
	tempTtl+="</td></tr></table></center>";

	writeInfo(dispTtle,tempTtl);
}


function ListBears(bearClass) // list the bears
{
	clearImg_page(); // clear the screen
	genBear=eval(bearClass); // set the generic bear type to the type of interest

	isChoiceBarDisplayed=true; // flag stating the state of the choice bar
	
	if(bearClass == "designer" || bearClass == "wahmbearz" || bearClass == "puppet"){
		displayBearChoice(); // display the choice bar for the bears
	}
	else displayOtherChoice(); // display the choice bar for the bears

	displayBearTitle(bearClass); // determine the title to display
	displayBearList(genBear,bearClass,bearClass); // show the listing of the bears
}

function displayBearList(BearObj,bearClass,bearClass) // show the bears in a list (table)
{
	var bearLstTxt=''; // variable holding the bear list

	// set the width of the bears depending on the size of the screen
	if(sizeSelection == 0) bearimg=150;
	else bearimg=200;

	bearLstTxt+="<form id='orderthisbear'>"; // create a form

	// put the print button on the right side of the layer
	bearLstTxt+="<table width='100%'><tr><td align='right'>";
	bearLstTxt+="<input type='button' value='View Printable Version' onclick='printBearList(\""+bearClass+"\")'>";
	bearLstTxt+="</td></tr></table>";
	
	bearLstTxt+="<table border='2' class='"+css_display+"'>"; // place bears in a table
	
	// fill in the description for the type of bear
	bearLstTxt+="<tr><td colspan=2>"+eval(bearClass+"_desc")+"</td></tr>";
	
	for(blist=0;blist<BearObj.length;blist++){
		bearLstTxt+="<tr><td><img src="+BearObj[blist].loadbearImg().src;
		bearLstTxt+=" width='"+bearimg+"'></td>"; // bear image
		bearLstTxt+="<td>"+BearObj[blist].descr+"<BR><BR>"; // bear description
		
		// depending on the status of the bear display the price, or another appropriate message
		
		if(BearObj[blist].cost == 'SOLD') bearLstTxt+="This bear has been sold."; // bear has been sold
		else if(BearObj[blist].cost == 'HOLD') bearLstTxt+="This bear has tentatively been sold."; // bear is on hold
		else if(BearObj[blist].cost == 'Not for sale'){
			bearLstTxt+="Send me an e-mail if you are interested in a custom made item<BR><a class='smallLinks' href=\"mailto:wahmbearz@shaw.ca?subject=Interested in a custom item\">";
			bearLstTxt+="Please send an Email</a>";
		}
		else {
			bearLstTxt+="Click the order button to order the Item or get the specifics on this item<BR><BR>"
			bearLstTxt+="Cost: "+BearObj[blist].cost+".00 USD&nbsp&nbsp&nbsp"; // cost of the bear
		
			// put an order button with the bear
			bearLstTxt+="<input type='button' value='Order/Specs' onclick='orderBear(\""+bearClass+"\","+blist+")'></td></tr>";
		}
	}

		
	bearLstTxt+="</table>"; // close the table
	bearLstTxt+="</form>"; // close the form

	// write out the information to the page
	writeInfo(dispMain,bearLstTxt); // write the info out

	showBearList(); // show the layers that contain the bear list layers
}

function printBearList(bearType)
{
	var tempURL="displaybears.html?bearType="+bearType; // call the display page with info on type of bear
	displayExtPage(tempURL); // call the floating window
}

function displayBearz() // display the information associated with the bear layer
{

	clearScreen(); // clear the screen
	isChoiceBarDisplayed=true; // flag stating the state of the choice bar
	adjustMain(); // adjust the main display window
	
	displayBearChoice(); // display the choice bar for the bears

	var tempBearz=''; // variable holding the information that will displayed in the main window

	tempBearz+='<p align="justify">In this gallery we have the various types of bears that I have designed. I have '
	tempBearz+='designed a number of bears and other stuffed animals. I have a ';
	tempBearz+='<a class="'+css_def+'" href="javascript:ListBears(\'designer\')">designer bear</a> series that ';
	tempBearz+='are made from a variety of different materials from faux fur to real fur. I ';
	tempBearz+='have range of bears called <a class="'+css_def+'" href="javascript:ListBears(\'wahmbearz\')">Wahmbearz</a> ';
	tempBearz+='that are kid friendly and are made with polystuffing, and have a ';
	tempBearz+='wheat bag insert. Another fun addition to the bear line, are ';
	tempBearz+='<a class="'+css_def+'" href="javascript:ListBears(\'puppet\')">hand puppets</a></p>';
	
	writeInfo(dispMain,tempBearz);

	showMain_page(); // show main links
}

function displayOther() // display the information associated with the bear layer
{
	clearScreen(); // clear the screen
	isChoiceBarDisplayed=true; // flag stating the state of the choice bar
	adjustMain(); // adjust the main display window

	displayOtherChoice(); // display the choice bar for the bears

	var tempBearz=''; // variable holding the information that will displayed in the main window

	tempBearz+='<p align="justify">You will find a variety of different products that compliment the bears. I have ';
	tempBearz+='made <a class="'+css_def+'" href="javascript:ListBears(\'wheatbag\')">wheat bags</a>, '
	tempBearz+='<a class="'+css_def+'" href="javascript:ListBears(\'jacket\')">doll jackets</a>, ';
	tempBearz+='and a hand <a class="'+css_def+'" href="javascript:ListBears(\'mrytle\')">knit doll</a>.';
	
	writeInfo(dispMain,tempBearz);

	showMain_page(); // show main links
}

function displayBearChoice() // display the choice bar for the bears
{
	var tmpChoice=''; // variable holding the bear choices in the menu bar

	tmpChoice+='<center><table border="1"><tr>';
	tmpChoice+='<td id="designerTbl">&nbsp;&nbsp;&nbsp;<a class="'+css_menu+'"href="javascript:ListBears(\'designer\')"';
	tmpChoice+=' onmouseover="javascript:HighLightBear(\'designerTbl\')"';
	tmpChoice+=' onmouseout="javascript:unHightLightBear(\'designerTbl\')">';
	tmpChoice+=' Designer Bearz</a>&nbsp;&nbsp;&nbsp;</td>';

	tmpChoice+='<td id="wahmTbl">&nbsp;&nbsp;&nbsp;<a class="'+css_menu+'" href="javascript:ListBears(\'wahmbearz\')"';
	tmpChoice+=' onmouseover="javascript:HighLightBear(\'wahmTbl\')"';
	tmpChoice+=' onmouseout="javascript:unHightLightBear(\'wahmTbl\')">';
	tmpChoice+=' Wahmbearz</a>&nbsp;&nbsp;&nbsp;</td></center>';

	tmpChoice+='<td id="puppetTbl">&nbsp;&nbsp;&nbsp;<a class="'+css_menu+'" href="javascript:ListBears(\'puppet\')"';
	tmpChoice+=' onmouseover="javascript:HighLightBear(\'puppetTbl\')"';
	tmpChoice+=' onmouseout="javascript:unHightLightBear(\'puppetTbl\')">';
	tmpChoice+=' Hand Puppets</a>&nbsp;&nbsp;&nbsp;</td></center>';
	
	tmpChoice+='</tr></table></center>';

	writeInfo(dispChoiceBar,tmpChoice); // write the information to the menu bar
	positionChoiceBar(); // display the menu choice bar
}

function displayOtherChoice() // display the choice bar for the bears
{
	var tmpChoice=''; // variable holding the bear choices in the menu bar
	
	tmpChoice+='<center><table border="1"><tr>';
	tmpChoice+='<td id="jacketsTble">&nbsp;&nbsp;&nbsp;<a class="'+css_menu+'" href="javascript:ListBears(\'jacket\')"';
	tmpChoice+=' onmouseover="javascript:HighLightBear(\'jacketsTble\')"';
	tmpChoice+=' onmouseout="javascript:unHightLightBear(\'jacketsTble\')">';
	tmpChoice+=' Bear Jackets</a>&nbsp;&nbsp;&nbsp;</td>';

	tmpChoice+='<td id="bagTbl">&nbsp;&nbsp;&nbsp;<a class="'+css_menu+'" href="javascript:ListBears(\'wheatbag\')"';
	tmpChoice+=' onmouseover="javascript:HighLightBear(\'bagTbl\')"';
	tmpChoice+=' onmouseout="javascript:unHightLightBear(\'bagTbl\')">';
	tmpChoice+=' Wheat Bags</a>&nbsp;&nbsp;&nbsp;</td></center>';
	
	tmpChoice+='<td id="mrytleTbl">&nbsp;&nbsp;&nbsp;<a class="'+css_menu+'" href="javascript:ListBears(\'mrytle\')"';
	tmpChoice+=' onmouseover="javascript:HighLightBear(\'mrytleTbl\')"';
	tmpChoice+=' onmouseout="javascript:unHightLightBear(\'mrytleTbl\')">';
	tmpChoice+=' Mrytle Dollz</a>&nbsp;&nbsp;&nbsp;</td></center>';
	
	tmpChoice+='</tr></table></center>';

	writeInfo(dispChoiceBar,tmpChoice); // write the information to the menu bar
	positionChoiceBar(); // display the menu choice bar
}

function positionChoiceBar() // display the menu choice bar
{
	dispChoiceBar.style.top=stripPx(dispBckGnd.style.top)+backGround_brder;
	dispChoiceBar.style.left=stripPx(dispBckGnd.style.left)+backGround_brder;
	
	show(dispChoiceBar);
}

function HighLightBear(tableType) // hightlight the table cell of the bear selection
{
	tempTbleCh=GetObject(tableType);
	tempTbleCh.style.backgroundColor=highLightClr[0]; // highlight the table cell
}

function unHightLightBear(tableType) // unhightlight the table cell of the bear selection
{
	tempTbleCh=GetObject(tableType);
	tempTbleCh.style.backgroundColor=backGroundClr[0]; // unhighlight the table cell
}

