var aDay = 86400000;
var past_date = new Date();
past_date = new Date(past_date.valueOf() - aDay);
//<!--
var local_server_position = "us";
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 set_gid_cookie(value, expires)
{
	var name = "gid";
    var today = new Date();
    today.setTime(today.getTime());
    if (!expires)
    {
    	expires = 7;
    }
    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 pre_set_data()
{
	var date = null;
	if (window.location.search.length>0)
	{
		data = window.location.search.substring(1);
		if (data.match(/-/))
		{
			var s  = document.getElementById('Date');
			set_tour_date (s, data);
		}
		else
		{
			set_gid_cookie(data);
		}
	}
}


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 '';
    }
    if (start == -1) return '';
    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,"");
}

function viewSavedTrips()
{
	make_unvisible();
    var savedBlock=document.getElementById("savedBlock");
    if(!savedBlock){
        savedBlock = document.createElement("div");
        savedBlock.id = "savedBlock";
    }
    savedBlock.innerHTML="";  
    var light_top = (document.documentElement.clientHeight - 230)/2 + 'px';
	var light_left = document.body.scrollLeft + (document.body.clientWidth - 420)/2 + 'px';
	savedBlock.style.left = light_left;
	savedBlock.style.top = light_top;
	savedBlock.className = "top_div";		
    var param = "type=find_saved_trip";
    var compare_xml;
    if(window.XMLHttpRequest) {
        compare_xml = new XMLHttpRequest();
    } else {
        compare_xml = new ActiveXObject("MSXML2.XMLHTTP");
    }
    url = '/cgi-bin/ajax.cgi?' + param;
    compare_xml.open("GET", url, true);
    compare_xml.onreadystatechange = function show_div()
    {
        if (compare_xml.readyState == 4)
        {
            var showResponseText=compare_xml.responseText;
            savedBlock.innerHTML=showResponseText;   
            savedBlock.style.display='block'; 
        }
    };
    compare_xml.setRequestHeader("If-Modified-Since","0");
    compare_xml.send("");
    document.body.appendChild(savedBlock);
    var fadeBlock=document.getElementById("fadeBlock");
    if(!fadeBlock){
        var fadeBlock = document.createElement("div");
        fadeBlock.id="fadeBlock";
    }
    
    fadeBlock.style.height = $(document).height() + 'px';
	fadeBlock.style.width = document.body.scrollWidth + 'px';
    fadeBlock.className="bg_div";   
    document.body.appendChild(fadeBlock);
    fadeBlock.style.display='block';
}
function hideDiv(tag, fade)
{
	make_visible();
	var light=document.getElementById(tag);
	var fade=document.getElementById(fade);
	light.style.display='none';
	fade.style.display='none';
	if(document.getElementById('compare_page') && document.getElementById('compare_page').value !=get_count())
	{

		pageRefresh();
	}
}

function  make_unvisible(){
	var as = document.getElementsByTagName("select");
	if(as !=null && as.length>0){
		for(var i=0; i < as.length; i++) {
			as[i].style.visibility="hidden";
		}
	}
}
function  make_visible(){
	var as = document.getElementsByTagName("select");
	if(as !=null && as.length>0){
		for(var i=0; i < as.length; i++) {
			as[i].style.visibility="visible";
		}
	}
}

function show_link(value) {
	if(value) {
		var currentValue = get_cookie('SAVED_TRIPS');
		if(!currentValue)
		{
			currentValue="";
		}
		var exists = currentValue.indexOf(value);
		var link_div = document.getElementById(value+'_a');
		if(link_div)
		{
			if(exists == -1){
				link_div.innerHTML="<a href='javascript:void(0)' class='n_savetour' title='Save Tour to Compare' onclick='saveToCookie(" + value+ ");'>Save Tour</a>";
			} else {
				link_div.innerHTML="<a href='javascript:void(0)' class='n_removetour' title='Remove' onclick='removeTrip(" + value+ ");'>Remove</a>" + 
				"<a href='http://www.gotobus.com/cgi-bin/v.cgi?a=product_compare' class='n_statenav_compare' title='Compare Tours' class='link1'>Compare</a>";
			}
		}
		showDetailSaveLink(value);
	}
}

function saveToCookie(value) {
	if(value) {
		var currentValue = get_cookie('SAVED_TRIPS');
		if(!currentValue)
		{
			currentValue = "";
		}
		var exists = currentValue.indexOf(value);
		if(exists == -1) {
			if(currentValue.length == 0) {
				var newValue = value;
			} else {
				var newValue = currentValue + "," + value;
			}				
			set_cookie('SAVED_TRIPS',newValue,7);
		}
	}
	updateSavedTrip(value);
}

function updateSavedTrip(value) {
	show_count();
	show_link(value);
}	

function removeChildNodes() {
	var a = (typeof arguments[0] == "string") ? document.getElementById(arguments[0]) : arguments[0];
	while ( a.hasChildNodes() ) {
		a.removeChild(a.childNodes[0]);
	}
}

function removeSavedTrip(obj,value) {
	if(value) {
		document.body.style.cursor = "wait";
		removeTripFromCookie(value);
		updateRemovedTrip(obj,value);
		document.body.style.cursor = "auto";
	}
}

function removeTripFromCookie(value) {
	if(value) {
		var currentValue = get_cookie('SAVED_TRIPS');
		var exists = currentValue.indexOf(value);			
		if(exists != -1){
			if(currentValue.indexOf("," + value) != -1) {
				var newValue = currentValue.replace("," + value,"");
			} else if(currentValue.indexOf(value + ",") != -1) {
				var newValue = currentValue.replace(value + ",","");
			} else {
				var newValue = currentValue.replace(value,"");
			}
			set_cookie('SAVED_TRIPS',newValue,7);
		} 
	}
}

function removeTrip(value) {
	if(value) {
		removeTripFromCookie(value);
		show_count();
		show_link(value);
	}
}

function updateRemovedTrip(obj,value) {
	var tdParent = obj.parentNode;
	var trParent = tdParent.parentNode;
	var tblParent = trParent.parentNode;		 	
	tblParent.removeChild(trParent);
	show_count();
	show_link(value);
}

function show_count() {
	var count = get_count();
	var stLink = document.getElementById('saved_trip_count');
	if(stLink){
		removeChildNodes(stLink);
		stLink.appendChild(document.createTextNode(count));
	}
	var div_count = document.getElementById('div_saved_trip_count');
	if(div_count){
		removeChildNodes(div_count);
		div_count.appendChild(document.createTextNode(count));
	}
}

function get_count() {
	var currentValue = get_cookie('SAVED_TRIPS');
	var count = 0;
	if(currentValue && currentValue.length != 0)
	{
		count = currentValue.split(',').length;
	}
	return count;
}
function pageRefresh()
{
	window.location.reload();
}

function showDetailSaveLink(value) {
	if(value) {
		var currentValue = get_cookie('SAVED_TRIPS');
		if(!currentValue)
		{
			currentValue="";
		}
		var exists = currentValue.indexOf(value);
		var link_div = document.getElementById("detail_save_link");
		if(link_div)
		{
			if(exists == -1){
				link_div.innerHTML="<a href='javascript:void(0)' class='n_savetour' title='Save Tour to Compare' onclick='saveToCookie(" + value+ ");'>Save this tour</a>";
			} else {
				link_div.innerHTML="<a href='javascript:void(0)' class='n_removetour' title='Remove' onclick='removeTrip(" + value+ ");'>Remove</a>";
			}
		}
	}
}
function setTabInit(name,cursel,n){
}
function product_onload()
{	
}
function show_hide_image_div(obj,nth_day)
{
	var image_div=document.getElementById("add_images_div_"+nth_day);
	if(image_div.style.display == "block")
	{
		obj.src="/images/add_image.gif";
		image_div.innerHTML = "";
		image_div.style.display="none";
	}
	else
	{
		obj.src="/images/reduce_image.gif";
		image_div.innerHTML=document.getElementById("serach_image_hidden_div").innerHTML;
		var inputs = image_div.getElementsByTagName("input"); 
		var selects = image_div.getElementsByTagName("select"); 
		var destination = selects[0];
		var divs = image_div.getElementsByTagName("div"); 
		var div = divs[0];
		var keywords;
		var search_button;
		for(var i=0;i<inputs.length;i++)
		{
			if(inputs[i].name=="keywords")
			{
				keywords = inputs[i];
			}					
			if(inputs[i].type=="button")
			{
				search_button = inputs[i];
			}
		}
		var product = document.getElementById("product_id");
		search_button.onclick =  function(){
			var param = "type=search_images&keywords="+keywords.value+"&destination="+destination.value+"&product_id="+product.value+"&nth_day="+nth_day;
			var search_xml;
		    if(window.XMLHttpRequest) {
		        search_xml = new XMLHttpRequest();
		    } else {
		        search_xml = new ActiveXObject("MSXML2.XMLHTTP");
		    }
		    var url = '/cgi-bin/ajax.cgi?' + param;
		    search_xml.open("GET", url, true);
		    search_xml.onreadystatechange = function show_div()
		    {
		        if (search_xml.readyState == 4)
		        {
		            var rt_text=search_xml.responseText;
		            div.innerHTML = "";
		            div.innerHTML = rt_text;
		        }
		    };
		    search_xml.setRequestHeader("If-Modified-Since","0");
		    search_xml.send("");					
		};
		image_div.style.display="block";
	}
}
function removeThisNode(spanname,nth_day) {
	var position = spanname.lastIndexOf("_");
	var image_id = spanname.substring(position+1,spanname.length);
	var image_ids_obj = document.getElementById("image_ids_"+nth_day);
	var image_ids = image_ids_obj.value;
	image_ids=image_ids.replace(","+image_id+",",",");
	image_ids_obj.value=image_ids;
	var obj = document.getElementById(spanname);
	var objParent = obj.parentNode;	 	
	objParent.removeChild(obj);
	if(image_ids == ",")
	{
		var message = document.createElement("span");
		message.innerHTML="<img src='/images/logo/nophoto.gif' title='No image' width='70px' height='55px'/>";
		objParent.appendChild(message);
	}
}
function appendToImage(obj,spanname,nth_day) {
	var position = spanname.lastIndexOf("_");
	var image_id = spanname.substring(position+1,spanname.length);
	var image_ids_obj = document.getElementById("image_ids_"+nth_day);
	var image_ids = image_ids_obj.value;
	var exists = image_ids.indexOf(","+image_id+",");
	if(exists >= 0){
		alert("The image already exists!");
		obj.src='/images/already_add.gif';
		obj.onclick=function(){};
	    obj.onmouseover=function(){};
	    obj.onmouseout=function(){};
	    return;
	}
	var div = document.getElementById("image_show_div_"+nth_day);
	if(image_ids == ",")
	{
		var message = div.getElementsByTagName("span")[0];
		div.removeChild(message);
	}
	image_ids_obj.value = image_ids + image_id + ",";
	var objParent = obj.parentNode;	
	var simg = objParent.childNodes[0];
	var img = simg.cloneNode(false);
	img.onclick=function(){};
	var imageObj = document.createElement("span");
	imageObj.setAttribute('name', spanname);
	imageObj.setAttribute('id', spanname);
    imageObj.appendChild(img);
   	var delImag = document.createElement("img");
   	delImag.src="/images/ico_tr_del.gif";
   	delImag.className="delete_image";
	delImag.setAttribute('title', "Delete");
   	delImag.onmouseover= function(){this.src='/images/ico_tr_delover.gif';};
   	delImag.onmouseout= function(){this.src='/images/ico_tr_del.gif';};
    delImag.onclick= function(){removeThisNode(spanname,nth_day)};
    imageObj.appendChild(delImag);
    div.appendChild(imageObj);
    obj.src='/images/already_add.gif';
    obj.onclick=function(){};
    obj.onmouseover=function(){};
    obj.onmouseout=function(){};
}
function getPhotoDiv(obj)
{
	var parNode = obj.parentNode;
	var divNode = parNode.getElementsByTagName("div");
	return divNode[0];	
}
function appendToImageByImage(obj,spanname,nth_day)
{
	var parNode = obj.parentNode;
	var imgNode = parNode.getElementsByTagName("img");
	var add_button = imgNode[1];
	appendToImage(add_button,spanname,nth_day);
}

function getElementsByClassName(clsName,htmltag){ 
	var arr = new Array(); 
	var elems = document.getElementsByTagName(htmltag);
	for (var i = 0; i<elems.length; i++ )
	{
		var elem = elems[i];
		if (elem.className == clsName)
		{
			arr[arr.length] = elem;   
		}
	}
	return arr;
}
var CssClass = {};
CssClass.is = function(e, c){
		if(typeof e == "string") e = document.getElementById(e);
		var classes = e.className;
		if(!classes) return false;
		if(classes == c) return true;
    	return e.className.match(new RegExp('(\\s|^)'+c+'(\\s|$)'));		
};
CssClass.add = function(e, c){
	if(typeof e == "string") e = document.getElementById(e);
	if(CssClass.is(e, c)) return;
	if(e.className) c = " " + c;
	e.className += c;
};
CssClass.remove = function(e, c){
	if(typeof e == "string") e = document.getElementById(e);		
    if (CssClass.is(e,c)) {
		var reg = new RegExp('(\\s|^)'+c+'(\\s|$)');
        e.className=e.className.replace(reg,' ');
    }
};
CssClass.toggle = function(e,c) {
    if (CssClass.is(e,c)) {
        CssClass.remove(e,c);
    }
    else{
        addClass.add(e,c);
    }
};
CssClass.change = function(ele,oc,nc) {
    if (!CssClass.is(e,nc)) {
        if(CssClass.is(e,oc)){
        	CssClass.remove(e,oc);
        }
        CssClass.add(e,nc);
    }
};
function is_ie_six()
{
	var browser_ver = $.browser.version;
	var accurate_value = browser_ver.substr(0,1);

	if($.browser.msie && accurate_value == '6' ){
		return true;
	}
	return false;
}
Date.prototype.format = function(format)
{
	var o = {
	"M+" : this.getMonth()+1, 
	"d+" : this.getDate(), 
	"h+" : this.getHours(), 
	"m+" : this.getMinutes(),
	"s+" : this.getSeconds(),
	"q+" : Math.floor((this.getMonth()+3)/3),
	"S" : this.getMilliseconds()
	}
	if(/(y+)/.test(format)) format=format.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
	for(var k in o)if(new RegExp("("+ k +")").test(format))
	format = format.replace(RegExp.$1,
	RegExp.$1.length==1 ? o[k] :
	("00"+ o[k]).substr((""+ o[k]).length));
	return format;
}

