   menuTimeout = 0;
		function subnavShow(num) {
			if(num==1) {
				document.getElementById('subnav_1').style.display = 'block';
				document.getElementById('subnav_2').style.display = 'none';
			} else if(num==2) {
				document.getElementById('subnav_2').style.display = 'block';
				document.getElementById('subnav_1').style.display = 'none';
			} else {
				document.getElementById('subnav_1').style.display = 'none';
				document.getElementById('subnav_2').style.display = 'none';
			}
			 menuTimeout = 0

		}

		function hideSubmenu(num){
			document.getElementById('subnav_' + num).style.display = 'none';

		}

	function handleSubmenuMouseover(num) {
	if(menuTimeout!=0){
	clearTimeout(menuTimeout);
	}
	document.getElementById('subnav_' + num).style.display = 'block';
	}

	function handleMenuMouseout(num) {
//   menuTimeout = setTimeout("hideSubmenu(" + num + ")", 1500);
    //document.getElementById('subnav_' + num).style.display = 'none';
	}


function $get(key,url){   
    if(arguments.length < 2) url =location.href;   
    if(arguments.length > 0 && key != ""){   
        if(key == "#"){   
            var regex = new RegExp("[#]([^$]*)");   
        } else if(key == "?"){   
            var regex = new RegExp("[?]([^#$]*)");   
        } else {   
            var regex = new RegExp("[?&]"+key+"=([^&#]*)");   
        }   
        var results = regex.exec(url);   
        return (results == null )? "" : results[1];   
    } else {   
        url = url.split("?");   
        var results = {};   
            if(url.length > 1){   
                url = url[1].split("#");   
                if(url.length > 1) results["hash"] = url[1];   
                url[0].split("&").each(function(item,index){   
                    item = item.split("=");   
                    results[item[0]] = item[1];   
                });   
            }   
        return results;   
    }   
}  


function getOriginOptions() {
			var el=document.getElementById('origin');
			var or = $get('origin');
var idx=0;
var	url = 'scripts/origin_options.php';

	var req=new Request({
		method: 'get', 
		url: url, 
		update: 'origin',
		onComplete: function(response) {

			arrResult = response.split('|');
			for (var i=0;i<arrResult.length;i++) {
				var curVal = arrResult[i].split(',');
				var newOption = document.createElement('option');
				if (curVal[1]==or) newOption.selected=true;
				newOption.value = curVal[0].replace('{', '');
				newOption.text = curVal[1].replace('}','');
				if (or==curVal[1].replace('}','')) idx=el.length;
				try {
					el.add(newOption, null); // standards compliant; doesn't work in IE
				}
				catch(ex) {
					el.add(newOption); // IE only
				}
			}
			el.selectedIndex=idx;
		}
	});
	req.send();
getDestinationOptions(or);
	
}

function getDestinationOptions(origin) {
	if (!origin) origin = 0;
var de = $get('destination');
var el=document.getElementById('destination');
var cv = $('origin').get('value');
var idx=0;

el.length = 0;
var newOpt = document.createElement('option');
newOpt.value = 0;
newOpt.text = 'To';
				try {
					el.add(newOpt, null); // standards compliant; doesn't work in IE
				}
				catch(ex) {
					el.add(newOpt); // IE only
				}


var	url = 'scripts/destination_options.php?origin=';
	url += origin;
	var req=new Request({
		method: 'get', 
		url: url, 
		update: 'destination',
		onComplete: function(response) {
			arrResult = response.split('|');
			for (var i=0;i<arrResult.length;i++) {
				var curVal = arrResult[i].split(',');
if (curVal=='') break;
				var newOption = document.createElement('option');
				newOption.value = curVal[0].replace('{', '');
				newOption.text = curVal[1].replace('}','');
				if (de==curVal[1].replace('}','')) idx=el.length;
				try {
					el.add(newOption, null); // standards compliant; doesn't work in IE
				}
				catch(ex) {
					el.add(newOption); // IE only
				}

			}
			el.selectedIndex=idx;
		}
	});
	req.send();
}

function routeCheck(origin, destination)  {
var orig;
var dest;
if (origin=='' || origin===undefined)
	orig = $('origin').get('value');
else
	orig=origin;

if (destination=='' || destination===undefined)
{	dest = $('destination').get('value');
	// alert ("Line 156 in js/stc.js   dest="+dest);
}
else
{
	dest = destination;
	// alert ("Line 161 in js/stc.js   dest="+dest);
}



var	url = 'scripts/route_check.php?origin=';
	url += orig;
	url += '&destination=' + dest;
	var req=new Request({
		method: 'get', 
		url: url, 
		update: 'where_chart',
		onComplete: function(response) {
			$('where_chart').set('html', response);
		}
	});
	req.send();
}

