var aDay = 86400000;
var past_date = new Date();
past_date = new Date(past_date.valueOf() - aDay);
//<!--
function ss(w){window.status=w;return true;}
function cs(){window.status='';}
function ga(l){if (l) location.href=l;}
function enabled_searchDateOption(clicked, type)
{
	var f = document.getElementById(type);
	var workRange;
	if (type == "SoldSearch")
	{
		workRange = new Array("FromMonth", "FromDate", "FromYear", "ToMonth", "ToDate", "ToYear");
	}
	else if (type == "BookingSearch")
	{
		workRange = new Array("Month", "Date", "Year");
	}
	if (workRange)
	{
		f['searchByBar'].disabled = !clicked;
		for (i=0; i<workRange.length; i++)
		{
			f[workRange[i]].disabled = clicked;
		}
	}
}	

function Device_OnLoad()
{
	if (navigator.userAgent.indexOf("Windows CE") != -1) 
	{
		window.location="http://www.gotobus.com/palm.html";
	}
}

function Vendor_onLoad(sold, booking)
{
	var s  = document.getElementById('SoldSearch');
	var b = document.getElementById('BookingSearch');
	if (s)
	{
		enabled_searchDateOption(sold, 'SoldSearch');
	}
	if (b)
	{
		enabled_searchDateOption(booking, 'BookingSearch');
	}
}

function opener_url(url)
{
        var target = window;
        if (window.opener != null && window.opener.closed == false)
        {
                target = window.opener;
        }
        target.location.href=url;
        target.focus();
        return false;
}


function open_url_param(url, date)
{
	var lnk = url;
	if (date != "")
	{
		if (lnk.match(/\?/))
		{
			lnk += "&d="+date;
		}
		else
		{
			lnk += "?"+date;
		}
	}
	opener_url(lnk);
}


function pre_set_date()
{
	var date = null;
	if (window.location.search.length>0)
	{
		date = window.location.search.substring(1);
		var s  = document.getElementById('Date');
		set_tour_date (s, date);
	}
}

function set_tour_date(obj, selected_date)
{
	if (obj == null || selected_date == null || selected_date == "")
	{
		return;
	}

	var sdate = selected_date.substr(0, 10);
	for (var i=0; i< obj.options.length; i++)
	{
		var val = obj.options[i].value;
		if (val != "")
		{
			val = val.substr(0,10);
			if (sdate.match(val))
			{
				obj.options.selectedIndex = i;
				return;
			}
		}
	}
}

function OnCalendarClick()
{
        window.open("http://www.gotobus.com/calendar/calendar.html", "calendar", 'width=240,height=200');
}

var browser = window.navigator.appName;
var isIE = false;
var Win = navigator.userAgent.indexOf("Win") > -1;
var MSIE = navigator.appName == "Microsoft Internet Explorer";

if (Win && MSIE)
{
    var n = navigator.userAgent;
    var MSIEVer = n.substr(n.indexOf("MSIE ")+("MSIE ").length, 4);
    MSIEVer = parseFloat(MSIEVer); 
    if (MSIEVer > 5.0)
	isIE = true;
}

function addToFavorites(url, title)
{
    if (window.external)
    {
        window.external.AddFavorite(url, title)
    }
    else
    { 
        alert("Sorry! Your browser doesn't support this function.");
    }
}

var d_about_up = "http://www.gotobus.com/images/explore_up.gif";
var d_about_down = "http://www.gotobus.com/images/explore_down.gif";
function changeImage_aboutus()
{
    if (document.images) {
        if (document.myImage_aboutus.src == d_about_up)
            document.myImage_aboutus.src = d_about_down;
        else
            document.myImage_aboutus.src = d_about_up;
    }
}

function SwitchMenu(obj)
{
    if(document.getElementById) {
        var el = document.getElementById(obj);
        if(el.style.display != "block")
            el.style.display = "block";
        else
            el.style.display = "none";
        changeImage_aboutus();
    }
}

function set_selected(obj, v)
{
    for (var i=0; i<obj.options.length; i++)
    {
        if (obj.options[i].value == v)
        {
            obj.options.selectedIndex = i;
            return i;
        }
    }
    return -1;
}

function clear_show_all_text(obj)
{
        if (obj && obj.value == "Show All")
        {
                obj.value = "";
        }
}

function set_cookie(name, value, expires) 
{
    var today = new Date();
    today.setTime(today.getTime());
    if (expires)
    {
        expires = expires * 1000 * 60 * 60 * 24;
    }
    var expires_date = new Date(today.getTime() + expires);
    document.cookie = name + "=" +escape(value) + (expires ? ";expires=" + expires_date.toGMTString() : "") + ";path=/;domain=gotobus.com";
}

function get_cookie(name)
{
    var start = document.cookie.indexOf( name + "=" );
    var len = start + name.length + 1;
    if ((!start) && (name != document.cookie.substring(0, name.length)))
    {
        return null;
    }
    if (start == -1) return null;
    var end = document.cookie.indexOf(";", len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len, end));
}

function Trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

//-->

// ===================================================================
// Author: Matt Kruse <matt@mattkruse.com>
// WWW: http://www.mattkruse.com/
//
// NOTICE: You may use this code for any purpose, commercial or
// private, without any further permission from the author. You may
// remove this notice from your final code if you wish, however it is
// appreciated by the author if at least my web site address is kept.
//
// You may *NOT* re-distribute this code in any way except through its
// use. That means, you can include it in your product, or your web
// site, or any other form where the code is actually being used. You
// may not put the plain javascript up on your site for download or
// include it in your javascript libraries for download. 
// If you wish to share this code with others, please just point them
// to the URL instead.
// Please DO NOT link directly to my .js files from your site. Copy
// the files to your server and use them there. Thank you.
// ===================================================================

/* SOURCE FILE: AnchorPosition.js */
function getAnchorPosition(anchorname){var useWindow=false;var coordinates=new Object();var x=0,y=0;var use_gebi=false, use_css=false, use_layers=false;if(document.getElementById){use_gebi=true;}else if(document.all){use_css=true;}else if(document.layers){use_layers=true;}if(use_gebi && document.all){x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);}else if(use_gebi){var o=document.getElementById(anchorname);x=AnchorPosition_getPageOffsetLeft(o);y=AnchorPosition_getPageOffsetTop(o);}else if(use_css){x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);}else if(use_layers){var found=0;for(var i=0;i<document.anchors.length;i++){if(document.anchors[i].name==anchorname){found=1;break;}}if(found==0){coordinates.x=0;coordinates.y=0;return coordinates;}x=document.anchors[i].x;y=document.anchors[i].y;}else{coordinates.x=0;coordinates.y=0;return coordinates;}coordinates.x=x;coordinates.y=y;return coordinates;}
function getAnchorWindowPosition(anchorname){var coordinates=getAnchorPosition(anchorname);var x=0;var y=0;if(document.getElementById){if(isNaN(window.screenX)){x=coordinates.x-document.body.scrollLeft+window.screenLeft;y=coordinates.y-document.body.scrollTop+window.screenTop;}else{x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;}}else if(document.all){x=coordinates.x-document.body.scrollLeft+window.screenLeft;y=coordinates.y-document.body.scrollTop+window.screenTop;}else if(document.layers){x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;}coordinates.x=x;coordinates.y=y;return coordinates;}
function AnchorPosition_getPageOffsetLeft(el){var ol=el.offsetLeft;while((el=el.offsetParent) != null){ol += el.offsetLeft;}return ol;}
function AnchorPosition_getWindowOffsetLeft(el){return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;}
function AnchorPosition_getPageOffsetTop(el){var ot=el.offsetTop;while((el=el.offsetParent) != null){ot += el.offsetTop;}return ot;}
function AnchorPosition_getWindowOffsetTop(el){return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;}

/* SOURCE FILE: date.js */
var MONTH_NAMES=new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');var DAY_NAMES=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat');
function LZ(x){return(x<0||x>9?"":"0")+x}
function isDate(val,format){var date=getDateFromFormat(val,format);if(date==0){return false;}return true;}
function compareDates(date1,dateformat1,date2,dateformat2){var d1=getDateFromFormat(date1,dateformat1);var d2=getDateFromFormat(date2,dateformat2);if(d1==0 || d2==0){return -1;}else if(d1 > d2){return 1;}return 0;}
function formatDate(date,format){format=format+"";var result="";var i_format=0;var c="";var token="";var y=date.getYear()+"";var M=date.getMonth()+1;var d=date.getDate();var E=date.getDay();var H=date.getHours();var m=date.getMinutes();var s=date.getSeconds();var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;var value=new Object();if(y.length < 4){y=""+(y-0+1900);}value["y"]=""+y;value["yyyy"]=y;value["yy"]=y.substring(2,4);value["M"]=M;value["MM"]=LZ(M);value["MMM"]=MONTH_NAMES[M-1];value["NNN"]=MONTH_NAMES[M+11];value["d"]=d;value["dd"]=LZ(d);value["E"]=DAY_NAMES[E+7];value["EE"]=DAY_NAMES[E];value["H"]=H;value["HH"]=LZ(H);if(H==0){value["h"]=12;}else if(H>12){value["h"]=H-12;}else{value["h"]=H;}value["hh"]=LZ(value["h"]);if(H>11){value["K"]=H-12;}else{value["K"]=H;}value["k"]=H+1;value["KK"]=LZ(value["K"]);value["kk"]=LZ(value["k"]);if(H > 11){value["a"]="PM";}else{value["a"]="AM";}value["m"]=m;value["mm"]=LZ(m);value["s"]=s;value["ss"]=LZ(s);while(i_format < format.length){c=format.charAt(i_format);token="";while((format.charAt(i_format)==c) &&(i_format < format.length)){token += format.charAt(i_format++);}if(value[token] != null){result=result + value[token];}else{result=result + token;}}return result;}
function _isInteger(val){var digits="1234567890";for(var i=0;i < val.length;i++){if(digits.indexOf(val.charAt(i))==-1){return false;}}return true;}
function _getInt(str,i,minlength,maxlength){for(var x=maxlength;x>=minlength;x--){var token=str.substring(i,i+x);if(token.length < minlength){return null;}if(_isInteger(token)){return token;}}return null;}
function getDateFromFormat(val,format){val=val+"";format=format+"";var i_val=0;var i_format=0;var c="";var token="";var token2="";var x,y;var now=new Date();var year=now.getYear();var month=now.getMonth()+1;var date=1;var hh=now.getHours();var mm=now.getMinutes();var ss=now.getSeconds();var ampm="";while(i_format < format.length){c=format.charAt(i_format);token="";while((format.charAt(i_format)==c) &&(i_format < format.length)){token += format.charAt(i_format++);}if(token=="yyyy" || token=="yy" || token=="y"){if(token=="yyyy"){x=4;y=4;}if(token=="yy"){x=2;y=2;}if(token=="y"){x=2;y=4;}year=_getInt(val,i_val,x,y);if(year==null){return 0;}i_val += year.length;if(year.length==2){if(year > 70){year=1900+(year-0);}else{year=2000+(year-0);}}}else if(token=="MMM"||token=="NNN"){month=0;for(var i=0;i<MONTH_NAMES.length;i++){var month_name=MONTH_NAMES[i];if(val.substring(i_val,i_val+month_name.length).toLowerCase()==month_name.toLowerCase()){if(token=="MMM"||(token=="NNN"&&i>11)){month=i+1;if(month>12){month -= 12;}i_val += month_name.length;break;}}}if((month < 1)||(month>12)){return 0;}}else if(token=="EE"||token=="E"){for(var i=0;i<DAY_NAMES.length;i++){var day_name=DAY_NAMES[i];if(val.substring(i_val,i_val+day_name.length).toLowerCase()==day_name.toLowerCase()){i_val += day_name.length;break;}}}else if(token=="MM"||token=="M"){month=_getInt(val,i_val,token.length,2);if(month==null||(month<1)||(month>12)){return 0;}i_val+=month.length;}else if(token=="dd"||token=="d"){date=_getInt(val,i_val,token.length,2);if(date==null||(date<1)||(date>31)){return 0;}i_val+=date.length;}else if(token=="hh"||token=="h"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<1)||(hh>12)){return 0;}i_val+=hh.length;}else if(token=="HH"||token=="H"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<0)||(hh>23)){return 0;}i_val+=hh.length;}else if(token=="KK"||token=="K"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<0)||(hh>11)){return 0;}i_val+=hh.length;}else if(token=="kk"||token=="k"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<1)||(hh>24)){return 0;}i_val+=hh.length;hh--;}else if(token=="mm"||token=="m"){mm=_getInt(val,i_val,token.length,2);if(mm==null||(mm<0)||(mm>59)){return 0;}i_val+=mm.length;}else if(token=="ss"||token=="s"){ss=_getInt(val,i_val,token.length,2);if(ss==null||(ss<0)||(ss>59)){return 0;}i_val+=ss.length;}else if(token=="a"){if(val.substring(i_val,i_val+2).toLowerCase()=="am"){ampm="AM";}else if(val.substring(i_val,i_val+2).toLowerCase()=="pm"){ampm="PM";}else{return 0;}i_val+=2;}else{if(val.substring(i_val,i_val+token.length)!=token){return 0;}else{i_val+=token.length;}}}if(i_val != val.length){return 0;}if(month==2){if( ((year%4==0)&&(year%100 != 0) ) ||(year%400==0) ){if(date > 29){return 0;}}else{if(date > 28){return 0;}}}if((month==4)||(month==6)||(month==9)||(month==11)){if(date > 30){return 0;}}if(hh<12 && ampm=="PM"){hh=hh-0+12;}else if(hh>11 && ampm=="AM"){hh-=12;}var newdate=new Date(year,month-1,date,hh,mm,ss);return newdate.getTime();}
function parseDate(val){var preferEuro=(arguments.length==2)?arguments[1]:false;generalFormats=new Array('y-M-d','MMM d, y','MMM d,y','y-MMM-d','d-MMM-y','MMM d');monthFirst=new Array('M/d/y','M-d-y','M.d.y','MMM-d','M/d','M-d');dateFirst =new Array('d/M/y','d-M-y','d.M.y','d-MMM','d/M','d-M');var checkList=new Array('generalFormats',preferEuro?'dateFirst':'monthFirst',preferEuro?'monthFirst':'dateFirst');var d=null;for(var i=0;i<checkList.length;i++){var l=window[checkList[i]];for(var j=0;j<l.length;j++){d=getDateFromFormat(val,l[j]);if(d!=0){return new Date(d);}}}return null;}

