function photoPopup(url) {
	window.open(url,'photosPopUp','width=600,height=416,resizable=no,scrollbars=no,status=no');
}

var scrollI = 0;
var scrollText = [
	'Half the nation\'s population is within a day\'s drive of Indianapolis.',
	'Considered second only to Washington, DC, in number of memorials.',
	//'The Indianapolis Zoo, divided into biomes, features nearly 4,000 animals and is home to the state’s largest aquarium and the country’s first totally submerged, underwater dolphin viewing dome.',
	'Indianapolis hosts the two largest single-day sporting events in the world: the Indianapolis 500 and the Allstate 400 at the Brickyard.',
	'The Indianapolis International Airport offers travel on 19 airlines and nonstop and direct flights to 39 destinations.',
	'Internationally-renowned architect Michael Graves designed the NCAA Hall of Champions.',
	'Indianapolis has the largest children\'s museum in the world-The Children\'s Museum of Indianapolis.',
	'Circle Centre mall houses the state\'s only Nordstrom department store, along with 100 other specialty stores.',
	'The NFL Colts moved to Indianapolis in 1984 from Baltimore, MD.',
	//'In 1847, a railroad was built and became the first to have all of its lines meet in one union station. Because of the railroad, Indianapolis was designated as the "Crossroads of America."',
	//'Seven downtown hotels with more than 2,800 rooms are connected via skywalk to the Indiana Convention Center  •  Indianapolis hosts the two largest single...'
	'Seven downtown hotels with more than 2,800 rooms are connected via skywalk to the Indiana Convention Center'
];

document.observe("dom:loaded", function () 
{
	move();
});

moveI = 0;
function move() {
	if ($('main-flash-bottom') == null)
		return false;

	new Effect.Move('main-flash-bottom-scroller', { 
		x: -100,
		y: 0, 
		mode: 'relative', 
		duration: 3.0,
		transition: Effect.Transitions.linear,
		afterFinish: function() {
			if (++moveI % 83 == 0)
				$('main-flash-bottom-scroller').style.left= '100px';
			move();
		}
	});	            	
}

function switchText() {
	if ($('main-flash-bottom') == null)
		return false;
	
	new Effect.Fade('main-flash-bottom-scroller', {
		queue: 'end',
		scope: 'text'
	});
	setTimeout("$('main-flash-bottom-scroller').update(scrollText[scrollI++ % scrollText.length])", 1200);
	setTimeout("new Effect.Appear('main-flash-bottom-scroller', { duration: 0.2, queue: 'end', scope: 'text' })", 1400);
	
	setTimeout('switchText()', 6000);
}

function switchHotel(hotel) {
	/*$('main-spacer').morph('height: 12px');
	$('main-flash').innerHTML = '';
	Effect.BlindUp('main-flash-container');
	Effect.SlideDown('main-middle');*/
	
	if (hotel == '') {
		return false;
	}
	
	new Effect.ScrollTo('lbwrap', {
		duration: 0.5,
		queue: 'front',
		scope: 'scroll'
	});
	
	new Ajax.Request(hotel, {
		method: 'post',
		parameters: {
			'function': 'get_a_hotel'
		},
		
		onLoading: function() {
			$('main-flash-container').style.backgroundColor = '#ffffff';
			$('main-flash-container').update('<div style="padding: 100px 450px; background: #ffffff; margin: 0px; text-align: center;" id="wait"><img src="templates/default/assets/images/wait30.gif" /></div>');
			
			//$('main-middle').style.display = 'block';
			//Effect.SlideDown('main-middle', { duration: 2.0 });
			
			//$('main-flash').innerHTML = '';
			//Effect.BlindUp('main-flash-container', { duration: 2.0 });
		},
		
		onSuccess: function(transport){
			$('main-flash-container').update('<div style="padding: 100px 450px; background: #ffffff; margin: 0px; text-align: center;" id="wait"><img src="templates/default/assets/images/wait30.gif" /></div>' + transport.responseText);
			if (hotel != 'index.php')
				new Effect.Parallel([
					new Effect.Morph('main-spacer', {
						style: 'height: 12px;',
						sync: true
					}),
					new Effect.Morph('main-flash-container', {
						style: 'height: 296px;',
						sync: true
					})
				], {
					queue: 'end',
					scope: 'scroll'
				});
			else
				// (296[height per box] * 3[boxes]) + 2[pixels for border]
				new Effect.Parallel([
					new Effect.Morph('main-spacer', {
						style: 'height: 12px;',
						sync: true
					}),
					new Effect.Morph('main-flash-container', {
						style: 'height: 890px;',
						sync: true
					})
				], {
					queue: 'end',
					scope: 'scroll'
				});
			//Effect.SlideDown('main-flash-container', { duration: 3.0, queue: 'end' });
			//setTimeout("$('main-middle').style.display = 'block'", 5000);
			setTimeout("$('main-flash-bordertop').style.display = 'block'", 500);
			setTimeout("$('hidden').style.display = 'block'", 500);
			setTimeout("$('wait').style.display = 'none'", 500);
		},
		
		onFailure: function(){
			$('main-flash-container').innerHTML = '<h2>Error connecting to server</h2>';
		}
	});
}

