// --------------------------------------------------------------------------------
// tabs.js
// --------------------------------------------------------------------------------
// description - outputs predefined style tab.
// --------------------------------------------------------------------------------


// --------------------------------------------------------------------------------
// function :: writeTabNav( tabName )
// --------------------------------------------------------------------------------
// tabName    - Name of product tab
// --------------------------------------------------------------------------------
function writeTabNav( tabName )
{
	// --------------------------------------------------------------------------------
	// DECLARATIONS
	// --------------------------------------------------------------------------------	
	var target, title, description, footer;

	var outerArray = new Array( 4 );
	for ( var i=0; i < outerArray.length; i++ )
	{	
		// inner array
		// rows = 4
		// cols = 2
		outerArray[ i ] = new Array( 2 );
	}
	
	// --------------------------------------------------------------------------------	
	// INDEX NAV TABS
	// --------------------------------------------------------------------------------	
	if( tabName=="ACCOMMODATION" )
	{
		target = "#";
		title = "ACCOMMODATION";
		description = "Whether you're looking for a <strong>Romantic Escape</strong>, <strong>Corporate Travel</strong>, or<strong> A Getaway with Friends</strong>, The Carmichael Inn & Spa looks forward to welcoming you on your next visit.<br><br><br><br>";
		footer = "<br><br><br>";
		outerArray [0][0] = "Leisure";
		outerArray [0][1] = "http://www.carmichaelinn.com/accommodationLeisure.html";
		outerArray [1][0] = "Corporate";
		outerArray [1][1] = "http://www.carmichaelinn.com/accommodationCorporate.html";
		outerArray [2][0] = "Cancellation Policy";
		outerArray [2][1] = "http://www.carmichaelinn.com/accommodationCancellationPolicy.html";
	}

	if( tabName=="SPA" )
	{
		target = "#";
		title = "SPA";
		description = "The Carmichael Spa is perfect for <br> <strong>Romantic Escapes</strong>, <br><strong>Individual Day Spa Outings</strong>, and <strong>Small Groups</strong>. <br><br>Great location and free parking.<br><br>";
		footer = "<br>";
		outerArray [0][0] = "Treatments";
		outerArray [0][1] = "http://www.carmichaelinn.com/spaTreatments.html";
		outerArray [1][0] = "Packages";
		outerArray [1][1] = "http://www.carmichaelinn.com/spaPackages.html";
		outerArray [2][0] = "Products";
		outerArray [2][1] = "http://www.carmichaelinn.com/spaProducts.html";
		outerArray [3][0] = "Cancellation Policy";
		outerArray [3][1] = "http://www.carmichaelinn.com/spaCancellationPolicy.html";
	}

	if( tabName=="GIFT CERTIFICATES" )
	{
		target = "https://www.carmichaelinn.com/giftCertificates.html";
		title = "GIFT CERTIFICATES";
		description = "<strong>Spa Treatments make a great gift for any Special Occasion!</strong><br>Order a gift certificate online today from the Carmichael Inn & Spa.<p align='center'><img src='images/holidayTree.jpg' border='0' alt='holidayTree' /></p>";
		footer = "<div id='buffer'></div>";
		outerArray [0][0] = "more";
		outerArray [0][1] = "https://www.carmichaelinn.com/giftCertificates.html";
	}

	if( tabName=="SPECIALS" )
	{
		target = "#";
		title = "Winterlude";
		description = "The Canal is Open!! <br><br><br>Winterlude Specials Include:<br>2nd night for $99 Sunday thru Thursday or:<br> Stay the Weekend and enjoy a third night for $49<br><br><br><br><br><br>";
		footer = "";
	}


	// --------------------------------------------------------------------------------	
	// WRITE NAV TAB TO PAGE
	// --------------------------------------------------------------------------------
	document.write( "<!-- tab --->" );
	document.write( "<div id='tab'>" );
	document.write( "	<div id='tabHeader'><a href=" + target + " class='linkTabHeader'>" + title + "</a></div>" );
	document.write( "	<div id='tabContentIndex'>" );
	
	document.write( "		<div id=tabContentIndexText>" );
	document.write( "			<a href=" + target + " class='linkTabContent'>" );
	document.write( "				" + description );
	document.write( "			</a>" );
	document.write( "		</div>" );	
	
	var counter = outerArray.length;

	for ( var i=0; i < outerArray.length; i++ )
	{		
		if( outerArray [0][0] != null && outerArray [i][0] != null )
		{
			document.write( "<div id='tabSelect'>" );
			document.write( "	<table class='structure'" );
			document.write( "		<tr valign='top'>" );
			document.write( "			<td align='left' width='80%'><a href=" + outerArray [i][1] + " class='linkBoldWhite'>" + outerArray [i][0] + "</a></td>" );
			document.write( "			<td align='right' width='20%'><a href=" + outerArray [i][1] + " class='linkBoldWhite'><img src='images/more.jpg' border='0' alt=''></a></td>" );	
			document.write( "		</tr>" );
			document.write( "	</table>" );
			document.write( "</div>" );	

			counter = counter - 1;
		}
	}
	
	if( counter > 0 )
	{
		document.write( "	<table class='structure'" );
		document.write( "		<tr valign='top'>" );
		document.write( "			<td height='"  + counter + "' width='100%'></td>" );
		document.write( "		</tr>" );
		document.write( "	</table>" );
	}
	
	document.write( "	" + footer );	
	
	document.write( "	</div>" );
	document.write( "</div>" );
	document.write( "<!-- tab --->" );
}	