function cookie_login(c_cgi, sc_cgi)
{
	var cookie_login = get_cookie("IvyCustomer_LoginCookie");
	if(cookie_login != null && cookie_login != '')
	{
		var cookie_email = get_cookie("IvyCustomer_LoginEmail");				
		var cookie_uid = get_cookie("IvyCustomer_FirstName");
		if(cookie_uid == "")
		{
			cookie_uid = get_cookie("IvyCustomer_Uid");
		}
		var cookie_is_facebook = get_cookie("IvyCustomer_IsFacebookSignin");		
		var facebook_login_html = "";
		if(cookie_is_facebook == 1)
		{
			facebook_login_html = "<img alt='Login with Facebook'  title='Login with Facebook' src='/images/fceebook_lg.gif' style='top:4px;position:relative;'> ";			
		}
		if(document.getElementById('facebook_signin'))
		{
			document.getElementById('facebook_signin').innerHTML = "";
		}	
		if(cookie_uid == "" || cookie_uid.indexOf("_auto_") != -1)
		{
			if(cookie_email.indexOf("facebook:")!= -1)
			{
				cookie_email = cookie_email.replace("facebook:", "");
			}
			document.getElementById('welcome_span').innerHTML = "Welcome - "+facebook_login_html+"<a style='text-decoration:underline;' title='Account' href='"+sc_cgi+"?a=main' target='_top'>" + cookie_email + "</a>";
		}
		else
		{
			document.getElementById('welcome_span').innerHTML = "Welcome - "+facebook_login_html+"<a style='text-decoration:underline;' title='Account' href='"+sc_cgi+"?a=main' target='_top'>" + cookie_uid + "</a>";
		}
		var sign_link = document.getElementById('sign_link');
		sign_link.innerHTML = "Sign Out";
		sign_link.href = c_cgi + "?a=signout";
		sign_link.title = "Sign Out";		
	}
}
//-->

// ===================================================================
// 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["DE"] = "Delaware";
states["DC"] = "District of Columbia";
states["FL"] = "Florida";
states["GA"] = "Georgia";
states["MD"] = "Maryland";
states["MA"] = "Massachusetts";
states["NJ"] = "New Jersey";states["NV"] = "Nevada";
states["NY"] = "New York";
states["NC"] = "North Carolina";
states["OH"] = "Ohio";
states["OR"] = "Oregon";
states["PA"] = "Pennsylvania";
states["SC"] = "South Carolina";
states["VA"] = "Virginia";
states["WA"] = "Washington";
states["WV"] = "West Virginia";
states["BC"] = "British Columbia";
states["BCN"] = "Baja California";
states["MX"] = "Mexico";
 
 //-->