function viewAll() {
	switchHotel('index.php');
}

// START GOOGLE MAPS API
function goGoGadgetMap() {
	
	new Effect.ScrollTo('lbwrap', {
		duration: 0.5,
		queue: 'front',
		scope: 'scroll'
	});

	// Default coordinates and zoom
	// Puts the position between the three hotels
	var latLong = new google.maps.LatLng(39.851775, -86.139679);
	var zoomLevel = 10;
	var coords = [
		[ 'Sheraton Indianapolis City Centre Hotel', 39.769788, -86.158627 ],
		[ 'The Westin Indianapolis', 39.766465, -86.161929 ],
		[ 'Sheraton Indianapolis Hotel & Suites', 39.916149, -86.109284 ],
	];
	
	if ($$('div.main-middle-left').size() == 1) {
		// We have one hotel in the main content area, zoom in on that specific location
		zoomLevel = 14;

		$$('div.main-middle-left').each(function(hotel) {
			// Extract the hotel property ID
			// Javascript doesn't support lookbehinds, so we have to strip the first slash
			hotel.style.backgroundImage.match(/\/\d+(?=\/)/g).each(function(hit) {
				// Max one hit
				switch (Number(hit.substr(1))) {
					case 158:
					latLong = new google.maps.LatLng(39.916149, -86.109284);
					coords = [
						[ 'Sheraton Indianapolis Hotel & Suites', 39.916149, -86.109284 ],
					];
					break;
					
					case 1033:
					latLong = new google.maps.LatLng(39.766465, -86.161929);
					coords = [
						[ 'The Westin Indianapolis', 39.766465, -86.161929 ],
					];
					break;
					
					case 3054:
					latLong = new google.maps.LatLng(39.769788, -86.158627);
					coords = [
						[ 'Sheraton Indianapolis City Centre Hotel', 39.769788, -86.158627 ],
					];
					break;
					
					default:
				}
			});
		});

		/*
		switch (where) {
			case 1:
			// The two hotels downtown
			latLong = new google.maps.LatLng(39.768238, -86.159849);
			
			break;
			
			case 2:
			// The one hotel not-so downtown
			latLong = new google.maps.LatLng(39.916149, -86.109284);
			
			default:
		}
		*/
	}
	
	$('main-flash-container').update('<div style="height: 271px;" id="main-middle"></div>');
	$('main-flash-container').style.backgroundColor = '#e5e3df';
	new Effect.Parallel([
		new Effect.Morph('main-spacer', {
			style: 'height: 2px;',
			sync: true
		}),
		new Effect.Morph('main-flash-container', {
			style: 'height: 271px;',
			sync: true
		})
	], {
		queue: 'end',
		scope: 'scroll'
	});
	
	var latLong;

	var markers = [];
	var infoBoxen = [];
	var infoBoxSize = new google.maps.Size(250,20);
	
	var mapOptions = {
		zoom: zoomLevel,
		center: latLong,
		mapTypeId: google.maps.MapTypeId.ROADMAP, // 2D map
		disableDefaultUI: true, // limit the user's ability to adjust the map
		navigationControl: true, // zoom/pan
		navigationControlOptions: google.maps.NavigationControlStyle.SMALL, // allows only the + and - zoom buttons
		mapTypeControl: false, // no you can't change it to satellite
		scaleControl: false, // :(
		//draggable: false, // more :(
		other_params: "sensor=false" // v3 API needs this
	};
	
	// plot
	var map = new google.maps.Map($('main-middle'), mapOptions);
	$('main-flash-bordertop').style.display = 'none';
	
	// add markers
	try {
		coords.each(function(coord, i) {
			markers.push(
				new google.maps.Marker({
					position: new google.maps.LatLng(coord[1], coord[2]),
					map: map,
					title: coord[0]
				})
			);
			
			infoBoxen.push(
				new google.maps.InfoWindow({
					content: coord[0],
					size: infoBoxSize
				})
			);
		
			google.maps.event.addListener(markers[i], 'click', function() {
				infoBoxen[i].open(map, markers[i]);
			});
		});
	}
	catch (e) {
	}
}

