// --------------------------------------------------------------------------------
// default.js
// --------------------------------------------------------------------------------
// description - builds page structure
// --------------------------------------------------------------------------------



// Record the original width and original height 
// and call the reloadPage() function
if ( document.layers )
{
	origWidth - innerWidth;
	origHeight - innerHeight;
	
	onresize = reloadPage();
}




// --------------------------------------------------------------------------------
// function :: reloadPage()
// --------------------------------------------------------------------------------
// This function will check if the original width and height have changed and 
// will force the page to reload to insure all CSS styles are reapplied.
//
// This also acst as a fix for absolute positioning of an element and it not being 
// recalculated if a popup warning is displayed on the browser area.  
// --------------------------------------------------------------------------------
function reloadPage()
{
	if( innerWidth != origWidth || innerHeight != origHeight )
	{
		location.reload();
	}
}


// --------------------------------------------------------------------------------
// function :: writeTop()
// --------------------------------------------------------------------------------
// This function will push markup to browser starting after the <body> tag and 
// ending just before the HTML PAGE CONTENT AREA.
// --------------------------------------------------------------------------------
function writeTop()
{
	writeBaseStart();
	writeHeader();
	writeMenu();
	writeContentStart();
}


// --------------------------------------------------------------------------------
// function :: writeBottom()
// --------------------------------------------------------------------------------
// This function will push markup to browser starting just after the HTML PAGE
// CONTENT AREA and ending at the </body> tag.
// --------------------------------------------------------------------------------
function writeBottom()
{
	writeContentEnd();
	writeBaseEnd();
}


// --------------------------------------------------------------------------------
// function :: writeBaseStart()
// --------------------------------------------------------------------------------
// This function outputs the start of the document.
// --------------------------------------------------------------------------------
function writeBaseStart()
{
	//document.write( "<div align='center'>" );
	document.write( "<div id='base'>" );
	document.write( "	<table cellpadding='0' cellspacing='0' border='0' width='100%'>" );
}


// function :: writeHeader()
// --------------------------------------------------------------------------------
// Writes out the header markup
// --------------------------------------------------------------------------------
function writeHeader()
{
	document.write( "		<tr>" );
	document.write( "			<td>" );
	document.write( "				<div id='header'>" );
	document.write( "					<table class='structure'>" );
	document.write( "						<tr>" );
	document.write( "							<td width='76%' valign='middle'>" );
	document.write( "								<a href='index.html'><img src='images/logo/logo.jpg' border='0' alt=''></a>" );
	document.write( "							</td>" );
	document.write( "							<td width='24%' align='right'>" );
	document.write( "								<table class='structure'>" );
	document.write( "									<tr>" );
	document.write( "										<td>tel- 613.270.0374</td>" );
	document.write( "									</tr>" );
	document.write( "									<tr>" );
	document.write( "										<td>fax-613.270.0724</td>" );
	document.write( "									</tr>" );
	document.write( "									<tr>" );
	document.write( "										<td><a href='mailto:info@chillydogs.ca'>info@chillydogs.ca</td>" );
	document.write( "									</tr>" );
	document.write( "								</table>" );
	document.write( "							</td>" );
	document.write( "						</tr>" );
	document.write( "					</table>" );
	document.write( "				</div>" );
	document.write( "			</td>" );
	document.write( "		</tr>" );
}


// function :: writeMenu()
// --------------------------------------------------------------------------------
// Writes out the menu markup
// --------------------------------------------------------------------------------
function writeMenu()
{
	document.write( "		<tr>" );
	document.write( "			<td>" );
	document.write( "				<div id='border1'><div id='border2'><div id='border3'><div id='border4'><div id='border5'>" );	
	document.write( "					<div class='chromestyle' id='chromemenu'>" );
	document.write( "						<ul>" );
	document.write( "							<li><a href='index.html'>HOME&nbsp;&nbsp;&nbsp;&nbsp;</a></li>" );
	document.write( "							<li><a href='#' rel='chillyWear'>CHILLY WEAR&nbsp;&nbsp;&nbsp;&nbsp;</a></li>" );
	document.write( "							<li><a href='fittingRoom.html'>FITTING ROOM&nbsp;&nbsp;&nbsp;&nbsp;</a></li>" );
	document.write( "							<li><a href='storeFinder.html'>STORE FINDER&nbsp;&nbsp;&nbsp;&nbsp;</a></li>" );
	document.write( "							<li><a href='raveReviews.html'>RAVE REVIEWS&nbsp;&nbsp;&nbsp;&nbsp;</a></li>" );
	//document.write( "							<li><a href='photos.html'>PHOTOS&nbsp;&nbsp;&nbsp;&nbsp;</a></li>" );
	document.write( "							<li><a href='contacts.html'>CONTACTS&nbsp;&nbsp;&nbsp;&nbsp;</a></li>" );
	document.write( "							<li><a href='wholesale.html'>WHOLESALE&nbsp;&nbsp;&nbsp;&nbsp;</a></li>" );
	document.write( "						</ul>" );
	document.write( "					</div>" );
	document.write("					<div id='chillyWear' class='dropmenudiv'>");
	document.write("						<a href='chillyWearAllBreed.html'>ALL BREED</a>");
	document.write("						<a href='chillyWearLongAndLean.html'>LONG &amp; LEAN</a>");
	document.write("						<a href='chillyWearWhippet.html'>WHIPPET</a>");
	//document.write("						<a href='productPawsForCharity.html'>PAWS FOR CHARITY</a>");
	document.write("						<a href='chillyWearHumanApparel.html'>HUMAN APPAREL</a>");
	document.write("						<a href='chillyWearCalendars.html'>CALENDARS/POSTERS</a>");	
	document.write("					</div>");	
	document.write("					<script type='text/javascript'>cssdropdown.startchrome('chromemenu')</script>");	
	document.write( "				</div></div></div></div></div>" );
	document.write( "			</td>" );
	document.write( "		</tr>" );
}


// function :: writeContentStart()
// --------------------------------------------------------------------------------
// Writes out the start of the content area.
// --------------------------------------------------------------------------------
function writeContentStart()
{
	document.write( "		<tr>" );
	document.write( "			<td>" );
}


// function :: writeContentEnd()
// --------------------------------------------------------------------------------
// Writes out the end of the content area.
// --------------------------------------------------------------------------------
function writeContentEnd()
{

	document.write( "			</td>" );
	document.write( "		</tr>" );
}


// function :: writeBaseEnd()
// --------------------------------------------------------------------------------
// This function outputs the end of the document.
// --------------------------------------------------------------------------------
function writeBaseEnd()
{
	document.write( "	</table>" );
	document.write( "	<br>" );
	document.write( "	<div id='footer' align='center'>&copy; 2008, All rights reserved. Chilly Dogs&#153;<br><a href='credits.html' class='websiteCredit'>website credits</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href='links.html' class='websiteCredit'>other links</a></div>" );	
	document.write( "</div>" );
	//document.write( "</div>" );
}








function toggleDiv(id,flagit)
{
	if (flagit=="1")
	{
		if (document.layers) document.layers[''+id+''].visibility = "show"
		else if (document.all) document.all[''+id+''].style.visibility = "visible"
		else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "visible"
	}
	else
	if (flagit=="0")
	{
		if (document.layers) document.layers[''+id+''].visibility = "hide"
		else if (document.all) document.all[''+id+''].style.visibility = "hidden"
		else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden"
	}
}