var special_citys = new Array('New York, NY', 'Washington, DC', 'Las Vegas, NV', 'Los Angeles, CA', 'San Francisco, CA', 'Orlando, FL', 'Albany, NY', 'Boston, MA', 'Oakland, CA', 'Miami, FL', 'Vancouver, BC');
<!--
var b_cities = new Array('Albany, NY', 'Albany, OR', 'Anaheim, CA', 'Anderson, SC', 'Arlington, VA', 'Atlanta, GA', 'Baltimore, MD', 'Bellingham Airport, WA', 'Bethesda, MD', 'Beverly Hills, CA', 'Boston, MA', 'Buena Park, CA', 'Bullhead City, AZ', 'Camarillo Outlet, CA', 'Camarillo, CA', 'Cambridge, MA', 'Carpinteria, CA', 'Chandler, AZ', 'Charleston, WV', 'Charlotte, NC', 'Cincinnati, OH', 'Colton, CA', 'Columbia, SC', 'Columbus, OH', 'Cupertino, CA', 'Dayton, OH', 'Dorchester, MA', 'Dorris, CA', 'Dover, DE', 'Durham, NC', 'El Monte, CA', 'Fairfax, VA', 'Fayetteville, NC', 'Fredericksburg, VA', 'Fresnillo, MX', 'Garden Grove, CA', 'Goleta, CA', 'Grants Pass, OR', 'Greensboro, NC', 'Greenville, SC', 'Hagerstown, MD', 'Hampton, VA', 'Harrisburg, PA', 'Harrisonburg, VA', 'Hartford, CT', 'Hillsboro, OR', 'Hollywood, CA', 'Hood River, OR', 'Huntington Park, CA', 'Jacksonville, FL', 'Jerez de Garcia Salinas, MX', 'John Wayne Airport, CA', 'Kingman, AZ', 'Kissimmee, FL', 'Klamanth Falls, OR', 'LAX Airport or Hotels, CA', 'Lancaster, PA', 'Las Vegas, NV', 'Laughlin, NV', 'Lawrence, MA', 'Los Angeles, CA', 'Lowell, MA', 'Mabton, WA', 'Madras, OR', 'Malden, MA', 'Medford, OR', 'Methuen, MA', 'Miami Beach, FL', 'Miami, FL', 'Milton Freewater, OR', 'Mohegan Sun Casino, CT', 'Morgantown, WV', 'New York, NY', 'Newport News, VA', 'Newton, MA', 'Norfolk, VA', 'Norristown, PA', 'Norwich, CT', 'Oakland, CA', 'Ontario, CA', 'Orlando, FL', 'Palm Springs, CA', 'Philadelphia, PA', 'Phoenix, AZ', 'Portland, OR', 'Quincy, MA', 'Quincy, WA', 'Raleigh, NC', 'Richmond, BC', 'Richmond, VA', 'Roanoke, VA', 'Rockville, MD', 'Rosemead, CA', 'Rowland Heights, CA', 'Royal City, WA', 'Salem, OR', 'San Diego Balboa Park, CA', 'San Diego, CA', 'San Fernando, CA', 'San Francisco, CA', 'San Jose, CA', 'Santa Ana, CA', 'Santa Barbara, CA', 'Santa Monica, CA', 'Savannah, GA', 'Seattle Airport, WA', 'Seattle, WA', 'Smyrna, DE', 'Spartanburg, SC', 'Springfield, OR', 'Springfield, VA', 'State College, PA', 'Studio City, CA', 'Tempe, AZ', 'Tualatin, OR', 'Tucson, AZ', 'Tulalip, WA', 'Tustin, CA', 'Universal City, CA', 'Vancouver, BC', 'Victorville, CA', 'Vienna, VA', 'Virginia Beach, VA', 'Walla Walla, WA', 'Washington, DC', 'Westminster, CA', 'Wilmington, DE', 'Woodburn, OR', 'Woodbury Outlets, NY', 'Worcester, MA', 'York, PA', 'Yosemite, CA');
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['Albany, OR'][0] = 'Huntington Park, CA';
g_bus['Anaheim, CA'][0] = 'Beverly Hills, CA';
g_bus['Anaheim, CA'][1] = 'Hollywood, CA';
g_bus['Anaheim, CA'][2] = 'John Wayne Airport, CA';
g_bus['Anaheim, CA'][3] = 'LAX Airport or Hotels, CA';
g_bus['Anaheim, CA'][4] = 'Las Vegas, NV';
g_bus['Anaheim, CA'][5] = 'Los Angeles, CA';
g_bus['Anaheim, CA'][6] = 'San Diego, CA';
g_bus['Anaheim, CA'][7] = 'Santa Monica, CA';
g_bus['Anaheim, CA'][8] = 'Universal City, CA';
g_bus['Anderson, SC'][0] = 'New York, NY';
g_bus['Arlington, VA'][0] = 'New York, NY';
g_bus['Atlanta, GA'][0] = 'New York, NY';
g_bus['Baltimore, MD'][0] = 'New York, NY';
g_bus['Bellingham Airport, WA'][0] = 'Richmond, BC';
g_bus['Bellingham Airport, WA'][1] = 'Vancouver, BC';
g_bus['Bethesda, MD'][0] = 'New York, NY';
g_bus['Beverly Hills, CA'][0] = 'Las Vegas, NV';
g_bus['Beverly Hills, CA'][1] = 'San Diego, CA';
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['Buena Park, CA'][0] = 'Las Vegas, NV';
g_bus['Bullhead City, AZ'][0] = 'Las Vegas, NV';
g_bus['Bullhead City, AZ'][1] = 'Nogales, AZ';
g_bus['Bullhead City, AZ'][2] = 'Phoenix, AZ';
g_bus['Bullhead City, AZ'][3] = 'Tucson, AZ';
g_bus['Camarillo Outlet, CA'][0] = 'Burbank, CA';
g_bus['Camarillo Outlet, CA'][1] = 'Glendale, CA';
g_bus['Camarillo Outlet, CA'][2] = 'Hollywood, CA';
g_bus['Camarillo Outlet, CA'][3] = 'Los Angeles, CA';
g_bus['Camarillo, CA'][0] = 'Burbank, CA';
g_bus['Camarillo, CA'][1] = 'Glendale, CA';
g_bus['Camarillo, CA'][2] = 'Hollywood, CA';
g_bus['Camarillo, CA'][3] = 'Los Angeles, CA';
g_bus['Cambridge, MA'][0] = 'New York, NY';
g_bus['Carpinteria, CA'][0] = 'LAX Airport or Hotels, CA';
g_bus['Chandler, AZ'][0] = 'Los Angeles, CA';
g_bus['Chandler, AZ'][1] = 'Rosemead, CA';
g_bus['Chandler, AZ'][2] = 'Westminster, CA';
g_bus['Charleston, WV'][0] = 'New York, NY';
g_bus['Charlotte, NC'][0] = 'New York, NY';
g_bus['Cincinnati, OH'][0] = 'New York, NY';
g_bus['Colton, CA'][0] = 'Las Vegas, NV';
g_bus['Columbia, SC'][0] = 'New York, NY';
g_bus['Columbus, OH'][0] = 'New York, NY';
g_bus['Cupertino, CA'][0] = 'Los Angeles, CA';
g_bus['Dayton, OH'][0] = 'New York, NY';
g_bus['Dorchester, MA'][0] = 'Mohegan Sun Casino, CT';
g_bus['Dorris, CA'][0] = 'Huntington Park, CA';
g_bus['Dorris, CA'][1] = 'Mabton, WA';
g_bus['Dorris, CA'][2] = 'Madras, OR';
g_bus['Dorris, CA'][3] = 'Milton Freewater, OR';
g_bus['Dorris, CA'][4] = 'Quincy, WA';
g_bus['Dorris, CA'][5] = 'Royal City, WA';
g_bus['Dorris, CA'][6] = 'Walla Walla, WA';
g_bus['Dover, DE'][0] = 'New York, NY';
g_bus['Durham, NC'][0] = 'New York, NY';
g_bus['El Monte, CA'][0] = 'Oakland, CA';
g_bus['El Monte, CA'][1] = 'San Francisco, CA';
g_bus['El Monte, CA'][2] = 'San Jose, CA';
g_bus['Fairfax, VA'][0] = 'New York, NY';
g_bus['Fayetteville, NC'][0] = 'New York, NY';
g_bus['Fredericksburg, VA'][0] = 'New York, NY';
g_bus['Fresnillo, MX'][0] = 'Los Angeles, CA';
g_bus['Fresnillo, MX'][1] = 'San Fernando, CA';
g_bus['Garden Grove, CA'][0] = 'Las Vegas, NV';
g_bus['Goleta, CA'][0] = 'LAX Airport or Hotels, CA';
g_bus['Grants Pass, OR'][0] = 'Huntington Park, CA';
g_bus['Greensboro, NC'][0] = 'New York, NY';
g_bus['Greenville, SC'][0] = 'New York, NY';
g_bus['Hagerstown, MD'][0] = 'New York, NY';
g_bus['Hampton, VA'][0] = 'New York, NY';
g_bus['Harrisburg, PA'][0] = 'New York, NY';
g_bus['Harrisonburg, VA'][0] = 'New York, NY';
g_bus['Hartford, CT'][0] = 'Boston, MA';
g_bus['Hartford, CT'][1] = 'New York, NY';
g_bus['Hillsboro, OR'][0] = 'Huntington Park, CA';
g_bus['Hollywood, CA'][0] = 'Las Vegas, NV';
g_bus['Hollywood, CA'][1] = 'San Diego, CA';
g_bus['Hollywood, CA'][2] = 'San Francisco, CA';
g_bus['Hollywood, CA'][3] = 'San Jose, CA';
g_bus['Hood River, OR'][0] = 'Dorris, CA';
g_bus['Hood River, OR'][1] = 'Huntington Park, CA';
g_bus['Huntington Park, CA'][0] = 'Albany, OR';
g_bus['Huntington Park, CA'][1] = 'Dorris, CA';
g_bus['Huntington Park, CA'][2] = 'Grants Pass, OR';
g_bus['Huntington Park, CA'][3] = 'Hillsboro, OR';
g_bus['Huntington Park, CA'][4] = 'Hood River, OR';
g_bus['Huntington Park, CA'][5] = 'Klamanth Falls, OR';
g_bus['Huntington Park, CA'][6] = 'Las Vegas, NV';
g_bus['Huntington Park, CA'][7] = 'Mabton, WA';
g_bus['Huntington Park, CA'][8] = 'Madras, OR';
g_bus['Huntington Park, CA'][9] = 'Medford, OR';
g_bus['Huntington Park, CA'][10] = 'Milton Freewater, OR';
g_bus['Huntington Park, CA'][11] = 'Phoenix, AZ';
g_bus['Huntington Park, CA'][12] = 'Portland, OR';
g_bus['Huntington Park, CA'][13] = 'Quincy, WA';
g_bus['Huntington Park, CA'][14] = 'Royal City, WA';
g_bus['Huntington Park, CA'][15] = 'Salem, OR';
g_bus['Huntington Park, CA'][16] = 'Springfield, OR';
g_bus['Huntington Park, CA'][17] = 'Tualatin, OR';
g_bus['Huntington Park, CA'][18] = 'Tucson, AZ';
g_bus['Huntington Park, CA'][19] = 'Walla Walla, WA';
g_bus['Huntington Park, CA'][20] = 'Woodburn, OR';
g_bus['Jacksonville, FL'][0] = 'New York, NY';
g_bus['Jerez de Garcia Salinas, MX'][0] = 'Los Angeles, CA';
g_bus['Jerez de Garcia Salinas, MX'][1] = 'San Fernando, CA';
g_bus['John Wayne Airport, CA'][0] = 'Anaheim, CA';
g_bus['Kingman, AZ'][0] = 'Las Vegas, NV';
g_bus['Kingman, AZ'][1] = 'Nogales, AZ';
g_bus['Kingman, AZ'][2] = 'Phoenix, AZ';
g_bus['Kingman, AZ'][3] = 'Tucson, AZ';
g_bus['Kissimmee, FL'][0] = 'Miami Beach, FL';
g_bus['Kissimmee, FL'][1] = 'Miami, FL';
g_bus['Klamanth Falls, OR'][0] = 'Huntington Park, CA';
g_bus['LAX Airport or Hotels, CA'][0] = 'Anaheim, CA';
g_bus['LAX Airport or Hotels, CA'][1] = 'Carpinteria, CA';
g_bus['LAX Airport or Hotels, CA'][2] = 'Goleta, CA';
g_bus['LAX Airport or Hotels, CA'][3] = 'Las Vegas, NV';
g_bus['LAX Airport or Hotels, CA'][4] = 'San Diego, CA';
g_bus['LAX Airport or Hotels, CA'][5] = 'Santa Barbara, CA';
g_bus['Lancaster, PA'][0] = 'New York, NY';
g_bus['Las Vegas, NV'][0] = 'Anaheim, CA';
g_bus['Las Vegas, NV'][1] = 'Buena Park, CA';
g_bus['Las Vegas, NV'][2] = 'Bullhead City, AZ';
g_bus['Las Vegas, NV'][3] = 'Colton, CA';
g_bus['Las Vegas, NV'][4] = 'Garden Grove, CA';
g_bus['Las Vegas, NV'][5] = 'Hollywood, CA';
g_bus['Las Vegas, NV'][6] = 'Huntington Park, CA';
g_bus['Las Vegas, NV'][7] = 'Kingman, AZ';
g_bus['Las Vegas, NV'][8] = 'LAX Airport or Hotels, CA';
g_bus['Las Vegas, NV'][9] = 'Laughlin, NV';
g_bus['Las Vegas, NV'][10] = 'Los Angeles, CA';
g_bus['Las Vegas, NV'][11] = 'Nogales, AZ';
g_bus['Las Vegas, NV'][12] = 'Ontario, CA';
g_bus['Las Vegas, NV'][13] = 'Phoenix, AZ';
g_bus['Las Vegas, NV'][14] = 'Rowland Heights, CA';
g_bus['Las Vegas, NV'][15] = 'San Fernando, CA';
g_bus['Las Vegas, NV'][16] = 'Santa Ana, CA';
g_bus['Las Vegas, NV'][17] = 'Studio City, CA';
g_bus['Las Vegas, NV'][18] = 'Tucson, AZ';
g_bus['Las Vegas, NV'][19] = 'Tustin, CA';
g_bus['Las Vegas, NV'][20] = 'Victorville, CA';
g_bus['Laughlin, NV'][0] = 'Las Vegas, NV';
g_bus['Laughlin, NV'][1] = 'Nogales, AZ';
g_bus['Laughlin, NV'][2] = 'Phoenix, AZ';
g_bus['Laughlin, NV'][3] = 'Tucson, AZ';
g_bus['Lawrence, MA'][0] = 'Mohegan Sun Casino, CT';
g_bus['Los Angeles, CA'][0] = 'Chandler, AZ';
g_bus['Los Angeles, CA'][1] = 'Citadel Outlet, CA';
g_bus['Los Angeles, CA'][2] = 'Cupertino, CA';
g_bus['Los Angeles, CA'][3] = 'Desert Hills Outlet, CA';
g_bus['Los Angeles, CA'][4] = 'El Monte, CA';
g_bus['Los Angeles, CA'][5] = 'Fresnillo, MX';
g_bus['Los Angeles, CA'][6] = 'Getty Museum, CA';
g_bus['Los Angeles, CA'][7] = 'Jerez de Garcia Salinas, MX';
g_bus['Los Angeles, CA'][8] = 'Knotts Berry Farm, CA';
g_bus['Los Angeles, CA'][9] = 'Las Vegas, NV';
g_bus['Los Angeles, CA'][10] = 'Oakland, CA';
g_bus['Los Angeles, CA'][11] = 'Ontario Mills Outlet, CA';
g_bus['Los Angeles, CA'][12] = 'Phoenix, AZ';
g_bus['Los Angeles, CA'][13] = 'Ronald Reagan Museum, CA';
g_bus['Los Angeles, CA'][14] = 'San Diego Zoo, CA';
g_bus['Los Angeles, CA'][15] = 'San Diego, CA';
g_bus['Los Angeles, CA'][16] = 'San Fernando, CA';
g_bus['Los Angeles, CA'][17] = 'San Francisco, CA';
g_bus['Los Angeles, CA'][18] = 'San Jose, CA';
g_bus['Los Angeles, CA'][19] = 'San Ysidro, CA';
g_bus['Los Angeles, CA'][20] = 'Sea World, CA';
g_bus['Los Angeles, CA'][21] = 'Six Flags Hurricane Harbor, CA';
g_bus['Los Angeles, CA'][22] = 'Six Flags Magic Mountain, CA';
g_bus['Los Angeles, CA'][23] = 'Tempe, AZ';
g_bus['Los Angeles, CA'][24] = 'Tijuana, BCN';
g_bus['Los Angeles, CA'][25] = 'Tucson, AZ';
g_bus['Los Angeles, CA'][26] = 'Westminster, CA';
g_bus['Lowell, MA'][0] = 'Mohegan Sun Casino, CT';
g_bus['Mabton, WA'][0] = 'Dorris, CA';
g_bus['Mabton, WA'][1] = 'Huntington Park, CA';
g_bus['Madras, OR'][0] = 'Dorris, CA';
g_bus['Madras, OR'][1] = 'Huntington Park, CA';
g_bus['Malden, MA'][0] = 'Mohegan Sun Casino, CT';
g_bus['Medford, OR'][0] = 'Huntington Park, CA';
g_bus['Methuen, MA'][0] = 'Mohegan Sun Casino, CT';
g_bus['Miami Beach, FL'][0] = 'Kissimmee, FL';
g_bus['Miami Beach, FL'][1] = 'Orlando, FL';
g_bus['Miami, FL'][0] = 'Kissimmee, FL';
g_bus['Miami, FL'][1] = 'Orlando, FL';
g_bus['Milton Freewater, OR'][0] = 'Dorris, CA';
g_bus['Milton Freewater, OR'][1] = 'Huntington Park, CA';
g_bus['Mohegan Sun Casino, CT'][0] = 'New York, NY';
g_bus['Morgantown, WV'][0] = 'New York, NY';
g_bus['New York, NY'][0] = 'Albany, NY';
g_bus['New York, NY'][1] = 'Anderson, SC';
g_bus['New York, NY'][2] = 'Arlington, VA';
g_bus['New York, NY'][3] = 'Atlanta, GA';
g_bus['New York, NY'][4] = 'Baltimore, MD';
g_bus['New York, NY'][5] = 'Bethesda, MD';
g_bus['New York, NY'][6] = 'Boston, MA';
g_bus['New York, NY'][7] = 'Cambridge, MA';
g_bus['New York, NY'][8] = 'Charleston, WV';
g_bus['New York, NY'][9] = 'Charlotte, NC';
g_bus['New York, NY'][10] = 'Cincinnati, OH';
g_bus['New York, NY'][11] = 'Columbia, SC';
g_bus['New York, NY'][12] = 'Columbus, OH';
g_bus['New York, NY'][13] = 'Dayton, OH';
g_bus['New York, NY'][14] = 'Dover, DE';
g_bus['New York, NY'][15] = 'Durham, NC';
g_bus['New York, NY'][16] = 'Fairfax, VA';
g_bus['New York, NY'][17] = 'Fayetteville, NC';
g_bus['New York, NY'][18] = 'Fredericksburg, VA';
g_bus['New York, NY'][19] = 'Greensboro, NC';
g_bus['New York, NY'][20] = 'Greenville, SC';
g_bus['New York, NY'][21] = 'Hagerstown, MD';
g_bus['New York, NY'][22] = 'Hampton, VA';
g_bus['New York, NY'][23] = 'Harrisburg, PA';
g_bus['New York, NY'][24] = 'Harrisonburg, VA';
g_bus['New York, NY'][25] = 'Hartford, CT';
g_bus['New York, NY'][26] = 'Jacksonville, FL';
g_bus['New York, NY'][27] = 'Lancaster, PA';
g_bus['New York, NY'][28] = 'Mohegan Sun Casino, CT';
g_bus['New York, NY'][29] = 'Morgantown, WV';
g_bus['New York, NY'][30] = 'Newport News, VA';
g_bus['New York, NY'][31] = 'Newton, MA';
g_bus['New York, NY'][32] = 'Norfolk, VA';
g_bus['New York, NY'][33] = 'Norristown, PA';
g_bus['New York, NY'][34] = 'Philadelphia, PA';
g_bus['New York, NY'][35] = 'Raleigh, NC';
g_bus['New York, NY'][36] = 'Richmond, VA';
g_bus['New York, NY'][37] = 'Roanoke, VA';
g_bus['New York, NY'][38] = 'Rockville, MD';
g_bus['New York, NY'][39] = 'Savannah, GA';
g_bus['New York, NY'][40] = 'Smyrna, DE';
g_bus['New York, NY'][41] = 'Spartanburg, SC';
g_bus['New York, NY'][42] = 'Springfield, VA';
g_bus['New York, NY'][43] = 'State College, PA';
g_bus['New York, NY'][44] = 'Virginia Beach, VA';
g_bus['New York, NY'][45] = 'Washington, DC';
g_bus['New York, NY'][46] = 'Wilmington, DE';
g_bus['New York, NY'][47] = 'Woodbury Outlets, NY';
g_bus['New York, NY'][48] = 'York, PA';
g_bus['Newport News, VA'][0] = 'New York, NY';
g_bus['Newton, MA'][0] = 'New York, NY';
g_bus['Norfolk, VA'][0] = 'New York, NY';
g_bus['Norristown, PA'][0] = 'New York, NY';
g_bus['Norwich, CT'][0] = 'New York, NY';
g_bus['Oakland, CA'][0] = 'El Monte, CA';
g_bus['Oakland, CA'][1] = 'Los Angeles, CA';
g_bus['Oakland, CA'][2] = 'Westminster, CA';
g_bus['Ontario, CA'][0] = 'Las Vegas, NV';
g_bus['Orlando, FL'][0] = 'Miami Beach, FL';
g_bus['Orlando, FL'][1] = 'Miami, FL';
g_bus['Palm Springs, CA'][0] = 'Burbank, CA';
g_bus['Palm Springs, CA'][1] = 'Glendale, CA';
g_bus['Palm Springs, CA'][2] = 'Hollywood, CA';
g_bus['Palm Springs, CA'][3] = 'Los Angeles, CA';
g_bus['Philadelphia, PA'][0] = 'New York, NY';
g_bus['Philadelphia, PA'][1] = 'Washington, DC';
g_bus['Phoenix, AZ'][0] = 'Bullhead City, AZ';
g_bus['Phoenix, AZ'][1] = 'Huntington Park, CA';
g_bus['Phoenix, AZ'][2] = 'Kingman, AZ';
g_bus['Phoenix, AZ'][3] = 'Las Vegas, NV';
g_bus['Phoenix, AZ'][4] = 'Laughlin, NV';
g_bus['Phoenix, AZ'][5] = 'Los Angeles, CA';
g_bus['Phoenix, AZ'][6] = 'Rosemead, CA';
g_bus['Phoenix, AZ'][7] = 'Westminster, CA';
g_bus['Portland, OR'][0] = 'Dorris, CA';
g_bus['Portland, OR'][1] = 'Huntington Park, CA';
g_bus['Quincy, MA'][0] = 'Mohegan Sun Casino, CT';
g_bus['Quincy, WA'][0] = 'Dorris, CA';
g_bus['Quincy, WA'][1] = 'Huntington Park, CA';
g_bus['Raleigh, NC'][0] = 'New York, NY';
g_bus['Richmond, BC'][0] = 'Bellingham Airport, WA';
g_bus['Richmond, BC'][1] = 'Seattle Airport, WA';
g_bus['Richmond, BC'][2] = 'Seattle, WA';
g_bus['Richmond, BC'][3] = 'Tulalip, WA';
g_bus['Richmond, VA'][0] = 'New York, NY';
g_bus['Richmond, VA'][1] = 'Washington, DC';
g_bus['Roanoke, VA'][0] = 'New York, NY';
g_bus['Rockville, MD'][0] = 'New York, NY';
g_bus['Rosemead, CA'][0] = 'Chandler, AZ';
g_bus['Rosemead, CA'][1] = 'Phoenix, AZ';
g_bus['Rosemead, CA'][2] = 'Tempe, AZ';
g_bus['Rowland Heights, CA'][0] = 'Las Vegas, NV';
g_bus['Royal City, WA'][0] = 'Dorris, CA';
g_bus['Royal City, WA'][1] = 'Huntington Park, CA';
g_bus['Salem, OR'][0] = 'Huntington Park, CA';
g_bus['San Diego Balboa Park, CA'][0] = 'Burbank, CA';
g_bus['San Diego Balboa Park, CA'][1] = 'Glendale, CA';
g_bus['San Diego Balboa Park, CA'][2] = 'Hollywood, CA';
g_bus['San Diego Balboa Park, CA'][3] = 'Los Angeles, CA';
g_bus['San Diego, CA'][0] = 'Anaheim, CA';
g_bus['San Diego, CA'][1] = 'Burbank, CA';
g_bus['San Diego, CA'][2] = 'Glendale, CA';
g_bus['San Diego, CA'][3] = 'Hollywood, CA';
g_bus['San Diego, CA'][4] = 'LAX Airport or Hotels, CA';
g_bus['San Diego, CA'][5] = 'Los Angeles, CA';
g_bus['San Fernando, CA'][0] = 'Fresnillo, MX';
g_bus['San Fernando, CA'][1] = 'Jerez de Garcia Salinas, MX';
g_bus['San Fernando, CA'][2] = 'Las Vegas, NV';
g_bus['San Fernando, CA'][3] = 'Los Angeles, CA';
g_bus['San Francisco, CA'][0] = 'El Monte, CA';
g_bus['San Francisco, CA'][1] = 'Hollywood, CA';
g_bus['San Francisco, CA'][2] = 'Los Angeles, CA';
g_bus['San Francisco, CA'][3] = 'Santa Monica, CA';
g_bus['San Francisco, CA'][4] = 'Westminster, CA';
g_bus['San Francisco, CA'][5] = 'Yosemite, CA';
g_bus['San Jose, CA'][0] = 'El Monte, CA';
g_bus['San Jose, CA'][1] = 'Hollywood, CA';
g_bus['San Jose, CA'][2] = 'Los Angeles, CA';
g_bus['San Jose, CA'][3] = 'Santa Monica, CA';
g_bus['San Jose, CA'][4] = 'Westminster, CA';
g_bus['Santa Ana, CA'][0] = 'Las Vegas, NV';
g_bus['Santa Barbara, CA'][0] = 'Burbank, CA';
g_bus['Santa Barbara, CA'][1] = 'Glendale, CA';
g_bus['Santa Barbara, CA'][2] = 'Hollywood, CA';
g_bus['Santa Barbara, CA'][3] = 'LAX Airport or Hotels, CA';
g_bus['Santa Barbara, CA'][4] = 'Los Angeles, CA';
g_bus['Santa Monica, CA'][0] = 'Las Vegas, NV';
g_bus['Santa Monica, CA'][1] = 'San Diego, CA';
g_bus['Santa Monica, CA'][2] = 'San Francisco, CA';
g_bus['Santa Monica, CA'][3] = 'San Jose, CA';
g_bus['Savannah, GA'][0] = 'New York, NY';
g_bus['Seattle Airport, WA'][0] = 'Richmond, BC';
g_bus['Seattle Airport, WA'][1] = 'Vancouver, BC';
g_bus['Seattle, WA'][0] = 'Richmond, BC';
g_bus['Seattle, WA'][1] = 'Vancouver, BC';
g_bus['Smyrna, DE'][0] = 'New York, NY';
g_bus['Spartanburg, SC'][0] = 'New York, NY';
g_bus['Springfield, OR'][0] = 'Huntington Park, CA';
g_bus['Springfield, VA'][0] = 'New York, NY';
g_bus['State College, PA'][0] = 'New York, NY';
g_bus['Studio City, CA'][0] = 'Las Vegas, NV';
g_bus['Tempe, AZ'][0] = 'Los Angeles, CA';
g_bus['Tempe, AZ'][1] = 'Rosemead, CA';
g_bus['Tempe, AZ'][2] = 'Westminster, CA';
g_bus['Tualatin, OR'][0] = 'Huntington Park, CA';
g_bus['Tucson, AZ'][0] = 'Bullhead City, AZ';
g_bus['Tucson, AZ'][1] = 'Huntington Park, CA';
g_bus['Tucson, AZ'][2] = 'Kingman, AZ';
g_bus['Tucson, AZ'][3] = 'Las Vegas, NV';
g_bus['Tucson, AZ'][4] = 'Laughlin, NV';
g_bus['Tucson, AZ'][5] = 'Los Angeles, CA';
g_bus['Tulalip, WA'][0] = 'Richmond, BC';
g_bus['Tulalip, WA'][1] = 'Vancouver, BC';
g_bus['Tustin, CA'][0] = 'Las Vegas, NV';
g_bus['Universal City, CA'][0] = 'Las Vegas, NV';
g_bus['Universal City, CA'][1] = 'San Diego, CA';
g_bus['Vancouver, BC'][0] = 'Bellingham Airport, WA';
g_bus['Vancouver, BC'][1] = 'Seattle Airport, WA';
g_bus['Vancouver, BC'][2] = 'Seattle, WA';
g_bus['Vancouver, BC'][3] = 'Tulalip, WA';
g_bus['Victorville, CA'][0] = 'Las Vegas, NV';
g_bus['Vienna, VA'][0] = 'Fairfax, VA';
g_bus['Vienna, VA'][1] = 'New York, NY';
g_bus['Virginia Beach, VA'][0] = 'New York, NY';
g_bus['Walla Walla, WA'][0] = 'Dorris, CA';
g_bus['Walla Walla, WA'][1] = 'Huntington Park, CA';
g_bus['Washington, DC'][0] = 'New York, NY';
g_bus['Washington, DC'][1] = 'Philadelphia, PA';
g_bus['Washington, DC'][2] = 'Richmond, VA';
g_bus['Westminster, CA'][0] = 'Chandler, AZ';
g_bus['Westminster, CA'][1] = 'Oakland, CA';
g_bus['Westminster, CA'][2] = 'Phoenix, AZ';
g_bus['Westminster, CA'][3] = 'San Francisco, CA';
g_bus['Westminster, CA'][4] = 'San Jose, CA';
g_bus['Westminster, CA'][5] = 'Tempe, AZ';
g_bus['Wilmington, DE'][0] = 'New York, NY';
g_bus['Woodburn, OR'][0] = 'Huntington Park, CA';
g_bus['Woodbury Outlets, NY'][0] = 'New York, NY';
g_bus['Worcester, MA'][0] = 'Mohegan Sun Casino, CT';
g_bus['York, PA'][0] = 'New York, NY';
g_bus['Yosemite, CA'][0] = 'San Francisco, CA';