function deMap() {
	if (typeof(window['map']) != "undefined")
		GUnload();
}
// END GOOGLE MAPS API

/*
// START GOOGLE MAPS API
var map;
var bounds;

function goGoGoMap() {
	if (GBrowserIsCompatible()) {
		$('main-spacer').morph('height: 2px');
		$('main-flash-bordertop').style.display = 'none';
		$('main-flash-container').morph('height: 271px;');
		
		map = new GMap2(document.getElementById("main-flash-container"));
		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
		map.setCenter(new GLatLng(39.8168333333333,-86.1433), 0);
		var bounds = new GLatLngBounds( 
		new GLatLng(39.9145, -86.1618), new GLatLng(39.7661, -86.1094));
		plotPoints();
		map.setZoom(map.getBoundsZoomLevel(bounds));
	}
}

var gmarkers = [];
var htmls = [];

// handle clicks from the listing:
function click(i) {
	gmarkers[i].openInfoWindowHtml(htmls[i]);
}

// set up a new marker
function addMarker(lat, lon, html) {
	var marker = new GMarker(new GLatLng(lat, lon));
	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(html);
	});
	gmarkers.push(marker);
	htmls.push(html);
	return marker;
}

function plotPoints() {
	var marker;
	
	// add the points
	var html = formatHtml("", "31 W Ohio St, Indianapolis, IN 46204, USA");
	marker = addMarker(39.7699, -86.1587, html);
	map.addOverlay(marker);
	
	// add the points
	var html = formatHtml("", "8787 Keystone Crossing, Indianapolis, IN 46240, USA");
	marker = addMarker(39.9145, -86.1094, html);
	map.addOverlay(marker);
	
	// add the points
	var html = formatHtml("", "50 S Capitol Ave, Indianapolis, IN 46204, USA");
	marker = addMarker(39.7661, -86.1618, html);
	map.addOverlay(marker);
}

function formatHtml(blurb, address) {
	return '<div class="blurb">' + blurb + '</div>\n<div class="address">' + address + '</div>';
}
// END GOOGLE MAPS API
*/

/*
function goGoGoMap() {
	var iframe = '<iframe width="960" height="271" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.ca/maps?f=d&amp;source=s_d&amp;saddr=50+S+Capitol+Ave,+Indianapolis,+Marion,+Indiana+46204,+United+States&amp;daddr=31+W+Ohio+St,+Indianapolis,+Marion,+Indiana+46204,+United+States+to:8787+Keystone+Crossing,+Indianapolis,+Marion,+Indiana+46240,+United+States&amp;hl=en&amp;geocode=&amp;mra=ls&amp;sll=39.841265,-86.13559&amp;sspn=0.182155,0.30899&amp;ie=UTF8&amp;ll=39.867588,-86.147919&amp;spn=0.285642,1.318359&amp;z=10&amp;output=embed"></iframe>';
	
	$('main-spacer').morph('height: 2px');
	$('main-flash-bordertop').style.display = 'none';
	$('main-flash-container').morph('height: 271px;');
	$('main-flash-container').update(iframe);
}
*/