function getTerminalOptions() {
	var qsParams=$get();
	var	url = 'scripts/terminals.php';
	var idx=0;
	if(!(qsParams.terminal===undefined)) {
		url += '?terminal=' + qsParams.terminal;
		showTerminal(qsParams.terminal);
	}
	var req=new Request({
		method: 'get', 
		url: url, 
		update: 'terminals',
		onComplete: function(response) {
			var el=$('terminals');
			arrResult = response.split('|');
			for (var i=0;i<arrResult.length;i++) {
				var curVal = arrResult[i].split(',');
				var newOption = document.createElement('option');
				newOption.value = curVal[0].replace('{', '');
				newOption.text = curVal[1] +  ' (' + curVal[2].replace('}','') +')';
				if (qsParams.terminal==curVal[0].replace('{', '')) idx=el.length;
				try {
					el.add(newOption, null); // standards compliant; doesn't work in IE
				}
				catch(ex) {
					el.add(newOption); // IE only
				}
			}
		el.selectedIndex=idx;
		}
	});
	req.send();
}

function showTerminal(terminalId) {
var tid = $('terminals').get('value');
if (terminalId>0) tid=terminalId;
var	url = 'scripts/show_terminal.php?terminal=';
url =url+=tid;
	var req=new Request({
		method: 'get', 
		url: url, 
		update: 'terminals_panel',
		onComplete: function(response) {
			$('terminals_panel').set('html', response);
		}
	});
	req.send();
	//if (tid>0) showTerminalMap(terminalId);
}

function showTerminalMap(terminalId) {
var tid = ''
if (terminalId=='' || terminalId===undefined)
	tid=$('terminals').get('value');
else
	tid=terminalId;

var	url = 'scripts/get_terminal_map.php?terminal=';
url =url+=tid;
	var req=new Request({
		method: 'get', 
		url: url, 
		update: 'terminalMap',
		onComplete: function(response) {
			$('terminalMap').set('html', response);
		}
	});
	req.send();
}

function getCarrierOptions() {
	var qsParams=$get();
	var	url = 'scripts/carriers.php';
	if(!(qsParams.terminal===undefined)) {
		url += '?terminal=' + qsParams.terminal;
		showTerminal(qsParams.terminal);
	}
	var req=new Request({
		method: 'get', 
		url: url, 
		update: 'terminals',
		onComplete: function(response) {
			var el=document.getElementById('terminals');
			arrResult = response.split('|');
			for (var i=0;i<arrResult.length;i++) {
				var curVal = arrResult[i].split(',');
				var newOption = document.createElement('option');
				newOption.value = curVal[0].replace('{', '').replace('}','');
				newOption.text = curVal[1].replace('{', '').replace('}','') + '(' + curVal[2].replace('{', '').replace('}','') +')';
				try {
					el.add(newOption, null); // standards compliant; doesn't work in IE
				}
				catch(ex) {
					el.add(newOption); // IE only
				}
			}
		}
	});
	req.send();
}

function doTracking()  {
//if (document.getElementById('container_tab'))
//	$('container_tab').set('id', 'container_tab-on');
//if (document.getElementById('pallet_tab-on'))
//	$('pallet_tab-on').set('id', 'pallet_tab');


var awbpre = $('awbpre').value;
var awbnum = $('awbnum').value;

if (awbpre == '' || awbnum == '') return;
//var cv = $('carrier').get('value');
			$('chart_track_panel').set('html', 'Loading...');

var	url = 'scripts/tra_result.php?awbpre=' + awbpre + '&awbnum=' + awbnum;

	var req=new Request({
		method: 'get', 
		url: url, 
		update: 'chart_track_panel',
		onComplete: function(response) {
			$('chart_track_panel').set('html', response);
		}
	});
	req.send();
}

