
	$(document).ready(function() {
		$('.hotel_video').css('background-image','url(https://www.orlandovacation.com/hotelphotos/VideoThumbnail1.png)');
		
		$('.hotel_video').hover(
			function() {
				$(this).css('background-image','url(https://www.orlandovacation.com/hotelphotos/VideoThumbnail2.png)');
			},
			function() {
				$(this).css('background-image','url(https://www.orlandovacation.com/hotelphotos/VideoThumbnail1.png)');
			}
		);
		
		
		
		$('a.hotel_video img').attr('src','https://www.orlandovacation.com/hotelphotos/VideoThumbnail1.png');
		
		
		$('a.hotel_video img').hover(
			function() {
				$(this).attr('src','https://www.orlandovacation.com/hotelphotos/VideoThumbnail2.png');
			},
			function() {
				$(this).attr('src','https://www.orlandovacation.com/hotelphotos/VideoThumbnail1.png');
			}
		);
		
		
		  pic1= new Image(196,145); 
		  pic1.src="https://www.orlandovacation.com/hotelphotos/VideoThumbnail1.png"; 
		  
		  pic2= new Image(196,145); 
		  pic2.src="https://www.orlandovacation.com/hotelphotos/VideoThumbnail2.png"; 

	});
	
	function load_after_video(hotel_id) {
		
		$.ajax({
			url: "home_inc/ajax.php?cmd=load_after_video_finishes",
			data: {hotel_id:hotel_id},
			type: "POST",
			cache:false,
			dataType: "xml",
			error: function() {
				
			},
			success: function(xml) {
				txt = "Thank you for viewing our video.<p>";
				txt += "<a href='http://www.orlandovacation.com/reservation/affiliates/orlandovacation/hotel_results.cfm'>Click here</a> to continue to our reservation system<p>";
				txt += "View other related videos below<p>";
				
				$(xml).find('RelatedVideo').each(function() {
					txt += "<a href='#' onclick=\"$.prompt.close();view_video('"+$(this).find('Filename').text()+"', true, "+$(this).find('HotelID').text()+")\">"+$(this).find('HotelName').text()+"</a><br>";
				});
				
				$.prompt(txt,{buttons: {Close: true}});
			}
		});

	}

	function view_video(video_file, show_after_screen, hotelid) {
		// video_file (required) - physical filename of the video
		// show_after_screen (optional) -- shows similar videos after the main video has ended
		// hotelid (normally optional - but required if show_after_screen is set to yes)

		player_holder = "<div class='modal_videos' id='player_modal' style='display:none'>";
		player_holder += "<div class='video_player_close' onclick='hidevideo()'><img src='https://www.orlandovacation.com/hotelphotos/close.png' alt='Close' title='Close'></div>";
		player_holder += "<div class='video_player_object' id='video_player_object'>";
		player_holder += "</div></div>";
		//document.write(player_holder);
		$('body').append(player_holder);

		$('#video_player_object').attr('href','https://www.orlandovacation.com//hotelphotos/'+video_file);
		flowplayer("video_player_object", "https://www.orlandovacation.com/hotelphotos/flowplayer/flowplayer-3.1.5.swf", {
		    onFinish: function() {
		    		if(show_after_screen) {
		    			$("#player_modal").overlay().close();
		    			load_after_video(hotelid);
		    		}
		    },
		    onPause: function() {
		    		/*
		    		if(show_after_screen) {
		    			$("#player_modal").overlay().close();
		    			load_after_video(hotelid);
		    		}
		    		*/
		    }
		});

		$("#player_modal").overlay({
		    expose: { 
		        color: '#333', 
		        loadSpeed: 200, 
		        opacity: 0.9 
		    }, 
		    api:true,
		    top:75,
		    onClose: function() {
				//flowplayer().pause();
				$('#video_player_object').html("");
				$('#player_modal').remove();
			}
		}).load();
	}
	
	function hidevideo() {
		$('#player_modal').overlay().close();
	}

