

$(document).ready(function() {
	$('#videoContainer').hide();													 
	$('#morecomments').hide();
	
	$('#videoContainer').click(function() {
		$(this).hide();				
		$('#videoPlayer').empty();
	});

	$('#morecommentsbtn').click(function(e) {
		$('#morecomments').toggle();
		e.preventDefault();
	});
	
	$('#emailAFriendBtn').click(function(e) 
		 {
			 window.open(this.href, 'sendAFriend', 'width=500,height=500');
			 e.preventDefault();
		 });

	$('#becomeAFan').submit(function(e) 	{
		e.preventDefault();
		 var dataString = $('#becomeAFan').serialize();  
		 //alert (dataString);return false;  
		 $.ajax({  
			 type: "POST",  
			 url: "/becomeafan.php",  
			 data: dataString,  
			 success: function(msg) {  
			 	alert(msg);
			 }  
		 });  												 
		});

	
	
	// minicalendar  update
	$('a.calArw').live('click', function(e) {
		e.preventDefault();
		var t = this.href.split('?', 2);
		var theurl = '/calendarDetails.php?' + t[1];
		$('#calendarWrap').load(theurl,function() {
			$('.dayEventItem img').css({opacity:.85});
		});
	});

	$('.dayEventItem img').css({opacity:.85});
	
	$('a.showDay').live('click', function(e) {
			e.preventDefault();
			if($('#' + this.rel + ':visible').length) {
				$('#' + this.rel).slideUp(500);	
			} else {
				$('.dayEvents:visible').slideUp(500);													
				$('#' + this.rel).slideDown(500);
			}
		});
	
	
	$('.dayEventItem').live('mousemove',function(){ $('img',this).stop(true,true).animate({opacity:.99},150); });
	$('.dayEventItem').live('mouseout',function(){ $('img',this).stop(true,true).animate({opacity:.85},200); });
	
	// New Video Features using eScreen
	$('.video_vimeo').each(function(){
		var rel = $(this).attr('rel');
		$(this).click(function(e) {e.preventDefault(); $(this).eScreen({html:'<iframe src="http://player.vimeo.com/video/'+rel+'?title=0&amp;byline=0&amp;portrait=0&amp;autoplay=1" width="800" height="450" frameborder="0"></iframe>'})});
	});
	
	$('.video_youtube').each(function(e){
		var rel = $(this).attr('rel');
		$(this).click(function(e) {e.preventDefault(); $(this).eScreen({html:'<iframe src="http://www.youtube.com/embed/'+rel+'?autoplay=1" width="800" height="450" frameborder="0" allowfullscreen></iframe>'})});
	});
	

	}
);													

function showVideo(fn) 
{ 
		$('#videoPlayer').empty();
		$('#videoContainer').show();		
		//videoFile: 'http://localhost/' + fn
		var flashvars = {
			videoFile: fn
			};
		
		swfobject.embedSWF("/flash/peaceVideo.swf", "videoPlayer", "640", "500", "10.0.0", "/flash/expressInstall.swf", flashvars);
} 