/* SOURCE FILE: PopupWindow.js */
function PopupWindow_getXYPosition(anchorname){var coordinates;if(this.type == "WINDOW"){coordinates = getAnchorWindowPosition(anchorname);}else{coordinates = getAnchorPosition(anchorname);}this.x = coordinates.x;this.y = coordinates.y;}
function PopupWindow_setSize(width,height){this.width = width;this.height = height;}
function PopupWindow_populate(contents){this.contents = contents;this.populated = false;}
function PopupWindow_setUrl(url){this.url = url;}
function PopupWindow_setWindowProperties(props){this.windowProperties = props;}
function PopupWindow_refresh(){if(this.divName != null){if(this.use_gebi){document.getElementById(this.divName).innerHTML = this.contents;}else if(this.use_css){document.all[this.divName].innerHTML = this.contents;}else if(this.use_layers){var d = document.layers[this.divName];d.document.open();d.document.writeln(this.contents);d.document.close();}}else{if(this.popupWindow != null && !this.popupWindow.closed){if(this.url!=""){this.popupWindow.location.href=this.url;}else{this.popupWindow.document.open();this.popupWindow.document.writeln(this.contents);this.popupWindow.document.close();}this.popupWindow.focus();}}}
function PopupWindow_showPopup(anchorname){this.getXYPosition(anchorname);this.x += this.offsetX;this.y += this.offsetY;if(!this.populated &&(this.contents != "")){this.populated = true;this.refresh();}if(this.divName != null){if(this.use_gebi){document.getElementById(this.divName).style.left = this.x + "px";document.getElementById(this.divName).style.top = this.y + "px";document.getElementById(this.divName).style.visibility = "visible";}else if(this.use_css){document.all[this.divName].style.left = this.x;document.all[this.divName].style.top = this.y;document.all[this.divName].style.visibility = "visible";}else if(this.use_layers){document.layers[this.divName].left = this.x;document.layers[this.divName].top = this.y;document.layers[this.divName].visibility = "visible";}}else{if(this.popupWindow == null || this.popupWindow.closed){if(this.x<0){this.x=0;}if(this.y<0){this.y=0;}if(screen && screen.availHeight){if((this.y + this.height) > screen.availHeight){this.y = screen.availHeight - this.height;}}if(screen && screen.availWidth){if((this.x + this.width) > screen.availWidth){this.x = screen.availWidth - this.width;}}var avoidAboutBlank = window.opera ||( document.layers && !navigator.mimeTypes['*']) || navigator.vendor == 'KDE' ||( document.childNodes && !document.all && !navigator.taintEnabled);this.popupWindow = window.open(avoidAboutBlank?"":"about:blank","window_"+anchorname,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+"");}this.refresh();}}
function PopupWindow_hidePopup(){if(this.divName != null){if(this.use_gebi){document.getElementById(this.divName).style.visibility = "hidden";}else if(this.use_css){document.all[this.divName].style.visibility = "hidden";}else if(this.use_layers){document.layers[this.divName].visibility = "hidden";}}else{if(this.popupWindow && !this.popupWindow.closed){this.popupWindow.close();this.popupWindow = null;}}}
function PopupWindow_isClicked(e){if(this.divName != null){if(this.use_layers){var clickX = e.pageX;var clickY = e.pageY;var t = document.layers[this.divName];if((clickX > t.left) &&(clickX < t.left+t.clip.width) &&(clickY > t.top) &&(clickY < t.top+t.clip.height)){return true;}else{return false;}}else if(document.all){var t = window.event.srcElement;while(t.parentElement != null){if(t.id==this.divName){return true;}t = t.parentElement;}return false;}else if(this.use_gebi && e){var t = e.originalTarget;while(t.parentNode != null){if(t.id==this.divName){return true;}t = t.parentNode;}return false;}return false;}return false;}
function PopupWindow_hideIfNotClicked(e){if(this.autoHideEnabled && !this.isClicked(e)){this.hidePopup();}}
function PopupWindow_autoHide(){this.autoHideEnabled = true;}
function PopupWindow_hidePopupWindows(e){for(var i=0;i<popupWindowObjects.length;i++){if(popupWindowObjects[i] != null){var p = popupWindowObjects[i];p.hideIfNotClicked(e);}}}
function PopupWindow_attachListener(){if(document.layers){document.captureEvents(Event.MOUSEUP);}window.popupWindowOldEventListener = document.onmouseup;if(window.popupWindowOldEventListener != null){document.onmouseup = new Function("window.popupWindowOldEventListener();PopupWindow_hidePopupWindows();");}else{document.onmouseup = PopupWindow_hidePopupWindows;}}
function PopupWindow(){if(!window.popupWindowIndex){window.popupWindowIndex = 0;}if(!window.popupWindowObjects){window.popupWindowObjects = new Array();}if(!window.listenerAttached){window.listenerAttached = true;PopupWindow_attachListener();}this.index = popupWindowIndex++;popupWindowObjects[this.index] = this;this.divName = null;this.popupWindow = null;this.width=0;this.height=0;this.populated = false;this.visible = false;this.autoHideEnabled = false;this.contents = "";this.url="";this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no";if(arguments.length>0){this.type="DIV";this.divName = arguments[0];}else{this.type="WINDOW";}this.use_gebi = false;this.use_css = false;this.use_layers = false;if(document.getElementById){this.use_gebi = true;}else if(document.all){this.use_css = true;}else if(document.layers){this.use_layers = true;}else{this.type = "WINDOW";}this.offsetX = 0;this.offsetY = 0;this.getXYPosition = PopupWindow_getXYPosition;this.populate = PopupWindow_populate;this.setUrl = PopupWindow_setUrl;this.setWindowProperties = PopupWindow_setWindowProperties;this.refresh = PopupWindow_refresh;this.showPopup = PopupWindow_showPopup;this.hidePopup = PopupWindow_hidePopup;this.setSize = PopupWindow_setSize;this.isClicked = PopupWindow_isClicked;this.autoHide = PopupWindow_autoHide;this.hideIfNotClicked = PopupWindow_hideIfNotClicked;}


/* SOURCE FILE: CalendarPopup.js */

function CalendarPopup(){var c;if(arguments.length>0){c = new PopupWindow(arguments[0]);}else{c = new PopupWindow();c.setSize(150,175);}c.offsetX = -152;c.offsetY = 25;c.autoHide();c.monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December");c.monthAbbreviations = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");c.dayHeaders = new Array("S","M","T","W","T","F","S");c.returnFunction = "CP_tmpReturnFunction";c.returnMonthFunction = "CP_tmpReturnMonthFunction";c.returnQuarterFunction = "CP_tmpReturnQuarterFunction";c.returnYearFunction = "CP_tmpReturnYearFunction";c.weekStartDay = 0;c.isShowYearNavigation = false;c.displayType = "date";c.disabledWeekDays = new Object();c.disabledDatesExpression = "";c.yearSelectStartOffset = 2;c.currentDate = null;c.todayText="Today";c.cssPrefix="";c.isShowNavigationDropdowns=false;c.isShowYearNavigationInput=false;window.CP_calendarObject = null;window.CP_targetInput = null;window.CP_dateFormat = "MM/dd/yyyy";c.copyMonthNamesToWindow = CP_copyMonthNamesToWindow;c.setReturnFunction = CP_setReturnFunction;c.setReturnMonthFunction = CP_setReturnMonthFunction;c.setReturnQuarterFunction = CP_setReturnQuarterFunction;c.setReturnYearFunction = CP_setReturnYearFunction;c.setMonthNames = CP_setMonthNames;c.setMonthAbbreviations = CP_setMonthAbbreviations;c.setDayHeaders = CP_setDayHeaders;c.setWeekStartDay = CP_setWeekStartDay;c.setDisplayType = CP_setDisplayType;c.setDisabledWeekDays = CP_setDisabledWeekDays;c.addDisabledDates = CP_addDisabledDates;c.setYearSelectStartOffset = CP_setYearSelectStartOffset;c.setTodayText = CP_setTodayText;c.showYearNavigation = CP_showYearNavigation;c.showCalendar = CP_showCalendar;c.hideCalendar = CP_hideCalendar;c.getStyles = getCalendarStyles;c.refreshCalendar = CP_refreshCalendar;c.getCalendar = CP_getCalendar;c.select = CP_select;c.setCssPrefix = CP_setCssPrefix;c.showNavigationDropdowns = CP_showNavigationDropdowns;c.showYearNavigationInput = CP_showYearNavigationInput;c.copyMonthNamesToWindow();return c;}
function CP_copyMonthNamesToWindow(){if(typeof(window.MONTH_NAMES)!="undefined" && window.MONTH_NAMES!=null){window.MONTH_NAMES = new Array();for(var i=0;i<this.monthNames.length;i++){window.MONTH_NAMES[window.MONTH_NAMES.length] = this.monthNames[i];}for(var i=0;i<this.monthAbbreviations.length;i++){window.MONTH_NAMES[window.MONTH_NAMES.length] = this.monthAbbreviations[i];}}}
function CP_tmpReturnFunction(y,m,d){if(window.CP_targetInput!=null){var dt = new Date(y,m-1,d,0,0,0);if(window.CP_calendarObject!=null){window.CP_calendarObject.copyMonthNamesToWindow();}window.CP_targetInput.value = formatDate(dt,window.CP_dateFormat);}else{alert('Use setReturnFunction() to define which function will get the clicked results!');}}
function CP_tmpReturnMonthFunction(y,m){alert('Use setReturnMonthFunction() to define which function will get the clicked results!\nYou clicked: year='+y+' , month='+m);}
function CP_tmpReturnQuarterFunction(y,q){alert('Use setReturnQuarterFunction() to define which function will get the clicked results!\nYou clicked: year='+y+' , quarter='+q);}
function CP_tmpReturnYearFunction(y){alert('Use setReturnYearFunction() to define which function will get the clicked results!\nYou clicked: year='+y);}
function CP_setReturnFunction(name){this.returnFunction = name;}
function CP_setReturnMonthFunction(name){this.returnMonthFunction = name;}
function CP_setReturnQuarterFunction(name){this.returnQuarterFunction = name;}
function CP_setReturnYearFunction(name){this.returnYearFunction = name;}
function CP_setMonthNames(){for(var i=0;i<arguments.length;i++){this.monthNames[i] = arguments[i];}this.copyMonthNamesToWindow();}
function CP_setMonthAbbreviations(){for(var i=0;i<arguments.length;i++){this.monthAbbreviations[i] = arguments[i];}this.copyMonthNamesToWindow();}
function CP_setDayHeaders(){for(var i=0;i<arguments.length;i++){this.dayHeaders[i] = arguments[i];}}
function CP_setWeekStartDay(day){this.weekStartDay = day;}
function CP_showYearNavigation(){this.isShowYearNavigation =(arguments.length>0)?arguments[0]:true;}
function CP_setDisplayType(type){if(type!="date"&&type!="week-end"&&type!="month"&&type!="quarter"&&type!="year"){alert("Invalid display type! Must be one of: date,week-end,month,quarter,year");return false;}this.displayType=type;}
function CP_setYearSelectStartOffset(num){this.yearSelectStartOffset=num;}
function CP_setDisabledWeekDays(){this.disabledWeekDays = new Object();for(var i=0;i<arguments.length;i++){this.disabledWeekDays[arguments[i]] = true;}}
function CP_addDisabledDates(start, end){if(arguments.length==1){end=start;}if(start==null && end==null){return;}if(this.disabledDatesExpression!=""){this.disabledDatesExpression+= "||";}if(start!=null){start = parseDate(start);start=""+start.getFullYear()+LZ(start.getMonth()+1)+LZ(start.getDate());}if(end!=null){end=parseDate(end);end=""+end.getFullYear()+LZ(end.getMonth()+1)+LZ(end.getDate());}if(start==null){this.disabledDatesExpression+="(ds<="+end+")";}else if(end  ==null){this.disabledDatesExpression+="(ds>="+start+")";}else{this.disabledDatesExpression+="(ds>="+start+"&&ds<="+end+")";}}
function CP_setTodayText(text){this.todayText = text;}
function CP_setCssPrefix(val){this.cssPrefix = val;}
function CP_showNavigationDropdowns(){this.isShowNavigationDropdowns =(arguments.length>0)?arguments[0]:true;}
function CP_showYearNavigationInput(){this.isShowYearNavigationInput =(arguments.length>0)?arguments[0]:true;}
function CP_hideCalendar(){if(arguments.length > 0){window.popupWindowObjects[arguments[0]].hidePopup();}else{this.hidePopup();}}
function CP_refreshCalendar(index){var calObject = window.popupWindowObjects[index];if(arguments.length>1){calObject.populate(calObject.getCalendar(arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]));}else{calObject.populate(calObject.getCalendar());}calObject.refresh();}
function CP_showCalendar(anchorname){if(arguments.length>1){if(arguments[1]==null||arguments[1]==""){this.currentDate=new Date();}else{this.currentDate=new Date(parseDate(arguments[1]));}}this.populate(this.getCalendar());this.showPopup(anchorname);}
function CP_select(inputobj, linkname, format){var selectedDate=(arguments.length>3)?arguments[3]:null;if(!window.getDateFromFormat){alert("calendar.select: To use this method you must also include 'date.js' for date formatting");return;}if(this.displayType!="date"&&this.displayType!="week-end"){alert("calendar.select: This function can only be used with displayType 'date' or 'week-end'");return;}if(inputobj.type!="text" && inputobj.type!="hidden" && inputobj.type!="textarea"){alert("calendar.select: Input object passed is not a valid form input object");window.CP_targetInput=null;return;}if(inputobj.disabled){return;}window.CP_targetInput = inputobj;window.CP_calendarObject = this;this.currentDate=null;var time=0;if(selectedDate!=null){time = getDateFromFormat(selectedDate,format)}else if(inputobj.value!=""){time = getDateFromFormat(inputobj.value,format);}if(selectedDate!=null || inputobj.value!=""){if(time==0){this.currentDate=null;}else{this.currentDate=new Date(time);}}window.CP_dateFormat = format;this.showCalendar(linkname);}
function getCalendarStyles(){var result = "";var p = "";if(this!=null && typeof(this.cssPrefix)!="undefined" && this.cssPrefix!=null && this.cssPrefix!=""){p=this.cssPrefix;}result += "<STYLE>\n";result += "."+p+"cpYearNavigation,."+p+"cpMonthNavigation{background-color:#C0C0C0;text-align:center;vertical-align:center;text-decoration:none;color:#000000;font-weight:bold;}\n";result += "."+p+"cpDayColumnHeader, ."+p+"cpYearNavigation,."+p+"cpMonthNavigation,."+p+"cpCurrentMonthDate,."+p+"cpCurrentMonthDateDisabled,."+p+"cpOtherMonthDate,."+p+"cpOtherMonthDateDisabled,."+p+"cpCurrentDate,."+p+"cpCurrentDateDisabled,."+p+"cpTodayText,."+p+"cpTodayTextDisabled,."+p+"cpText{font-family:arial;font-size:8pt;}\n";result += "TD."+p+"cpDayColumnHeader{text-align:right;border:solid thin #C0C0C0;border-width:0px 0px 1px 0px;}\n";result += "."+p+"cpCurrentMonthDate, ."+p+"cpOtherMonthDate, ."+p+"cpCurrentDate{text-align:right;text-decoration:none;}\n";result += "."+p+"cpCurrentMonthDateDisabled, ."+p+"cpOtherMonthDateDisabled, ."+p+"cpCurrentDateDisabled{color:#D0D0D0;text-align:right;text-decoration:line-through;}\n";result += "."+p+"cpCurrentMonthDate, .cpCurrentDate{color:#000000;}\n";result += "."+p+"cpOtherMonthDate{color:#808080;}\n";result += "TD."+p+"cpCurrentDate{color:white;background-color: #C0C0C0;border-width:1px;border:solid thin #800000;}\n";result += "TD."+p+"cpCurrentDateDisabled{border-width:1px;border:solid thin #FFAAAA;}\n";result += "TD."+p+"cpTodayText, TD."+p+"cpTodayTextDisabled{border:solid thin #C0C0C0;border-width:1px 0px 0px 0px;}\n";result += "A."+p+"cpTodayText, SPAN."+p+"cpTodayTextDisabled{height:20px;}\n";result += "A."+p+"cpTodayText{color:black;}\n";result += "."+p+"cpTodayTextDisabled{color:#D0D0D0;}\n";result += "."+p+"cpBorder{border:solid thin #808080;}\n";result += "</STYLE>\n";return result;}
function CP_getCalendar(){var now = new Date();if(this.type == "WINDOW"){var windowref = "window.opener.";}else{var windowref = "";}var result = "";if(this.type == "WINDOW"){result += "<HTML><HEAD><TITLE>Calendar</TITLE>"+this.getStyles()+"</HEAD><BODY MARGINWIDTH=0 MARGINHEIGHT=0 TOPMARGIN=0 RIGHTMARGIN=0 LEFTMARGIN=0>\n";result += '<CENTER><TABLE WIDTH=100% BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>\n';}else{result += '<TABLE CLASS="'+this.cssPrefix+'cpBorder" WIDTH=144 BORDER=1 BORDERWIDTH=1 CELLSPACING=0 CELLPADDING=1>\n';result += '<TR><TD ALIGN=CENTER>\n';result += '<CENTER>\n';}if(this.displayType=="date" || this.displayType=="week-end"){if(this.currentDate==null){this.currentDate = now;}if(arguments.length > 0){var month = arguments[0];}else{var month = this.currentDate.getMonth()+1;}if(arguments.length > 1 && arguments[1]>0 && arguments[1]-0==arguments[1]){var year = arguments[1];}else{var year = this.currentDate.getFullYear();}var daysinmonth= new Array(0,31,28,31,30,31,30,31,31,30,31,30,31);if( ((year%4 == 0)&&(year%100 != 0) ) ||(year%400 == 0) ){daysinmonth[2] = 29;}var current_month = new Date(year,month-1,1);var display_year = year;var display_month = month;var display_date = 1;var weekday= current_month.getDay();var offset = 0;offset =(weekday >= this.weekStartDay) ? weekday-this.weekStartDay : 7-this.weekStartDay+weekday ;if(offset > 0){display_month--;if(display_month < 1){display_month = 12;display_year--;}display_date = daysinmonth[display_month]-offset+1;}var next_month = month+1;var next_month_year = year;if(next_month > 12){next_month=1;next_month_year++;}var last_month = month-1;var last_month_year = year;if(last_month < 1){last_month=12;last_month_year--;}var date_class;if(this.type!="WINDOW"){result += "<TABLE WIDTH=144 BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>";}result += '<TR>\n';var refresh = windowref+'CP_refreshCalendar';var refreshLink = 'javascript:' + refresh;if(this.isShowNavigationDropdowns){result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="78" COLSPAN="3"><select CLASS="'+this.cssPrefix+'cpMonthNavigation" name="cpMonth" onChange="'+refresh+'('+this.index+',this.options[this.selectedIndex].value-0,'+(year-0)+');">';for( var monthCounter=1;monthCounter<=12;monthCounter++){var selected =(monthCounter==month) ? 'SELECTED' : '';result += '<option value="'+monthCounter+'" '+selected+'>'+this.monthNames[monthCounter-1]+'</option>';}result += '</select></TD>';result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10">&nbsp;</TD>';result += '<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="56" COLSPAN="3"><select CLASS="'+this.cssPrefix+'cpYearNavigation" name="cpYear" onChange="'+refresh+'('+this.index+','+month+',this.options[this.selectedIndex].value-0);">';for( var yearCounter=year-this.yearSelectStartOffset;yearCounter<=year+this.yearSelectStartOffset;yearCounter++){var selected =(yearCounter==year) ? 'SELECTED' : '';result += '<option value="'+yearCounter+'" '+selected+'>'+yearCounter+'</option>';}result += '</select></TD>';}else{if(this.isShowYearNavigation){result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+'('+this.index+','+last_month+','+last_month_year+');">&lt;</A></TD>';result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="58"><SPAN CLASS="'+this.cssPrefix+'cpMonthNavigation">'+this.monthNames[month-1]+'</SPAN></TD>';result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+'('+this.index+','+next_month+','+next_month_year+');">&gt;</A></TD>';result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10">&nbsp;</TD>';result += '<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="'+refreshLink+'('+this.index+','+month+','+(year-1)+');">&lt;</A></TD>';if(this.isShowYearNavigationInput){result += '<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="36"><INPUT NAME="cpYear" CLASS="'+this.cssPrefix+'cpYearNavigation" SIZE="4" MAXLENGTH="4" VALUE="'+year+'" onBlur="'+refresh+'('+this.index+','+month+',this.value-0);"></TD>';}else{result += '<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="36"><SPAN CLASS="'+this.cssPrefix+'cpYearNavigation">'+year+'</SPAN></TD>';}result += '<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="'+refreshLink+'('+this.index+','+month+','+(year+1)+');">&gt;</A></TD>';}else{result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+'('+this.index+','+last_month+','+last_month_year+');">&lt;&lt;</A></TD>\n';result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="100"><SPAN CLASS="'+this.cssPrefix+'cpMonthNavigation">'+this.monthNames[month-1]+' '+year+'</SPAN></TD>\n';result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+'('+this.index+','+next_month+','+next_month_year+');">&gt;&gt;</A></TD>\n';}}result += '</TR></TABLE>\n';result += '<TABLE WIDTH=120 BORDER=0 CELLSPACING=0 CELLPADDING=1 ALIGN=CENTER>\n';result += '<TR>\n';for(var j=0;j<7;j++){result += '<TD CLASS="'+this.cssPrefix+'cpDayColumnHeader" WIDTH="14%"><SPAN CLASS="'+this.cssPrefix+'cpDayColumnHeader">'+this.dayHeaders[(this.weekStartDay+j)%7]+'</TD>\n';}result += '</TR>\n';for(var row=1;row<=6;row++){result += '<TR>\n';for(var col=1;col<=7;col++){var disabled=false;if(this.disabledDatesExpression!=""){var ds=""+display_year+LZ(display_month)+LZ(display_date);eval("disabled=("+this.disabledDatesExpression+")");}var dateClass = "";if((display_month == this.currentDate.getMonth()+1) &&(display_date==this.currentDate.getDate()) &&(display_year==this.currentDate.getFullYear())){dateClass = "cpCurrentDate";}else if(display_month == month){dateClass = "cpCurrentMonthDate";}else{dateClass = "cpOtherMonthDate";}if(disabled || this.disabledWeekDays[col-1]){result += '	<TD CLASS="'+this.cssPrefix+dateClass+'"><SPAN CLASS="'+this.cssPrefix+dateClass+'Disabled">'+display_date+'</SPAN></TD>\n';}else{var selected_date = display_date;var selected_month = display_month;var selected_year = display_year;if(this.displayType=="week-end"){var d = new Date(selected_year,selected_month-1,selected_date,0,0,0,0);d.setDate(d.getDate() +(7-col));selected_year = d.getYear();if(selected_year < 1000){selected_year += 1900;}selected_month = d.getMonth()+1;selected_date = d.getDate();}result += '	<TD CLASS="'+this.cssPrefix+dateClass+'"><A HREF="javascript:'+windowref+this.returnFunction+'('+selected_year+','+selected_month+','+selected_date+');'+windowref+'CP_hideCalendar(\''+this.index+'\');" CLASS="'+this.cssPrefix+dateClass+'">'+display_date+'</A></TD>\n';}display_date++;if(display_date > daysinmonth[display_month]){display_date=1;display_month++;}if(display_month > 12){display_month=1;display_year++;}}result += '</TR>';}var current_weekday = now.getDay() - this.weekStartDay;if(current_weekday < 0){current_weekday += 7;}result += '<TR>\n';result += '	<TD COLSPAN=7 ALIGN=CENTER CLASS="'+this.cssPrefix+'cpTodayText">\n';if(this.disabledDatesExpression!=""){var ds=""+now.getFullYear()+LZ(now.getMonth()+1)+LZ(now.getDate());eval("disabled=("+this.disabledDatesExpression+")");}if(disabled || this.disabledWeekDays[current_weekday+1]){result += '		<SPAN CLASS="'+this.cssPrefix+'cpTodayTextDisabled">'+this.todayText+'</SPAN>\n';}else{result += '		<A CLASS="'+this.cssPrefix+'cpTodayText" HREF="javascript:'+windowref+this.returnFunction+'(\''+now.getFullYear()+'\',\''+(now.getMonth()+1)+'\',\''+now.getDate()+'\');'+windowref+'CP_hideCalendar(\''+this.index+'\');">'+this.todayText+'</A>\n';}result += '		<BR>\n';result += '	</TD></TR></TABLE></CENTER></TD></TR></TABLE>\n';}if(this.displayType=="month" || this.displayType=="quarter" || this.displayType=="year"){if(arguments.length > 0){var year = arguments[0];}else{if(this.displayType=="year"){var year = now.getFullYear()-this.yearSelectStartOffset;}else{var year = now.getFullYear();}}if(this.displayType!="year" && this.isShowYearNavigation){result += "<TABLE WIDTH=144 BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>";result += '<TR>\n';result += '	<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+'CP_refreshCalendar('+this.index+','+(year-1)+');">&lt;&lt;</A></TD>\n';result += '	<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="100">'+year+'</TD>\n';result += '	<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+'CP_refreshCalendar('+this.index+','+(year+1)+');">&gt;&gt;</A></TD>\n';result += '</TR></TABLE>\n';}}if(this.displayType=="month"){result += '<TABLE WIDTH=120 BORDER=0 CELLSPACING=1 CELLPADDING=0 ALIGN=CENTER>\n';for(var i=0;i<4;i++){result += '<TR>';for(var j=0;j<3;j++){var monthindex =((i*3)+j);result += '<TD WIDTH=33% ALIGN=CENTER><A CLASS="'+this.cssPrefix+'cpText" HREF="javascript:'+windowref+this.returnMonthFunction+'('+year+','+(monthindex+1)+');'+windowref+'CP_hideCalendar(\''+this.index+'\');" CLASS="'+date_class+'">'+this.monthAbbreviations[monthindex]+'</A></TD>';}result += '</TR>';}result += '</TABLE></CENTER></TD></TR></TABLE>\n';}if(this.displayType=="quarter"){result += '<BR><TABLE WIDTH=120 BORDER=1 CELLSPACING=0 CELLPADDING=0 ALIGN=CENTER>\n';for(var i=0;i<2;i++){result += '<TR>';for(var j=0;j<2;j++){var quarter =((i*2)+j+1);result += '<TD WIDTH=50% ALIGN=CENTER><BR><A CLASS="'+this.cssPrefix+'cpText" HREF="javascript:'+windowref+this.returnQuarterFunction+'('+year+','+quarter+');'+windowref+'CP_hideCalendar(\''+this.index+'\');" CLASS="'+date_class+'">Q'+quarter+'</A><BR><BR></TD>';}result += '</TR>';}result += '</TABLE></CENTER></TD></TR></TABLE>\n';}if(this.displayType=="year"){var yearColumnSize = 4;result += "<TABLE WIDTH=144 BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>";result += '<TR>\n';result += '	<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="50%"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+'CP_refreshCalendar('+this.index+','+(year-(yearColumnSize*2))+');">&lt;&lt;</A></TD>\n';result += '	<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="50%"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+'CP_refreshCalendar('+this.index+','+(year+(yearColumnSize*2))+');">&gt;&gt;</A></TD>\n';result += '</TR></TABLE>\n';result += '<TABLE WIDTH=120 BORDER=0 CELLSPACING=1 CELLPADDING=0 ALIGN=CENTER>\n';for(var i=0;i<yearColumnSize;i++){for(var j=0;j<2;j++){var currentyear = year+(j*yearColumnSize)+i;result += '<TD WIDTH=50% ALIGN=CENTER><A CLASS="'+this.cssPrefix+'cpText" HREF="javascript:'+windowref+this.returnYearFunction+'('+currentyear+');'+windowref+'CP_hideCalendar(\''+this.index+'\');" CLASS="'+date_class+'">'+currentyear+'</A></TD>';}result += '</TR>';}result += '</TABLE></CENTER></TD></TR></TABLE>\n';}if(this.type == "WINDOW"){result += "</BODY></HTML>\n";}return result;}

<!-- 

var listing_style = "states";

var states = new Array(); 
states["AZ"] = "Arizona";
states["CA"] = "California";
states["CT"] = "Connecticut";
states["DC"] = "District of Columbia";
states["DE"] = "Delaware";
states["FL"] = "Florida";
states["GA"] = "Georgia";
states["MA"] = "Massachusetts";
states["MD"] = "Maryland";
states["NC"] = "North Carolina";
states["NH"] = "New Hampshire";
states["NJ"] = "New Jersey";
states["NV"] = "Nevada";
states["NY"] = "New York";
states["OH"] = "Ohio";
states["PA"] = "Pennsylvania";
states["VA"] = "Virginia";
states["WA"] = "Washington";
states["BC"] = "British Columbia";
 
 //-->

<!--
var b_cities = new Array('Albany, NY', 'Alexandria, VA', 'Amherst, NY', 'Anaheim, CA', 'Arlington, VA', 'Atlanta, GA', 'Baltimore, MD', 'Bellingham Airport, WA', 'Bethesda, MD', 'Boston, MA', 'Carlisle, PA', 'Cincinnati, OH', 'Cupertino, CA', 'Elizabeth, NJ', 'Fairfax, VA', 'Greensboro, NC', 'Hagerstown, MD', 'Harrisburg, PA', 'Hartford, CT', 'Irvington, NJ', 'JFK Airport, NY', 'Jersey City, NJ', 'John Wayne Airport, CA', 'King of Prussia, PA', 'Kingston, NY', 'LAX Airport or Hotels, CA', 'LGA Airport, NY', 'Lancaster, PA', 'Las Vegas, NV', 'Liverpool, NY', 'Los Angeles, CA', 'Miami, FL', 'New York, NY', 'Newark, NJ', 'Niagara Falls, NY', 'Norfolk, VA', 'Oakland, CA', 'Orlando, FL', 'Philadelphia, PA', 'Phoenix, AZ', 'Raleigh, NC', 'Richmond, VA', 'Rochester, NY', 'Rockville, MD', 'San Diego, CA', 'San Francisco, CA', 'Seattle Airport, WA', 'Seattle Downtown, WA', 'Springfield, VA', 'State College, PA', 'Syracuse, NY', 'Tulalip, WA', 'Union City, NJ', 'Vancouver, BC', 'Virginia Beach, VA', 'Washington, DC', 'Wheaton, MD', 'Willow Grove, PA', 'Wilmington, DE', 'Woodbury Outlets, NY', 'York, PA');
var g_bus = new Object;
var total_cities = b_cities.length;
for (i=0; i<total_cities; i++)
  g_bus[b_cities[i]] = new Array;

g_bus['Albany, NY'][0] = 'New York, NY';
g_bus['Alexandria, VA'][0] = 'New York, NY';
g_bus['Amherst, NY'][0] = 'New York, NY';
g_bus['Anaheim, CA'][0] = 'John Wayne Airport, CA';
g_bus['Anaheim, CA'][1] = 'LAX Airport or Hotels, CA';
g_bus['Anaheim, CA'][2] = 'Las Vegas, NV';
g_bus['Anaheim, CA'][3] = 'Los Angeles, CA';
g_bus['Anaheim, CA'][4] = 'San Diego, CA';
g_bus['Anaheim, CA'][5] = 'Universal Studios, CA';
g_bus['Arlington, VA'][0] = 'New York, NY';
g_bus['Atlanta, GA'][0] = 'Greensboro, NC';
g_bus['Atlanta, GA'][1] = 'New York, NY';
g_bus['Atlanta, GA'][2] = 'Washington, DC';
g_bus['Baltimore, MD'][0] = 'New York, NY';
g_bus['Bellingham Airport, WA'][0] = 'Vancouver, BC';
g_bus['Bethesda, MD'][0] = 'New York, NY';
g_bus['Boston, MA'][0] = 'Hartford, CT';
g_bus['Boston, MA'][1] = 'Mohegan Sun Casino, CT';
g_bus['Boston, MA'][2] = 'New York, NY';
g_bus['Carlisle, PA'][0] = 'New York, NY';
g_bus['Cincinnati, OH'][0] = 'New York, NY';
g_bus['Cupertino, CA'][0] = 'Los Angeles, CA';
g_bus['Elizabeth, NJ'][0] = 'Philadelphia Park Casino, PA';
g_bus['Fairfax, VA'][0] = 'Atlantic City, NJ';
g_bus['Greensboro, NC'][0] = 'Atlanta, GA';
g_bus['Greensboro, NC'][1] = 'New York, NY';
g_bus['Greensboro, NC'][2] = 'Washington, DC';
g_bus['Hagerstown, MD'][0] = 'New York, NY';
g_bus['Harrisburg, PA'][0] = 'New York, NY';
g_bus['Hartford, CT'][0] = 'Boston, MA';
g_bus['Hartford, CT'][1] = 'New York, NY';
g_bus['Irvington, NJ'][0] = 'Philly Park Casino, PA';
g_bus['JFK Airport, NY'][0] = 'New York, NY';
g_bus['JFK Airport, NY'][1] = 'Newark, NJ';
g_bus['JFK Airport, NY'][2] = 'Union City, NJ';
g_bus['Jersey City, NJ'][0] = 'Niagara Falls, NY';
g_bus['Jersey City, NJ'][1] = 'Philadelphia Park Casino, PA';
g_bus['John Wayne Airport, CA'][0] = 'Anaheim, CA';
g_bus['King of Prussia, PA'][0] = 'New York, NY';
g_bus['Kingston, NY'][0] = 'New York, NY';
g_bus['LAX Airport or Hotels, CA'][0] = 'Anaheim, CA';
g_bus['LAX Airport or Hotels, CA'][1] = 'Las Vegas, NV';
g_bus['LAX Airport or Hotels, CA'][2] = 'San Diego, CA';
g_bus['LGA Airport, NY'][0] = 'New York, NY';
g_bus['Lancaster, PA'][0] = 'New York, NY';
g_bus['Las Vegas, NV'][0] = 'Anaheim, CA';
g_bus['Las Vegas, NV'][1] = 'LAX Airport or Hotels, CA';
g_bus['Las Vegas, NV'][2] = 'Los Angeles, CA';
g_bus['Las Vegas, NV'][3] = 'San Diego, CA';
g_bus['Liverpool, NY'][0] = 'New York, NY';
g_bus['Los Angeles, CA'][0] = 'Anaheim, CA';
g_bus['Los Angeles, CA'][1] = 'Cupertino, CA';
g_bus['Los Angeles, CA'][2] = 'Las Vegas, NV';
g_bus['Los Angeles, CA'][3] = 'Oakland, CA';
g_bus['Los Angeles, CA'][4] = 'Phoenix, AZ';
g_bus['Los Angeles, CA'][5] = 'San Diego, CA';
g_bus['Los Angeles, CA'][6] = 'San Francisco, CA';
g_bus['Miami, FL'][0] = 'Orlando, FL';
g_bus['New York, NY'][0] = 'Albany, NY';
g_bus['New York, NY'][1] = 'Alexandria, VA ';
g_bus['New York, NY'][2] = 'Amherst, NY';
g_bus['New York, NY'][3] = 'Arlington, VA';
g_bus['New York, NY'][4] = 'Atlanta, GA';
g_bus['New York, NY'][5] = 'Baltimore, MD';
g_bus['New York, NY'][6] = 'Bethesda, MD';
g_bus['New York, NY'][7] = 'Boston, MA';
g_bus['New York, NY'][8] = 'Carlisle, PA';
g_bus['New York, NY'][9] = 'Cincinnati, OH';
g_bus['New York, NY'][10] = 'Greensboro, NC';
g_bus['New York, NY'][11] = 'Hagerstown, MD';
g_bus['New York, NY'][12] = 'Harrisburg, PA';
g_bus['New York, NY'][13] = 'Hartford, CT';
g_bus['New York, NY'][14] = 'JFK Airport, NY';
g_bus['New York, NY'][15] = 'King of Prussia, PA';
g_bus['New York, NY'][16] = 'Kingston, NY';
g_bus['New York, NY'][17] = 'LGA Airport, NY';
g_bus['New York, NY'][18] = 'Lancaster, PA';
g_bus['New York, NY'][19] = 'Liverpool, NY';
g_bus['New York, NY'][20] = 'Niagara Falls, NY';
g_bus['New York, NY'][21] = 'Norfolk, VA';
g_bus['New York, NY'][22] = 'Philadelphia Park Casino, PA';
g_bus['New York, NY'][23] = 'Philadelphia, PA';
g_bus['New York, NY'][24] = 'Raleigh, NC';
g_bus['New York, NY'][25] = 'Richmond, VA';
g_bus['New York, NY'][26] = 'Rochester, NY';
g_bus['New York, NY'][27] = 'Rockville, MD';
g_bus['New York, NY'][28] = 'State College, PA';
g_bus['New York, NY'][29] = 'Syracuse, NY';
g_bus['New York, NY'][30] = 'Virginia Beach, VA';
g_bus['New York, NY'][31] = 'Washington, DC';
g_bus['New York, NY'][32] = 'Willow Grove, PA';
g_bus['New York, NY'][33] = 'Wilmington, DE';
g_bus['New York, NY'][34] = 'Woodbury Outlets, NY';
g_bus['New York, NY'][35] = 'York, PA';
g_bus['Newark, NJ'][0] = 'Niagara Falls, NY';
g_bus['Newark, NJ'][1] = 'Philadelphia Park Casino, PA';
g_bus['Niagara Falls, NY'][0] = 'Jersey City, NJ';
g_bus['Niagara Falls, NY'][1] = 'New York, NY';
g_bus['Niagara Falls, NY'][2] = 'Newark, NJ';
g_bus['Niagara Falls, NY'][3] = 'Union City, NJ';
g_bus['Norfolk, VA'][0] = 'New York, NY';
g_bus['Oakland, CA'][0] = 'Los Angeles, CA';
g_bus['Orlando, FL'][0] = 'Miami, FL';
g_bus['Philadelphia, PA'][0] = 'Elizabeth, NJ';
g_bus['Philadelphia, PA'][1] = 'Irvington, NJ';
g_bus['Philadelphia, PA'][2] = 'Jersey City, NJ';
g_bus['Philadelphia, PA'][3] = 'New York, NY';
g_bus['Philadelphia, PA'][4] = 'Newark, NJ';
g_bus['Philadelphia, PA'][5] = 'Union City, NJ';
g_bus['Philadelphia, PA'][6] = 'Washington, DC';
g_bus['Phoenix, AZ'][0] = 'Los Angeles, CA';
g_bus['Raleigh, NC'][0] = 'New York, NY';
g_bus['Richmond, VA'][0] = 'New York, NY';
g_bus['Richmond, VA'][1] = 'Washington, DC';
g_bus['Rochester, NY'][0] = 'New York, NY';
g_bus['Rockville, MD'][0] = 'New York, NY';
g_bus['San Diego, CA'][0] = 'Anaheim, CA';
g_bus['San Diego, CA'][1] = 'LAX Airport or Hotels, CA';
g_bus['San Diego, CA'][2] = 'Las Vegas, NV';
g_bus['San Diego, CA'][3] = 'Los Angeles, CA';
g_bus['San Francisco, CA'][0] = 'Los Angeles, CA';
g_bus['San Francisco, CA'][1] = 'Reno, NV';
g_bus['Seattle Airport, WA'][0] = 'Vancouver, BC';
g_bus['Seattle Downtown, WA'][0] = 'Vancouver, BC';
g_bus['Springfield, VA'][0] = 'Atlantic City, NJ';
g_bus['State College, PA'][0] = 'New York, NY';
g_bus['Syracuse, NY'][0] = 'New York, NY';
g_bus['Tulalip, WA'][0] = 'Vancouver, BC';
g_bus['Union City, NJ'][0] = 'Niagara Falls, NY';
g_bus['Union City, NJ'][1] = 'Philadelphia Park Casino, PA';
g_bus['Vancouver, BC'][0] = 'Bellingham Airport, WA';
g_bus['Vancouver, BC'][1] = 'Seattle Airport, WA';
g_bus['Vancouver, BC'][2] = 'Seattle Downtown, WA';
g_bus['Vancouver, BC'][3] = 'Tulalip, WA';
g_bus['Virginia Beach, VA'][0] = 'New York, NY';
g_bus['Washington, DC'][0] = 'Atlanta, GA';
g_bus['Washington, DC'][1] = 'Atlantic City, NJ';
g_bus['Washington, DC'][2] = 'Greensboro, NC';
g_bus['Washington, DC'][3] = 'New York, NY';
g_bus['Washington, DC'][4] = 'Philadelphia, PA';
g_bus['Washington, DC'][5] = 'Richmond, VA';
g_bus['Wheaton, MD'][0] = 'Atlantic City, NJ';
g_bus['Willow Grove, PA'][0] = 'New York, NY';
g_bus['Wilmington, DE'][0] = 'New York, NY';
g_bus['Woodbury Outlets, NY'][0] = 'New York, NY';
g_bus['York, PA'][0] = 'New York, NY';
///////////// function
function update_bus_from()
{

	var bf_obj = get_bus_from_obj();

	while(bf_obj.hasChildNodes())
	{
		bf_obj.removeChild(bf_obj.lastChild);

	}
	bf_obj.options[0] = new Option("Departure City","");

	if(listing_style == 'states')
	{
		bus_listing_states(bf_obj);
	}
	else
	{
		//document.getElementById("listing_style").checked = false;
		bus_listing_cityes(bf_obj);
	}
}

function bus_listing_cityes(bf_obj)
{


	for (var i=0; i<b_cities.length; i++)
	{
		var j = i+1;
		bf_obj.options[j] = new Option(b_cities[i], b_cities[i]);
	}
}

function bus_listing_states(bf_obj)
{
	var opg_arr = new Array();

	for (var opg in states )
	{
		opg_arr[opg] = document.createElement("optgroup");

		opg_arr[opg].label = states[opg];
	}

	for (var i=0; i<b_cities.length; i++)
	{
		var j = i+1;

		var o = document.createElement("option");

		var arr = b_cities[i].split(/,\s+/);

		o.value = b_cities[i];

		o.innerHTML = arr[0];

		var short_state = arr[1];

		if(opg_arr[short_state])
			opg_arr[short_state].appendChild(o);

	}

	for(var opg in opg_arr) {

		opg_arr[opg].label = states[opg];

		if(opg_arr[opg].hasChildNodes())
			bf_obj.appendChild(opg_arr[opg]);

	}
}

function change_r_date(d)
{
    if (document.bus_search)
    {
		if (document.bus_search.b_roundtrip.checked == false)
		{
			document.bus_search.return_date.value = '';
		}
		else
		{
			if (d == "")
			{
				d = "N/A";
			}
			var f_count = document.forms.length;
			for (var i=0; i<f_count; ++i)
			{
				if (document.forms[i].r_date)
				{
					document.forms[i].r_date.value = d;
				}
			}
		}
    }
}

function change_passengers(n)
{
    if (document.bus_search)
    {
        var f_count = document.forms.length;
        for (var i=0; i<f_count; ++i)
        {
            if (document.forms[i].vol)
            {
                document.forms[i].vol.value = n;
            }
        }
    }
}

function select_oneway(no_update)
{
	if (document.bus_search)
	{
		document.bus_search.return_date.value = '';
		conditional_update();
	}
}

function select_roundtrip(d)
{
	if (document.bus_search)
	{
		var rd_obj = document.bus_search.return_date;
		if (d == null)
		{
			d = document.bus_search.filter_date.value;
			var darray = d.split("-");
			var start_d = new Date(darray[0], darray[1]-1, darray[2]);
			var r_d = new Date(start_d.valueOf() + 172800000);
			var m = r_d.getMonth() + 1;
			if (m < 10)
			{
				m = "0" + m;
			}
			var dt = r_d.getDate();
			if (dt < 10)
			{
				dt = "0" + dt;
			}
			rd_obj.value = r_d.getFullYear() + '-' + m + '-' + dt;
		}
		conditional_update();
	}
}

function enable_roundtrip()
{
        if (document.bus_search)
        {
                document.bus_search.b_roundtrip.checked = true;
                var t_obj = document.getElementById("timeList");
                if (t_obj && t_obj.innerHTML != "")
                {
                        t_obj.innerHTML = "";
                }
                br_cal.select(document.bus_search.return_date,'br_date','yyyy-MM-dd');
        }
}

function select_preset()
{
	if (document.bus_search && document.bus_search.sbus_from)
	{
		document.bus_search.sbus_from.disabled = true;
		document.bus_search.sbus_to.disabled = true;
		document.bus_search.bus_from.disabled = false;
		document.bus_search.bus_to.disabled = false;
	}
}

function select_search()
{
    if (document.bus_search && document.bus_search.sbus_from)
    {
		document.bus_search.sbus_from.disabled = false;
		document.bus_search.sbus_to.disabled = false;
		document.bus_search.bus_from.disabled = true;
		document.bus_search.bus_to.disabled = true;
	}
}
///////////////////////////// list by states //////////

function list_by_states(f) {

	var bt_obj = get_bus_to_obj();
	var f_states = new Array();
	var opg_arr = new Array();

	for (var i=0; i<g_bus[f].length; i++)
	{

		var citys_arr = g_bus[f][i].split(/,\s+/);
		citys_arr.push(g_bus[f][i]);
		opg_arr.push(citys_arr);
		if( f_states.toString().indexOf(citys_arr[1])<0 ){

			f_states.push(citys_arr[1]);
		}

	}

	var opg_obj = new Array();

	for(var st in states ) {

		if(f_states.toString().indexOf(st) > -1){


			var opt = document.createElement("optgroup");

			for(var j=0; j<opg_arr.length; j++) {

				var o = document.createElement("option");
				o.value = opg_arr[j][2];

				o.innerHTML = opg_arr[j][0];

				if(st == opg_arr[j][1]) {

					opt.label = states[st];

					opt.appendChild(o);
				}
			}
			opg_obj.push(opt);

		}
	}

	for(var opg in opg_obj) {

		if(opg_obj[opg].hasChildNodes())
			bt_obj.appendChild(opg_obj[opg]);

	}
}

//////////////////////////////////// list_by_cities
function list_by_cities(f) {

		var bt_obj = get_bus_to_obj();

	if (f)
		{

		for (var i=0; i<g_bus[f].length; i++)
		{
			var j = i+1;
        	bt_obj.options[j] = new Option(g_bus[f][i], g_bus[f][i]);
	}
	}

}

function update_bus_to(f)
{
	var bt_obj = get_bus_to_obj();

	while(bt_obj.hasChildNodes())
	{
		bt_obj.removeChild(bt_obj.lastChild);

	}
	var op = document.createElement("option");
	op.value = "";
	op.style.color = '#555555';
	op.innerHTML = "Arrival City";

	bt_obj.appendChild(op);
	if (f)
    {
		if(g_bus[f].length >10 && listing_style == 'states') 
		{
			list_by_states(f);
		} 
		else 
		{
			list_by_cities(f);
        }
	}
	conditional_clear();
}

function get_bus_from_obj()
{
	return window.document.bus_search.bus_from;
}

function get_sbus_from_obj()
{
       	return window.document.bus_search.sbus_from;
}

function get_bus_to_obj()
{
	return window.document.bus_search.bus_to;
}

function get_sbus_to_obj()
{
	return window.document.bus_search.sbus_to;
}

function set_selected(obj, v)
{
    for (var i=0; i<obj.options.length; i++)
    {
        if (obj.options[i].value == v)
        {
            obj.options.selectedIndex = i;
            return i;
        }
    }
    return -1;
}

function update_bus_from_to(f, t)
{
    var bf_obj = get_bus_from_obj();
    var index = 0;
    if (f)
    {
		if (g_bus[f] instanceof Array)
		{
			index = set_selected(bf_obj, f);
		}
    }
    else
    {
		index = bf_obj.selectedIndex;
		if (index > 0)
		{
			f = bf_obj.options[index].value;
		}
    }
    if (t)
    {
		if (g_bus[f] instanceof Array)
		{
			var bt_obj = get_bus_to_obj();
			update_bus_to(f);
			index = set_selected(bt_obj, t);
		}
    }
    else if (index > 0)
    {
       	update_bus_to(f);
    }
    return 0;
}

function jump_or_clear()
{
    var bf_obj = get_bus_from_obj();
    var bt_obj = get_bus_to_obj();
    var fv = bf_obj.options[bf_obj.selectedIndex].value;
    var tv = bt_obj.options[bt_obj.selectedIndex].value;
    if (tv == "Mohegan Sun Casino, CT")
    {
        if (fv == "Boston, MA")
        {
            return ga("http://www.gotobus.com/sunshine/boston_mohegansuntour/");
        }
    }
    else if (tv == "Atlantic City, NJ")
    {
        if (fv == "Newark, DE" || fv == "Wilmington, DE" || fv == "New Castle, DE")
        {
            return ga("http://www.gotobus.com/creativetravel/");
        }
        if (fv == "Washington, DC" || fv == "Fairfax, VA" || fv == "Springfield, VA" || fv == "Wheaton, MD")
        {
            return ga("http://www.gotobus.com/rexbus/daytriptotajmahalatlanticcity/");
        }
    }
    else if (tv == "Reno, NV")
    {
        if (fv == "San Francisco, CA")
        {
            return ga("http://www.gotobus.com/usasia/sanfrancisco___reno/");
        }
    }
    else if (fv == "San Diego, CA")
    {
        if (tv == "Viejas Casino, CA" || tv == "Sycuan Casino, CA")
        {
            return ga("http://www.gotobus.com/sunfuntours/");
        }
    }
    else if (tv == "Foxwoods Casino, CT")
    {
		return ga("http://www.gotobus.com/shortline/citytour/foxwoodsresortandcasino1_daytour.html");
    }
    else if (tv == "Philadelphia Park Casino, PA" || tv == "Philly Park Casino, PA")    {
        return ga("http://www.gotobus.com/skybus/philadelphiaparkcasinotour/");
    }
    conditional_clear();
}

function conditional_clear()
{
	var t_obj = document.getElementById("timeList");
	if (t_obj)
	{
	    t_obj.innerHTML = "";
	}
}

function get_departure_date()
{
	return document.bus_search.filter_date;
}

function get_return_date()
{
	return document.bus_search.return_date;
}

function check_bus_data()
{
	if (document.bus_search.option.value == "Select")
	{
		if (document.bus_search.bus_from.value == "")
		{
			alert("Please select a valid Departure City!");
			document.bus_search.bus_from.focus();
			return false;
		}
		if (document.bus_search.bus_to.value == "")
		{
			alert("Please select a valid Arrival City!");
			document.bus_search.bus_to.focus();
			return false;
		}
	}
	else if (document.bus_search.option.value == "Search")
	{
		if (document.bus_search.sbus_from.value == "")
		{
			alert("Please enter a valid Departure City!");
			document.bus_search.sbus_from.focus();
			return false;
		}
		if (document.bus_search.sbus_to.value == "")
		{
			document.bus_search.sbus_to.focus();
			alert("Please enter a valid Arrival City!");
			return false;
		}
	}
    if (document.bus_search.filter_date.value == "")
    {
        alert("Please select a valid Departure Date!");
        document.bus_search.filter_date.focus();
        return false;
    }
    if (document.bus_search.b_roundtrip.checked == true && document.bus_search.return_date.value == "")
    {
        alert("Please select a valid Return Date!");
        document.bus_search.return_date.focus();
        return false;
    }
	return true;
}

function pickdaterange()
{
    var dateObj = document.getElementById("beforethisdate");
    var dateFilter = dateObj.options[dateObj.selectedIndex].value;
    if (document.bus_search && document.bus_search.filter_date)
    {
        document.bus_search.filter_date.value = dateFilter;
    }
    server_update();
    window.document.getElementById("beforethisdate").focus();
}

function conditional_update()
{
	var t_obj = document.getElementById("timeList");
	if (t_obj && t_obj.innerHTML != "")
	{
		server_update();
	}
}

function server_update()
{
	var from;
	var to;
	var vfrom;
	var vto;
	var vopt;
	if (document.bus_search.option && document.bus_search.option.value == "Hidden")
	{
		from = document.bus_search.bus_from.value;
		to   = document.bus_search.bus_to.value;
		vopt = "option=Hidden";
        vfrom = "&bus_from=";
        vto = "&bus_to=";
	}
	else if (document.bus_search.option.value == "Select")
	{
		var bus_from_obj = get_bus_from_obj();
		if (bus_from_obj && bus_from_obj.value != "")
		{
			from = bus_from_obj.value;
		}
		else
		{
			conditional_clear();
			return;
		}
   		var bus_to_obj = get_bus_to_obj();
		if (bus_to_obj && bus_to_obj.value)
		{
			to = bus_to_obj.value;
		}
		else
		{
			conditional_clear();
			return;
		}
        vfrom = "&bus_from=";
        vto = "&bus_to=";
        vopt = "option=Select";
	}
	else
	{
		from = document.bus_search.sbus_from.value;
		to   = document.bus_search.sbus_to.value;
        vfrom = "&sbus_from=";
        vto = "&sbus_to=";
        vopt = "option=Search";
	}
	var date_obj = window.document.bus_search.filter_date;
	var date = "";
	if (date_obj)
	{
		date = date_obj.value;
	}
	else
	{
		date_obj = window.document.getElementById("beforethisdate");
		if (date_obj)
		{
            date = date_obj.value;
		}
    }
	var op_url = "";
	var operator_obj = window.document.getElementById("operatorList");
	if (operator_obj)
	{
		op_url = "&operator=" + operator_obj.value;
	}
	var q_url = "";
	if (window.document.bus_search.quantity && window.document.bus_search.quantity.value > 1)
	{
		var quantity = window.document.bus_search.quantity.value;
		q_url = "&quantity=" + quantity;
	}
	var rt_url = "";
	var return_url = "";
	var roundtrip = -1;
	if (window.document.bus_search.roundtrip)
	{
	    if (document.bus_search.roundtrip[1].checked == true)
	    {
		roundtrip = 1;
	    }
	    else
	    {
	        roundtrip = 0;
	    }
        }
        if (document.bus_search.option && document.bus_search.option.value != "Hidden")
	{
            var return_obj = window.document.bus_search.return_date;
            if (return_obj)
            {
                var return_date = return_obj.value;
                return_url = "&return_date=" + return_date;
	    }
	    if (roundtrip < 0)
	    {
	       roundtrip = 1;
	    }
	}
	else
	{
	    roundtrip = 0;
	}
	rt_url = "&roundtrip=" + roundtrip;
        var nm_url = "";
        if (window.document.bus_search.nm && window.document.bus_search.nm.value != '')
        {
                var nm = window.document.bus_search.nm.value;
                nm_url = "&nm=" + nm;
        }
        var st_url = "";
        if (window.document.bus_search.st && window.document.bus_search.st.value != '')
        {
                var st = window.document.bus_search.st.value;
                st_url = "&st=" + st;
        }
    var selected_url = "&s_pid=" + document.getElementById("pid").value;
    if(document.getElementById("b_roundtrip").checked ==true)
    {

    	var pid_return_obj = document.getElementById("pid_return");
    	if (pid_return_obj != null)
    	{
    	 	selected_url = selected_url + "&s_return_pid=" + document.getElementById("pid_return").value;
    	}
    }
    ga("/cgi-bin/bus.cgi?" + vopt + vfrom + from + vto + to + "&filter_date=" + date + op_url + q_url + rt_url + return_url + nm_url + st_url+selected_url);
}

function assignOperator(operator)
{
    var operatorObj = window.document.getElementById("operatorList");
	for (var i=0; i<operatorObj.options.length; i++)
	{
		if (operatorObj.options[i].value == operator)
        {
	        operatorObj.options[i].selected = true;
		    operatorFilter = operator;
		}
		else
		{
			operatorObj.options[i].selected = false;
		}
	}
	server_update();
}

function reverse_from_to()
{
    var option_obj = document.bus_search.option;
    if (option_obj)
    {

		    var to   = document.bus_search.bus_from.value;
			var from = document.bus_search.bus_to.value;
			var need_clear = 0;
			if (from)
			{
				need_clear = 1;
				update_bus_from_to(from, to);
			}
				to   = document.bus_search.sbus_from.value;
				from = document.bus_search.sbus_to.value;
				if (from)
				{
					need_clear = 1;
					document.bus_search.sbus_from.value = from;
					document.bus_search.sbus_to.value = to;
				}


		if (need_clear == 1)
		{
			conditional_clear();
		}
	}
}

function copy_select_to_search()
{
    var f_obj = document.bus_search.bus_from;
    var t_obj = document.bus_search.bus_to;
    var sf_obj = document.bus_search.sbus_from;
    var st_obj = document.bus_search.sbus_to;
    if (t_obj.selectedIndex > 0)
    {
        st_obj.value = t_obj.options[t_obj.selectedIndex].value;
    }

    if (f_obj.selectedIndex > 0)
    {
        sf_obj.value = f_obj.options[f_obj.selectedIndex].value;
    }
}

function copy_search_to_select()
{
    var sf_obj = document.bus_search.sbus_from;
    var st_obj = document.bus_search.sbus_to;
    update_bus_from_to(sf_obj.value, st_obj.value);
}

function bus_where_switch()
{
    var option_obj = document.bus_search.option;
    if (option_obj)
    {
        conditional_clear();
        var select = document.getElementById("select_where");
        var search = document.getElementById("search_where");
        if (option_obj.value == "Select")
        {
            option_obj.value = "Search";
	    if (select && search)
            {
                select.className = "ivyDivHidden";
                search.className = "ivyDivShow";
            }
            copy_select_to_search();
            document.getElementById("bus_choice_switch").innerHTML = "Switch to Select";
        }
        else
        {
            option_obj.value = "Select";
            if (select && search)
            {
                select.className = "ivyDivShow";
                search.className = "ivyDivHidden";
            }
            copy_search_to_select();
            document.getElementById("bus_choice_switch").innerHTML = "Switch to Text";
        }
    }
}

function bus_departure_date_clicked(y,m,d)
{
	if (m < 10) m = '0' + m;
	if (d < 10) d = '0' + d;
	document.bus_search.filter_date.value = y + '-' + m + '-' + d;
	conditional_update();
}

function bus_return_date_clicked(y,m,d)
{
        if (m < 10) m = '0' + m;
        if (d < 10) d = '0' + d;
        document.bus_search.return_date.value = y + '-' + m + '-' + d;
        conditional_update();
}       

function validate_form_selections(f)
{
    for (var i=0, j=f.elements.length; i<j; i++)
    {
        var t = f.elements[i].type;
        if (t.match(/select/))
		{
		    if (f.elements[i].value == '')
			{
				alert("Please Select " + f.elements[i].name + "!");
                f.elements[i].focus();
				return false;
			}
        }
    }
    if (f.Date != null && f.Date.value == '')
    {
        alert("Please select a valid Date!");
        return false;
    }
    if (f.time != null && f.time.value < 1.01)
    {
        return confirm("Important: It is a new date after passing 12:00am.\nYou have selected a very early schedule on " + f.Date.value + ".  Please confirm.");
    }
}

function onBalloonOver()
{
	var b_obj = document.getElementById('balloon').style;
	b_obj.visibility = "visible";
	b_obj.display = "block";
}

function onBalloonOut()
{
        var b_obj = document.getElementById('balloon').style;
        b_obj.visibility = "hidden";
        b_obj.display = "none";
}

function el_pos(obj)
{
    var xOffset, yOffset, elParent;
    if(obj.offsetTop != 'undefined'){
        yOffset = (obj.offsetTop?obj.offsetTop:0);
        xOffset = (obj.offsetLeft?obj.offsetLeft:0);
        yOffset -= (obj.scrollTop?obj.scrollTop:0);
        xOffset -= (obj.scrollLeft?obj.scrollLeft:0);
        elParent = obj.offsetParent;
        while(elParent){
            yOffset += (elParent.offsetTop?elParent.offsetTop:0);
            xOffset += (elParent.offsetLeft?elParent.offsetLeft:0);
            yOffset -= (elParent.scrollTop?elParent.scrollTop:0);
            xOffset -= (elParent.scrollLeft?elParent.scrollLeft:0);
            elParent = elParent.offsetParent;
        }
    }else if(typeof obj.y != 'undefined'){
        yOffset = obj.y;
        xOffset = obj.x;
    }else{      //information is not available
        yOffset = -1;
        xOffset = -1;
    }
    return {x:xOffset,y:yOffset};
}

function b_text(obj, text)
{
        var b_obj = document.getElementById('balloon').style;
        var tt = "<table width=150 bgcolor=#aaaaaa cellpadding=4 cellspacing=1><tr><td bgcolor=#ffffff style=\"font-family:ariel,sans-serif\">" + text + "</td></tr></table>";
        document.getElementById('balloon').innerHTML = tt;
        var pos = el_pos(obj);
        b_obj.top = pos.y + 16;
        b_obj.left = pos.x + 16;
        b_obj.visibility = "visible";
        b_obj.display = "block";
}

function no_b_text()
{
        var b_obj = document.getElementById('balloon').style;
        b_obj.visibility = "hidden";
        b_obj.display = "none";
}

function check_oneway_image()
{
	if (document.getElementById('b_oneway').checked == true)
	{
		rd_popup.showPopup('r_text_date');
	}
	else
	{
		br_cal.select(document.bus_search.return_date,'br_date','yyyy-MM-dd');
	}
}

function check_oneway_text()
{
	if (document.getElementById('b_oneway').checked == true)
	{
		rd_popup.showPopup('r_text_date');
	}
}


function select_operator(operator)
{
	var old_index = document.getElementById("operatorList").selectedIndex;
	if (document.getElementById("b_roundtrip").checked)
	{
		select_operator_change(operator)
		if (document.getElementById("operatorList").selectedIndex != old_index)
		{
			server_update();
		}
	}
}

function select_operator_change(operator)
{
	var obj_operatorlist = document.getElementById("operatorList");
	for(var i=0;i<obj_operatorlist.length-1;i++)
	{
		if (obj_operatorlist.options[i].value == operator)
		{
			obj_operatorlist.selectedIndex =i;
			if(operator == "")
			{
				document.getElementById("pid").value = "";
			}
		}
	}
	if (document.getElementById("b_roundtrip").checked)
	{
		var obj_operatorlist_return = document.getElementById("operatorList_return");
		if (obj_operatorlist_return !=null)
		{
			for(var j=0;j<obj_operatorlist_return.length-1;j++)
			{
				if (obj_operatorlist_return.options[j].value == operator)
				{
					obj_operatorlist_return.selectedIndex =j;
					if(operator == "")
					{
						document.getElementById("pid_return").value = "";
					}
				}
			}
		}
	}
}


function set_hidden_value(return_spec,pid)
{
	var time = document.getElementById("time"+ pid).value;
	var operator = document.getElementById("operator" + pid).value;
	var obj_pid = document.getElementById("pid" + return_spec);
	var obj_time =document.getElementById("time" + return_spec);

	var discount_obj = document.getElementById("Discount" + return_spec);
	var depart_obj = document.getElementById("Departure_form" + return_spec);
	var current_vol_obj = document.getElementById("vol" + return_spec + pid);
	var arrival_obj = document.getElementById("Arrival_form" + return_spec);
	var vol_obj = document.getElementById("vol" + return_spec);

	var departure_value;
	var discount_value;
	var arrival_value;
	var dd_arrival_value;
	var dd_departure_value;
	var has_operator;

	var arrival_pid_obj = document.getElementById('Arrival' + return_spec + pid);
	var departure_pid_obj = document.getElementById('Departure' + return_spec + pid);
	var discount_pid_obj = document.getElementById('Discount' + return_spec + pid);
	var operatorList_obj = document.getElementById("operatorList"  + return_spec);
	var dd_arrival_obj = document.getElementById("dd" + pid + "_Arrival");
	var dd_depart_obj = document.getElementById("dd" + pid + "_Departure");
        var st_obj = document.getElementById("st");

	if (arrival_pid_obj != null  )
	{
		arrival_value = arrival_pid_obj.value;
	}

	if (departure_pid_obj != null  )
	{
		departure_value = departure_pid_obj.value;
	}

	if (discount_pid_obj != null  )
	{
		discount_value = discount_pid_obj.value;
	}

	if (operatorList_obj != null && st_obj.value < 1)
	{
		has_operator = "true";
	}

	if (dd_arrival_obj != null  )
	{
		dd_arrival_value = dd_arrival_obj.value;
	}

	if (dd_depart_obj != null  )
	{
		dd_departure_value = dd_depart_obj.value;
	}

	depart_obj.value = departure_value;
	discount_obj.value = discount_value;
	arrival_obj.value = arrival_value;
	if (dd_arrival_value)
	{
		arrival_obj.value = dd_arrival_value ;
	}
	if(dd_departure_value)
	{
		depart_obj.value = dd_departure_value;
	}
	obj_pid.value = pid;
	obj_time.value = time;
	vol_obj.value = current_vol_obj.value;
 	if ( has_operator )
	{
		select_operator(operator);
	}
}

function obj_value_change(value,current_pid,return_spec,operator)
{
	var pid_obj = document.getElementById("pid"+return_spec);
	var selected_pid = pid_obj.value;
	if (selected_pid =="" || current_pid != selected_pid)
	{
		document.getElementById("radselect" + return_spec + current_pid).checked =true;
		pid_obj.value = current_pid;
		var operatorList_obj = document.getElementById("operatorList"  + return_spec);
		if (operatorList_obj !=null)
		{
			select_operator(operator);
		}
	}
	set_hidden_value(return_spec,current_pid)
}


function validate_form()
{
	var pid = document.getElementById("pid").value;

	if(pid=="")
	{
		alert("Please select a departure schedule.");
		return false;
	}
	var depart_obj = document.getElementById('Departure_form');
	if (depart_obj.value =="")
	{
		alert("Please select Departure of departure schedule.");
		document.getElementById('Departure' + pid).focus();
		return false;
	}
	var arrival_obj = document.getElementById('Arrival' + pid);
	var departure_obj = document.getElementById('Departure' + pid);
	var discount_obj = document.getElementById('Discount' + pid);
	var ddl_arrival_obj = document.getElementById('dd' + pid + '_Arrival');
	var ddl_departure_obj = document.getElementById('dd' + pid + '_Departure');



	if (departure_obj != null  )
	{
		if (departure_obj.value =='')
		{
			alert("Please Select Departure of departure schedule!");
        	departure_obj.focus();
			return false;
		}
	}

	if (ddl_departure_obj != null)
	{
		if (ddl_departure_obj.value =='')
		{
			alert("Please Select Departure of departure schedule!");
        	ddl_departure_obj.focus();
			return false;
		}
		else
		{
			document.getElementById("Departure_form").value = ddl_departure_obj.value;
		}
	}

	if (arrival_obj != null  )
	{
		if ( arrival_obj.value =='' )
		{
			alert("Please Select Arrival of departure schedule!");
        	arrival_obj.focus();
			return false;
		}
	}

	if (ddl_arrival_obj != null)
	{
		if(ddl_arrival_obj.value =='')
		{
			alert("Please Select Arrival of departure schedule!");
        	ddl_arrival_obj.focus();
			return false;
		}
		else
		{
			document.getElementById("Arrival_form").value = ddl_arrival_obj.value;
		}
	}



	if (discount_obj != null)
	{
		if(discount_obj.value =='')
		{
			alert("Please Select Discount of departure schedule!");
        	discount_obj.focus();
			return false;
		}
	}

	if (document.getElementById("b_roundtrip").checked ==true)
	{
		var pid = document.getElementById("pid_return").value;
		if(document.getElementById("frmsearch").pid_return.value=="")
		{
			alert("Please select a return schedule.");
			return false;
		}
		var depart_obj_return = document.getElementById('Departure_form_return');
		if (depart_obj_return.value =="")
		{
			alert("Please select Departure of return schedule.");
			document.getElementById('Departure_return' + pid).focus();
			return false;
		}

		var arrival_return_obj = document.getElementById('Arrival_return' + pid);
		var departure_return_obj = document.getElementById('Departure_return' + pid);
		var discount_return_obj = document.getElementById('Discount_return' + pid);
		var ddl_arrival_return_obj = document.getElementById('dd' + pid + '_Arrival');
		var ddl_departure_return_obj = document.getElementById('dd' + pid + '_Departure');


		if (departure_return_obj != null  )
		{
			if (departure_return_obj.value =='')
			{
				alert("Please Select Departure of return schedule!");
	        	departure_return_obj.focus();
				return false;
			}
		}

		if (ddl_departure_return_obj != null)
		{
			if (ddl_departure_return_obj.value =='')
			{
				alert("Please Select Reparture of return schedule!");
	        	ddl_departure_return_obj.focus();
				return false;
			}
			else
			{
				document.getElementById("Departure_form_return").value = ddl_departure_return_obj.value;
			}
		}

		if (arrival_return_obj != null  )
		{
			if ( arrival_return_obj.value =='' )
			{
				alert("Please Select Arrival of return schedule!");
	        	arrival_return_obj.focus();
				return false;
			}
		}


		if (ddl_arrival_return_obj != null)
		{
			if(ddl_arrival_return_obj.value =='')
			{
				alert("Please Select Arrival of return schedule!");
	        	ddl_arrival_return_obj.focus();
				return false;
			}
			else
			{
				document.getElementById("Arrival_form_return").value = ddl_arrival_return_obj.value;
			}
		}


		if (discount_return_obj != null)
		{
			if(discount_return_obj.value =='')
			{
				alert("Please Select Discount of return schedule!");
	        	discount_return_obj.focus();
				return false;
			}
		}


	}
	return true;
}

function form_submit()
{
	if (validate_form())
	{
		frmsearch.submit();
	}
	else
	{
		return false;
	}
}


function pickdaterange_return()
{
    var dateObj = document.getElementById("beforethisdate_return");
    var dateFilter = dateObj.options[dateObj.selectedIndex].value;
    if (document.bus_search && document.bus_search.return_date)
    {
        document.bus_search.return_date.value = dateFilter;
    }
    server_update();
    window.document.getElementById("beforethisdate_return").focus();
}

function get_dynamic_price(pid,service_date)
{
	document.getElementById("dynamic_price" + pid).innerHTML = "<font color='red'>Checking..</font>";
	if(window.XMLHttpRequest) {
		dynamic_xml = new XMLHttpRequest();
	} else {
		dynamic_xml = new ActiveXObject("MSXML2.XMLHTTP");
	}
	var url = '/cgi-bin/ajax.cgi?type=dynamic_price&pid=' + pid + '&service_date=' + service_date;
	dynamic_xml.open("GET", url, true);
	dynamic_xml.onreadystatechange = function() {response_dynamic_price(pid);}
	dynamic_xml.setRequestHeader("If-Modified-Since","0");
	dynamic_xml.send("");
}

function response_dynamic_price(pid)
{
	if (dynamic_xml.readyState == 4)
	{
		var response = dynamic_xml.responseText;
		document.getElementById("dynamic_price" + pid).innerHTML = response;
	}
}

function dynamic_image(pid)
{
	var dynamic_image_html = document.getElementById("dynamic_price_hidden" + pid).innerHTML;
	document.getElementById("dynamic_price" + pid).innerHTML = dynamic_image_html;

}

function show_dynamic(pid)
{
	if (document.getElementById("return_flag" + pid ) .value =="return")
	{
		get_dynamic_price(pid,document.getElementById('beforethisdate_return').value);
	}
	else
	{
		get_dynamic_price(pid,document.getElementById('beforethisdate').value);
	}
	setTimeout("dynamic_image('" + pid + "')",15000);
}



//-->
// ===================================================================
// Author: Matt Kruse <matt@mattkruse.com>
// WWW: http://www.mattkruse.com/
//
// NOTICE: You may use this code for any purpose, commercial or
// private, without any further permission from the author. You may
// remove this notice from your final code if you wish, however it is
// appreciated by the author if at least my web site address is kept.
//
// You may *NOT* re-distribute this code in any way except through its
// use. That means, you can include it in your product, or your web
// site, or any other form where the code is actually being used. You
// may not put the plain javascript up on your site for download or
// include it in your javascript libraries for download. 
// If you wish to share this code with others, please just point them
// to the URL instead.
// Please DO NOT link directly to my .js files from your site. Copy
// the files to your server and use them there. Thank you.
// ===================================================================





/* SOURCE FILE: AnchorPosition.js */

/* 
AnchorPosition.js
Author: Matt Kruse
Last modified: 10/11/02

DESCRIPTION: These functions find the position of an <A> tag in a document,
so other elements can be positioned relative to it.

COMPATABILITY: Netscape 4.x,6.x,Mozilla, IE 5.x,6.x on Windows. Some small
positioning errors - usually with Window positioning - occur on the 
Macintosh platform.

FUNCTIONS:
getAnchorPosition(anchorname)
  Returns an Object() having .x and .y properties of the pixel coordinates
  of the upper-left corner of the anchor. Position is relative to the PAGE.

getAnchorWindowPosition(anchorname)
  Returns an Object() having .x and .y properties of the pixel coordinates
  of the upper-left corner of the anchor, relative to the WHOLE SCREEN.

NOTES:

1) For popping up separate browser windows, use getAnchorWindowPosition. 
   Otherwise, use getAnchorPosition

2) Your anchor tag MUST contain both NAME and ID attributes which are the 
   same. For example:
   <A NAME="test" ID="test"> </A>

3) There must be at least a space between <A> </A> for IE5.5 to see the 
   anchor tag correctly. Do not do <A></A> with no space.
*/ 

// getAnchorPosition(anchorname)
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the page.
function getAnchorPosition(anchorname) {
	// This function will return an Object with x and y properties
	var useWindow=false;
	var coordinates=new Object();
	var x=0,y=0;
	// Browser capability sniffing
	var use_gebi=false, use_css=false, use_layers=false;
	if (document.getElementById) { use_gebi=true; }
	else if (document.all) { use_css=true; }
	else if (document.layers) { use_layers=true; }
	// Logic to find position
 	if (use_gebi && document.all) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_gebi) {
		var o=document.getElementById(anchorname);
		x=AnchorPosition_getPageOffsetLeft(o);
		y=AnchorPosition_getPageOffsetTop(o);
		}
 	else if (use_css) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_layers) {
		var found=0;
		for (var i=0; i<document.anchors.length; i++) {
			if (document.anchors[i].name==anchorname) { found=1; break; }
			}
		if (found==0) {
			coordinates.x=0; coordinates.y=0; return coordinates;
			}
		x=document.anchors[i].x;
		y=document.anchors[i].y;
		}
	else {
		coordinates.x=0; coordinates.y=0; return coordinates;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}

// getAnchorWindowPosition(anchorname)
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the window
function getAnchorWindowPosition(anchorname) {
	var coordinates=getAnchorPosition(anchorname);
	var x=0;
	var y=0;
	if (document.getElementById) {
		if (isNaN(window.screenX)) {
			x=coordinates.x-document.body.scrollLeft+window.screenLeft;
			y=coordinates.y-document.body.scrollTop+window.screenTop;
			}
		else {
			x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
			y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
			}
		}
	else if (document.all) {
		x=coordinates.x-document.body.scrollLeft+window.screenLeft;
		y=coordinates.y-document.body.scrollTop+window.screenTop;
		}
	else if (document.layers) {
		x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
		y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}

// Functions for IE to get position of an object
function AnchorPosition_getPageOffsetLeft (el) {
	var ol=el.offsetLeft;
	while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
	return ol;
	}
function AnchorPosition_getWindowOffsetLeft (el) {
	return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
	}	
function AnchorPosition_getPageOffsetTop (el) {
	var ot=el.offsetTop;
	while((el=el.offsetParent) != null) { ot += el.offsetTop; }
	return ot;
	}
function AnchorPosition_getWindowOffsetTop (el) {
	return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;
	}

/* 
PopupWindow.js
Author: Matt Kruse
Last modified: 02/16/04

DESCRIPTION: This object allows you to easily and quickly popup a window
in a certain place. The window can either be a DIV or a separate browser
window.

COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small
positioning errors - usually with Window positioning - occur on the 
Macintosh platform. Due to bugs in Netscape 4.x, populating the popup 
window with <STYLE> tags may cause errors.

USAGE:
// Create an object for a WINDOW popup
var win = new PopupWindow(); 

// Create an object for a DIV window using the DIV named 'mydiv'
var win = new PopupWindow('mydiv'); 

// Set the window to automatically hide itself when the user clicks 
// anywhere else on the page except the popup
win.autoHide(); 

// Show the window relative to the anchor name passed in
win.showPopup(anchorname);

// Hide the popup
win.hidePopup();

// Set the size of the popup window (only applies to WINDOW popups
win.setSize(width,height);

// Populate the contents of the popup window that will be shown. If you 
// change the contents while it is displayed, you will need to refresh()
win.populate(string);

// set the URL of the window, rather than populating its contents
// manually
win.setUrl("http://www.site.com/");

// Refresh the contents of the popup
win.refresh();

// Specify how many pixels to the right of the anchor the popup will appear
win.offsetX = 50;

// Specify how many pixels below the anchor the popup will appear
win.offsetY = 100;

NOTES:
1) Requires the functions in AnchorPosition.js

2) Your anchor tag MUST contain both NAME and ID attributes which are the 
   same. For example:
   <A NAME="test" ID="test"> </A>

3) There must be at least a space between <A> </A> for IE5.5 to see the 
   anchor tag correctly. Do not do <A></A> with no space.

4) When a PopupWindow object is created, a handler for 'onmouseup' is
   attached to any event handler you may have already defined. Do NOT define
   an event handler for 'onmouseup' after you define a PopupWindow object or
   the autoHide() will not work correctly.
*/ 

// Set the position of the popup window based on the anchor
function PopupWindow_getXYPosition(anchorname) {
	var coordinates;
	if (this.type == "WINDOW") {
		coordinates = getAnchorWindowPosition(anchorname);
		}
	else {
		coordinates = getAnchorPosition(anchorname);
		}
	this.x = coordinates.x;
	this.y = coordinates.y;
	}
// Set width/height of DIV/popup window
function PopupWindow_setSize(width,height) {
	this.width = width;
	this.height = height;
	}
// Fill the window with contents
function PopupWindow_populate(contents) {
	this.contents = contents;
	this.populated = false;
	}
// Set the URL to go to
function PopupWindow_setUrl(url) {
	this.url = url;
	}
// Set the window popup properties
function PopupWindow_setWindowProperties(props) {
	this.windowProperties = props;
	}
// Refresh the displayed contents of the popup
function PopupWindow_refresh() {
	if (this.divName != null) {
		// refresh the DIV object
		if (this.use_gebi) {
			document.getElementById(this.divName).innerHTML = this.contents;
			}
		else if (this.use_css) { 
			document.all[this.divName].innerHTML = this.contents;
			}
		else if (this.use_layers) { 
			var d = document.layers[this.divName]; 
			d.document.open();
			d.document.writeln(this.contents);
			d.document.close();
			}
		}
	else {
		if (this.popupWindow != null && !this.popupWindow.closed) {
			if (this.url!="") {
				this.popupWindow.location.href=this.url;
				}
			else {
				this.popupWindow.document.open();
				this.popupWindow.document.writeln(this.contents);
				this.popupWindow.document.close();
			}
			this.popupWindow.focus();
			}
		}
	}
// Position and show the popup, relative to an anchor object
function PopupWindow_showPopup(anchorname) {
	this.getXYPosition(anchorname);
	this.x += this.offsetX;
	this.y += this.offsetY;
	if (!this.populated && (this.contents != "")) {
		this.populated = true;
		this.refresh();
		}
	if (this.divName != null) {
		// Show the DIV object
		if (this.use_gebi) {
			document.getElementById(this.divName).style.left = this.x + "px";
			document.getElementById(this.divName).style.top = this.y + "px";
			document.getElementById(this.divName).style.visibility = "visible";
			}
		else if (this.use_css) {
			document.all[this.divName].style.left = this.x;
			document.all[this.divName].style.top = this.y;
			document.all[this.divName].style.visibility = "visible";
			}
		else if (this.use_layers) {
			document.layers[this.divName].left = this.x;
			document.layers[this.divName].top = this.y;
			document.layers[this.divName].visibility = "visible";
			}
		}
	else {
		if (this.popupWindow == null || this.popupWindow.closed) {
			// If the popup window will go off-screen, move it so it doesn't
			if (this.x<0) { this.x=0; }
			if (this.y<0) { this.y=0; }
			if (screen && screen.availHeight) {
				if ((this.y + this.height) > screen.availHeight) {
					this.y = screen.availHeight - this.height;
					}
				}
			if (screen && screen.availWidth) {
				if ((this.x + this.width) > screen.availWidth) {
					this.x = screen.availWidth - this.width;
					}
				}
			var avoidAboutBlank = window.opera || ( document.layers && !navigator.mimeTypes['*'] ) || navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled );
			this.popupWindow = window.open(avoidAboutBlank?"":"about:blank","window_"+anchorname,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+"");
			}
		this.refresh();
		}
	}
// Hide the popup
function PopupWindow_hidePopup() {
	if (this.divName != null) {
		if (this.use_gebi) {
			if (document.getElementById(this.divName))
			{
				document.getElementById(this.divName).style.visibility = "hidden";
			}
			}
		else if (this.use_css) {
			document.all[this.divName].style.visibility = "hidden";
			}
		else if (this.use_layers) {
			document.layers[this.divName].visibility = "hidden";
			}
		}
	else {
		if (this.popupWindow && !this.popupWindow.closed) {
			this.popupWindow.close();
			this.popupWindow = null;
			}
		}
	}
// Pass an event and return whether or not it was the popup DIV that was clicked
function PopupWindow_isClicked(e) {
	if (this.divName != null) {
		if (this.use_layers) {
			var clickX = e.pageX;
			var clickY = e.pageY;
			var t = document.layers[this.divName];
			if ((clickX > t.left) && (clickX < t.left+t.clip.width) && (clickY > t.top) && (clickY < t.top+t.clip.height)) {
				return true;
				}
			else { return false; }
			}
		else if (document.all) { // Need to hard-code this to trap IE for error-handling
			var t = window.event.srcElement;
			while (t.parentElement != null) {
				if (t.id==this.divName) {
					return true;
					}
				t = t.parentElement;
				}
			return false;
			}
		else if (this.use_gebi && e) {
			var t = e.originalTarget;
			while (t.parentNode != null) {
				if (t.id==this.divName) {
					return true;
					}
				t = t.parentNode;
				}
			return false;
			}
		return false;
		}
	return false;
	}

// Check an onMouseDown event to see if we should hide
function PopupWindow_hideIfNotClicked(e) {
	if (this.autoHideEnabled && !this.isClicked(e)) {
		this.hidePopup();
		}
	}
// Call this to make the DIV disable automatically when mouse is clicked outside it
function PopupWindow_autoHide() {
	this.autoHideEnabled = true;
	}
// This global function checks all PopupWindow objects onmouseup to see if they should be hidden
function PopupWindow_hidePopupWindows(e) {
	for (var i=0; i<popupWindowObjects.length; i++) {
		if (popupWindowObjects[i] != null) {
			var p = popupWindowObjects[i];
			p.hideIfNotClicked(e);
			}
		}
	}
// Run this immediately to attach the event listener
function PopupWindow_attachListener() {
	if (document.layers) {
		document.captureEvents(Event.MOUSEUP);
		}
	window.popupWindowOldEventListener = document.onmouseup;
	if (window.popupWindowOldEventListener != null) {
		document.onmouseup = new Function("window.popupWindowOldEventListener(); PopupWindow_hidePopupWindows();");
		}
	else {
		document.onmouseup = PopupWindow_hidePopupWindows;
		}
	}
// CONSTRUCTOR for the PopupWindow object
// Pass it a DIV name to use a DHTML popup, otherwise will default to window popup
function PopupWindow() {
	if (!window.popupWindowIndex) { window.popupWindowIndex = 0; }
	if (!window.popupWindowObjects) { window.popupWindowObjects = new Array(); }
	if (!window.listenerAttached) {
		window.listenerAttached = true;
		PopupWindow_attachListener();
		}
	this.index = popupWindowIndex++;
	popupWindowObjects[this.index] = this;
	this.divName = null;
	this.popupWindow = null;
	this.width=0;
	this.height=0;
	this.populated = false;
	this.visible = false;
	this.autoHideEnabled = false;
	
	this.contents = "";
	this.url="";
	this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no";
	if (arguments.length>0) {
		this.type="DIV";
		this.divName = arguments[0];
		}
	else {
		this.type="WINDOW";
		}
	this.use_gebi = false;
	this.use_css = false;
	this.use_layers = false;
	if (document.getElementById) { this.use_gebi = true; }
	else if (document.all) { this.use_css = true; }
	else if (document.layers) { this.use_layers = true; }
	else { this.type = "WINDOW"; }
	this.offsetX = 0;
	this.offsetY = 0;
	// Method mappings
	this.getXYPosition = PopupWindow_getXYPosition;
	this.populate = PopupWindow_populate;
	this.setUrl = PopupWindow_setUrl;
	this.setWindowProperties = PopupWindow_setWindowProperties;
	this.refresh = PopupWindow_refresh;
	this.showPopup = PopupWindow_showPopup;
	this.hidePopup = PopupWindow_hidePopup;
	this.setSize = PopupWindow_setSize;
	this.isClicked = PopupWindow_isClicked;
	this.autoHide = PopupWindow_autoHide;
	this.hideIfNotClicked = PopupWindow_hideIfNotClicked;
	}

function b_text(obj, text,event)
{
	var b_obj = document.getElementById('balloon').style;
	var tt = "<table bgcolor=#999999 width=154 cellpadding=3 cellspacing=1><tr><td bgcolor=#ffffff class=\"balloon_text\">" + text + "</td></tr></table>";
	document.getElementById('balloon').innerHTML = tt;
	var pos = el_pos(obj,event);
	b_obj.top = pos.y + 4;
	b_obj.left = pos.x + 4;
	b_obj.visibility = "visible";
	b_obj.display = "block";
}

function no_b_text()
{
	var b_obj = document.getElementById('balloon').style;
	b_obj.visibility = "hidden";
	b_obj.display = "none";
}

function onBalloonOver()
{
	var b_obj = document.getElementById('balloon').style;
	b_obj.visibility = "visible";
	b_obj.display = "block";
}

function onBalloonOut()
{
        var b_obj = document.getElementById('balloon').style;
        b_obj.visibility = "hidden";
        b_obj.display = "none";
}

function el_pos(obj,event)
{
    var xOffset, yOffset;
	if (event)
	{
		xOffset =  event.clientX + document.body.scrollLeft -10;
		yOffset = event.clientY + document.body.scrollTop -10;
	}
	else
	{
 		if(obj.offsetTop != 'undefined'){
        	yOffset = (obj.offsetTop?obj.offsetTop:0);
        	xOffset = (obj.offsetLeft?obj.offsetLeft:0);
        	yOffset -= (obj.scrollTop?obj.scrollTop:0);
        	xOffset -= (obj.scrollLeft?obj.scrollLeft:0);
        	elParent = obj.offsetParent;
        	while(elParent){
            	yOffset += (elParent.offsetTop?elParent.offsetTop:0);
            	xOffset += (elParent.offsetLeft?elParent.offsetLeft:0);
	    		yOffset -= (elParent.scrollTop?elParent.scrollTop:0);
            	xOffset -= (elParent.scrollLeft?elParent.scrollLeft:0);
            	elParent = elParent.offsetParent;
        	}
    	} else if(typeof obj.y != 'undefined'){
			alert(obj.y);
        	yOffset = obj.y;
        	xOffset = obj.x;
    	} else {      //information is not available
        	yOffset = -1;
        	xOffset = -1;
    	} 
	}
    return {x:xOffset,y:yOffset};
}

function long_option_clicked(popup_obj, div_name)
{
	var div_obj = document.getElementById(div_name);
	var i_obj = document.getElementById('i' + div_name);
	var style_obj = div_obj.style;
	var pos = el_pos(i_obj);
	popup_obj.offsetY = 20;
	popup_obj.offsetX = -200;
	popup_obj.showPopup("i" + div_name);
}

function long_option_closed(popup_obj, div_name)
{
	popup_obj.hidePopup();
}

function long_option_selected(obj, div_name, popup_obj)
{
	document.getElementById('d' + div_name).value = obj.value;
	long_option_closed(popup_obj, div_name);
}

function validate_form_selections(f)
{
	var plObj = document.getElementById("Provide_Later");
	var check_text = true;
	if (plObj != null && plObj.checked)
	{
		check_text = false;
	}
    for (var i=0, j=f.elements.length; i<j; i++)
    {
        var t = f.elements[i].type;
        if (t.match(/select/))
        {
            if (f.elements[i].value == '')
            {
                alert("Please Select " + f.elements[i].name + "!");
                f.elements[i].focus();
                return false;
            }
        }
		else if (t.match(/text/) && check_text)
	{
	    if (f.elements[i].value == '')
	    {
	    	alert("Please enter a value the text field!");
	    	f.elements[i].focus();
		return false;
	    }
	}
    }
    if (f.Date != null && f.Date.value == '')
    {
        alert("Please select a valid Date!");
        return false;
    }
    if (f.time != null && f.time.value < 1.01)
    {
        return confirm("Important: It is a new date after passing 12:00am.\nYou have selected a very early schedule on " + f.Date.value + ".  Please confirm.");
    }
}

function AutoComplete(obj,ca){
	/* ---- Public Variables ---- */
	this.actb_timeOut = -1; // Autocomplete Timeout in ms (-1: autocomplete never time out)
	this.actb_lim = 4;    // Number of elements autocomplete can show (-1: no limit)
	this.actb_firstText = false; // should the auto complete be limited to the beginning of keyword?
	this.actb_mouse = true; // Enable Mouse Support
	this.actb_delimiter = new Array(';',',');  // Delimiter for multiple autocomplete. Set it to empty array for single autocomplete
	this.actb_startcheck = 1; // Show widget only after this number of characters is typed in.
	/* ---- Public Variables ---- */

	/* --- Styles --- */
	this.actb_bgColor = '#ffffff';
	this.actb_textColor = '#000000';
	this.actb_hColor = '#cccccc';
	this.actb_fFamily = 'Verdana';
	this.actb_fSize = '11px';
	this.actb_Width = 'auto';
	this.actb_hStyle = 'text-decoration:underline;font-weight="bold"';
	/* --- Styles --- */

	/* ---- Private Variables ---- */
	var actb_delimwords = new Array();
	var actb_cdelimword = 0;
	var actb_delimchar = new Array();
	var actb_display = false;
	var actb_pos = 0;
	var actb_total = 0;
	var actb_curr = null;
	var actb_rangeu = 0;
	var actb_ranged = 0;
	var actb_bool = new Array();
	var actb_pre = 0;
	var actb_toid;
	var actb_tomake = false;
	var actb_getpre = "";
	var actb_mouse_on_list = 1;
	var actb_kwcount = 0;
	var actb_caretmove = false;
	this.actb_keywords = new Array();
	/* ---- Private Variables---- */

	this.actb_keywords = ca;
	var actb_self = this;

	actb_curr = obj;

	//addEvent(actb_curr,"focus",actb_setup);
	this.actb_setup = function(){
		addEvent(document,"keydown",actb_checkkey);
		addEvent(actb_curr,"blur",actb_clear);
		addEvent(document,"keypress",actb_keypress);
	}
	function actb_clear(evt){
		if (!evt) evt = event;
		removeEvent(document,"keydown",actb_checkkey);
		removeEvent(actb_curr,"blur",actb_clear);
		removeEvent(document,"keypress",actb_keypress);
		actb_removedisp();
	}
	function actb_parse(n){
		if (actb_self.actb_delimiter.length > 0){
			var t = actb_delimwords[actb_cdelimword].trim().addslashes();
			var plen = actb_delimwords[actb_cdelimword].trim().length;
		}else{
			var t = actb_curr.value.addslashes();
			var plen = actb_curr.value.length;
		}
		var tobuild = '';
		var i;

		if (actb_self.actb_firstText){
			var re = new RegExp("^" + t, "i");
		}else{
			var re = new RegExp(t, "i");
		}
		var p = n.search(re);

		for (i=0;i<p;i++){
			tobuild += n.substr(i,1);
		}
		tobuild += "<font style='"+(actb_self.actb_hStyle)+"'>"
		for (i=p;i<plen+p;i++){
			tobuild += n.substr(i,1);
		}
		tobuild += "</font>";
			for (i=plen+p;i<n.length;i++){
			tobuild += n.substr(i,1);
		}
		return tobuild;
	}
	function actb_generate(){
		if (document.getElementById('tat_table')){ actb_display = false;document.body.removeChild(document.getElementById('tat_table')); }
		if (actb_kwcount == 0){
			actb_display = false;
			return;
		}
		a = document.createElement('table');
		a.cellSpacing='1px';
		a.cellPadding='2px';
		a.style.position='absolute';
		a.style.top = eval(curTop(actb_curr) + actb_curr.offsetHeight) + "px";
		a.style.left = curLeft(actb_curr) + "px";
		a.style.backgroundColor=actb_self.actb_bgColor;
////////////////////////////////////
		a.style.border = "#000000 solid 1px";
		a.style.width = actb_self.actb_Width;

////////////////////
		a.id = 'tat_table';
		document.body.appendChild(a);
		var i;
		var first = true;
		var j = 1;
		if (actb_self.actb_mouse){
			a.onmouseout = actb_table_unfocus;
			a.onmouseover = actb_table_focus;
		}
		var counter = 0;
		for (i=0;i<actb_self.actb_keywords.length;i++){
			if (actb_bool[i]){
				counter++;
				r = a.insertRow(-1);
				if (first && !actb_tomake){
					r.style.backgroundColor = actb_self.actb_hColor;
					first = false;
					actb_pos = counter;
				}else if(actb_pre == i){
					r.style.backgroundColor = actb_self.actb_hColor;
					first = false;
					actb_pos = counter;
				}else{
					r.style.backgroundColor = actb_self.actb_bgColor;
				}
				r.id = 'tat_tr'+(j);
				c = r.insertCell(-1);
				c.style.color = actb_self.actb_textColor;
				c.style.fontFamily = actb_self.actb_fFamily;
				c.style.fontSize = actb_self.actb_fSize;
				c.innerHTML = actb_parse(actb_self.actb_keywords[i]);
				c.id = 'tat_td'+(j);
				c.setAttribute('pos',j);
				//window.alert(actb_self.actb_mouse);
				if (actb_self.actb_mouse){
					c.style.cursor = 'pointer';
					c.onclick=actb_mouseclick;
					c.onmouseover = actb_table_highlight;
				}
				j++;
			}
			if (j - 1 == actb_self.actb_lim && j < actb_total){
				r = a.insertRow(-1);
				r.style.backgroundColor = actb_self.actb_bgColor;
				c = r.insertCell(-1);
				c.style.color = actb_self.actb_textColor;
				c.style.fontFamily = 'arial narrow';
				c.style.fontSize = actb_self.actb_fSize;
				c.align='center';
				replaceHTML(c,'\\/');
				if (actb_self.actb_mouse){
					c.style.cursor = 'pointer';
					c.onclick = actb_mouse_down;
				}
				break;
			}
		}
		actb_rangeu = 1;
		actb_ranged = j-1;
		actb_display = true;
		if (actb_pos <= 0) actb_pos = 1;
	}
	function actb_remake(){
		document.body.removeChild(document.getElementById('tat_table'));
		a = document.createElement('table');
		a.cellSpacing='1px';
		a.cellPadding='2px';
		a.style.position='absolute';
		a.style.top = eval(curTop(actb_curr) + actb_curr.offsetHeight) + "px";
		a.style.left = curLeft(actb_curr) + "px";
		a.style.backgroundColor=actb_self.actb_bgColor;
		a.id = 'tat_table';
		if (actb_self.actb_mouse){
			a.onmouseout= actb_table_unfocus;
			a.onmouseover=actb_table_focus;
		}
		document.body.appendChild(a);
		var i;
		var first = true;
		var j = 1;
		if (actb_rangeu > 1){
			r = a.insertRow(-1);
			r.style.backgroundColor = actb_self.actb_bgColor;
			c = r.insertCell(-1);
			c.style.color = actb_self.actb_textColor;
			c.style.fontFamily = 'arial narrow';
			c.style.fontSize = actb_self.actb_fSize;
			c.align='center';
			replaceHTML(c,'/\\');
			if (actb_self.actb_mouse){
				c.style.cursor = 'pointer';
				c.onclick = actb_mouse_up;
			}
		}
		for (i=0;i<actb_self.actb_keywords.length;i++){
			if (actb_bool[i]){
				if (j >= actb_rangeu && j <= actb_ranged){
					r = a.insertRow(-1);
					r.style.backgroundColor = actb_self.actb_bgColor;
					r.id = 'tat_tr'+(j);
					c = r.insertCell(-1);
					c.style.color = actb_self.actb_textColor;
					c.style.fontFamily = actb_self.actb_fFamily;
					c.style.fontSize = actb_self.actb_fSize;
					c.innerHTML = actb_parse(actb_self.actb_keywords[i]);
					c.id = 'tat_td'+(j);
					c.setAttribute('pos',j);
					if (actb_self.actb_mouse){
						c.style.cursor = 'pointer';
						c.onclick=actb_mouseclick;
						c.onmouseover = actb_table_highlight;
					}
					j++;
				}else{
					j++;
				}
			}
			if (j > actb_ranged) break;
		}
		if (j-1 < actb_total){
			r = a.insertRow(-1);
			r.style.backgroundColor = actb_self.actb_bgColor;
			c = r.insertCell(-1);
			c.style.color = actb_self.actb_textColor;
			c.style.fontFamily = 'arial narrow';
			c.style.fontSize = actb_self.actb_fSize;
			c.align='center';
			replaceHTML(c,'\\/');
			if (actb_self.actb_mouse){
				c.style.cursor = 'pointer';
				c.onclick = actb_mouse_down;
			}
		}
	}
	function actb_goup(){
		if (!actb_display) return;
		if (actb_pos == 1) return;
		document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_bgColor;
		actb_pos--;
		if (actb_pos < actb_rangeu) actb_moveup();
		document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_hColor;
		if (actb_toid) clearTimeout(actb_toid);
		if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list=0;actb_removedisp();},actb_self.actb_timeOut);
	}
	function actb_godown(){
		if (!actb_display) return;
		if (actb_pos == actb_total) return;
		document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_bgColor;
		actb_pos++;
		if (actb_pos > actb_ranged) actb_movedown();
		document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_hColor;
		if (actb_toid) clearTimeout(actb_toid);
		if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list=0;actb_removedisp();},actb_self.actb_timeOut);
	}
	function actb_movedown(){
		actb_rangeu++;
		actb_ranged++;
		actb_remake();
	}
	function actb_moveup(){
		actb_rangeu--;
		actb_ranged--;
		actb_remake();
	}

	/* Mouse */
	function actb_mouse_down(){
//////
		//window.alert('mouse_down');
		document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_bgColor;
		actb_pos++;
		actb_movedown();
		document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_hColor;
		actb_curr.focus();
		actb_mouse_on_list = 0;
		if (actb_toid) clearTimeout(actb_toid);
		if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list=0;actb_removedisp();},actb_self.actb_timeOut);
	}
	function actb_mouse_up(evt){
		//window.alert('mouse_up');
		if (!evt) evt = event;
		if (evt.stopPropagation){
			evt.stopPropagation();
		}else{
			evt.cancelBubble = true;
		}
		document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_bgColor;
		actb_pos--;
		actb_moveup();
		document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_hColor;
		actb_curr.focus();
		actb_mouse_on_list = 0;
		if (actb_toid) clearTimeout(actb_toid);
		if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list=0;actb_removedisp();},actb_self.actb_timeOut);
	}
	function actb_mouseclick(evt){

		if (!evt) evt = event;
		if (!actb_display) return;
		actb_mouse_on_list = 0;
		actb_pos = this.getAttribute('pos');

		actb_penter();
	}
	function actb_table_focus(){
		actb_mouse_on_list = 1;
	}
	function actb_table_unfocus(){
		actb_mouse_on_list = 0;
		if (actb_toid) clearTimeout(actb_toid);
		if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list = 0;actb_removedisp();},actb_self.actb_timeOut);
	}
	function actb_table_highlight(){
		actb_mouse_on_list = 1;
		document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_bgColor;
		actb_pos = this.getAttribute('pos');
		while (actb_pos < actb_rangeu) actb_moveup();
		while (actb_pos > actb_ranged) actb_movedown();
		document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_hColor;
		if (actb_toid) clearTimeout(actb_toid);
		if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list = 0;actb_removedisp();},actb_self.actb_timeOut);
	}
	/* ---- */

	function actb_insertword(a){
		if (actb_self.actb_delimiter.length > 0){
			str = '';
			l=0;
			for (i=0;i<actb_delimwords.length;i++){
				if (actb_cdelimword == i){
					prespace = postspace = '';
					gotbreak = false;
					for (j=0;j<actb_delimwords[i].length;++j){
						if (actb_delimwords[i].charAt(j) != ' '){
							gotbreak = true;
							break;
						}
						prespace += ' ';
					}
					for (j=actb_delimwords[i].length-1;j>=0;--j){
						if (actb_delimwords[i].charAt(j) != ' ') break;
						postspace += ' ';
					}
					str += prespace;
					str += a;
					l = str.length;
					if (gotbreak) str += postspace;
				}else{
					str += actb_delimwords[i];
				}
				if (i != actb_delimwords.length - 1){
					str += actb_delimchar[i];
				}
			}
			actb_curr.value = str;
			setCaret(actb_curr,l);
		}else{
			actb_curr.value = a;
		}
		actb_mouse_on_list = 0;
		actb_removedisp();
	}
	function actb_penter(){
		if (!actb_display) return;
		actb_display = false;
		var word = '';
		var c = 0;
		for (var i=0;i<=actb_self.actb_keywords.length;i++){
			if (actb_bool[i]) c++;
			if (c == actb_pos){
				word = actb_self.actb_keywords[i];
				break;
			}
		}
		actb_insertword(word);
		l = getCaretStart(actb_curr);
	}
	function actb_removedisp(){
		if (actb_mouse_on_list==0){
			actb_display = 0;
			if (document.getElementById('tat_table')){ document.body.removeChild(document.getElementById('tat_table')); }
			if (actb_toid) clearTimeout(actb_toid);
		}
	}
	function actb_keypress(e){
		if (actb_caretmove) stopEvent(e);
		return !actb_caretmove;
	}
	function actb_checkkey(evt){
		if (!evt) evt = event;
		a = evt.keyCode;
		caret_pos_start = getCaretStart(actb_curr);
		actb_caretmove = 0;
		switch (a){
			case 38:
				actb_goup();
				actb_caretmove = 1;
				return false;
				break;
			case 40:
				actb_godown();
				actb_caretmove = 1;
				return false;
				break;
			case 13: case 9:
				if (actb_display){
					actb_caretmove = 1;
					actb_penter();
					return false;
				}else{
					return true;
				}
				break;
			default:
				setTimeout(function(){actb_tocomplete(a)},50);
				break;
		}
	}

	function actb_tocomplete(kc){
		if (kc == 38 || kc == 40 || kc == 13) return;
		var i;
		if (actb_display){
			var word = 0;
			var c = 0;
			for (var i=0;i<=actb_self.actb_keywords.length;i++){
				if (actb_bool[i]) c++;
				if (c == actb_pos){
					word = i;
					break;
				}
			}
			actb_pre = word;
		}else{ actb_pre = -1};

		if (actb_curr.value == ''){
			actb_mouse_on_list = 0;
			actb_removedisp();
			return;
		}
		if (actb_self.actb_delimiter.length > 0){
			caret_pos_start = getCaretStart(actb_curr);
			caret_pos_end = getCaretEnd(actb_curr);

			delim_split = '';
			for (i=0;i<actb_self.actb_delimiter.length;i++){
				delim_split += actb_self.actb_delimiter[i];
			}
			delim_split = delim_split.addslashes();
			delim_split_rx = new RegExp("(["+delim_split+"])");
			c = 0;
			actb_delimwords = new Array();
			actb_delimwords[0] = '';
			for (i=0,j=actb_curr.value.length;i<actb_curr.value.length;i++,j--){
				if (actb_curr.value.substr(i,j).search(delim_split_rx) == 0){
					ma = actb_curr.value.substr(i,j).match(delim_split_rx);
					actb_delimchar[c] = ma[1];
					c++;
					actb_delimwords[c] = '';
				}else{
					actb_delimwords[c] += actb_curr.value.charAt(i);
				}
			}

			var l = 0;
			actb_cdelimword = -1;
			for (i=0;i<actb_delimwords.length;i++){
				if (caret_pos_end >= l && caret_pos_end <= l + actb_delimwords[i].length){
					actb_cdelimword = i;
				}
				l+=actb_delimwords[i].length + 1;
			}
			var ot = actb_delimwords[actb_cdelimword].trim();
			var t = actb_delimwords[actb_cdelimword].addslashes().trim();
		}else{
			var ot = actb_curr.value;
			var t = actb_curr.value.addslashes();
		}
		if (ot.length == 0){
			actb_mouse_on_list = 0;
			actb_removedisp();
		}
		if (ot.length < actb_self.actb_startcheck) return this;
		if (actb_self.actb_firstText){
			var re = new RegExp("^" + t, "i");
		}else{
			var re = new RegExp(t, "i");
		}

		actb_total = 0;
		actb_tomake = false;
		actb_kwcount = 0;
		for (i=0;i<actb_self.actb_keywords.length;i++){
			actb_bool[i] = false;
			if (re.test(actb_self.actb_keywords[i])){
				actb_total++;
				actb_bool[i] = true;
				actb_kwcount++;
				if (actb_pre == i) actb_tomake = true;
			}
		}

		if (actb_toid) clearTimeout(actb_toid);
		if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list = 0;actb_removedisp();},actb_self.actb_timeOut);
		actb_generate();
	}
	return this;
}/* Event Functions */