/*
OLD

function switch_hotel(hotel) {
	if (hotel == '') {
		alert('Please select a hotel.');
		return false;
	}
	
	new Ajax.Request('index.php', {
		method: 'post',
		
		parameters: {
			'function': 'get_a_hotel', 
			'which_hotel': hotel
		},
		
		onLoading: function() {
			$('main-spacer').morph('height: 12px');
			
			$('main-flash-container').update('<div style="padding: 100px 450px; background: #ffffff; margin: 0px; text-align: center;"><img src="templates/default/assets/images/wait30.gif" /></div>');
			
			//$('main-middle').style.display = 'block';
			//Effect.SlideDown('main-middle', { duration: 2.0 });
			
			//$('main-flash').innerHTML = '';
			//Effect.BlindUp('main-flash-container', { duration: 2.0 });
		},
		
		onSuccess: function(transport){
			$('main-flash-container').update(transport.responseText);
			$('main-flash-container').morph('height: 296px');
			//Effect.SlideDown('main-flash-container', { duration: 3.0, queue: 'end' });
			//setTimeout("$('main-middle').style.display = 'block'", 5000);
		},
		
		onFailure: function(){
			$('main-middle').innerHTML = '<h2>Error connecting to server</h2>';
		}
	});
}
*/

/*
function get_states(country) {
	if(country != '')
	{
		new Ajax.Request('index.php', {
			method: 'post',
			parameters: {
				'fx':'get_states',
				'country':country
			},
			onSuccess: function(transport) {
				$('state').update(transport.responseText);
				$('state').show();
				// get_properties(country,'',lang,iata,brand);
			}
		});
	}
}

function get_properties(country,city) {
	if(country != '' && city != '')
	{
	new Ajax.Request('index.php', {
		method:'post',
		parameters: {
			'fx': 'show_properties', 
			'country':country,
			'city':city
		},
		onLoading: function() {
			new Effect.BlindUp('main',{duration:3});
		//	$('main').hide();
			$('content').update('<div style="padding:100px 450px;background: #ffffff; margin: 0px;"><img src="templates/default/assets/images/wait30.gif" /></div>');
			$('content').style.display='block';
		},
		onSuccess: function(transport){
		  $('content').update(transport.responseText);
		  $('content').style.display='block';
		  $('search-again').show()
		},
		onFailure: function(){$('content').innerHTML = '<h2>Error connecting to server</h2>';}
	  });
	}
	else {
		alert('Please select a Country and a City');	
	}
}

function loadImage(propID) {
	var thumb = propID.toString()
	$(thumb).setStyle({display:'block'});
}

function unLoadImage(propID) {
	var thumb = propID.toString()
	$(thumb).setStyle({display:'none'});
}

function selectOff(loc,id,howMany,booknow,booknow_url,copy) {
	$('percent-choice-'+loc+'-'+id).style.background = '#f5f2eb';

	if(loc == 1){
		if ($('percent-choice-2-'+id)) $('percent-choice-2-'+id).style.background = '#dfdbd5';
		if($('percent-choice-3-'+id)) $('percent-choice-3-'+id).style.background = '#dfdbd5';
		
	}
	else if(loc == 2)
	{
		if ($('percent-choice-1-'+id)) $('percent-choice-1-'+id).style.background = '#dfdbd5';
		if ($('percent-choice-3-'+id)) $('percent-choice-3-'+id).style.background = '#dfdbd5';
	}
	else if(loc == 3){
		if ($('percent-choice-1-'+id)) $('percent-choice-1-'+id).style.background = '#dfdbd5';
		if ($('percent-choice-2-'+id)) $('percent-choice-2-'+id).style.background = '#dfdbd5';
	}
	
	var percent = loc+1;
	if(loc==2)
	{
		var plus= '+';	
	}
	else {
		var plus=''	
	}
	$('price_' + id).innerHTML = '<p class="offers">'+copy+'</p>';
		
	$('price_' + id).innerHTML += '<a href="' + booknow_url + '" class="booknow" target="_blank" style="background: url('+booknow+') no-repeat;"></a>';
}

function photoPopup(url) {
	window.open(url,'photosPopUp','width=600,height=416,resizable=no,scrollbars=no,status=no');
}

function showHeader(){
	new Effect.BlindDown('main',{duration:2});
	$('search-again').hide();
}
*/