var latitudes = new Array();
var longitudes = new Array();
var city_ids = new Array();
var id_citys = new Array();
		
latitudes["Anaheim, CA"] = "33.835";
longitudes["Anaheim, CA"] = "-117.915";
city_ids["Anaheim, CA"] = "9";
id_citys["9"] = "Anaheim, CA";
			
latitudes["Boston, MA"] = "42.358";
longitudes["Boston, MA"] = "-71.060";
city_ids["Boston, MA"] = "6";
id_citys["6"] = "Boston, MA";
			
latitudes["John Wayne Airport, CA"] = "33.680";
longitudes["John Wayne Airport, CA"] = "-117.860";
city_ids["John Wayne Airport, CA"] = "13";
id_citys["13"] = "John Wayne Airport, CA";
			
latitudes["Seattle Airport, WA"] = "47.444";
longitudes["Seattle Airport, WA"] = "-122.300";
city_ids["Seattle Airport, WA"] = "54";
id_citys["54"] = "Seattle Airport, WA";
			
latitudes["Washington, DC"] = "38.895";
longitudes["Washington, DC"] = "-77.036";
city_ids["Washington, DC"] = "24";
id_citys["24"] = "Washington, DC";
			
latitudes["New York, NY"] = "40.714";
longitudes["New York, NY"] = "-74.006";
city_ids["New York, NY"] = "23";
id_citys["23"] = "New York, NY";
			
latitudes["Baltimore, MD"] = "39.290";
longitudes["Baltimore, MD"] = "-76.612";
city_ids["Baltimore, MD"] = "36";
id_citys["36"] = "Baltimore, MD";
			
latitudes["LAX Airport or Hotels, CA"] = "36.778";
longitudes["LAX Airport or Hotels, CA"] = "-119.418";
city_ids["LAX Airport or Hotels, CA"] = "14";
id_citys["14"] = "LAX Airport or Hotels, CA";
			
latitudes["Las Vegas, NV"] = "36.115";
longitudes["Las Vegas, NV"] = "-115.173";
city_ids["Las Vegas, NV"] = "28";
id_citys["28"] = "Las Vegas, NV";
			
latitudes["Vancouver, BC"] = "49.261";
longitudes["Vancouver, BC"] = "-123.114";
city_ids["Vancouver, BC"] = "12";
id_citys["12"] = "Vancouver, BC";
			
latitudes["Cambridge, MA"] = "42.375";
longitudes["Cambridge, MA"] = "-71.106";
city_ids["Cambridge, MA"] = "92";
id_citys["92"] = "Cambridge, MA";
			
latitudes["Tucson, AZ"] = "32.222";
longitudes["Tucson, AZ"] = "-110.926";
city_ids["Tucson, AZ"] = "777";
id_citys["777"] = "Tucson, AZ";
			
latitudes["Bellingham Airport, WA"] = "48.793";
longitudes["Bellingham Airport, WA"] = "-122.538";
city_ids["Bellingham Airport, WA"] = "38";
id_citys["38"] = "Bellingham Airport, WA";
			
latitudes["Durham, NC"] = "35.994";
longitudes["Durham, NC"] = "-78.899";
city_ids["Durham, NC"] = "767";
id_citys["767"] = "Durham, NC";
			
latitudes["Tulalip, WA"] = "48.069";
longitudes["Tulalip, WA"] = "-122.291";
city_ids["Tulalip, WA"] = "103";
id_citys["103"] = "Tulalip, WA";
			
latitudes["Seattle, WA"] = "47.606";
longitudes["Seattle, WA"] = "-122.332";
city_ids["Seattle, WA"] = "15";
id_citys["15"] = "Seattle, WA";
			
latitudes["Newport News, VA"] = "36.979";
longitudes["Newport News, VA"] = "-76.428";
city_ids["Newport News, VA"] = "173";
id_citys["173"] = "Newport News, VA";
			
latitudes["York, PA"] = "39.963";
longitudes["York, PA"] = "-76.728";
city_ids["York, PA"] = "30";
id_citys["30"] = "York, PA";
			
latitudes["Charleston, WV"] = "38.350";
longitudes["Charleston, WV"] = "-81.633";
city_ids["Charleston, WV"] = "910";
id_citys["910"] = "Charleston, WV";
			
latitudes["Roanoke, VA"] = "37.271";
longitudes["Roanoke, VA"] = "-79.941";
city_ids["Roanoke, VA"] = "912";
id_citys["912"] = "Roanoke, VA";
			
latitudes["Harrisonburg, VA"] = "38.450";
longitudes["Harrisonburg, VA"] = "-78.869";
city_ids["Harrisonburg, VA"] = "911";
id_citys["911"] = "Harrisonburg, VA";
			
latitudes["Newton, MA"] = "42.337";
longitudes["Newton, MA"] = "-71.209";
city_ids["Newton, MA"] = "913";
id_citys["913"] = "Newton, MA";
			
latitudes["Los Angeles, CA"] = "34.052";
longitudes["Los Angeles, CA"] = "-118.244";
city_ids["Los Angeles, CA"] = "16";
id_citys["16"] = "Los Angeles, CA";
			
latitudes["Richmond, BC"] = "49.163";
longitudes["Richmond, BC"] = "-123.138";
city_ids["Richmond, BC"] = "214";
id_citys["214"] = "Richmond, BC";
			
latitudes["Huntington Park, CA"] = "33.982";
longitudes["Huntington Park, CA"] = "-118.225";
city_ids["Huntington Park, CA"] = "215";
id_citys["215"] = "Huntington Park, CA";
			
latitudes["Lancaster, PA"] = "40.038";
longitudes["Lancaster, PA"] = "-76.306";
city_ids["Lancaster, PA"] = "55";
id_citys["55"] = "Lancaster, PA";
			
latitudes["Springfield, VA"] = "38.789";
longitudes["Springfield, VA"] = "-77.187";
city_ids["Springfield, VA"] = "144";
id_citys["144"] = "Springfield, VA";
			
latitudes["Norristown, PA"] = "40.121";
longitudes["Norristown, PA"] = "-75.340";
city_ids["Norristown, PA"] = "907";
id_citys["907"] = "Norristown, PA";
			
latitudes["Columbus, OH"] = "39.961";
longitudes["Columbus, OH"] = "-82.999";
city_ids["Columbus, OH"] = "953";
id_citys["953"] = "Columbus, OH";
			
latitudes["San Francisco, CA"] = "37.775";
longitudes["San Francisco, CA"] = "-122.419";
city_ids["San Francisco, CA"] = "20";
id_citys["20"] = "San Francisco, CA";
			
latitudes["San Jose, CA"] = "37.339";
longitudes["San Jose, CA"] = "-121.895";
city_ids["San Jose, CA"] = "82";
id_citys["82"] = "San Jose, CA";
			
latitudes["Harrisburg, PA"] = "40.274";
longitudes["Harrisburg, PA"] = "-76.884";
city_ids["Harrisburg, PA"] = "46";
id_citys["46"] = "Harrisburg, PA";
			
latitudes["Hartford, CT"] = "41.764";
longitudes["Hartford, CT"] = "-72.685";
city_ids["Hartford, CT"] = "21";
id_citys["21"] = "Hartford, CT";
			
latitudes["Phoenix, AZ"] = "33.448";
longitudes["Phoenix, AZ"] = "-112.074";
city_ids["Phoenix, AZ"] = "7";
id_citys["7"] = "Phoenix, AZ";
			
latitudes["San Diego, CA"] = "32.715";
longitudes["San Diego, CA"] = "-117.157";
city_ids["San Diego, CA"] = "18";
id_citys["18"] = "San Diego, CA";
			
latitudes["Beverly Hills, CA"] = "34.074";
longitudes["Beverly Hills, CA"] = "-118.400";
city_ids["Beverly Hills, CA"] = "902";
id_citys["902"] = "Beverly Hills, CA";
			
latitudes["Hollywood, CA"] = "34.098";
longitudes["Hollywood, CA"] = "-118.327";
city_ids["Hollywood, CA"] = "129";
id_citys["129"] = "Hollywood, CA";
			
latitudes["Santa Monica, CA"] = "34.019";
longitudes["Santa Monica, CA"] = "-118.491";
city_ids["Santa Monica, CA"] = "83";
id_citys["83"] = "Santa Monica, CA";
			
latitudes["Universal City, CA"] = "34.139";
longitudes["Universal City, CA"] = "-118.353";
city_ids["Universal City, CA"] = "769";
id_citys["769"] = "Universal City, CA";
			
latitudes["San Fernando, CA"] = "34.282";
longitudes["San Fernando, CA"] = "-118.439";
city_ids["San Fernando, CA"] = "236";
id_citys["236"] = "San Fernando, CA";
			
latitudes["Carpinteria, CA"] = "34.399";
longitudes["Carpinteria, CA"] = "-119.518";
city_ids["Carpinteria, CA"] = "884";
id_citys["884"] = "Carpinteria, CA";
			
latitudes["Goleta, CA"] = "34.436";
longitudes["Goleta, CA"] = "-119.828";
city_ids["Goleta, CA"] = "885";
id_citys["885"] = "Goleta, CA";
			
latitudes["Santa Barbara, CA"] = "34.421";
longitudes["Santa Barbara, CA"] = "-119.698";
city_ids["Santa Barbara, CA"] = "231";
id_citys["231"] = "Santa Barbara, CA";
			
latitudes["Dover, DE"] = "39.158";
longitudes["Dover, DE"] = "-75.524";
city_ids["Dover, DE"] = "239";
id_citys["239"] = "Dover, DE";
			
latitudes["Smyrna, DE"] = "39.300";
longitudes["Smyrna, DE"] = "-75.605";
city_ids["Smyrna, DE"] = "238";
id_citys["238"] = "Smyrna, DE";
			
latitudes["Rockville, MD"] = "39.084";
longitudes["Rockville, MD"] = "-77.153";
city_ids["Rockville, MD"] = "59";
id_citys["59"] = "Rockville, MD";
			
latitudes["Milton Freewater, OR"] = "45.933";
longitudes["Milton Freewater, OR"] = "-118.388";
city_ids["Milton Freewater, OR"] = "821";
id_citys["821"] = "Milton Freewater, OR";
			
latitudes["Walla Walla, WA"] = "46.065";
longitudes["Walla Walla, WA"] = "-118.343";
city_ids["Walla Walla, WA"] = "822";
id_citys["822"] = "Walla Walla, WA";
			
latitudes["Richmond, VA"] = "37.533";
longitudes["Richmond, VA"] = "-77.467";
city_ids["Richmond, VA"] = "63";
id_citys["63"] = "Richmond, VA";
			
latitudes["Bethesda, MD"] = "38.981";
longitudes["Bethesda, MD"] = "-77.100";
city_ids["Bethesda, MD"] = "39";
id_citys["39"] = "Bethesda, MD";
			
latitudes["Arlington, VA"] = "38.890";
longitudes["Arlington, VA"] = "-77.084";
city_ids["Arlington, VA"] = "33";
id_citys["33"] = "Arlington, VA";
			
latitudes["Quincy, WA"] = "47.234";
longitudes["Quincy, WA"] = "-119.853";
city_ids["Quincy, WA"] = "818";
id_citys["818"] = "Quincy, WA";
			
latitudes["Royal City, WA"] = "46.901";
longitudes["Royal City, WA"] = "-119.631";
city_ids["Royal City, WA"] = "819";
id_citys["819"] = "Royal City, WA";
			
