var resort;
var orlandoAirport;
var sanfordAirport;
var disneyEntrance;
var epcotCenter;
var magicKingdom;
var MGM;
var animalKingdom;
var universalStudios;
var seaWorld;
var wetNWild;
var kennedySpaceCenter;
var legoLand;
var downTownDisney;
var infowindow;
var directionsRenderer;
var map;
var geocoder;
var currentMarker; 
  

function updateMap()
{
	geocoder = new google.maps.Geocoder();

	var resortImages = {
		image : "Images/house_icon.png", 
		rolloverImage : "Images/house_icon.png"
	}
	var disneyImages = {
		image : "Images/disney.png", 
		rolloverImage : "Images/disneyr.png"
	}
	
	var epcotImages = {
		image : "Images/epcot_center_disc.png", 
		rolloverImage : "Images/epcot_center_disc.png"
	}

	var attractionImages = {
		image : "Images/star1.png", 
		rolloverImage : "Images/star2.png"
	}
	var airportImages = {
		image : "Images/airplane_icon2.gif", 
		rolloverImage : "Images/airplane_icon2.gif"
	}

	var legoImages = {
		image : "Images/lego1.png", 
		rolloverImage : "Images/lego2.png"
	}	
	var rocketImages = {
		image : "Images/rocket_fly.png", 
		rolloverImage : "Images/rocket_fly.png"
	}
	resort = {
		images : resortImages,
		title : "Emerald Island Resort",
		html :  '<p>Emerald Island Resort</p>', 
		latlng : new google.maps.LatLng(28.32982545454858, -81.61996364593506),
		address : '2751 Emerald Island Boulevard Kissimmee, FL 34747-3002',
		info : null,
		name : 'resort'
	}
	orlandoAirport = {
		images : airportImages,
		title: "Orlando International Airport(MCO)",
		html :  "<a target='_blank' href='http://local.google.com/maps?lh=en&q=mco+to+emerald+island+blvd+34747'>Click for Directions to resort</a>  ", 
		latlng : new google.maps.LatLng(28.431713426539677, -81.30792617797852),
		address : "1 Jeff Fuqua Blvd Orlando, Florida 32827",
		info : null,
		name : 'orlandoAirport'
	}

	sanfordAirport = {
		images : airportImages,
		title: "<h1>Sanford International Airport</h1>(SFB)",
		html : "Sanford International Airport(SFB)", 
		latlng :  new google.maps.LatLng(28.774204548416503, -81.2427806854248),
		address : "1200 Red Cleveland Blvd. Sanford, Florida 32773",
		info : null,
		name : 'sanfordAirport'
	}

	disneyEntrance = {
		images : disneyImages,
		title : "Walt Disney World",
		html : "World Drive Main Entrance", 
		latlng : new google.maps.LatLng(28.332960765885726, -81.56812191009521),
		info : null,
		name : 'disneyEntrance'
	}

	epcotCenter = {
		images : disneyImages,
		title: "Walt Disney World",
		html : "Epcot Park", 
		latlng : new google.maps.LatLng(28.374221148733284, -81.54945373535156),
		address : "1510 North Avenue of the Stars Lake Buena Vista, FL 32830",
		info : null,
		name : 'epcotCenter'
	}

	magicKingdom = {
		images : disneyImages,
		title: "Walt Disney World",
		html : "Magic Kingdom Park", 
		latlng : new google.maps.LatLng(28.42057980127919, -81.5815544128418),
		address : "3111 World Dr. Lake Buena Vista, FL 32830",
		info : null,
		name : 'magicKingdom'
	}

	MGM = {
		images : disneyImages,
		title: "Walt Disney World",
		html :  "MGM Studios Park", 
		latlng : new google.maps.LatLng(28.35866305244597, -81.55820846557617),
		address : "351 South Studio Dr. Lake Buena Vista, FL 32830",
		info : null,
		name : 'MGM'
	}

	animalKingdom = {
		images : disneyImages,
		title: "Walt Disney World",		
		html : "Animal Kingdom Park", 
		latlng : new google.maps.LatLng(28.359493882224797, -81.59073829650879),
		address : "2901 Osceola Parkway, Lake Buena Vista, FL 32830",
		info : null,
		name : 'animalKingdom'
	}
	
	downTownDisney = {
		images : disneyImages,
		title: "Walt Disney World",		
		html : "Downtown Disney", 
		latlng : new google.maps.LatLng(28.370000, -81.515000),
		address : "1494 E Buena Vista Dr. Lake Buena Vista, FL 32830",
		info : null,
		name : 'downTownDisney'
	}
	
	universalStudios = {
		images : attractionImages,
		title : "Universal Studios",
		html : "Universal Islands of Adventure<br>Universal Citywalk", 
		latlng : new google.maps.LatLng(28.47404824260341, -81.46748542785645),
		address: "6000 Universal Blvd Orlando, Florida 32819",
		info : null,
		name : 'universalStudios'
	}

	seaWorld = {
		images : attractionImages,
		title : "Seaworld",
		html : "<h1>Seaworld</h1>", 
		latlng : new google.maps.LatLng(28.41050191740378, -81.46233558654785),
		address: "7007 SeaWorld Drive Orlando, Florida 32821",
		info : null,
		name : 'seaWorld'
	}
	wetNWild = {
		images : attractionImages,
		title : "Wet 'n' Wild",
		html : "", 
		latlng : new google.maps.LatLng(28.4589575609595, -81.46576881408691),
		address: "6200 International Drive Orlando, FL 32819",
		info : null,
		name : 'wetNWild'
	}
	kennedySpaceCenter = {
		images : rocketImages,
		title : "NASA",
		html : "Kennedy Space Center", 
		latlng : new google.maps.LatLng(28.62065493341091, -80.68200588226318),
		address: "SR 405, Kennedy Space Center, FL, 32899",
		info : null,
		name : 'kennedySpaceCenter'
	}
	legoLand = {
		images : legoImages,
		title : "LegoLand",
		html : "LegoLand", 
		latlng : new google.maps.LatLng(27.96576,-81.68021),
		address : "One Legoland Way Winter Haven, FL 33884-2100",
		info : null,
		name : 'legoLand'
	}	
	
	var myOptions = {
		zoom: 11,
		center: resort.latlng,
		mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById("map_canvas"),
        myOptions);
	createResortMarker(resort);
//	createMarker(resort);
	createMarkerToResort(orlandoAirport);
	createMarkerToResort(sanfordAirport);
	createResortMarker(disneyEntrance);
	createMarkerFromResort(epcotCenter);
	createMarkerFromResort(magicKingdom);
	createMarkerFromResort(MGM);
	createMarkerFromResort(animalKingdom);
	createMarkerFromResort(universalStudios);
	createMarkerFromResort(seaWorld);
	createMarkerFromResort(wetNWild);
	createMarkerFromResort(kennedySpaceCenter);
	createMarkerFromResort(legoLand);
	createMarkerFromResort(downTownDisney);
	directionsRenderer = new google.maps.DirectionsRenderer();
	directionsRenderer.setMap(map);    
	directionsRenderer.setPanel(document.getElementById('directionsPanel'));
	
}


