$(document).ready(function() {
		
		$("#slideshowButton").click(function(){
				window.open($(this).attr('href'), 'SlideShow','left=0,top=0,toolbar=no,menubar=no,scrollbars=yes,resizable=no,width=450,height=465');
				return false;
		});
		
		$("#virtualTourButton").click(function(){
				window.open($(this).attr('href'), 'VirtualTour','left=0,top=0,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,width=450,height=465');
				return false;
		});
		
		$("#emailAlerts").click(function(){
				window.open($(this).attr('href'), 'ListingNotification','left=100,top=50,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,width=660,height=450');
				return false;
		});
		
		$("#emailAd").click(function(){
				window.open($(this).attr('href'), 'EmailFriend','left=100,top=50,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,width=410,height=380');
				return false;
		});
		
		$("#schoolReport").click(function(){
				window.open($(this).attr('href'), 'SchoolReport','left=100,top=50,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,width=660,height=550');
				return false;
		});
		
		$("#neighborhoodReport").click(function(){
				window.open($(this).attr('href'), 'NeighborhoodReport', 'left=100,top=50,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,width=660,height=550');
				return false;
		});
		
		$(".emailSeller").click(function(){
				window.open($(this).attr('href'), 'ContactSeller','left=100,top=50,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,width=425,height=485');
				return false;
		});
		
		$("#printListing").click(function(){
				window.open($(this).attr('href'), 'PrintFlyer','left=100,top=50,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,width=670,height=720');
				return false;
		});
		
		$("#PhotoToggle").click(function(){
			 $('#actionBar .active').removeClass('active');
			 $(this).parent().addClass('active');
			 
			 $('#videoPlayer').removeClass('show');
			 $('#homeImg').removeClass('hide');
			 $('#swapPrev').toggleClass('disabled');
			 $('#swapPrev').html('<a href="javascript:swapPrev()">Previous</a>');
			 $('#swapNext').toggleClass('disabled');
			 $('#swapNext').html('<a href="javascript:swapNext()">Next</a>');
	 });
	 
	 
	 $("#VideoToggle").click(function(){
			 $('#actionBar .active').removeClass('active');
			 $(this).parent().addClass('active');
			 
			 $('#videoPlayer').addClass('show');
			 $('#homeImg').addClass('hide');
			 $('#swapPrev').toggleClass('disabled');
			 $('#swapPrev').html('Previous');
			 $('#swapNext').toggleClass('disabled');
			 $('#swapNext').html('Next');
			 return false;
	 });
		
		
		
		
});


//Function added to check if video is open and if so hide it when lightbox is triggered
//TODO:  MOVE TO JQUERY
function HideVideoForLightBox(){
	 var videoHandler = document.getElementById('videoPlayer');
	 if(videoHandler){
    if(videoHandler.style.display=='none'){
      return false;
    } else {
			var videoHandler = document.getElementById('videoPlayer');
			videoHandler.style.display='none';
		}
	}
}