latitudes["Buena Park, CA"] = "33.868";
longitudes["Buena Park, CA"] = "-117.998";
city_ids["Buena Park, CA"] = "928";
id_citys["928"] = "Buena Park, CA";
			
latitudes["Wilmington, DE"] = "39.746";
longitudes["Wilmington, DE"] = "-75.547";
city_ids["Wilmington, DE"] = "35";
id_citys["35"] = "Wilmington, DE";
			
latitudes["Philadelphia, PA"] = "39.952";
longitudes["Philadelphia, PA"] = "-75.164";
city_ids["Philadelphia, PA"] = "22";
id_citys["22"] = "Philadelphia, PA";
			
latitudes["Albany, NY"] = "42.653";
longitudes["Albany, NY"] = "-73.756";
city_ids["Albany, NY"] = "27";
id_citys["27"] = "Albany, NY";
			
latitudes["Virginia Beach, VA"] = "36.853";
longitudes["Virginia Beach, VA"] = "-75.978";
city_ids["Virginia Beach, VA"] = "42";
id_citys["42"] = "Virginia Beach, VA";
			
latitudes["Kingman, AZ"] = "35.189";
longitudes["Kingman, AZ"] = "-114.053";
city_ids["Kingman, AZ"] = "804";
id_citys["804"] = "Kingman, AZ";
			
latitudes["Mabton, WA"] = "46.215";
longitudes["Mabton, WA"] = "-119.997";
city_ids["Mabton, WA"] = "827";
id_citys["827"] = "Mabton, WA";
			
latitudes["Camarillo Outlet, CA"] = "36.778";
longitudes["Camarillo Outlet, CA"] = "-119.418";
city_ids["Camarillo Outlet, CA"] = "233";
id_citys["233"] = "Camarillo Outlet, CA";
			
latitudes["Camarillo, CA"] = "34.216";
longitudes["Camarillo, CA"] = "-119.038";
city_ids["Camarillo, CA"] = "226";
id_citys["226"] = "Camarillo, CA";
			
latitudes["Laughlin, NV"] = "35.168";
longitudes["Laughlin, NV"] = "-114.573";
city_ids["Laughlin, NV"] = "779";
id_citys["779"] = "Laughlin, NV";
			
latitudes["Bullhead City, AZ"] = "35.148";
longitudes["Bullhead City, AZ"] = "-114.568";
city_ids["Bullhead City, AZ"] = "887";
id_citys["887"] = "Bullhead City, AZ";
			
latitudes["Dorris, CA"] = "41.967";
longitudes["Dorris, CA"] = "-121.918";
city_ids["Dorris, CA"] = "848";
id_citys["848"] = "Dorris, CA";
			
latitudes["Cupertino, CA"] = "37.323";
longitudes["Cupertino, CA"] = "-122.032";
city_ids["Cupertino, CA"] = "11";
id_citys["11"] = "Cupertino, CA";
			
latitudes["Rowland Heights, CA"] = "33.976";
longitudes["Rowland Heights, CA"] = "-117.905";
city_ids["Rowland Heights, CA"] = "70";
id_citys["70"] = "Rowland Heights, CA";
			
latitudes["Hood River, OR"] = "45.705";
longitudes["Hood River, OR"] = "-121.521";
city_ids["Hood River, OR"] = "834";
id_citys["834"] = "Hood River, OR";
			
latitudes["Portland, OR"] = "45.523";
longitudes["Portland, OR"] = "-122.676";
city_ids["Portland, OR"] = "835";
id_citys["835"] = "Portland, OR";
			
latitudes["Mohegan Sun Casino, CT"] = "41.492";
longitudes["Mohegan Sun Casino, CT"] = "-72.091";
city_ids["Mohegan Sun Casino, CT"] = "792";
id_citys["792"] = "Mohegan Sun Casino, CT";
			
latitudes["Norfolk, VA"] = "36.847";
longitudes["Norfolk, VA"] = "-76.285";
city_ids["Norfolk, VA"] = "61";
id_citys["61"] = "Norfolk, VA";
			
latitudes["State College, PA"] = "40.793";
longitudes["State College, PA"] = "-77.860";
city_ids["State College, PA"] = "48";
id_citys["48"] = "State College, PA";
			
latitudes["Hillsboro, OR"] = "45.705";
longitudes["Hillsboro, OR"] = "-121.521";
city_ids["Hillsboro, OR"] = "840";
id_citys["840"] = "Hillsboro, OR";
			
latitudes["Fredericksburg, VA"] = "38.303";
longitudes["Fredericksburg, VA"] = "-77.461";
city_ids["Fredericksburg, VA"] = "915";
id_citys["915"] = "Fredericksburg, VA";
			
latitudes["Tualatin, OR"] = "45.523";
longitudes["Tualatin, OR"] = "-122.990";
city_ids["Tualatin, OR"] = "841";
id_citys["841"] = "Tualatin, OR";
			
latitudes["Madras, OR"] = "44.633";
longitudes["Madras, OR"] = "-121.129";
city_ids["Madras, OR"] = "831";
id_citys["831"] = "Madras, OR";
			
latitudes["Palm Springs, CA"] = "33.830";
longitudes["Palm Springs, CA"] = "-116.545";
city_ids["Palm Springs, CA"] = "182";
id_citys["182"] = "Palm Springs, CA";
			
latitudes["Albany, OR"] = "44.637";
longitudes["Albany, OR"] = "-123.106";
city_ids["Albany, OR"] = "844";
id_citys["844"] = "Albany, OR";
			
latitudes["Salem, OR"] = "44.943";
longitudes["Salem, OR"] = "-123.035";
city_ids["Salem, OR"] = "843";
id_citys["843"] = "Salem, OR";
			
latitudes["Woodburn, OR"] = "45.144";
longitudes["Woodburn, OR"] = "-122.855";
city_ids["Woodburn, OR"] = "842";
id_citys["842"] = "Woodburn, OR";
			
latitudes["Springfield, OR"] = "44.046";
longitudes["Springfield, OR"] = "-123.022";
city_ids["Springfield, OR"] = "845";
id_citys["845"] = "Springfield, OR";
			
latitudes["Grants Pass, OR"] = "42.439";
longitudes["Grants Pass, OR"] = "-123.328";
city_ids["Grants Pass, OR"] = "846";
id_citys["846"] = "Grants Pass, OR";
			
latitudes["Medford, OR"] = "42.327";
longitudes["Medford, OR"] = "-122.876";
city_ids["Medford, OR"] = "847";
id_citys["847"] = "Medford, OR";
			
latitudes["Charlotte, NC"] = "35.227";
longitudes["Charlotte, NC"] = "-80.843";
city_ids["Charlotte, NC"] = "240";
id_citys["240"] = "Charlotte, NC";
			
latitudes["Vienna, VA"] = "38.901";
longitudes["Vienna, VA"] = "-77.265";
city_ids["Vienna, VA"] = "920";
id_citys["920"] = "Vienna, VA";
			
latitudes["Fairfax, VA"] = "38.846";
longitudes["Fairfax, VA"] = "-77.306";
city_ids["Fairfax, VA"] = "143";
id_citys["143"] = "Fairfax, VA";
			
latitudes["Victorville, CA"] = "34.536";
longitudes["Victorville, CA"] = "-117.291";
city_ids["Victorville, CA"] = "959";
id_citys["959"] = "Victorville, CA";
			
latitudes["Miami, FL"] = "25.789";
longitudes["Miami, FL"] = "-80.226";
city_ids["Miami, FL"] = "62";
id_citys["62"] = "Miami, FL";
			
latitudes["Miami Beach, FL"] = "25.791";
longitudes["Miami Beach, FL"] = "-80.130";
city_ids["Miami Beach, FL"] = "114";
id_citys["114"] = "Miami Beach, FL";
			
latitudes["Raleigh, NC"] = "35.772";
longitudes["Raleigh, NC"] = "-78.639";
city_ids["Raleigh, NC"] = "122";
id_citys["122"] = "Raleigh, NC";
			
latitudes["Savannah, GA"] = "32.084";
longitudes["Savannah, GA"] = "-81.100";
city_ids["Savannah, GA"] = "10";
id_citys["10"] = "Savannah, GA";
			
latitudes["San Diego Balboa Park, CA"] = "32.734";
longitudes["San Diego Balboa Park, CA"] = "-117.144";
city_ids["San Diego Balboa Park, CA"] = "896";
id_citys["896"] = "San Diego Balboa Park, CA";
			
latitudes["Klamanth Falls, OR"] = "42.225";
longitudes["Klamanth Falls, OR"] = "-121.782";
city_ids["Klamanth Falls, OR"] = "833";
id_citys["833"] = "Klamanth Falls, OR";
			
latitudes["Santa Ana, CA"] = "33.746";
longitudes["Santa Ana, CA"] = "-117.868";
city_ids["Santa Ana, CA"] = "871";
id_citys["871"] = "Santa Ana, CA";
			
latitudes["Westminster, CA"] = "33.751";
longitudes["Westminster, CA"] = "-117.994";
city_ids["Westminster, CA"] = "118";
id_citys["118"] = "Westminster, CA";
			
latitudes["Norwich, CT"] = "41.524";
longitudes["Norwich, CT"] = "-72.076";
city_ids["Norwich, CT"] = "237";
id_citys["237"] = "Norwich, CT";
			
latitudes["Kissimmee, FL"] = "28.292";
longitudes["Kissimmee, FL"] = "-81.408";
city_ids["Kissimmee, FL"] = "110";
id_citys["110"] = "Kissimmee, FL";
			
latitudes["Orlando, FL"] = "28.538";
longitudes["Orlando, FL"] = "-81.379";
city_ids["Orlando, FL"] = "64";
id_citys["64"] = "Orlando, FL";
			
latitudes["Atlanta, GA"] = "33.749";
longitudes["Atlanta, GA"] = "-84.388";
city_ids["Atlanta, GA"] = "34";
id_citys["34"] = "Atlanta, GA";
			
latitudes["Ontario, CA"] = "34.063";
longitudes["Ontario, CA"] = "-117.651";
city_ids["Ontario, CA"] = "888";
id_citys["888"] = "Ontario, CA";
			
latitudes["Dayton, OH"] = "39.759";
longitudes["Dayton, OH"] = "-84.192";
city_ids["Dayton, OH"] = "174";
id_citys["174"] = "Dayton, OH";
			
latitudes["Greensboro, NC"] = "36.073";
longitudes["Greensboro, NC"] = "-79.792";
city_ids["Greensboro, NC"] = "140";
id_citys["140"] = "Greensboro, NC";
			
latitudes["Yosemite, CA"] = "37.771";
longitudes["Yosemite, CA"] = "-119.511";
city_ids["Yosemite, CA"] = "228";
id_citys["228"] = "Yosemite, CA";
			
latitudes["Hagerstown, MD"] = "39.642";
longitudes["Hagerstown, MD"] = "-77.720";
city_ids["Hagerstown, MD"] = "44";
id_citys["44"] = "Hagerstown, MD";
			
latitudes["Anderson, SC"] = "34.503";
longitudes["Anderson, SC"] = "-82.650";
city_ids["Anderson, SC"] = "244";
id_citys["244"] = "Anderson, SC";
			
latitudes["Greenville, SC"] = "34.853";
longitudes["Greenville, SC"] = "-82.394";
city_ids["Greenville, SC"] = "245";
id_citys["245"] = "Greenville, SC";
			
latitudes["Spartanburg, SC"] = "34.950";
longitudes["Spartanburg, SC"] = "-81.932";
city_ids["Spartanburg, SC"] = "246";
id_citys["246"] = "Spartanburg, SC";
			
latitudes["Hampton, VA"] = "37.030";
longitudes["Hampton, VA"] = "-76.345";
city_ids["Hampton, VA"] = "251";
id_citys["251"] = "Hampton, VA";
			
latitudes["Tustin, CA"] = "33.746";
longitudes["Tustin, CA"] = "-117.826";
city_ids["Tustin, CA"] = "940";
id_citys["940"] = "Tustin, CA";
			
latitudes["Garden Grove, CA"] = "33.774";
longitudes["Garden Grove, CA"] = "-117.941";
city_ids["Garden Grove, CA"] = "899";
id_citys["899"] = "Garden Grove, CA";
			
latitudes["Morgantown, WV"] = "39.630";
longitudes["Morgantown, WV"] = "-79.956";
city_ids["Morgantown, WV"] = "909";
id_citys["909"] = "Morgantown, WV";
			
latitudes["Colton, CA"] = "34.074";
longitudes["Colton, CA"] = "-117.314";
city_ids["Colton, CA"] = "958";
id_citys["958"] = "Colton, CA";
			
latitudes["Rosemead, CA"] = "34.081";
longitudes["Rosemead, CA"] = "-118.073";
city_ids["Rosemead, CA"] = "71";
id_citys["71"] = "Rosemead, CA";
			
latitudes["Fayetteville, NC"] = "35.053";
longitudes["Fayetteville, NC"] = "-78.878";
city_ids["Fayetteville, NC"] = "881";
id_citys["881"] = "Fayetteville, NC";
			
latitudes["Woodbury Outlets, NY"] = "41.315";
longitudes["Woodbury Outlets, NY"] = "-74.126";
city_ids["Woodbury Outlets, NY"] = "31";
id_citys["31"] = "Woodbury Outlets, NY";
			
latitudes["Columbia, SC"] = "34.001";
longitudes["Columbia, SC"] = "-81.035";
city_ids["Columbia, SC"] = "242";
id_citys["242"] = "Columbia, SC";
			
latitudes["El Monte, CA"] = "34.069";
longitudes["El Monte, CA"] = "-118.028";
city_ids["El Monte, CA"] = "130";
id_citys["130"] = "El Monte, CA";
			
latitudes["Jacksonville, FL"] = "30.332";
longitudes["Jacksonville, FL"] = "-81.656";
city_ids["Jacksonville, FL"] = "772";
id_citys["772"] = "Jacksonville, FL";
			
latitudes["Oakland, CA"] = "37.804";
longitudes["Oakland, CA"] = "-122.271";
city_ids["Oakland, CA"] = "17";
id_citys["17"] = "Oakland, CA";
			
latitudes["Cincinnati, OH"] = "39.136";
longitudes["Cincinnati, OH"] = "-84.503";
city_ids["Cincinnati, OH"] = "133";
id_citys["133"] = "Cincinnati, OH";
			
latitudes["Chandler, AZ"] = "33.306";
longitudes["Chandler, AZ"] = "-111.841";
city_ids["Chandler, AZ"] = "148";
id_citys["148"] = "Chandler, AZ";
			
latitudes["Tempe, AZ"] = "33.415";
longitudes["Tempe, AZ"] = "-111.909";
city_ids["Tempe, AZ"] = "180";
id_citys["180"] = "Tempe, AZ";
			