// Add an event to the obj given
// event_name refers to the event trigger, without the "on", like click or mouseover
// func_name refers to the function callback when event is triggered
function addEvent(obj,event_name,func_name){
	if (obj.attachEvent){
		obj.attachEvent("on"+event_name, func_name);
	}else if(obj.addEventListener){
		obj.addEventListener(event_name,func_name,true);
	}else{
		obj["on"+event_name] = func_name;
	}
}

// Removes an event from the object
function removeEvent(obj,event_name,func_name){
	if (obj.detachEvent){
		obj.detachEvent("on"+event_name,func_name);
	}else if(obj.removeEventListener){
		obj.removeEventListener(event_name,func_name,true);
	}else{
		obj["on"+event_name] = null;
	}
}

// Stop an event from bubbling up the event DOM
function stopEvent(evt){
	evt || window.event;
	if (evt.stopPropagation){
		evt.stopPropagation();
		evt.preventDefault();
	}else if(typeof evt.cancelBubble != "undefined"){
		evt.cancelBubble = true;
		evt.returnValue = false;
	}
	return false;
}

// Get the obj that starts the event
function getElement(evt){
	if (window.event){
		return window.event.srcElement;
	}else{
		return evt.currentTarget;
	}
}
// Get the obj that triggers off the event
function getTargetElement(evt){
	if (window.event){
		return window.event.srcElement;
	}else{
		return evt.target;
	}
}
// For IE only, stops the obj from being selected
function stopSelect(obj){
	if (typeof obj.onselectstart != 'undefined'){
		addEvent(obj,"selectstart",function(){ return false;});
	}
}