function center(info) {
	map.setCenter(info.latlng);
	directionsRenderer.setMap(null);
	document.getElementById('directionsPanel').innerHTML = "";
}
  
function showDirectionsToResort(start) {
	directionsRenderer.setMap(map);   
	start.info.close();
	 
	var directionsService = new google.maps.DirectionsService();
	var request = {
	  origin: start.latlng, 
	  destination: resort.address,
	  travelMode: google.maps.DirectionsTravelMode.DRIVING,
	  unitSystem: google.maps.DirectionsUnitSystem.IMPERIAL
	};
	directionsService.route(request, function(response, status) {
	  if (status == google.maps.DirectionsStatus.OK) {
		directionsRenderer.setDirections(response);
	  } else {
		alert('Error: ' + status);
	  }
	});

}

function showDirectionsFromResort(end) {
	directionsRenderer.setMap(map);   
	end.info.close();
	 
	var directionsService = new google.maps.DirectionsService();
	var request = {
	  origin: resort.address, 
	  destination: end.latlng,
	  travelMode: google.maps.DirectionsTravelMode.DRIVING,
	  unitSystem: google.maps.DirectionsUnitSystem.IMPERIAL
	};
	directionsService.route(request, function(response, status) {
	  if (status == google.maps.DirectionsStatus.OK) {
		directionsRenderer.setDirections(response);
	  } else {
		alert('Error: ' + status);
	  }
	});
}