latitudes["Studio City, CA"] = "34.149";
longitudes["Studio City, CA"] = "-118.451";
city_ids["Studio City, CA"] = "81";
id_citys["81"] = "Studio City, CA";
			
latitudes["Dorchester, MA"] = "42.297";
longitudes["Dorchester, MA"] = "-71.075";
city_ids["Dorchester, MA"] = "124";
id_citys["124"] = "Dorchester, MA";
			
latitudes["Lawrence, MA"] = "42.707";
longitudes["Lawrence, MA"] = "-71.163";
city_ids["Lawrence, MA"] = "125";
id_citys["125"] = "Lawrence, MA";
			
latitudes["Lowell, MA"] = "42.633";
longitudes["Lowell, MA"] = "-71.316";
city_ids["Lowell, MA"] = "127";
id_citys["127"] = "Lowell, MA";
			
latitudes["Malden, MA"] = "42.425";
longitudes["Malden, MA"] = "-71.066";
city_ids["Malden, MA"] = "221";
id_citys["221"] = "Malden, MA";
			
latitudes["Methuen, MA"] = "42.726";
longitudes["Methuen, MA"] = "-71.191";
city_ids["Methuen, MA"] = "218";
id_citys["218"] = "Methuen, MA";
			
latitudes["Quincy, MA"] = "42.253";
longitudes["Quincy, MA"] = "-71.002";
city_ids["Quincy, MA"] = "190";
id_citys["190"] = "Quincy, MA";
			
latitudes["Worcester, MA"] = "42.263";
longitudes["Worcester, MA"] = "-71.802";
city_ids["Worcester, MA"] = "219";
id_citys["219"] = "Worcester, MA";
			
latitudes["Nogales, AZ"] = "31.599";
longitudes["Nogales, AZ"] = "-110.808";
city_ids["Nogales, AZ"] = "778";
id_citys["778"] = "Nogales, AZ";
			
latitudes["Tijuana, BCN"] = "32.517";
longitudes["Tijuana, BCN"] = "-116.944";
city_ids["Tijuana, BCN"] = "217";
id_citys["217"] = "Tijuana, BCN";
			
latitudes["San Ysidro, CA"] = "32.552";
longitudes["San Ysidro, CA"] = "-117.043";
city_ids["San Ysidro, CA"] = "216";
id_citys["216"] = "San Ysidro, CA";
			
latitudes["Six Flags Magic Mountain, CA"] = "34.427";
longitudes["Six Flags Magic Mountain, CA"] = "-118.599";
city_ids["Six Flags Magic Mountain, CA"] = "897";
id_citys["897"] = "Six Flags Magic Mountain, CA";
			
latitudes["Knotts Berry Farm, CA"] = "36.778";
longitudes["Knotts Berry Farm, CA"] = "-119.418";
city_ids["Knotts Berry Farm, CA"] = "472";
id_citys["472"] = "Knotts Berry Farm, CA";
			
latitudes["Ontario Mills Outlet, CA"] = "36.778";
longitudes["Ontario Mills Outlet, CA"] = "-119.418";
city_ids["Ontario Mills Outlet, CA"] = "893";
id_citys["893"] = "Ontario Mills Outlet, CA";
			
latitudes["Desert Hills Outlet, CA"] = "36.778";
longitudes["Desert Hills Outlet, CA"] = "-119.418";
city_ids["Desert Hills Outlet, CA"] = "891";
id_citys["891"] = "Desert Hills Outlet, CA";
			
latitudes["Citadel Outlet, CA"] = "36.778";
longitudes["Citadel Outlet, CA"] = "-119.418";
city_ids["Citadel Outlet, CA"] = "889";
id_citys["889"] = "Citadel Outlet, CA";
			
latitudes["Ronald Reagan Museum, CA"] = "34.260";
longitudes["Ronald Reagan Museum, CA"] = "-118.819";
city_ids["Ronald Reagan Museum, CA"] = "894";
id_citys["894"] = "Ronald Reagan Museum, CA";
			
latitudes["Getty Museum, CA"] = "34.077";
longitudes["Getty Museum, CA"] = "-118.474";
city_ids["Getty Museum, CA"] = "892";
id_citys["892"] = "Getty Museum, CA";
			
latitudes["Sea World, CA"] = "33.748";
longitudes["Sea World, CA"] = "-118.095";
city_ids["Sea World, CA"] = "507";
id_citys["507"] = "Sea World, CA";
			
latitudes["San Diego Zoo, CA"] = "32.737";
longitudes["San Diego Zoo, CA"] = "-117.151";
city_ids["San Diego Zoo, CA"] = "895";
id_citys["895"] = "San Diego Zoo, CA";
			
latitudes["Glendale, CA"] = "34.143";
longitudes["Glendale, CA"] = "-118.255";
city_ids["Glendale, CA"] = "79";
id_citys["79"] = "Glendale, CA";
			
latitudes["Burbank, CA"] = "34.181";
longitudes["Burbank, CA"] = "-118.309";
city_ids["Burbank, CA"] = "223";
id_citys["223"] = "Burbank, CA";
			
var depart_area = new Object;

depart_area[1] = new Array('Anaheim, CA', 'John Wayne Airport, CA', 'Seattle Airport, WA', 'LAX Airport or Hotels, CA', 'Las Vegas, NV', 'Vancouver, BC', 'Bellingham Airport, WA', 'Tulalip, WA', 'Seattle, WA', 'Los Angeles, CA', 'Richmond, BC', 'Huntington Park, CA', 'San Francisco, CA', 'San Jose, CA', 'Phoenix, AZ', 'San Diego, CA', 'Beverly Hills, CA', 'Hollywood, CA', 'Santa Monica, CA', 'Universal City, CA', 'San Fernando, CA', 'Carpinteria, CA', 'Goleta, CA', 'Santa Barbara, CA', 'Milton Freewater, OR', 'Walla Walla, WA', 'Quincy, WA', 'Royal City, WA', 'Buena Park, CA', 'Kingman, AZ', 'Mabton, WA', 'Camarillo Outlet, CA', 'Camarillo, CA', 'Laughlin, NV', 'Bullhead City, AZ', 'Dorris, CA', 'Cupertino, CA', 'Rowland Heights, CA', 'Hood River, OR', 'Portland, OR', 'Hillsboro, OR', 'Tualatin, OR', 'Madras, OR', 'Palm Springs, CA', 'Albany, OR', 'Salem, OR', 'Woodburn, OR', 'Springfield, OR', 'Grants Pass, OR', 'Medford, OR', 'Victorville, CA', 'San Diego Balboa Park, CA', 'Klamanth Falls, OR', 'Santa Ana, CA', 'Westminster, CA', 'Ontario, CA', 'Yosemite, CA', 'Tustin, CA', 'Garden Grove, CA', 'Colton, CA', 'Rosemead, CA', 'El Monte, CA', 'Oakland, CA', 'Chandler, AZ', 'Tempe, AZ', 'Studio City, CA');
depart_area[2] = new Array('Boston, MA', 'Washington, DC', 'New York, NY', 'Baltimore, MD', 'Cambridge, MA', 'York, PA', 'Newton, MA', 'Lancaster, PA', 'Springfield, VA', 'Norristown, PA', 'Columbus, OH', 'Harrisburg, PA', 'Hartford, CT', 'Dover, DE', 'Smyrna, DE', 'Rockville, MD', 'Bethesda, MD', 'Arlington, VA', 'Wilmington, DE', 'Philadelphia, PA', 'Albany, NY', 'Mohegan Sun Casino, CT', 'State College, PA', 'Vienna, VA', 'Fairfax, VA', 'Norwich, CT', 'Hagerstown, MD', 'Morgantown, WV', 'Woodbury Outlets, NY', 'Dorchester, MA', 'Lawrence, MA', 'Lowell, MA', 'Malden, MA', 'Methuen, MA', 'Quincy, MA', 'Worcester, MA');
depart_area[3] = new Array('Durham, NC', 'Newport News, VA', 'Charleston, WV', 'Roanoke, VA', 'Harrisonburg, VA', 'Richmond, VA', 'Virginia Beach, VA', 'Norfolk, VA', 'Fredericksburg, VA', 'Charlotte, NC', 'Raleigh, NC', 'Savannah, GA', 'Greensboro, NC', 'Anderson, SC', 'Greenville, SC', 'Spartanburg, SC', 'Hampton, VA', 'Fayetteville, NC', 'Columbia, SC');
depart_area[4] = new Array('Miami, FL', 'Miami Beach, FL', 'Kissimmee, FL', 'Orlando, FL', 'Jacksonville, FL');
			///////////// 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 = '';
		$('#return_date').datepick('destroy'); 		
		if (typeof(no_update) == 'undefined')
		{		
		$('#return_date').after('<img src="/images/home/n_soso03.gif" alt="Popup" class="trigger datepick-trigger" id="imgyesno">');
		}
		$('#imgyesno').click(function(){
			check_oneway_text();
			});
		if ($.browser.msie) {
 				if ($.browser.version == "6.0")
	 			{
					if (typeof(no_update) == 'undefined')
					{
					$('#return_date').next().addClass("ie6embed");
				}
			}				
			}				
		conditional_update();
	}
}

function select_roundtrip(d, no_update)
{
	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;
			}
			$('#return_date').datepick('destroy');
			$('#r_text_date').find('img').each(function(){$(this).remove();});
			var myDate = new Date();//current date
			rd_obj.value = r_d.getFullYear() + '-' + m + '-' + dt;
			$('#return_date').datepick({
				rangeSelect: false, 
				monthsToShow: 2,
				constrainInput: false,
				dateFormat:'yyyy-mm-dd',
				showOnFocus: false,
				showTrigger: '#calImg',
				showSpeed: 'fast',
				showAnim: '',
				minDate:new Date(myDate.getFullYear(),myDate.getMonth(),myDate.getDate()),
				maxDate:new Date(2100,11,12)});
				if ($.browser.msie) {
 				if ($.browser.version == "6.0")
	 			{
					if (typeof(no_update) == 'undefined')
	 				{
					$('#return_date').next().addClass("ie6embed");
				}
			}			
		}
		}
		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 && typeof(g_bus[f]) != "undefined")
    {
		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;
            obj.options[i].setAttribute('selected', true);
            return i;
        }
    }
    return -1;
}