function containerInfo(containerInfo)  {
	
var cv = $('carrier').get('value');

// alert ("Line 305 in js/stc.js: cv: " + cv);

if(cv == 1)
{
	document.getElementById('airline_tabs_special').style.display = 'block';
	document.getElementById('airline_tabs').style.display = 'none';
	
	var tab_container = document.getElementById('container_tab_special');
	var tab_pallet = document.getElementById('pallet_tab_special');
	var tab_bulkload = document.getElementById('bulkload_tab_special');
	
	if (tab_container)
	{
		$('container_tab_special').set('id', 'container_tab_special-on');
	}
	else
	{
		$('container_tab_special-on').set('id', 'container_tab_special-on');
	}
	
	
	if (tab_pallet)
	{
		$('pallet_tab_special').set('id', 'pallet_tab_special');
	}
	else
	{
		$('pallet_tab_special-on').set('id', 'pallet_tab_special');
	}
	
	if (tab_bulkload)
	{
		$('bulkload_tab_special').set('id', 'bulkload_tab_special');
	}
	else
	{
		$('bulkload_tab_special-on').set('id', 'bulkload_tab_special');
	}
	
}
else
{
	if (document.getElementById('container_tab'))
		$('container_tab').set('id', 'container_tab-on');
	if (document.getElementById('pallet_tab-on'))
		$('pallet_tab-on').set('id', 'pallet_tab');
		
		document.getElementById('airline_tabs_special').style.display = 'none';
		document.getElementById('airline_tabs').style.display = 'block';
}


// alert ("Line 360 in js/stc.js: containerInfo: " + containerInfo);
// for Delta, containerInfo = undefined

var	url = (containerInfo ? 'scripts/uldm.php?carrier=' : 'scripts/uld.php?carrier=');
	url += cv;
	url += '&uldType=C';
	
	// alert ("Line 365 in js/stc.js: url: " + url);
	
	var req=new Request({
		method: 'get', 
		url: url, 
		update: 'airline_chart',
		onComplete: function(response) {
			$('airline_chart').set('html', response);
		}
	});
	
	
	
	req.send();
}

function palletteInfo(containerInfo) {
	
	var cv = $('carrier').get('value');
	
	if(cv == 1)
{
	document.getElementById('airline_tabs_special').style.display = 'block';
	document.getElementById('airline_tabs').style.display = 'none';
	
	var tab_container = document.getElementById('container_tab_special');
	var tab_pallet = document.getElementById('pallet_tab_special');
	var tab_bulkload = document.getElementById('bulkload_tab_special');
	
	//alert(cv);
	
	if (tab_container)
	{
		$('container_tab_special').set('id', 'container_tab_special');
	}
	else
	{
		$('container_tab_special-on').set('id', 'container_tab_special');
	}
	
	
	if (tab_pallet)
	{
		$('pallet_tab_special').set('id', 'pallet_tab_special-on');
	}
	else
	{
		$('pallet_tab_special-on').set('id', 'pallet_tab_special-on');
	}
	
	if (tab_bulkload)
	{
		$('bulkload_tab_special').set('id', 'bulkload_tab_special');
	}
	else
	{
		$('bulkload_tab_special-on').set('id', 'bulkload_tab_special');
	}
	
}
else
{
	if (document.getElementById('container_tab-on'))
		$('container_tab-on').set('id', 'container_tab');
	if (document.getElementById('pallet_tab'))
		$('pallet_tab').set('id', 'pallet_tab-on');
		
		document.getElementById('airline_tabs_special').style.display = 'none';
		document.getElementById('airline_tabs').style.display = 'block';
}

/*
if (document.getElementById('pallet_tab'))
	$('pallet_tab').set('id', 'pallet_tab-on');

if (document.getElementById('container_tab-on'))
	$('container_tab-on').set('id', 'container_tab');

var cv = $('carrier').get('value');
*/
var	url = (containerInfo ? 'scripts/uldm.php?carrier=' : 'scripts/uld.php?carrier=');
	url += cv;
	url += '&uldType=P';
	// alert ("Line 455 in js/stc.js: url: "+url);
	var req=new Request({
		method: 'get', 
		url: url, 
		update: 'airline_chart',
		onComplete: function(response) {
			$('airline_chart').set('html', response);
		}
	});
	req.send();
}

function bulkloadInfo(containerInfo) {
	var cv = $('carrier').get('value');
	
	//alert(cv);
	
	if(cv == 1)
{
	document.getElementById('airline_tabs_special').style.display = 'block';
	document.getElementById('airline_tabs').style.display = 'none';
	
	
	var tab_container = document.getElementById('container_tab_special');
	var tab_pallet = document.getElementById('pallet_tab_special');
	var tab_bulkload = document.getElementById('bulkload_tab_special');
	
	if (tab_container)
	{
		$('container_tab_special').set('id', 'container_tab_special');
	}
	else
	{
		$('container_tab_special-on').set('id', 'container_tab_special');
	}
	
	
	if (tab_pallet)
	{
		$('pallet_tab_special').set('id', 'pallet_tab_special');
	}
	else
	{
		$('pallet_tab_special-on').set('id', 'pallet_tab_special');
	}
	
	if (tab_bulkload)
	{
		$('bulkload_tab_special').set('id', 'bulkload_tab_special-on');
	}
	else
	{
		$('bulkload_tab_special-on').set('id', 'bulkload_tab_special-on');
	}
	
}
else
{
	if (document.getElementById('container_tab'))
		$('container_tab').set('id', 'container_tab-on');
	if (document.getElementById('pallet_tab-on'))
		$('pallet_tab-on').set('id', 'pallet_tab');
		
		document.getElementById('airline_tabs_special').style.display = 'none';
		document.getElementById('airline_tabs').style.display = 'block';
}
	
	
	/*
if (document.getElementById('pallet_tab'))
	$('pallet_tab').set('id', 'pallet_tab');

if (document.getElementById('container_tab-on'))
	$('container_tab-on').set('id', 'container_tab');
	
if (document.getElementById('bulkload_tab'))
	$('bulkload_tab').set('id', 'bulkload_tab-on');
*/


var	url = (containerInfo ? 'scripts/uldm.php?carrier=' : 'scripts/uld.php?carrier=');
	url += cv;
	url += '&uldType=B';
	var req=new Request({
		method: 'get', 
		url: url, 
		update: 'airline_chart',
		onComplete: function(response) {
			$('airline_chart').set('html', response);
		}
	});
	req.send();
}