/*    Caret Functions     */

// Get the end position of the caret in the object. Note that the obj needs to be in focus first
function getCaretEnd(obj){
	if(typeof obj.selectionEnd != "undefined"){
		return obj.selectionEnd;
	}else if(document.selection&&document.selection.createRange){
		var M=document.selection.createRange();
		try{
			var Lp = M.duplicate();
			Lp.moveToElementText(obj);
		}catch(e){
			var Lp=obj.createTextRange();
		}
		Lp.setEndPoint("EndToEnd",M);
		var rb=Lp.text.length;
		if(rb>obj.value.length){
			return -1;
		}
		return rb;
	}
}
// Get the start position of the caret in the object
function getCaretStart(obj){
	if(typeof obj.selectionStart != "undefined"){
		return obj.selectionStart;
	}else if(document.selection&&document.selection.createRange){
		var M=document.selection.createRange();
		try{
			var Lp = M.duplicate();
			Lp.moveToElementText(obj);
		}catch(e){
			var Lp=obj.createTextRange();
		}
		Lp.setEndPoint("EndToStart",M);
		var rb=Lp.text.length;
		if(rb>obj.value.length){
			return -1;
		}
		return rb;
	}
}
// sets the caret position to l in the object
function setCaret(obj,l){
	obj.focus();
	if (obj.setSelectionRange){
		obj.setSelectionRange(l,l);
	}else if(obj.createTextRange){
		m = obj.createTextRange();		
		m.moveStart('character',l);
		m.collapse();
		m.select();
	}
}
// sets the caret selection from s to e in the object
function setSelection(obj,s,e){
	obj.focus();
	if (obj.setSelectionRange){
		obj.setSelectionRange(s,e);
	}else if(obj.createTextRange){
		m = obj.createTextRange();		
		m.moveStart('character',s);
		m.moveEnd('character',e);
		m.select();
	}
}