function update_bus_from_to(f, t)
{
    var bf_obj = get_bus_from_obj();
    var index = 0;
    var sbus_from = document.getElementById("sbus_from_id");
    var sbus_to = document.getElementById("sbus_to_id");
    if (f)
    {
		if (g_bus[f] instanceof Array )
		{
			index = set_selected(bf_obj, f);
			if (sbus_from != null)
			{
				sbus_from.value = bf_obj.options[index].value;
			}
		}
    }
    else
    {
		index = bf_obj.selectedIndex;
		if (index > 0)
		{
			f = bf_obj.options[index].value;
		}
    }
    if (t)
    {
		if (g_bus[f] instanceof Array)
		{
			update_bus_to(f);
			var bt_obj = get_bus_to_obj();
			index = set_selected(bt_obj, t);
			if (index > -1 &&  sbus_to != null)
			{
				sbus_to.value = bt_obj.options[index].value;
			}
    	}
    }
    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 (fv == "New York, NY")
    {
    	if (tv == "Sands Casino, PA")
    	{
    		return ga("http://www.gotobus.com/edwardbusservice/newyorktosandcasinoroundtrip/index.html");	
    	}
	if (tv == "Atlantic City, NJ")
    	{
    		return ga("http://www.gotobus.com/todaysbus/newyorktoatlanticcityshuttlebus/index.html ");	
    	}
    }
    if (fv == "Los Angeles, CA")
    {
    	if (tv == "Six Flags Magic Mountain, CA")
    	{
		return ga("http://www.gotobus.com/cs/c1379/shuttleservice/latosixflagsmagicmountainroundtripshuttlebus.html");
    	}
	if (tv == "Six Flags Hurricane Harbor, CA")
        {
                return ga("http://www.gotobus.com/us/burbankca/tours/hurricaneharborroundtripshuttlebus_478-786.html");
        }
    	if (tv == "Disneyland, CA")
    	{
    		return ga("http://www.gotobus.com/cs/c1379/shuttleservice/latodisneylandroundtripshuttlebus.html");
    	}	
    	if (tv == "Knott's Berry Farm, CA")
    	{
    		return ga("http://www.gotobus.com/cs/c1379/shuttleservice/latoknott_sberryfarmroundtripshuttlebus.html");
    	}	
    	if (tv == "Ontario Mills Outlet, CA")
    	{
    		return ga("http://www.gotobus.com/cs/c1379/shuttleservice/latoontariomillsoutletroundtripshuttlebus.html");
    	}	
    	if (tv == "Desert Hills Outlet, CA")
    	{
    		return ga("http://www.gotobus.com/cs/c1379/shuttleservice/latodeserthillsoutletroundtripshuttlebus.html");
    	}	
    	if (tv == "Citadel Outlet, CA")
    	{
    		return ga("http://www.gotobus.com/cs/c1379/shuttleservice/latocitadeloutletroundtripshuttlebus.html");
    	}	
    	if (tv == "Ronald Reagan Museum, CA")
    	{
    		return ga("http://www.gotobus.com/cs/c1379/shuttleservice/latoronaldreaganmuseumroundtripshuttlebus.html");
    	}	
    	if (tv == "Getty Museum, CA")
    	{
    		return ga("http://www.gotobus.com/cs/c1379/shuttleservice/latogettymuseumroundtripshuttlebus.html");
    	}	
    	if (tv == "Sea World, CA")
    	{
    		return ga("http://www.gotobus.com/cs/c1379/shuttleservice/latoseaworldroundtripshuttlebus.html");
    	}	
    	if (tv == "San Diego Zoo, CA")
    	{
    		return ga("http://www.gotobus.com/cs/c1379/shuttleservice/latosandiegozooroundtripshuttlebus.html");
    	}	
    }
    if (tv == "Turning Stone Casino, NY")
    {
        if (fv == "Albany, NY")
        {
            return ga("http://www.gotobus.com/cs/c1259/albanytoturningstonecasino/");
        }

    }
    if (tv == "Mohegan Sun Casino, CT")
    {
        if (fv == "Boston, MA" || fv == "Dorchester, MA" || fv == "Quincy, MA" || fv == "Lawrence, MA" || fv == "Lowell, MA" || fv == "Methuen, MA" || fv == "Worcester, MA"  || fv == "Malden, 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" || fv == "Bethesda, MD")
        {
            return ga("http://www.gotobus.com/rexbus/daytriptotajmahalatlanticcity/");
        }
	if (fv == "Capitol Heights, MD" || fv == "Clinton, MD" || fv == "Tysons Corner, VA")
        {
            return ga("http://www.gotobus.com/rexbus/daytriptotajmahalatlanticcity/daytriptotajmahalatlanticcity.html");
        }
    }
    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;
    }
    else
	{
		var filter_date = document.bus_search.filter_date.value;
		var date_obj = document.bus_search.filter_date;
		if (filter_date && !filter_date.match(/\d\d\d\d-\d\d-\d\d/))
        {
            alert("Departure Date (" + filter_date + ") must be either empty or in the format: YYYY-MM-DD");
            date_obj.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;
    }
    else
	{
		if(document.bus_search.b_roundtrip.checked == true && document.bus_search.return_date.value != "")
		{
			var return_date = document.bus_search.return_date.value;
			var date_obj = document.bus_search.return_date;
			if (return_date && !return_date.match(/\d\d\d\d-\d\d-\d\d/))
	        {
	            alert("Return Date (" + return_date + ") must be either empty or in the format: YYYY-MM-DD");
	            date_obj.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;
	var bss_id='';
	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 depart_bss = window.document.getElementById("depart_bss_id");
    if (depart_bss && depart_bss.value)
	{
        bss_id = "&depart_bss=" + depart_bss.value;
	}
	var arrival_bss = window.document.getElementById("arrival_bss_id");
    if (arrival_bss && arrival_bss.value)
	{
        bss_id = bss_id + "&arrival_bss=" + arrival_bss.value;
	}
	var keep_scale_param = ''
	var depart_scale_obj = window.document.getElementById("depart_bss_scale");
	if (depart_scale_obj && depart_scale_obj.value)
	{
		keep_scale_param = "&depart_scale=" + depart_scale_obj.value;
	}
	var depart_center_obj = window.document.getElementById("depart_bss_center");
	if (depart_center_obj && depart_center_obj.value)
	{
		keep_scale_param = keep_scale_param + "&depart_center=" + depart_center_obj.value;
	}
	var arrival_scale_obj = window.document.getElementById("arrival_bss_scale");
	if (arrival_scale_obj && arrival_scale_obj.value)
	{
		keep_scale_param = keep_scale_param + "&arrival_scale=" + arrival_scale_obj.value;
	}
	var arrival_center_obj = window.document.getElementById("arrival_bss_center");
	if (arrival_center_obj && arrival_center_obj.value)
	{
		keep_scale_param = keep_scale_param + "&arrival_center=" + arrival_center_obj.value;
	}
	var price_param='';
	if (typeof(price) != 'undefined')
	{
		var min_price_temp = 0;
		if (document.bus_search && document.bus_search.min_price)
		{
			min_price_temp = parseInt(document.bus_search.min_price.value);
		}
		if (document.bus_search && document.bus_search.left_point)
		{
			price_param = "&left_point=" + price.getSldPoint();
		}
		if (document.bus_search && document.bus_search.right_point)
		{
			price_param = price_param + "&right_point=" + price.getSldRightPoint();
		}
		if (document.bus_search && document.bus_search.max_price)
		{
			var temp_price_int = parseInt(price.getSldRightPoint()) + min_price_temp;
			price_param = price_param + "&max_price=" + temp_price_int;
		}
		if (document.bus_search && document.bus_search.lowest_price)
		{
			var temp_price_int = parseInt(price.getSldPoint()) + min_price_temp;
			price_param = price_param + "&lowest_price=" + temp_price_int;
		}
	}
	var time_param='';
	if (typeof(time_obj) != 'undefined')
	{
		if (document.bus_search && document.bus_search.time_left)
		{
			time_param = "&time_left=" + time_obj.getSldPoint();
		}
		if (document.bus_search && document.bus_search.time_right)
		{
			time_param = time_param + "&time_right=" + time_obj.getSldRightPoint();
		}		
	}
	var op_url = "";
//	if(flag == 0) commented by Jimmy Oct 16, 2009
	var operator_obj = window.document.getElementById("operatorList");
	if (operator_obj && operator_obj.value != "")
	{
		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+price_param+bss_id+keep_scale_param+time_param);
}

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;
		if (from)
		{
			update_bus_from_to(from, to);
			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;
    }
    else
    {
    	st_obj.value = "Arrival City";
    }

    if (f_obj.selectedIndex > 0)
    {
        sf_obj.value = f_obj.options[f_obj.selectedIndex].value;
    }
    else
    {
    	sf_obj.value = "Departure City";
    }
}

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 fast_day_select(day,isdepart)
{
	if (document.bus_search && document.bus_search.filter_date)
    {
    	if (isdepart)
    	{
        	document.bus_search.filter_date.value = day;
        }
        else
    	{
    		document.bus_search.return_date.value = day;    		
    	}
    	document.getElementById("bus_search").submit();
    }
}

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 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, pid)
{
	var old_index = document.getElementById("operatorList").selectedIndex;
	if (document.getElementById("b_roundtrip").checked)
	{
		select_operator_change(operator)
		if (document.getElementById("operatorList").selectedIndex != old_index)
		{
			ajax_soap_bus_search(pid);
		}
	}
}

function select_operator_change(operator)
{
	var obj_operatorlist = document.getElementById("operatorList");
	for(var i=0;i<obj_operatorlist.length;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;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)
{
	document.getElementById("Date" + return_spec).value = document.getElementById('date'+pid).value;
	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, pid);
	}
}

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 a departure point from the drop down menu.");
		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 a departure point from the drop down menu.");
        	departure_obj.focus();
			return false;
		}
	}

	if (ddl_departure_obj != null)
	{
		if (ddl_departure_obj.value =='')
		{
			alert("Please select a departure point from the drop down menu.");
        	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 a departure point from the drop down menu.");
			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 a departure point from the drop down menu.");
	        	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())
	{
		document.getElementById("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,quick)
{
	document.getElementById("dynamic_price" + pid).innerHTML = "<font color='red'>Pricing..</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 + '&quick=' + quick;
	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,1);
	}
	else
	{
		get_dynamic_price(pid,document.getElementById('beforethisdate').value,1);
	}
	setTimeout("dynamic_image('" + pid + "')",600000);
}

function show_dynamic_prices(pids, service_date, return_pids, return_date)
{
	if(window.XMLHttpRequest) {
		dynamic_xml_all = new XMLHttpRequest();
	} else {
		dynamic_xml_all = new ActiveXObject("MSXML2.XMLHTTP");
	}
	var url = '/cgi-bin/get_ajax_content.cgi?type=dynamic_prices&pids=' + pids + '&service_date=' + service_date + '&return_pids=' + return_pids + '&return_date=' + return_date;
	dynamic_xml_all.open("GET", url, true);
	dynamic_xml_all.onreadystatechange = function() {response_dynamic_prices(pids, return_pids);}
	dynamic_xml_all.setRequestHeader("If-Modified-Since","0");
	dynamic_xml_all.send("");
}

function response_dynamic_prices(pids, return_pids)
{
	if (dynamic_xml_all.readyState == 4)
	{
		var response = dynamic_xml_all.responseText;
		var arr_response = response.split("|");
		var index = 0;
		if (pids != '')
		{
			var pids_array = pids.split("|");
			for(i = 0; i < pids_array.length; i++)
			{
				document.getElementById("dynamic_price" + pids_array[i]).innerHTML = arr_response[i];
				index++;
			}
		}
		if (return_pids != '')
		{
			var return_pids_array = return_pids.split("|");
			for(i = 0; i < return_pids_array.length; i++)
			{
				document.getElementById("dynamic_price" + return_pids_array[i]).innerHTML = arr_response[i+index];
			}
		}
	}
}

function change_date(flag, is_return)
{
	document.bus_search.is_prev.value = flag;
	document.bus_search.return_flag.value = is_return;
	document.getElementById("bus_search").submit();
}

function is_special_city(city)
{
	city = city.toUpperCase();
	var total_special_cities = special_citys.length;
	for (i=0; i<total_special_cities; i++)
	{
		var temp_city = special_citys[i];
		temp_city = temp_city.toUpperCase();
		if (city == temp_city)
		{
			return true;
		}
	}
	return false;
}

function enable_roundtrip_new()
{
        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 = "";
                }
                
                var myDate = new Date();//current date
                $('#return_date').datepick('destroy'); 
                $('#r_text_date').find('img').each(function(){$(this).remove();});                        
                $('#return_date').datepick({
				rangeSelect: false, 
				monthsToShow: 2,
				constrainInput: false,
				dateFormat:'yyyy-mm-dd',
				showOnFocus: false,
				showTrigger: '#calImg',
				showSpeed: 'fast',
				showAnim: '',
				minDate:new Date(myDate.getFullYear(),myDate.getMonth(),myDate.getDate()),
				maxDate:new Date(2100,11,12)}).datepick('show');
				if ($.browser.msie) {
 				if ($.browser.version == "6.0")
	 			{
					$('#return_date').next().addClass("ie6embed");
				}
			}
        }
}

function ca_jump_or_clear(tv)
{
    var bf_obj = get_bus_from_obj();
    var fv = bf_obj.options[bf_obj.selectedIndex].value;
 	if (fv == "New York, NY")
    {
    	if (tv == "Sands Casino, PA")
    	{
    		return ga("http://www.gotobus.com/edwardbusservice/newyorktosandcasinoroundtrip/index.html");	
    	}
	if (tv == "Atlantic City, NJ")
    	{
    		return ga("http://www.gotobus.com/todaysbus/newyorktoatlanticcityshuttlebus/index.html ");	
    	}
    }
    if (fv == "Los Angeles, CA")
    {
    	if (tv == "Six Flags Magic Mountain, CA")
    	{
		return ga("http://www.gotobus.com/cs/c1379/shuttleservice/latosixflagsmagicmountainroundtripshuttlebus.html");
    	}
	if (tv == "Six Flags Hurricane Harbor, CA")
        {
                return ga("http://www.gotobus.com/us/burbankca/tours/hurricaneharborroundtripshuttlebus_478-786.html");
        }
    	if (tv == "Disneyland, CA")
    	{
    		return ga("http://www.gotobus.com/cs/c1379/shuttleservice/latodisneylandroundtripshuttlebus.html");
    	}	
    	if (tv == "Knott's Berry Farm, CA")
    	{
    		return ga("http://www.gotobus.com/cs/c1379/shuttleservice/latoknott_sberryfarmroundtripshuttlebus.html");
    	}	
    	if (tv == "Ontario Mills Outlet, CA")
    	{
    		return ga("http://www.gotobus.com/cs/c1379/shuttleservice/latoontariomillsoutletroundtripshuttlebus.html");
    	}	
    	if (tv == "Desert Hills Outlet, CA")
    	{
    		return ga("http://www.gotobus.com/cs/c1379/shuttleservice/latodeserthillsoutletroundtripshuttlebus.html");
    	}	
    	if (tv == "Citadel Outlet, CA")
    	{
    		return ga("http://www.gotobus.com/cs/c1379/shuttleservice/latocitadeloutletroundtripshuttlebus.html");
    	}	
    	if (tv == "Ronald Reagan Museum, CA")
    	{
    		return ga("http://www.gotobus.com/cs/c1379/shuttleservice/latoronaldreaganmuseumroundtripshuttlebus.html");
    	}	
    	if (tv == "Getty Museum, CA")
    	{
    		return ga("http://www.gotobus.com/cs/c1379/shuttleservice/latogettymuseumroundtripshuttlebus.html");
    	}	
    	if (tv == "Sea World, CA")
    	{
    		return ga("http://www.gotobus.com/cs/c1379/shuttleservice/latoseaworldroundtripshuttlebus.html");
    	}	
    	if (tv == "San Diego Zoo, CA")
    	{
    		return ga("http://www.gotobus.com/cs/c1379/shuttleservice/latosandiegozooroundtripshuttlebus.html");
    	}	
    }
    if (tv == "Turning Stone Casino, NY")
    {
        if (fv == "Albany, NY")
        {
            return ga("http://www.gotobus.com/cs/c1259/albanytoturningstonecasino/");
        }

    }
    if (tv == "Mohegan Sun Casino, CT")
    {
        if (fv == "Boston, MA" || fv == "Dorchester, MA" || fv == "Quincy, MA" || fv == "Lawrence, MA" || fv == "Lowell, MA" || fv == "Methuen, MA" || fv == "Worcester, MA"  || fv == "Malden, 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" || fv == "Bethesda, MD")
        {
            return ga("http://www.gotobus.com/rexbus/daytriptotajmahalatlanticcity/");
        }
	if (fv == "Capitol Heights, MD" || fv == "Clinton, MD" || fv == "Tysons Corner, VA")
        {
            return ga("http://www.gotobus.com/rexbus/daytriptotajmahalatlanticcity/daytriptotajmahalatlanticcity.html");
        }
    }
    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/");
    }
}
//-->
// ===================================================================
// 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 + "px";
			document.all[this.divName].style.top = this.y + "px";
			document.all[this.divName].style.visibility = "visible";
			}
		else if (this.use_layers) {
			document.layers[this.divName].left = this.x + "px";
			document.layers[this.divName].top = this.y + "px";
			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=100% 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 = document.documentElement.scrollTop + pos.y + 4 + "px";
	b_obj.left = pos.x + 4 + "px";
	b_obj.visibility = "visible";
	b_obj.display = "block";
}

