jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
// This code will get the "Remember Me" cookie information
function getCookie()
{
	var SAVELOGIN = $.cookie('SAVELOGIN');
	if ( SAVELOGIN == 'true' )
	{
	var COMPANYNAME = $.cookie('COMPANYNAME');
	var USERLOGIN = $.cookie('USERLOGIN');
	// autofill the fields
	$('#COMPANYNAME').attr("value", COMPANYNAME);
	$('#USERLOGIN').attr("value", USERLOGIN);
	$('#SAVELOGIN').attr("checked", true);
	}
}

function setCookie()
{
	if ($('#SAVELOGIN').attr('checked'))
	{
	var COMPANYNAME = $('#COMPANYNAME').attr("value");
	var USERLOGIN = $('#USERLOGIN').attr("value");
	// set cookies to expire in 28 days
	$.cookie('COMPANYNAME', COMPANYNAME, { expires: 28 });
	$.cookie('USERLOGIN', USERLOGIN, { expires: 28 });
	$.cookie('SAVELOGIN', true, { expires: 28 });
	}
	else
	{
	// reset cookies
	$.cookie('COMPANYNAME', null);
	$.cookie('USERLOGIN', null);
	$.cookie('SAVELOGIN', null);
	}
}


function CheckBasicLogin ( form, Basic )
{
    if (form.COMPANYNAME.value == "") {
        alert( "Please enter a company, member ID, and password to continue." );
        form.COMPANYNAME.focus();
        BasicLogin = 'Yes';
        return false ;
    }

    if (form.USERLOGIN.value == "") {
        alert( "Please enter a company, member ID, and password to continue." );
        form.USERLOGIN.focus();
        BasicLogin = 'Yes';
        return false ;
    }

	setCookie();
    return true ;
}

  function SetReturnDepartCity( form )
{
	form.DEPCITY2.value = form.ARRCITY1.value
}
function SetReturnArriveCity( form )
{
	form.ARRCITY2.value = form.DEPCITY1.value
}
	function PopupOpen(theURL,winName,width,height,features) 
	{ 
		var availW = screen.availWidth;
		var availH = screen.availHeight;
		var popup = null;
		features+=',width=' + width + ',height=' + height;
		if (navigator.appName.indexOf('Microsoft') >= 0) 
			{
			features+=',left=' + ((availW - width - 10) * .5) + ',top=' + ((availH- height - 30) * .5);
			}
		else
			{
			features+=',screenX=' + ((screen.availWidth - width - 10) * .5)+ ',screenY=' + ((screen.availHeight- height - 30) * .5);
			}
		popup = window.open(theURL,winName,features);
		popup.focus();
    }
	
<!--
function StrToHex(sTextToEncode)
{
   return sTextToEncode;
}
//-->
<!--
	function CalendarPopup(sCtrlName,sCtrlValue,flgClose,sCountryCode,flgUseDayLabel) 
	{ 
 PopupOpen('../../CalendarPopup.aspx?control='+sCtrlName+'&start='+StrToHex(sCtrlValue)+'&close='+flgClose+'&CountryCode='+sCountryCode+'&DayLabel='+flgUseDayLabel,'',600,240,'scrollbars=no,toolbar=no,status=no,resizable');
    }
//-->
<!--
function DayGet(Item, TargetID)
{
    	var Days = new Array('SUN','MON','TUE','WED','THU','FRI','SAT');
	    var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
    	var dDate = new Date(Item.value);
    	var dNow = new Date();
    	if (Days[dDate.getDay()] != null)
    	{
    		if (dDate.getFullYear() < (dNow.getFullYear() - 10))
    		{
    			dDate.setFullYear(dDate.getFullYear() + 100);
	    	}
    	}
    	else if (Item.value.match('[0-9]+/[0-9]+') || Item.value.match('[0-9]+-[0-9]+'))
    	{
    		dDate = new Date(Item.value + '/' + dNow.getFullYear());
    	}
    	else if (Item.value.match('[A-Za-z][A-Za-z][A-Za-z][0-9]+ [0-9][0-9]') || Item.value.match('[0-9]+[A-Za-z][A-Za-z][A-Za-z] [0-9][0-9]') || (Item.value.match('[A-Za-z][A-Za-z][A-Za-z][0-9]+, [0-9][0-9]')) || (Item.value.match('[0-9]+[A-Za-z][A-Za-z][A-Za-z], [0-9][0-9]')))
    	{
    		var aDate = Item.value.split(' ');
    		aDate[1] = dNow.getFullYear();
    		dDate = new Date(aDate[0] + ' ' + aDate[1]);
    	}
    	else if (Item.value.match('[0-9]+[A-Za-z]+[0-9][0-9]'))
    	{
    		var aMatches = Item.value.match('[A-Za-z][A-Za-z][A-Za-z]');
    		var iCount = 0;
    		for (iCount = 0; iCount<=12; iCount++)
    		{
    			if (iCount < 12)
    			{
    				if (aMatches[0].substr(0,3).toUpperCase() == months[iCount].substr(0, 3).toUpperCase())
    				{
    					break;
    				}
    			}
    		}
    		if (iCount < 12)
    		{
    			var iIndex = Item.value.indexOf(aMatches[0]);
    			dDate = new Date((iCount + 1) + '/' + Item.value.substring(0, iIndex) + '/' + Item.value.substring(Item.value.length - 2, Item.value.length));
    			if (dDate.getFullYear() < (dNow.getFullYear() - 10))
    			{
    				dDate.setFullYear(dDate.getFullYear() + 100);
    			}
    		}
    	}
    	else if ((Item.value.match('[0-9]+ [A-Za-z]+ [0-9][0-9]') && (Item.value.length > 9)) || (Item.value.match('[0-9]+ [A-Za-z]+, [0-9][0-9]') && (Item.value.length > 10)))
    	{
    		var aDate = Item.value.split(' ');
    		aDate[2] = dNow.getFullYear();
    		dDate = new Date(aDate[0] + ' ' + aDate[1] + ' ' + aDate[2]);
    	}
    	else if (Item.value.match('[A-Za-z][A-Za-z][A-Za-z] [0-9]+ [0-9][0-9]') || Item.value.match('[0-9]+ [A-Za-z][A-Za-z][A-Za-z] [0-9][0-9]') || Item.value.match('[A-Za-z][A-Za-z][A-Za-z] [0-9]+, [0-9][0-9]') || Item.value.match('[0-9]+ [A-Za-z][A-Za-z][A-Za-z], [0-9][0-9]'))
    	{
    		var aDate = Item.value.split(' ');
    		aDate[2] = dNow.getFullYear();
    		dDate = new Date(aDate[0] + ' ' + aDate[1] + ' ' + aDate[2]);
    	}
    	else if (Item.value.match('[A-Za-z][A-Za-z][A-Za-z][0-9]+') || Item.value.match('[0-9]+[A-Za-z][A-Za-z][A-Za-z]') || Item.value.match('[A-Za-z][A-Za-z][A-Za-z] [0-9]+') || Item.value.match('[0-9]+ [A-Za-z][A-Za-z][A-Za-z]'))
    	{
    		dDate = new Date(Item.value + ' ' + dNow.getFullYear());
    	}
    	if (Days[dDate.getDay()] != null)
    	{
            var Today = new Date();
            Today.setDate(Today.getDate() - 1);
            if (dDate < Today)
            {
                dDate.setYear(dDate.getYear() + 1);
            }
            eval('document.all.' + TargetID + '.innerHTML = Days[dDate.getDay()]');
    	}
        else
        {
            eval('document.all.' + TargetID + '.innerHTML = \'&nbsp;\'');
        }
    }
//-->
