	jQuery(document).ready(function(){
		
		if(jQuery.browser.msie == true){
			jQuery('#video-overlay-background').css('height', jQuery(document).height());
			jQuery('#virtual-tour-overlay-background').css('height', jQuery(document).height());
		}
		
		jQuery('#video-overlay-container .body .link a').click(function(){
			jQuery('#video-overlay-background').css('display','none');
			jQuery('#video-overlay-container').css('display','none');
			
			if(!jQuery.browser.mozilla){
				jQuery('#video-overlay-container .body .video .video-player').html('');
			}
			
			return false;
		});
		
		jQuery('#overview-video-callout a').click(function(){
		
			var height = jQuery(window).height();
			var marginTop = Math.round((height - 405) / 2);
			
			if(marginTop > 0){
				jQuery('#video-overlay-container .body').css('margin-top', marginTop+'px');
			}

			var html = '<iframe src="_loadFlash.php" name="flashFrame" id="flashFrame" style="padding: 0px; width: 530px; height: 405px; border: 0px;" frameborder="0"></iframe>';
			
			jQuery('#video-overlay-background').css('display','block');
			jQuery('#video-overlay-container').css('display','block');
			
			if(!jQuery.browser.mozilla){
				jQuery('#video-overlay-container .body .video .video-player').html(html);
			}
			
			return false;
		});
		
		
		jQuery('#virtual-tour-overlay .body .link a').click(function(){
			jQuery('#virtual-tour-overlay-background').css('display','none');
			jQuery('#virtual-tour-overlay').css('display','none');
			
			return false;
		});
		
		jQuery('#show-tour').click(function(){
		
			var height = jQuery(window).height();
			var marginTopTour = Math.round((height - 650) / 2);
			
			if(height < 660){
				jQuery('#virtual-tour-overlay-background').css('position','absolute');
				jQuery('#virtual-tour-overlay').css('position','absolute');
				jQuery('#virtual-tour-overlay-background').css('height', jQuery(document).height());
			}
			else{
				jQuery('#virtual-tour-overlay-background').css('position','fixed');
				jQuery('#virtual-tour-overlay').css('position','fixed');
				jQuery('#virtual-tour-overlay-background').css('height', '100%');
			}
		
			if(marginTopTour > 0){
				jQuery('#virtual-tour-overlay .body').css('margin-top', marginTopTour+'px');
			}
			
			jQuery('#virtual-tour-overlay-background').css('display','block');
			jQuery('#virtual-tour-overlay').css('display','block');
			
			return false;
		});
		
	});