function getCountries() {
	var qsParams=$get();
	var	url = 'scripts/countries.php';
	var req=new Request({
		method: 'get', 
		url: url, 
		update: '',
		onComplete: function(response) {
			var el=$('country');
			el.length=0;
			var defaultOption = document.createElement('option');
			defaultOption.value=0;
			defaultOption.text="Select country...";
			try {
				el.add(defaultOption, null);
			} catch(ex) {
				el.add(defaultOption);
			}
			arrResult = response.split('|');
			for (var i=0;i<arrResult.length;i++) {
				var curVal = arrResult[i].split(',');
				var newOption = document.createElement('option');
				newOption.value = curVal[0].replace('{', '');
				newOption.text = curVal[1].replace('}','');
				try {
					el.add(newOption, null); // standards compliant; doesn't work in IE
				}
				catch(ex) {
					el.add(newOption); // IE only
				}
			}
		}
	});
	req.send();
}

function getAirports() {
	var country = $('country').value;
	var qsParams=$get();
	var	url = 'scripts/airports.php';
		url += '?country=' + country;
	var req=new Request({
		method: 'get', 
		url: url, 
		update: '',
		onComplete: function(response) {
			var el=$('airport');
			el.length=0;
			var defaultOption = document.createElement('option');
			defaultOption.value=0;
			defaultOption.text="Select airport...";
			try {
				el.add(defaultOption, null);
			} catch(ex) {
				el.add(defaultOption);
			}

			arrResult = response.split('|');
			for (var i=0;i<arrResult.length;i++) {
				var curVal = arrResult[i].split(',');
				var newOption = document.createElement('option');
				newOption.value = curVal[0].replace('{','');
				newOption.text = curVal[1];
				if (curVal[2] !='}')
				newOption.text += ', ' + curVal[2].replace('}','');
				newOption.text += ' (' + curVal[0].replace('{','') + ')';
				try {
					el.add(newOption, null); // standards compliant; doesn't work in IE
				}
				catch(ex) {
					el.add(newOption); // IE only
				}
			}
		}
	});
	req.send();
}


function showHide(divName) {
//var divNumber = divName.substring(4);
//var panel = 'panel';
//panel = panel+divNumber;
var el = $(divName);
if (el.getStyle('display') == 'none')
	el.setStyle('display', 'block');
else
	el.setStyle('display', 'none');
}
/*
window.addEvent('domready', function() {
	var status = {
		'true': 'open',
		'false': 'close'
	};
	
	//-vertical

	var myVerticalSlide = new Fx.Slide('vertical_slide');

	$('terminal_click').addEvent('click', function(e){
		e.stop();
		myVerticalSlide.slideIn();
	});

	$('terminal_click').addEvent('click', function(e){
		e.stop();
		myVerticalSlide.slideOut();
	});

	$('terminal_click').addEvent('click', function(e){
		e.stop();
		myVerticalSlide.toggle();
	});

	$('terminal_click').addEvent('click', function(e){
		e.stop();
		myVerticalSlide.hide();
		$('terminal_slide').set('html', status[myVerticalSlide.close]);
	});
	
	$('terminal_slide').addEvent('click', function(e){
		e.stop();
		myVerticalSlide.show();
		$('terminal_slide').set('html', status[myVerticalSlide.open]);
	});
	
	// When Vertical Slide ends its transition, we check for its status
	// note that complete will not affect 'hide' and 'show' methods
	myVerticalSlide.addEvent('complete', function() {
		$('vertical_status').set('html', status[myVerticalSlide.open]);
	});

});
*/
function slideOut() {
var myFx = new Fx.Slide('terminal_slide', {
    mode: 'horizontal',
    //Due to inheritance, all the [Fx][] options are available.
    onComplete: function(){
        alert('Poof!');
    }
//The mode argument provided to slideOut overrides the option set.
}).slideOut('vertical');
	
}

   


// redirect to $url
function url_redirect($url) {
  header("Location: $url");
    //print('<script type="text/javascript">document.location="'.$url.'"</script>');
}