
/**
 * Go to MyTrips page is the user is already logged in
 * else shows the login prompt
 * @param ssoLoggedIn
 * @return
 */
function openMyTrips(ssoLoggedIn){
	if( ssoLoggedIn == 'Y' ){
		document.dataform.action = '/aev/mytrips.action';
		document.forms['dataform'].submit();
		if( waitpage ){waitpage.show('LOADING MY TRIPS',2000);}
	}
	else {
		myTripsLogin(true);
	}
}

/**
 * Submits the form, to save the trip
 * @return
 */
function saveMyTrip(ssoLoggedIn){
	if( ssoLoggedIn == 'Y' ){
		document.forms['dataform'].action = '/aev/mytrips.action';
		document.forms['dataform'].requestFor.value = 'saveTrip';
		document.forms['dataform'].submit();
		if( waitpage ){waitpage.show('SAVING YOUR TRIP',2000);}
	}
	else {
		myTripsLogin(true,'ST');
	}
}

/**
 * Submits the form, to save the trip
 * @return
 */
function saveChanges(){
	document.forms['dataform'].action = '/aev/mytrips.action';
	document.forms['dataform'].requestFor.value = 'saveTripChanges';
	document.forms['dataform'].submit();
	if( waitpage ){waitpage.show('SAVING CHANGES TO YOUR TRIP',2000);}
}

/**
 * Displays a window (DIV) showing the message to login
 * to access My Trips
 * @return
 */
function myTripsLogin(show, requestFor){
	if( show ){
		$('#mytripLoginLink').removeShadow();
		var coors = getPosition(document.getElementById('breadcrumb'));
		coors[0] -= 5;
		coors[1] += 75;
		$('#mytripLoginLink').css({top:coors[1], left:coors[0]});
		$('#mytripLoginLink').fadeIn('fast');
		$('#mytripLoginLink').dropShadow({blur:1,top:2,left:2,opacity:1});
		document.forms['dataform'].requestFor.value = requestFor;
	}
	else {
		$('#mytripLoginLink').removeShadow();
		$('#mytripLoginLink').fadeOut('fast');
	}
}