function show_bus_station_info(diplay_obj,text,mark,is_return)
{
	var counts_str = "counts" + mark;
	var counts_obj = document.getElementById(counts_str);
	var count=counts_obj.value;
	var display_value = "display_value" + mark + diplay_obj + "_" + is_return;
	var current_display = "display" +  mark + diplay_obj + "_" + is_return;
	var div_listarea = document.getElementById("listarea");
	var div_listarea_return = document.getElementById("listarea_return");
	var radselect_objs = document.getElementsByName("radselect");
	var count1=radselect_objs.length;
	var radselect_objs_return = document.getElementsByName("radselect_return");
	var count2=radselect_objs_return.length;
	document.getElementById(display_value).innerHTML = text;	
	for (var i=1; i<=count; i++)
    {
    	var display_id = "display" + mark + i + "_" + is_return;
    	var click_here_id = "click_here" + i + "_" + is_return;
		var click_here_obj = document.getElementById(click_here_id);
    	if (document.getElementById(display_id) && display_id != current_display)
    	{
	    	var div_display = document.getElementById(display_id).style;
	    	if (div_display.display != "none")
	    	{
	    		div_display.display = "none";
	    		click_here_obj.innerHTML = "Click for Bus Stations and Details";
	    	}
	    }
    }    
    var click_here_id = "click_here" + diplay_obj + "_" + is_return;
	var click_here_obj = document.getElementById(click_here_id);
    var current_div = document.getElementById(current_display).style;
    if (current_div.display != "")
	{
		if (div_listarea != null && mark == 'b')
		{
			var listarea_height
			listarea_height = 12 * 56 + 50;
			if ( count1 <= 12 )
			{
				listarea_height = count1 * 56 + 180;		    	
				div_listarea.style.overflow = "auto";
			}			
			div_listarea.style.height = listarea_height + 'px';	
		}
		if (div_listarea_return != null && mark == 'c')
		{
			var listarea_height
			listarea_height = 12 * 56 + 50;
			if ( count2 <= 12 )
			{
				listarea_height = count2 * 56 + 180;		    	
				div_listarea_return.style.overflow = "auto";
			}			
			div_listarea_return.style.height = listarea_height + 'px';	
		}
		current_div.display = "";
		if (click_here_obj != null)
		{
			click_here_obj.innerHTML = "Hide details";	
		}
	}
	else
	{
		if (div_listarea != null && mark == 'b')
		{
			var listarea_height
			listarea_height = 12 * 56 + 50;
			if ( count1 <= 12 )
			{
				listarea_height = count1 * 56 + 10;	
				div_listarea.style.overflow = "hidden";
			}
			div_listarea.style.height = listarea_height + 'px';
		}
		if (div_listarea_return != null && mark == 'c')
		{
			var listarea_height
			listarea_height = 12 * 56 + 50;
			if ( count2 <= 12 )
			{
				listarea_height = count2 * 56 + 10;	
				div_listarea_return.style.overflow = "hidden";
			}
			div_listarea_return.style.height = listarea_height + 'px';
		}
		current_div.display = "none";
		if (click_here_obj != null)
		{
			click_here_obj.innerHTML = "Click for Bus Stations and Details";	
		}
	}		
}

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;
	}
	var total_people_count = -1;
	var room_array = [];
	var room_count = 0;
    for (var i=0, j=f.elements.length; i<j; i++)
    {
        var t = f.elements[i].type;
        if (t.match(/select/))
        {
			var sname = f.elements[i].name;
			if (sname.match(/^Room(.)(Adult|Child)/i))
			{
				if (total_people_count == -1)
				{
					total_people_count = 0;
				}
				var pnum =  parseInt(f.elements[i].value);
				total_people_count += pnum;

				if (pnum > 0)
				{
					var room_no = parseInt(sname[4])-1;
					if (room_array[room_no] == undefined)
					{
						room_array[room_no] = 0;
					}
					room_array[room_no] += pnum;
					if (room_no+1 > room_count)
					{
						room_count = room_no+1;
					}
				}
			}
            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 (total_people_count == 0)
	{
		alert("Please select adult/child number!");
        return false;
	}

	var max_capacity = 4;
	for ( i=0; i < room_count; i++)
	{
		if (room_array[i] > max_capacity)
		{
			alert("The number of passengers cannot be greater than 4 for each room.");
			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 show_number_based_price(obj)
{
	var price_obj = $(obj);
	var number_based_price = $("#number_based_price");
	var price_content = $("#price_content");
	price_content.html(price_obj.attr("pricecontent"));
	var left_ps = price_obj.offset().left;
	var top_ps = price_obj.offset().top + 14;
	number_based_price.css('left',left_ps).css('top',top_ps);
	number_based_price.show();
}
function hide_number_based_price()
{

	var number_based_price = $("#number_based_price");
	number_based_price.hide();
}
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;
		}
		 var tat_table = document.createElement('table');
		tat_table.cellSpacing='1px';
		tat_table.cellPadding='2px';
		tat_table.style.position='absolute';
		tat_table.style.top = eval(curTop(actb_curr) + actb_curr.offsetHeight) + "px";
		tat_table.style.left = curLeft(actb_curr) + "px";
		tat_table.style.backgroundColor=actb_self.actb_bgColor;
////////////////////////////////////
		tat_table.style.border = "#000000 solid 1px";
		tat_table.style.width = actb_self.actb_Width;
		tat_table.style.zIndex = "2";
////////////////////
		tat_table.id = 'tat_table';
		document.body.appendChild(tat_table);
		var i;
		var first = true;
		var j = 1;
		if (actb_self.actb_mouse){
			tat_table.onmouseout = actb_table_unfocus;
			tat_table.onmouseover = actb_table_focus;
		}
		var counter = 0;
		for (i=0;i<actb_self.actb_keywords.length;i++){
			if (actb_bool[i]){
				counter++;
				var r = tat_table.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);
				var 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.style.textAlign = 'left';
				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){
				var r = tat_table.insertRow(-1);
				r.style.backgroundColor = actb_self.actb_bgColor;
				var c = r.insertCell(-1);
				c.style.color = actb_self.actb_textColor;
				c.style.fontFamily = 'arial narrow';
				c.style.fontSize = actb_self.actb_fSize;
				c.style.textAlign = 'left';				
				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'));
		var tat_table = document.createElement('table');
		tat_table.cellSpacing='1px';
		tat_table.cellPadding='2px';
		tat_table.style.position='absolute';
		tat_table.style.top = eval(curTop(actb_curr) + actb_curr.offsetHeight) + "px";
		tat_table.style.left = curLeft(actb_curr) + "px";
		tat_table.style.backgroundColor=actb_self.actb_bgColor;
		tat_table.id = 'tat_table';
		if (actb_self.actb_mouse){
			tat_table.onmouseout= actb_table_unfocus;
			tat_table.onmouseover=actb_table_focus;
		}
		document.body.appendChild(tat_table);
		var i;
		var first = true;
		var j = 1;
		if (actb_rangeu > 1){
			var r = tat_table.insertRow(-1);
			r.style.backgroundColor = actb_self.actb_bgColor;
			var 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){
					var r = tat_table.insertRow(-1);
					r.style.backgroundColor = actb_self.actb_bgColor;
					r.id = 'tat_tr'+(j);
					var 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){
			var r = tat_table.insertRow(-1);
			r.style.backgroundColor = actb_self.actb_bgColor;
			var 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;
			}
		}
		if(document.tour_search && actb_curr.id != "t_keywords")
		{
			update_tour_to(word);
		}			
		if(actb_curr.id == "sbus_to_id")
		{
			ca_jump_or_clear(word)			
		}
		if(actb_curr.id == "t_keywords")
		{
			actb_curr.style.color="#000000";
		}			
		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;
		var ak = evt.keyCode;
		caret_pos_start = getCaretStart(actb_curr);
		actb_caretmove = 0;
		if(ak==13 && document.getElementById('itemList') && document.tour_search)
		{
			
			if(actb_curr.id != "t_keywords")
			{
				document.getElementById('itemList').innerHTML='';
			}
			
			}
		var div = document.getElementById("city_list_div");
		if(div && div.style.display=="block")
		{
			div.style.display="none";
		}
		switch (ak){
			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(ak)},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) == "undefined" || arr == null || arr.length == 0)
	{
		return;
	}
	if(typeof(arr) != "object") {
		arr = g_bus[arr];
		if(typeof(arr) == "undefined" || arr.length<1)
			arr = new Array();
	}
	var acObj = AutoComplete(obj, arr);
	acObj.actb_setup();
	acObj.actb_firstText = true;
	if(obj.id == "t_keywords")
	{
		acObj.actb_Width = '147px';
	}
	else
	{
		acObj.actb_Width = '180px';
	}
	
	acObj.actb_lim = 20;
}

if(window.addEventListener){

	window.addEventListener("load",function(){
		var url = window.location.href;
		if(url.indexOf('option=Search')<0 && document.bus_search)
			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)
			document.bus_search.option.value = "Select";

	});
}

function show_rating(pid, rating)
{
	rating1 = parseFloat(rating);
	var value_arr = new Array(0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0);
	var rating_show = new Array("","","","","","","","","","");
	for(j=0; j < 10;j++)
	{
		if(value_arr[j]<= rating1)
		{
			rating_show[j] = "star-rating-on";
		}
		else
		{
			rating_show[j] = "";
		}
	}
	var rating_string = "<span class='star-rating-control' title='Reviews Rating' alt='Reviews Rating'><div style='display: none;' class='rating-cancel'><a title='Cancel Rating'></a></div>";	    	
	rating_string += "<div style='width: 8px;' class='star-rating rater-0 star {split:2} star-rating-applied star-rating-readonly "+rating_show[0]+"'><a style='margin-left: 0px;' title='Reviews Rating'>0.5</a></div>";
	rating_string += "<div style='width: 8px;' class='star-rating rater-0 star {split:2} star-rating-applied star-rating-readonly "+rating_show[1]+"'><a style='margin-left: -8px;' title='Reviews Rating'>1.0</a></div>";
	rating_string += "<div style='width: 8px;' class='star-rating rater-0 star {split:2} star-rating-applied star-rating-readonly "+rating_show[2]+"'><a style='margin-left: 0px;' title='Reviews Rating'>1.5</a></div>";
	rating_string += "<div style='width: 8px;' class='star-rating rater-0 star {split:2} star-rating-applied star-rating-readonly "+rating_show[3]+"'><a style='margin-left: -8px;' title='Reviews Rating'>2.0</a></div>";
	rating_string += "<div style='width: 8px;' class='star-rating rater-0 star {split:2} star-rating-applied star-rating-readonly "+rating_show[4]+"'><a style='margin-left: 0px;' title='Reviews Rating'>2.5</a></div>";
	rating_string += "<div style='width: 8px;' class='star-rating rater-0 star {split:2} star-rating-applied star-rating-readonly "+rating_show[5]+"'><a style='margin-left: -8px;' title='Reviews Rating'>3.0</a></div>";
	rating_string += "<div style='width: 8px;' class='star-rating rater-0 star {split:2} star-rating-applied star-rating-readonly "+rating_show[6]+"'><a style='margin-left: 0px;' title='Reviews Rating'>3.5</a></div>";
	rating_string += "<div style='width: 8px;' class='star-rating rater-0 star {split:2} star-rating-applied star-rating-readonly "+rating_show[7]+"'><a style='margin-left: -8px;' title='Reviews Rating'>4.0</a></div>";
	rating_string += "<div style='width: 8px;' class='star-rating rater-0 star {split:2} star-rating-applied star-rating-readonly "+rating_show[8]+"'><a style='margin-left: 0px;' title='Reviews Rating'>4.5</a></div>";
	rating_string += "<div style='width: 8px;' class='star-rating rater-0 star {split:2} star-rating-applied star-rating-readonly "+rating_show[9]+"'><a style='margin-left: -8px;' title='Reviews Rating'>5.0</a></div></span>";
	if(document.getElementById(pid+'_rating'))
	{
		document.getElementById(pid+'_rating').innerHTML = rating_string;
	}   	
	//document.getElementById(pid+'_rating').innerHTML = rating_string;
}

function validateXML(txt)
{
// code for IE
if (window.ActiveXObject)
{
	var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
	xmlDoc.async="false";
	xmlDoc.loadXML(document.all(txt).value);
	
	if(xmlDoc.parseError.errorCode!=0)
	{
		txt="Error Code: " + xmlDoc.parseError.errorCode;
		txt=txt+"Error Reason: " + xmlDoc.parseError.reason;
		txt=txt+"Error Line: " + xmlDoc.parseError.line;
		alert(txt);
		return false;
	}
	else
	{
		return true;
	}
		
}
	// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation.createDocument)
{
		var parser=new DOMParser();
		var text=document.getElementById(txt).value;
		var xmlDoc=parser.parseFromString(text,"text/xml");
		
		if (xmlDoc.documentElement.nodeName=="parsererror")
		{
		
			var msg = xmlDoc.documentElement.childNodes[0].nodeValue;
			alert(msg);
			return false;
		}
		else
		{
			return true;
		}
}
else
{
	alert('Your browser cannot handle XML validation');
	return false;
}

	
}

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;z-index:999;background-color:#ffffff;layer-background-color:#ffffff;\"></div>');
document.write('<table width=\"100%\" align=\"center\" cellspacing=\"2\" 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() + 90 * 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://search.gotobus.com/cgi-bin/bus.cgi\">');
document.write('<script language=\"javascript\" src=\"http://www.gotobus.com/js/en/jquery/jquery-1.4.2.min.js\"></script>');
document.write('<script language=\"JavaScript\" src=\"http://www.gotobus.com/js/jquery/jquery.ui.datepickv402.js\"></script>');
document.write('<script language=\"JavaScript\" src=\"http://www.gotobus.com/js/jquery/dateformate.js\"></script>');
document.write('<input type=\"hidden\" id=\"is_prev\" name=\"is_prev\" value=\"\">');
document.write('<input type=\"hidden\" id=\"return_flag\" name=\"return_flag\" value=\"\">');
document.write('<input type=\"hidden\" id=\"is_roundtrip\" name=\"is_roundtrip\" value=\"\">');
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\" align=\"left\">');
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\" align=\"left\">');
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('        <select id=\"bus_from\" name=\"bus_from\" class=\"textbox\" style=\"width:160px;\" onChange=\"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('	<input type=\"hidden\" name=\"sbus_from\" id=\"sbus_from_id\"/>');
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('');
document.write('	</td>');
document.write('	<td valign=\"top\">');
document.write('      <small>Select or Enter Arrival:</small><br>');
document.write('        <select id=\"bus_to\" name=\"bus_to\"  class=\"textbox\" style=\"width:160px;\" onChange=\"jump_or_clear();copy_select_to_search();\" >');
document.write('      <option>Arrival City</option>');
document.write('      </select>');
document.write('      <input type=\"hidden\" name=\"sbus_to\" id=\"sbus_to_id\"/>');
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('');
document.write('	</td>');
document.write('  </tr>');
document.write('  </table>');
document.write('');
document.write('  </td>');
document.write('  <td align=\"left\"><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%\" align=\"left\">');
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%\" align=\"left\">');
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;z-index:999;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);\" style=\"width:60px;\">');
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 type=\"text/javascript\" src=\"http://search.gotobus.com/js/en/soap_search.js\"></script>');
document.write('		<script language=\"javascript\" src=\"/js/balloon_option.js\"></script>');
document.write('		<script language=\"javascript\">');
document.write('');
document.write('	update_bus_from();');
document.write('');
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('var bf_obj = get_bus_from_obj();');
document.write('var bt_obj = get_bus_to_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('');
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('	update_bus_from_to(cf, ct);');
document.write('	if (cf == null || cf ==\"\" || bf_obj.options.selectedIndex <=0)');
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('	if (ct == null || ct ==\"\" || bt_obj.options.selectedIndex <=0)');
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('if (document.bus_search.b_roundtrip.checked == false)');
document.write('{');
document.write('	document.bus_search.b_oneway.checked = true;');
document.write('	}');
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('');
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('var bf_obj = get_bus_from_obj();');
document.write('var bt_obj = get_bus_to_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('');
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('	update_bus_from_to(cf, ct);');
document.write('	if (cf == null || cf ==\"\" || bf_obj.options.selectedIndex <=0)');
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('	if (ct == null || ct ==\"\" || bt_obj.options.selectedIndex <=0)');
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('if (document.bus_search.b_roundtrip.checked == false)');
document.write('{');
document.write('	document.bus_search.b_oneway.checked = true;');
document.write('	}');
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('if (typeof(preset_departure) != \'undefined\')');
document.write('{');
document.write('	if (preset_departure !=\'\' && preset_arrival != \'\')	');
document.write('	{');
document.write('		update_bus_from_to(preset_departure, preset_arrival);');
document.write('	}');
document.write('}');
document.write('</script>');