function createMarkerToResort(info)
{
	var marker = new google.maps.Marker({
      position: info.latlng,
      map: map,
      icon: info.images.image
	
	});
	info.info = new google.maps.InfoWindow({
		content: '<div id="content">'+
			'<div id="siteNotice">'+
			'</div>'+
			'<h1 id="firstHeading" class="firstHeading">' +
			info.title +
			'</h1><div id="bodyContent">'+
			info.html +
			'<br>' + 
				'<a href="javascript:showDirectionsToResort(' + info.name +  ')">Get directions to resort</a>' + 
			'</div></div>'
	});
	google.maps.event.addListener(marker, 'click', function(){
		if (currentMarker != null) {
			currentMarker.info.close();
		}
		info.info.open(map,marker);
		currentMarker = info;
	});
	google.maps.event.addListener(marker, "mouseover", function(){
		marker.setIcon(info.images.rolloverImage);
	});
	google.maps.event.addListener(marker, "mouseout", function(){
		marker.setIcon(info.images.image);
	});

	return marker;
}


function createResortMarker(info)
{
	var marker = new google.maps.Marker({
      position: info.latlng,
      map: map,
      icon: info.images.image
	
	});
	info.info = new google.maps.InfoWindow({
		content: '<div id="content">'+
			'<div id="siteNotice">'+
			'</div>'+
			'<h1 id="firstHeading" class="firstHeading">' +
			info.title +
			'</h1><div id="bodyContent">'+
			info.html  + 
			'</div></div>'
	});
	google.maps.event.addListener(marker, 'click', function(){
		if (currentMarker != null) {
			currentMarker.info.close();
		}
		info.info.open(map,marker);
		currentMarker = info;	});
	google.maps.event.addListener(marker, "mouseover", function(){
		marker.setIcon(info.images.rolloverImage);
	});
	google.maps.event.addListener(marker, "mouseout", function(){
		marker.setIcon(info.images.image);
	});

	return marker;
}


function createMarkerFromResort(info)
{
	var marker = new google.maps.Marker({
      position: info.latlng,
      map: map,
      icon: info.images.image
	
	});
	info.info = new google.maps.InfoWindow({
		content: '<div id="content">'+
			'<div id="siteNotice">'+
			'</div>'+
			'<h1 id="firstHeading" class="firstHeading">' +
			info.title +
			'</h1><div id="bodyContent">'+
			info.html +
			'<br>' + 
				'<a href="javascript:showDirectionsFromResort(' + info.name +  ')">Get directions from resort</a>' + 
			'</div></div>'
	});
	google.maps.event.addListener(marker, 'click', function(){
		if (currentMarker != null) {
			currentMarker.info.close();
		}
		info.info.open(map,marker);
		currentMarker = info;	});
	google.maps.event.addListener(marker, "mouseover", function(){
		marker.setIcon(info.images.rolloverImage);
	});
	google.maps.event.addListener(marker, "mouseout", function(){
		marker.setIcon(info.images.image);
	});

	return marker;
}

  
  function show(name,src,caption) {
	if (document.images)
	document.images[name].src = src;
	CAPTION.innerHTML=caption;
	}

	function changeFrame() {
		var oIframe = document.getElementById("headerFrame");
		alert (oIframe);
		var oDoc = oIframe.contentWindow || oIframe.contentDocument;
		alert ("next");
		if (oDoc.document) {
			oDoc = oDoc.document;
		}
		document.getElementById('header').innerHTML = oDoc.body.innerHTML;
		cssdropdown.startchrome("chromemenu");
alert ("2");
/*		oIframe = document.getElementById("footerFrame");
		oDoc = oIframe.contentWindow || oIframe.contentDocument;
		if (oDoc.document) {
			oDoc = oDoc.document;
		}
		document.getElementById('footer').innerHTML = oDoc.body.innerHTML;

alert ("1");
		var leftIframe = document.getElementById("leftFrame");
		alert (leftIframe);
		oDoc = leftIframe.contentWindow || leftIframe.contentDocument;
		if (oDoc.document) {
			oDoc = oDoc.document;
		}
		document.getElementById('left').innerHTML = oDoc.body.innerHTML;
*/
	}


	
function initializeMaps() {
    updateMap();
	cssdropdown.startchrome("chromemenu");
//	changeFrame();
}

function initialize() {
	changeFrame();
}

var mickeyReviews = new Array();
var nemoReviews = new Array();
var poohReviews = new Array();
var allReviews = new Array();

