var ct_ie = true;
var ct_block = 'block';

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

function ct_init()
{
	// detect the user agent
	var a = navigator.userAgent.toLowerCase();
	ct_ie = (a.match(/firefox/) == null);

	// set the display type according to browser
	if (!ct_ie) ct_block = 'table-row-group';
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

// this should really be a base definition in the kiosk file
var kiosk_TypePRINT = "menubar=no,toolbar=no,hotkeys=no,status=yes,resizable=no,scrollbars=yes,width=630,height=500";

function ct_print(table, lang)
{
	var printUrl;

	if (lang == "fr")
	{
		printUrl =  '/cgi-bin/voyages/compare/generate.cgi?table=' + table + '&lang=' + lang + '&print=1&expandstate=[' + expandstate + ']';
	}
	else
	{
		printUrl =  '/cgi-bin/travel/compare/generate.cgi?table=' + table + '&lang=' + lang + '&print=1&expandstate=[' + expandstate + ']';
	}
	//alert(printUrl);
	kiosk_OpenWinRTB(printUrl, 'RBCI_PRINT', kiosk_Type2X, kiosk_Type2Y, kiosk_TypePRINT );
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


function ct_expandcollapseExtraInfo(id)
{
	var ei = document.getElementById(id);
	var eia = document.getElementById('a' + id);

	if (ei.style.display == 'none' )
	{
		ei.style.display = ""; //ct_block;
		eia.title = "Hide Help";
		expandstate = expandstate.concat(" " + id);
	}
	else
	{
		ei.style.display = 'none';
		eia.title = "Show Help";
		expandstate = expandstate.replace(new RegExp(' *' + id + ' *',  'g'),"");
	}

	//alert("expandstate: " + expandstate + " id: " + id);
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

function ct_expandcollapse(id)
{
	//alert(id);

	// flip button state
	//var img = document.getElementById(id);

	var e = document.getElementById(id + "_expand");
	var c = document.getElementById(id + "_collapse");
	//var img = document.getElementById(id);
	//alert(img.src);

	// for firefox , need to use 'table-row-group' instead of 'block'
	//alert('     ' + id + ' ' + e.style.display + ' ' + c.style.display);

	if (c.style.display == 'none' )
	{
		e.style.display = 'none';
		c.style.display = '';
		expandstate = expandstate.concat(" " + id);

		//img.src = ct_img_expand.src;
		//img.alt = "Expand Section";
		//img.title = "Expand Section";
		//document.getElementById(id) = ct_imgs['expand'];
	}
	else
	{
		expandstate = expandstate.replace(new RegExp(' *' + id + ' *',  'g'),"");
		e.style.display = '';
		c.style.display = 'none';
		//img.src = ct_img_collapse.src;
		//img.alt = "Collapse Section";
		//img.title = "Collapse Section";
		//document.getElementById(id) = ct_imgs['collapse'];
	}

	//alert("expandstate: " + expandstate + " id: " + id);

}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