/*    Escape function   */
String.prototype.addslashes = function(){
	return this.replace(/(["\\\.\|\[\]\^\*\+\?\$\(\)])/g, '\\$1');
}
String.prototype.trim = function () {
    return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");
};
/* --- Escape --- */

/* Offset position from top of the screen */
function curTop(obj){
	toreturn = 0;
	while(obj){
		toreturn += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return toreturn;
}
function curLeft(obj){
	toreturn = 0;
	while(obj){
		toreturn += obj.offsetLeft;
		obj = obj.offsetParent;
	}
	return toreturn;
}
/* ------ End of Offset function ------- */

/* Types Function */

// is a given input a number?
function isNumber(a) {
    return typeof a == 'number' && isFinite(a);
}

/* Object Functions */

function replaceHTML(obj,text){
	while(el = obj.childNodes[0]){
		obj.removeChild(el);
	};
	obj.appendChild(document.createTextNode(text));
}

/* Set aucto complete handler */
function setComplete(obj,arr) {

	if(typeof(arr) != "object") {
		arr = g_bus[arr];
		if(arr.length<1)
			arr = new Array();
	}
	var acObj = AutoComplete(obj, arr);
	acObj.actb_setup();
	acObj.actb_firstText = true;
	acObj.actb_Width = '160px';
	acObj.actb_lim = 10;
}

if(window.addEventListener){

	window.addEventListener("load",function(){
		var url = window.location.href;
		if(url.indexOf('option=Search')<0)
			document.bus_search.option.value = "Select";
		
		},true);
}

if(window.attachEvent){

	window.attachEvent("onload",function(){
		var url = window.location.href;
		if(url.indexOf('option=Search') < 0 )
			document.bus_search.option.value = "Select";

	});
}document.write('<link href=\"http://www.gotobus.com/css/searchbox.css\" rel=\"stylesheet\" type=\"text/css\">');
document.write('<div ID=\"calendarDiv\" style=\"position:absolute;visibility:hidden;background-color:#ffffff;layer-background-color:#ffffff;\"></div>');
document.write('<table width=\"100%\" align=\"center\" cellspacing=\"2\" bgcolor=\"#cc0000\" border=\"0\" cellpadding=\"0\">');
document.write('<tr>');
document.write('  <td bgcolor=\"#ffffff\" width=\"98%\" align=\"center\">');
document.write('  	<script language=\"JavaScript\">');
document.write('     var bd_cal = new CalendarPopup(\"calendarDiv\");');
document.write('	 bd_cal.offsetX = -85;');
document.write('	 bd_cal.offsetY = 16;');
document.write('	 bd_cal.setCssPrefix(\'Bus_\');');
document.write('     var br_cal = new CalendarPopup(\"calendarDiv\");');
document.write('	 br_cal.offsetX = -85;');
document.write('	 br_cal.offsetY = 16;');
document.write('	 br_cal.setCssPrefix(\'Bus_\');');
document.write('     var last_date = new Date(past_date.valueOf() + 31 * aDay);');
document.write('     bd_cal.addDisabledDates(null,formatDate(past_date,\"yyyy-MM-dd\"));');
document.write('     bd_cal.addDisabledDates(formatDate(last_date, \"yyyy-MM-dd\"),null);');
document.write('	 bd_cal.setReturnFunction(\'bus_departure_date_clicked\');');
document.write('     br_cal.addDisabledDates(null,formatDate(past_date,\"yyyy-MM-dd\"));');
document.write('     br_cal.addDisabledDates(formatDate(last_date, \"yyyy-MM-dd\"),null);');
document.write('	 br_cal.setReturnFunction(\'bus_return_date_clicked\');');
document.write('	</script>');
document.write('<form name=\"bus_search\" class=\"ivySearchForm\" method=\"get\" onSubmit=\"return check_bus_data();\" action=\"http://www.gotobus.com/cgi-bin/bus.cgi\">');
document.write('<input type=\"hidden\" name=\"nm\" value=\"__AFFID__\"> <input type=\"hidden\" name=\"st\" value=\"0\"> <input type=\"hidden\" name=\"gid\" value=\"\"><input type=\"hidden\" name=\"option\" value=\"Select\">');
document.write('<table align=\"center\" width=\"98%\" cellspacing=\"0\" cellpadding=\"1\" border=\"0\">');
document.write('<tr>');
document.write('  <td colspan=\"2\" height=\"36\">');
document.write('    <input type=\"radio\" id=\"b_oneway\" name=\"roundtrip\" value=\"0\" onClick=\"select_oneway();\"><b>One Way</b>');
document.write('	<input type=\"radio\" id=\"b_roundtrip\" name=\"roundtrip\" value=\"1\" onClick=\"select_roundtrip();\"><b>Roundtrip</b>');
document.write(' </td>');
document.write('</tr>');
document.write('<tr>');
document.write('  <td width=\"72%\" height=\"44\">');
document.write('	  <table width=\"100%\" cellspacing=2 cellpadding=2 border=\"0\" height=\"44\">');
document.write('  <tr>');
document.write('	<td width=\"50%\" valign=\"top\"><small>Select or Enter Departure:</small><br>');
document.write('    <div style=\"position:absolute;\"><span style=\"margin-left:142px;width:18px;overflow:hidden;\">');
document.write('        <select id=\"bus_from\" name=\"bus_from\" class=\"textbox\" style=\"width:160px;margin-left:-142px\" onChange=\"this.parentNode.nextSibling.value=this.value;document.getElementById(\'sbus_to_id\').value=\'\';update_bus_to(this.options[this.selectedIndex].value);copy_select_to_search();\">');
document.write('      <option>Departure City</option>');
document.write('	</select>');
document.write('        </span><input class=\"textbox\" type=\"text\" size=\"18\" name=\"sbus_from\"  style=\"width:142px;position:absolute;left:0px;\" class=\"textbox\" onChange=\"conditional_clear();\"');
document.write('	 	onclick=\'this.select();\' id=\"sbus_from_id\" autocomplete=\"off\" onfocus=\"setComplete(this, b_cities);\"  onblur=\"copy_search_to_select();document.getElementById(\'sbus_to_id\').value=\'\';\">');
document.write('   	      <div id=\"sbus_from_cnt\" style=\"display:none;border:1px solid black;background-color:white;cursor:pointer;height:100px;overflow:auto;\"></div>');
document.write('    </div>');
document.write('	</td>');
document.write('	<td valign=\"top\">');
document.write('      <small>Select or Enter Arrival:</small><br>');
document.write('       <div style=\"position:absolute;\"> <span style=\"margin-left:142px;width:18px;overflow:hidden;\">');
document.write('        <select id=\"bus_to\" name=\"bus_to\"  class=\"textbox\" style=\"width:160px;margin-left:-142px\" onChange=\"this.parentNode.nextSibling.value=this.value;jump_or_clear();copy_select_to_search();\" >');
document.write('      <option>Arrival City</option>');
document.write('      </select>');
document.write('        </span>');
document.write('	    <input class=\"textbox\" type=\"text\" size=\"18\" name=\"sbus_to\"  onChange=\"conditional_clear();\" style=\"width:142px;position:absolute;left:0px;\" class=\"textbox\"');
document.write('	    onclick=\'this.select();\' id=\"sbus_to_id\" autocomplete=\"off\"  onfocus=\"setComplete(this, document.getElementById(\'sbus_from_id\').value);update_bus_to(document.getElementById(\'sbus_from_id\').value);\"  onblur=\"copy_search_to_select();\">');
document.write('  	<div id=\"sbus_to_cnt\" style=\"display:none;border:1px solid black;background-color:white;cursor:pointer;height:100px;overflow:auto;\"></div>');
document.write('        </div>');
document.write('	</td>');
document.write('  </tr>');
document.write('  </table>');
document.write('');
document.write('  </td>');
document.write('  <td><a href=\"#\" onclick=\"reverse_from_to();\">Reverse</a></td>');
document.write('</tr>');
document.write('<tr>');
document.write('  <td height=\"48\">');
document.write('  <table width=\"100%\" cellspacing=2 cellpadding=2 border=0>');
document.write('  <tr>');
document.write('    <td width=\"50%\">');
document.write('	  <small>Depart Date:</small><br>');
document.write('      <input type=\"text\" name=\"filter_date\" value=\"\" onChange=\"conditional_update();\" style=\"font-size: 12px; font-family: Arial; width:80px;\">');
document.write('      <a href=\"#\" onClick=\"bd_cal.select(document.bus_search.filter_date,\'bd_date\',\'yyyy-MM-dd\'); return false;\" NAME=\"bd_date\" ID=\"bd_date\"><img border=0 alt=\"Popup Calendar\" src=\"http://www.gotobus.com/images/calendar.gif\"></a>');
document.write('    </td>');
document.write('	<td width=\"50%\">');
document.write('	  <small>Return Date:</small><br>');
document.write('	  <script language=\"JavaScript\">');
document.write('        var rd_popup = new PopupWindow(\"rdate_popup\");');
document.write('	    rd_popup.offsetY = 24;');
document.write('		rd_popup.autoHide();');
document.write('	  </script>');
document.write('');
document.write('	  <div id=\"rdate_popup\" style=\"position:absolute;visibility:hidden;\">');
document.write('	    <table bgcolor=\'#999999\' width=130 cellpadding=3 cellspacing=1>');
document.write('		<tr>');
document.write('		  <td bgcolor=\'#ffffe1\' style=\"font-family:ariel,sans-serif;font-size:9pt\">');
document.write('		  <center>Change to roundtrip?</center><br>');
document.write('		  <table align=center>');
document.write('		  <tr>');
document.write('		    <td>');
document.write('			<input type=\'button\' value=\'Yes\' onClick=\"rd_popup.hidePopup();enable_roundtrip();\">');
document.write('			</td>');
document.write('			<td>');
document.write('			<input type=\'button\' value=\'No\' onClick=\'rd_popup.hidePopup();\'>');
document.write('			</td>');
document.write('		  </tr>');
document.write('		  </table>');
document.write('		  </td>');
document.write('		</tr>');
document.write('		</table>');
document.write('	  </div>');
document.write('');
document.write('	  <span NAME=\"r_text_date\" ID=\"r_text_date\">');
document.write('	  <input type=\"text\" name=\"return_date\" onClick=\"check_oneway_text();\" value=\"\" onChange=\"conditional_update();\" style=\"font-size: 12px; font-family: Arial; width:80px;\"></span>');
document.write('	  <span onClick=\"check_oneway_image();\" NAME=\"br_date\" ID=\"br_date\"><img border=0 alt=\"Popup Calendar\" src=\"http://www.gotobus.com/images/calendar.gif\"></span>');
document.write('     </td>');
document.write('  </tr>');
document.write('  </table>');
document.write('  </td>');
document.write('  <td>');
document.write('  <small>Qty:</small><br>');
document.write('      <select name=\"quantity\" onChange=\"change_passengers(this.value);\">');
document.write('		<option value=\"1\" selected>1</option>');
document.write('		<option value=\"2\">2</option>');
document.write('		<option value=\"3\">3</option>');
document.write('		<option value=\"4\">4</option>');
document.write('		<option value=\"5\">5</option>');
document.write('		<option value=\"6\">6</option>');
document.write('		<option value=\"7\">7</option>');
document.write('		<option value=\"8\">8</option>');
document.write('		<option value=\"9\">9</option>');
document.write('		<option value=\"10\">10</option>');
document.write('		<option value=\"11\">11</option>');
document.write('		<option value=\"12\">12</option>');
document.write('		<option value=\"13\">13</option>');
document.write('		<option value=\"14\">14</option>');
document.write('		<option value=\"15\">15</option>');
document.write('		<option value=\"16\">16</option>');
document.write('		<option value=\"17\">17</option>');
document.write('		<option value=\"18\">18</option>');
document.write('		<option value=\"19\">19</option>');
document.write('		<option value=\"20\">20</option>');
document.write('		<option value=\"21\">21</option>');
document.write('		<option value=\"22\">22</option>');
document.write('		<option value=\"23\">23</option>');
document.write('		<option value=\"24\">24</option>');
document.write('		<option value=\"25\">25</option>');
document.write('		<option value=\"26\">26</option>');
document.write('		<option value=\"27\">27</option>');
document.write('		<option value=\"28\">28</option>');
document.write('		<option value=\"29\">29</option>');
document.write('		<option value=\"30\">30</option>');
document.write('      </select>');
document.write('');
document.write('  &nbsp; <input type=\"submit\" value=\"Buy Ticket\">');
document.write('  </td>');
document.write('</tr>');
document.write('</table>');
document.write('</form>');
document.write('');
document.write('		<script language=\"javascript\" src=\"/js/new_bus_search.js\"></script>');
document.write('		<script language=\"javascript\" src=\"/js/balloon_option.js\"></script>');
document.write('		<script type=\"text/javascript\" src=\"/js/ac/actb.js\"></script>');
document.write('		<script type=\"text/javascript\" src=\"/js/ac/common.js\"></script>');
document.write('		<script language=\"javascript\">');
document.write('');
document.write('	update_bus_from();');
document.write('if (document.bus_search.filter_date.value == \'\')');
document.write('{');
document.write('	var b_date = new Date(past_date.valueOf() + aDay);');
document.write('	document.bus_search.filter_date.value = formatDate(b_date, \"yyyy-MM-dd\");');
document.write('}');
document.write('');
document.write('var bf_obj = get_bus_from_obj();');
document.write('var sbf_obj = get_sbus_from_obj();');
document.write('var sbt_obj = get_sbus_to_obj();');
document.write('if (bf_obj.options.selectedIndex > 0)');
document.write('{');
document.write('	var bt_obj = get_bus_to_obj();');
document.write('	var bt_index = bt_obj.options.selectedIndex;');
document.write('	update_bus_to(bf_obj.options[bf_obj.selectedIndex].value);');
document.write('	if (bt_index >= 0)');
document.write('	{');
document.write('		bt_obj.options.selectedIndex = bt_index;');
document.write('		sbf_obj.value = bt_obj.options[bt_index].value;');
document.write('	}');
document.write('}');
document.write('else');
document.write('{');
document.write('	var cf = get_cookie(\'gbfrom\');');
document.write('	var ct = get_cookie(\'gbto\');');
document.write('	if (cf == null || cf ==\"\")');
document.write('	{');
document.write('		sbf_obj.value = \"Departure City\";');
document.write('	}');
document.write('	else');
document.write('	{');
document.write('		sbf_obj.value = cf;');
document.write('	}');
document.write('	update_bus_from_to(cf, ct);');
document.write('	if (ct == null || ct ==\"\")');
document.write('	{');
document.write('		sbt_obj.value = \"Arrival City\";');
document.write('	}');
document.write('	else');
document.write('	{');
document.write('		sbt_obj.value = ct;');
document.write('	}');
document.write('}');
document.write('');
document.write('	if (document.bus_search.b_roundtrip.checked == false)');
document.write('{');
document.write('	document.bus_search.b_oneway.checked = true;');
document.write('}');
document.write('</script>');
document.write('');
document.write('  </td>');
document.write('</tr>');
document.write('</table>');
document.write('<script language=\"javascript\">');
document.write('update_bus_from();');
document.write('if (document.bus_search.filter_date.value == \'\')');
document.write('{');
document.write('	var b_date = new Date(past_date.valueOf() + aDay);');
document.write('	document.bus_search.filter_date.value = formatDate(b_date, \"yyyy-MM-dd\");');
document.write('}');
document.write('');
document.write('var bf_obj = get_bus_from_obj();');
document.write('var sbf_obj = get_sbus_from_obj();');
document.write('var sbt_obj = get_sbus_to_obj();');
document.write('if (bf_obj.options.selectedIndex > 0)');
document.write('{');
document.write('	var bt_obj = get_bus_to_obj();');
document.write('	var bt_index = bt_obj.options.selectedIndex;');
document.write('	update_bus_to(bf_obj.options[bf_obj.selectedIndex].value);');
document.write('	if (bt_index >= 0)');
document.write('	{');
document.write('		bt_obj.options.selectedIndex = bt_index;');
document.write('		sbf_obj.value = bt_obj.options[bt_index].value;');
document.write('	}');
document.write('}');
document.write('else');
document.write('{');
document.write('	var cf = get_cookie(\'gbfrom\');');
document.write('	var ct = get_cookie(\'gbto\');');
document.write('	if (cf == null || cf ==\"\")');
document.write('	{');
document.write('		sbf_obj.value = \"Departure City\";');
document.write('	}');
document.write('	else');
document.write('	{');
document.write('		sbf_obj.value = cf;');
document.write('	}');
document.write('	update_bus_from_to(cf, ct);');
document.write('	if (ct == null || ct ==\"\")');
document.write('	{');
document.write('		sbt_obj.value = \"Arrival City\";');
document.write('	}');
document.write('	else');
document.write('	{');
document.write('		sbt_obj.value = ct;');
document.write('	}');
document.write('}');
document.write('');
document.write('	if (document.bus_search.b_roundtrip.checked == false)');
document.write('{');
document.write('	document.bus_search.b_oneway.checked = true;');
document.write('}');
document.write('if (aff_id != null)');
document.write('{');
document.write('	document.bus_search.nm.value = aff_id;');
document.write('}');
document.write('if (document.bus_search.gid)');
document.write('{');
document.write('	document.bus_search.gid.value = aff_id;');
document.write('}');
document.write('</script>');
