﻿	// 03/15/08 initial routine, toggle(row) for showing/hiding date/price category rows on Promo Detail
	// 03/15/08 fixed for FireFox
	// 10/15/08 fixed: wasn't "un-bolding" and removing the "tab" from the row that had previously been shown
	// 10/16/08 added: toggleTab to show/hide tabbed promotion detail paragraphs (ship, itin, pricing, etc)
	// 10/21/08 added: selectCat, called when a pricing category is selected on the pricing display, selects a category
	//				from the request form and moves the user to the request form tab

function toggle(row) 
{
//	alert (document.getElementById("lastToggle").value);
//	alert ('Toggle:' + row);
//	alert ('TitleRow='+'title'+row);

//	window.frames("frame1").document.forms("form1").elements("FirstName1").value = "Randy";
//	alert(window.frames("frame1").document.forms("form1").elements("FirstName1").value);

	var lastRow = document.getElementById("lastToggle")	;
	var prevRow = document.getElementById(lastRow.value);
	var thisRow = document.getElementById(row);
	var titleRow = document.getElementById('title'+row);
	var linkRow = document.getElementById('link'+row);

	if (thisRow.style.display=="none")							// if row is hidden
	{
		thisRow.style.display="";							// show the row
		titleRow.className="PriceTableCellBold";			// and hilite Departure Date above shown row
		linkRow.style.fontWeight="bold";					// and bold the link
		
							// turn lastToggle off if not 'none' (uninitialized) and not the same as the row just turned on
		if (document.getElementById("lastToggle").value!='none' && document.getElementById("lastToggle").value!=row )
		{	
			prevRow.style.display="none";					// hide the row
			titleRow = document.getElementById('title'+lastRow.value);
			titleRow.className="PriceTableCell";			// and un-hilite Departure Date above last row
			linkRow = document.getElementById('link'+lastRow.value);
			linkRow.style.fontWeight="normal";				// and un-bold the link
		}
	}
	else														// else, if row is shown
	{
		thisRow.style.display="none";							// hide the row
		titleRow.className="PriceTableCell";					// and un-hilite Departure Date above hidden row
		linkRow.style.fontWeight="normal";						// and un-bold the link		
	}
	document.getElementById("lastToggle").value=row;					// then store this row in 'lastToggle'
}

function toggleTab(row) 
{
//	alert (document.getElementById("lastTab").value);
//	alert ('Tab:' + row);
//	alert ('TitleRow='+'title'+row);

	var lastRow = document.getElementById("lastTab")	;
	var prevRow = document.getElementById(lastRow.value);
	var thisRow = document.getElementById(row);
	var linkRow = document.getElementById('link'+row);

	if (thisRow.style.display=="none")							// if row is hidden
	{
		thisRow.style.display="";								// show the row
		linkRow.className="selected";							// and hilite Departure Date above shown row

		
		// turn lastTab off if not 'none' (uninitialized) and not the same as the row just turned on
		if (document.getElementById("lastTab").value!='none' && document.getElementById("lastTab").value!=row )
		{	
			prevRow.style.display="none";						// hide the row
			linkRow = document.getElementById('link'+lastRow.value);
			linkRow.className="not-selected";					// and un-hilite tab
		}
	}
	else														// else, if row is shown
	{
		thisRow.style.display="none";							// hide the row
		linkRow.className="not-selected";						// and un-hilite Departure Date above hidden row
	}
	document.getElementById("lastTab").value=row;				// then store this row in 'lastToggle'
}

function selectCat(id)	// brings PriceID in from Date/Price form "More Info" click
{
	//	window.frames("frame1").document.forms("form1").elements("FirstName1").value = "Randy";
	// accesses the category list on the request form which is located within the frame1
	// matches the PriceID that is passed in, selects that entry and toggles to the request form

	var theCat = window.frames("frame1").document.forms("form1").elements("Category1");	
	var i = 1;
//					substring from position 0 to the position of '|' for PriceID  (12345| November 12, xxxx)
	while (id!=theCat.options[i].value.substring(0,theCat.options[i].value.indexOf("|")) && i<theCat.length-1)	// loop until we find the PriceID/Category in the list
	{
	  i++;
	}
	theCat.selectedIndex=i;										// select this category
	toggleTab('cellq');											// toggle to the quote request
}