mickeyReviews[0] = "<p>This home was beautiful and well beyond what we expected. Everything you could ever possibly need and more was there! Walking in to the 'Mickey' set dining table was awesome! A Mickey waffle iron, Mickey toaster, hot air popcorn popper - I didn't realize there were so many Mickey appliances!!!</p>" +
"<p>We loved the pool and spa - the kids spent almost every waking minute either in the pool or playing PS2!! They were amazed at all the pool toys. The grownups enjoyed the spa every night.</p>"+
"<p>Again, the home is beautiful and there was too much there to enjoy in only one week - we left wishing we had more time. As my nine year old said at the Disney World candy store - 'this is paradise' - we all felt the same way about the house!! I would certainly recommend this property as the 'way to go' for a Disney vacation!</p>" +
"<span class='reviewer'>Kim McNeill, Prince Edward Island, Canada</span>";
mickeyReviews[1] = "<p>We had a great time at your house. It was everything we hoped for and much more. We really enjoyed the pool and the game room. In fact, our children didn't even want to go to Disney but rather wanted to stay at the house and swim and play air hockey. It was nice to have the crib and highchair there already since we drove and car space was at a premium with three adults and four children in the car. Your home is beautiful and we are very happy that we found it. We will, and already have, recommend it to our friends and family. Thanks again for everything, our vacation was awesome because of your home!!!</p>" +
"<span class='reviewer'>Tom Pennsylvania</span>";
mickeyReviews[2] ="<p>Hi Jane, Just wanted to let you know that we throughly enjoyed staying at your house in Florida. It was great, the pool was warm and fun to play in and the accommodations were great. We had every thing we needed and enjoyed the toaster that played a song when the toast was ready!! We could not have had a better place to stay in. Thanks so much for all your information it helped get us to the store to get all we needed. I just fell in love with your china it is beautiful and goes so well with a house named Disney House. They children just loved all the Disney things you have in the house. They also wanted to spend every minute in the pool. The days were a little chilly during our stay but there was not a day when we were not able to use the pool. Thank you so much for such a wonderful stay. Carol</p>" +
"<p>P.S. We will keep you in mind for our next visit to the Orlando area.</p>" +
"<span class='reviewer'>Carol Colorado</span>";
mickeyReviews[3] ="<p>The house is exceptional, perfect for a young family on vacation. If you are reading this and even thinking about a hotel for your Disneyworld/Florida vacation, DON'T. THIS IS THE PLACE TO STAY.</p>" +
"<p>It is centrally located, well appointed, with 4 spacious bedrooms. Two of the bedrooms designed for children on a disney adventure.</p>" +
"<p>The house comes equipped with a games room, pool, TV's and dvd's. Kids disney DVD's in the drawers! Your kids will occupy themselves while you relax by your very own pool. Amazing!</p>" +
"<p>I can't thank the owners enough for making the house available for our family trip. I can't now imagine any other way to go and it has totally spoiled us for future vacations. Forget hotels!</p>" +
"<span class='reviewer'>Gordon Samson, Vancouver, British Columbia</span>";
mickeyReviews[4] ="<p>This house was clean, furnished well, and a very close distance to Disney, groceries, and restaurants. The resort was well maintained and the people we talked to friendly and helpful. The children enjoyed the games room and the warm pool/spa. The kitchen was well stocked with enough gadgets and utensils for a large group. A good place for a family to stay.</p>" +
"<span class='reviewer'>Anonymous</span>";
mickeyReviews[5] ="<p>Thank you so much!!! Your house was beautiful and our stay was the best trip we have had in a long time!!</p>" +
"<p>Location was great!</p>" +
"<p>Furnishings were beautiful!</p>" +
"<p>The Mickey room and game room were a HUGE HIT with my son! I swear we only went to Sea World..the rest of the vacation was spent at the house. The Mickey waffle iron was seriously the highlight of our vacation! It seems like such a small thing, but it made all the difference.</p>" +
"<p>The pool was awesome...having it right there to use whenever our hearts desired was so convenient. The Mickey dishes and utensils added just the right touch. You've thought of everything...there was little reason to leave! I have shown pictures to all my friends and co-workers...their jaws drop when they look at them!! We couldn't have asked for a nicer vacation and will definitely like to make this a yearly trip </p>" +
"<span class='reviewer'></span>";
poohReviews[0] ="<p>We recently stayed at your pooh house. We had a fantastic time with friends of ours from europe. Everything was perfect!! We thoroughly enjoyed our stay and would definitely recommend your home to anyone who wants to stay near disney!! We would be very interested in staying at your homeagain. Thank You.</p>" +
"<span class='reviewer'>Denis&Angela Brennan, Wilmington NC</span>";
nemoReviews[0] ="<p>My family and I spent a week at the home in Emerald Island and we had a wonderful time. The home is very spacious in a very well kept nieghborhood. Jane was very helpful in getting everything set up and very quick to respond to questions. The next time we go to Orlando it'll probably be to move there but we would deffinately reccomend this property to anyone interested in having fun with the comforts of home. God Bless</p>" +
"<span class='reviewer'>John Kane, Phoenix, AZ</span>";
nemoReviews[1] ="<p>Jane was very helpful during the renting process. The house is very well maintained and I was pleased with the everything related to our experience staying in the house. It was amazing how close to Disney World this house is, 5 minute drive. Our kids loved the pool and us adults loved the hot tub. We had six adults and two children who stayed very comfortablity in this Nemo house. Thanks Jane for such a pleasurable experience. When we come back to Disney World we will most certainly get in touch with you!</p>" +
"<span class='reviewer'>Anonymous, Kentucky </span>";
nemoReviews[2] ="<p>We recently stayed in the NEMO house and absolutely LOVED it! It is fantastic for families or even TWO families!! The house is really nice and extremely close to all attractions! We can't wait to come visit again!</p>" +
"<span class='reviewer'>Christina, West Berlin, New Jersey </span>";
nemoReviews[3] ="<p>It was a pleasure to work with Jane. The transaction was very smooth and her prices fair. We loved the house! For families or groups you can't beat the accomodations. Everything was great. Thanks and we will return!</p>" +
"<span class='reviewer'>Dawn Lozano, Lawrenceville, GA </span>";
nemoReviews[4] ="<p>It is a pleasure working with Jane. The house is brand new and nicely decorated. We had a great time. Thanks.</p>" +
"<span class='reviewer'>Colette Le, Raleigh, NC </span>";
nemoReviews[5] ="<p>Had a very good experience dealing with Jane. Great location and beautiful home. Everything was as described; there were no surprises</p>" +
"<p>Would recommend without hesitation!</p>" +
"<span class='reviewer'></span>";
allReviews[0] ="<p>My family and I stayed in Orlando about 3 weeks ago now and loved every minute of it. The home was perfect for our family with 3 teens. Everyone had their own room, 2 of the bedrooms were cutely themed, one with Mickey the other with Winnie the pooh. My girls loved their rooms. My 19 year old son had a big bed to himself and it was perfect. There is a gameroom with pool table and fooseball and airhockey. Everyone enjoyed it. The kitchen was well appointed with everything you need all in Mickey. We cooked everyday and saved lots of money by not eating at the parks so much. The pool was private and heated with its own hot tub. We went to the parks in the morning came home at lunch to eat and swim and went back to the parks refreshed. The home was spotless and we loved every minute and would recommend it to everyone who askes us where to stay near Disney. Only a few minutes drive to all the Disney parks and about 20 mins to Seaworld and Universal. 2 minutes to the parkway with just about every restraunt you can think of, and convient to the grocery stores as well. The home is in a beautiful resort that is gated with a community pool, volleyball court, trails, game room, workout room and more. Jane was absolutely wonderful! We will definitly stay in her beautiful home again!</p>" +
"<span class='reviewer'>Debbie(Bolingbrook,Illinois)</span>";
allReviews[0] ="<p>This was a great house! It was so relaxing- Disney in the am, home for rest and swim (the pool and hot tub were perfect temp even on chilly days) disney in the pm for fireworks. The game room was nice- everything worked ( the floor was carpeted too)- this kept the kids busy while not swimming. The owner was great to work with as well. I would definitely recommend these houses.</p>" +
"<span class='reviewer'>Michelle(Live Oak, FL)</span>";
allReviews[0] ="<p>Great house , very clean owner provide great customer service .Stayed in christmas and new year for 9 days my kids have a ball in the pool, will rent this property again and recommend it to friends or relative.Thanks Jane</p>" +
"<span class='reviewer'>irona(conn.)</span>";

function getReview(reviewArray){
	var randomnumber=Math.floor(Math.random()*reviewArray.length)
	document.getElementById('review').innerHTML = reviewArray[randomnumber];

}



