var currentHeart=5;
var docHeight=0;
var cast='up';
var creative='up';
var band='up';
var alumni='up';
var contactStatus='down';
var currentCast='';
var isIE = false;
$(document).ready(function() {

	$("#tagbutton").click(function(){
		$("#tagbutton").hide();
		$("#addtag").show();
		$("#taginfo").hide();
	});
	
	$("#closetag").click(function(){
		$("#tagbutton").show();
		$("#addtag").hide();
	});
	
	$(".tag").click(function(){
		if($("#taginfo").css("display") != "block"){
			var pos = $(this).position();
			if(!isIE){
				$("#taginfo").css({top: (pos.top+88) + "px", left: (pos.left + 147) + "px"});
			} else {
				$("#taginfo").css({top: (pos.top+87) + "px", left: (pos.left + 345) + "px"});
			}
			$("#taginfo #remove_link").attr({href: "/curtain_call/remove/" + $(this).attr("lang")});
			$("#taginfo #fb_link").attr({href: $(this).attr("name")});
			$("#taginfo #timestamp").text($(this).attr("id"));
			$("#taginfo").show();
		} else {
			$("#taginfo").hide();
		}
	});
	
	//header
	$("#navigation li").hover(	
		function() { $(this).removeClass("inactive").addClass("active"); },
		function() { $(this).removeClass("active").addClass("inactive"); }
	);
	//footer
	$("#footerLinks li").hover(	
		function() { $(this).removeClass("inactive").addClass("active"); },
		function() { $(this).removeClass("active").addClass("inactive"); }
	);
	//media
	$("#mediaNavigation li").hover(	
		function() { $(this).removeClass("inactive").addClass("active"); },
		function() { $(this).removeClass("active").addClass("inactive"); }
	);
	//news
	$("#newsNav li").hover(	
		function() { $(this).removeClass("inactive").addClass("active"); },
		function() { $(this).removeClass("active").addClass("inactive"); }
	);
	//Giving Garden
	$("#flowers li").hover(	
		function() {$("#flowers .active").removeClass("active");  $(this).removeClass("inactive").addClass("active"); },
		function() { }
	);
	
	$("#contactSubmitButton").click(
		function(){
			var contactName = $("#formName").val();
			var contactEmail = $("#formEmail").val();
			var contactComment = $("#formComment").val();
			if (is_valid_email(contactEmail)&&contactName!=''&&contactComment!='')
			{
				$.ajax({
				   type: "POST",
				   url: "/sendEmail.php",
				   data: "name="+contactName+"&email="+contactEmail+"&message="+contactComment,
				   success: function(msg){
				 		if (msg=='no')
							alert('message did not send please try again later.');
						else
						{
							$("#contactForm").html('<br/><center><img src="/img/messageSent.jpg"/></center>');
							setTimeout("popContact()",1000);
						}
				   }
			 	});
			}
			else
				alert('Please enter a name, comment and valid email address')
			
		}
	);
	
	$("#audienceSubmitButton").click(
		function(){
			var reviewName = $("#reviewName").val();
			var reviewEmail = $("#reviewEmail").val();
			var reviewTitle = $("#reviewTitle").val();
			var review = $("#review").val();
			var reviewRating = $("#rating").val();
			if (is_valid_email(reviewEmail)&&reviewName!=''&&reviewTitle!=''&&review!='')
			{
				$.ajax({
				   type: "POST",
				   url: "/postReview.php",
				   data: "name="+reviewName+"&email="+reviewEmail+"&title="+reviewTitle+"&review="+review+"&reviewRating="+reviewRating,
				   success: function(msg){
				 		if (msg!='yes')
							alert('Review could not be submitted at this time, please try again later');
						else
						{
							$("#audienceContainer").html('<br/><br/><br/><br/><br/><br/><br/><center>Your review has been submitted.<br/>Please check back later to see it posted here.</center>')
						}
				   }
			 	});
				
				if ($("#newsletterCheckBox").is(':checked')){
					$.ajax({
						type: "POST",
						url: "/land/addNewsletter.php",
						data: {
							account_id: "287",
							email: reviewEmail
						},
						success: function(response) {
						},
						error: function(r, t, e) {
						}
					});
				}
			}
			else
				alert('Please enter a name, valid email address, review title, and review')
			
		}
	);	
	//heart count for audience form
	$("#oneHeart").hover(	
		function() { setHeart(1); },
		function() { setHeart(currentHeart); }
	);
	$("#twoHeart").hover(	
		function() { setHeart(2); },
		function() { setHeart(currentHeart); }
	);
	$("#threeHeart").hover(	
		function() { setHeart(3); },
		function() { setHeart(currentHeart); }
	);
	$("#fourHeart").hover(	
		function() { setHeart(4); },
		function() { setHeart(currentHeart); }
	);
	$("#fiveHeart").hover(	
		function() { setHeart(5); },
		function() { setHeart(currentHeart); }
	);
	$("#oneHeart").click(	
		function() { setRating(1); }
	);
	$("#twoHeart").click(	
		function() { setRating(2); }
	);
	$("#threeHeart").click(	
		function() { setRating(3); }
	);
	$("#fourHeart").click(	
		function() { setRating(4); }
	);
	$("#fiveHeart").click(	
		function() { setRating(5); }
	);
	
	//tribe
	$("#castMembers .castMember").unbind('click').click(
		function() {
			$("#castMembers .selected").removeClass("selected"); 
			$("#creativeMembers .selected").removeClass("selected");
			$("#bandMembers .selected").removeClass("selected");
			$("#alumniMembers .selected").removeClass("selected");
			$(this).children("img").addClass("selected");
			currentCast=this.id;
			replaceVid(currentCast);
		}
	);
	$("#creativeMembers .castMember").unbind('click').click(
		function() {
			$("#castMembers .selected").removeClass("selected"); 
			$("#creativeMembers .selected").removeClass("selected");
			$("#bandMembers .selected").removeClass("selected");
			$("#alumniMembers .selected").removeClass("selected");
			$(this).children("img").addClass("selected");
			currentCast=this.id;
			replaceVid(currentCast);
		}
	);
	$("#bandMembers .castMember").unbind('click').click(
		function() {
			$("#castMembers .selected").removeClass("selected"); 
			$("#creativeMembers .selected").removeClass("selected");
			$("#bandMembers .selected").removeClass("selected");
			$(this).children("img").addClass("selected");
			currentCast=this.id;
			replaceVid(currentCast);
		}
	);
	$("#alumniMembers .castMember").unbind('click').click(
		function() {
			$("#castMembers .selected").removeClass("selected"); 
			$("#creativeMembers .selected").removeClass("selected");
			$("#bandMembers .selected").removeClass("selected");
			$("#alumniMembers .selected").removeClass("selected");
			$(this).children("img").addClass("selected");
			currentCast=this.id;
			replaceVid(currentCast);
		}
	);
	$("#castHeader").unbind('click').click(
		function(){
			openCast();
			setContactTop();
		}
	);
	$("#creativeHeader").unbind('click').click(
		function(){
			openCreative();
			setContactTop();
		}
	);
	$("#bandHeader").unbind('click').click(
		function(){
			openBand();
			setContactTop();
		}
	);
	$("#alumniHeader").unbind('click').click(
		function(){
			openAlumni();
			setContactTop();
		}
	);
	//cast blog
	$("#blogEntries .blogEntry").unbind('click').click(
		function() {
			$("#blogEntries .selected").removeClass("selected"); 
			$(this).children("img").addClass("selected");
			blogID=this.id;
			replaceBlog(blogID);
		}
	);
	//Giving Garden
	$("#white-flower").hover(
		function(){	changeContent(1); },
		function(){}
	);
	$("#yellow-flower").hover(
		function(){	changeContent(2); },
		function(){}
	);
	$("#purple-flower").hover(
		function(){	changeContent(3); },
		function(){}
	);
	$("#orange-flower").hover(
		function(){	changeContent(4); },
		function(){}
	);
	$("#pink-flower").hover(
		function(){	changeContent(5); },
		function(){}
	);
});

function is_valid_email (email)
   {
   	return /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(email);
   }
function dropFooter()
{}
//-------************--------------------
//PRIVACY POLICY POP UP
//-------************--------------------
function popitup(url,w,h) {
	newwindow=window.open(url,'name','height=395,width=660,scrollbars=yes,toolbar=no');
}

//-------************--------------------
//CAST PAGE
//-------************--------------------
function replaceVid(name)
{
	if (name=='ragni')
	{
		swfobject.embedSWF("/flash/ragni_bio.swf", "videoPlayer", "361", "253", "9.0.0","expressInstall.swf", flashvars, params, attributes);
		$("#actorDesc").html('Born and raised in Pittsburgh, PA, from a large family of five sisters and three brothers. After a stint in the Air Force, as a young actor, he won the Barter Theater Award. He appeared on Broadway in the John Gielgud/Richard Burton Hamlet, starred in The Knack Off-Broadway, studied acting and new experimental theatre techniques with Nola Chilton and Joseph Chaikin and the Open Theater. An unusual stage presence, he created the role of Berger in Hair. Movie: Lions Love. Wrote the Broadway show Dude with music by Galt MacDermot. Co-authored the yet-to-be-seen Sun. He was a prolific writer, the originator of "napkin art," a most interesting painter and a body sculptor. His son, Erick, is an innovative architect.<br/><br/>');
	}
	else
	{
		flashvars.flvPath = "http://s3.amazonaws.com/media.hair/cast/"+name+".flv";
		flashvars.imagePath = "/flash/pageHeadersFiles/"+name+".jpg";
		swfobject.embedSWF("/flash/cast_video_player_v01.swf", "videoPlayer", "361", "253", "9.0.0","expressInstall.swf", flashvars, params, attributes);
		$("#actorDesc").html($("#"+name+" .role").html());
	}
	Tracker.track('/cast/video/'+name);
	$("#actorName").html($("#"+name+" .first").html()+"<br/>"+$("#"+name+" .last").html());
	$('body').animate({scrollTop:0}, 350);
    $('html').animate({scrollTop:0}, 350);
    $('html, body').animate({scrollTop:0}, 350);
}
function nextCast()
{
	$currentDiv	= $(".castMember .selected").removeClass("selected").parent();
	$next	= $currentDiv.next();
	
	if($next.length) {
		$next.children("img").addClass("selected");
		replaceVid($next.attr('id'));
	} 
	else {
		if ($currentDiv.parent().next().next().length)
		{
			$currentDiv.parent().next().next().children("div:first-child").children("img").addClass("selected");
			replaceVid($currentDiv.parent().next().next().children("div:first-child").attr('id'));
			if ($currentDiv.parent().next().next().attr('id')=='bandMembers')
			{
				openBand();
				closeCreative();
				closeCast();
				closeAlumni();
			}
			
			if ($currentDiv.parent().next().next().attr('id')=='alumniMembers')
			{
				openAlumni();
				closeCreative();
				closeCast();
				closeBand();
			}
			
			if ($currentDiv.parent().next().next().attr('id')=='creativeMembers')
			{
				closeBand();
				openCreative();
				closeCast();
				closeAlumni();
			}
		}
		else
		{
			$("#castSection").children("div:first-child").next().children("div:first-child").children("img").addClass("selected");
			replaceVid($("#castSection").children("div:first-child").next().children("div:first-child").attr('id'));
			closeBand();
			closeCreative();
			closeAlumni();
			openCast();
		}
	}
}
function prevCast()
{	
	$currentDiv	= $(".castMember .selected").removeClass("selected").parent();
	$prev	= $currentDiv.prev();
	
	if($prev.length) {
		$prev.children("img").addClass("selected");
		replaceVid($prev.attr('id'));
	} 
	else {
		if ($currentDiv.parent().prev().prev().length)
		{
			$currentDiv.parent().prev().prev().children("div:last-child").children("img").addClass("selected");
			replaceVid($currentDiv.parent().prev().prev().children("div:last-child").attr('id'));
			
			
			if ($currentDiv.parent().prev().prev().attr('id')=='castMembers')
			{
				closeBand();
				closeCreative();
				openCast();
			}
			
			if ($currentDiv.parent().prev().prev().attr('id')=='creativeMembers')
			{
				closeBand();
				openCreative();
				closeCast();
			}
			
		}
		else
		{
			$("#castSection").children("div:last-child").children("div:last-child").children("img").addClass("selected");
			replaceVid($("#castSection").children("div:last-child").children("div:last-child").attr('id'));
			closeCreative();
			closeCast();
			openBand();
		}
	}	
}
function chooseRandom()
{
	var castMemberCount=$('#castMembers').children().size();
	var randomNumber=Math.floor(Math.random()*castMemberCount);
	$currentCast=$('#castMembers').children("div:first-child");
	for (var i=0; i<randomNumber; i++)
	{
		$currentCast = $currentCast.next();
	}
	$currentCast.children("img").addClass("selected");
	replaceVid($currentCast.attr('id'));
}
function openCast()
{
		if (cast=='up')
		{
			var castMembersSize=$('#castMembers').children().size();
			castMembersSize = castMembersSize / 5;
			castMembersSize = Math.ceil(castMembersSize);
			castMembersSize = castMembersSize * 152;
			castMembersSize = castMembersSize + 'px';
			$("#castArrow").html('<img src="/img/arrow_down.png" width="11" height="11" alt="Arrow">');
			$("#castMembers").animate({height:castMembersSize},1500);
			cast='down';
		}
		else
		{
			closeCast();
		}
			setContactTop();
}
function closeCast()
{
		$("#castArrow").html('<img src="/img/arrow.png" width="11" height="11" alt="Arrow">');
		$("#castMembers").animate({height:'0'},1500);
		cast='up';
}
function openCreative()
{
	if (creative=='up')
	{
		
		var creativeMembersSize=$('#creativeMembers').children().size();
		creativeMembersSize = creativeMembersSize / 5;
		creativeMembersSize = Math.ceil(creativeMembersSize);
		creativeMembersSize = creativeMembersSize * 152;
		creativeMembersSize = creativeMembersSize + 'px';
		$("#creativeArrow").html('<img src="/img/arrow_down.png" width="11" height="11" alt="Arrow">');
		$("#creativeMembers").animate({height:creativeMembersSize},1500);
		creative='down';
	}
	else
	{
		closeCreative();
	}
}
function closeCreative()
{
		$("#creativeArrow").html('<img src="/img/arrow.png" width="11" height="11" alt="Arrow">');
		$("#creativeMembers").animate({height:'0'},1500);
		creative='up';
}
function openBand()
{
	if (band=='up')
	{
		
		var bandMembersSize=$('#bandMembers').children().size();
		bandMembersSize = bandMembersSize / 5;
		bandMembersSize = Math.ceil(bandMembersSize);
		bandMembersSize = bandMembersSize * 152;
		bandMembersSize = bandMembersSize + 'px';
		$("#bandArrow").html('<img src="/img/arrow_down.png" width="11" height="11" alt="Arrow">');
		$("#bandMembers").animate({height:bandMembersSize},1500);
		band='down';
	}
	else
	{
		closeBand();
	}
}
function closeBand()
{
		$("#bandArrow").html('<img src="/img/arrow.png" width="11" height="11" alt="Arrow">');
		$("#bandMembers").animate({height:'0'},1500);
		band='up';
}

function openAlumni()
{
	if (alumni=='up')
	{
		var alumniMembersSize=$('#alumniMembers').children().size();
		alumniMembersSize = alumniMembersSize / 5;
		alumniMembersSize = Math.ceil(alumniMembersSize);
		alumniMembersSize = alumniMembersSize * 152;
		alumniMembersSize = alumniMembersSize + 'px';
		$("#alumniArrow").html('<img src="/img/arrow_down.png" width="11" height="11" alt="Arrow">');
		$("#alumniMembers").animate({height:alumniMembersSize},1500);
		alumni='down';
	}
	else
	{
		closeAlumni();
	}
}
function closeAlumni()
{
		$("#alumniArrow").html('<img src="/img/arrow.png" width="11" height="11" alt="Arrow">');
		$("#alumniMembers").animate({height:'0'},1500);
		alumni='up';
}
//-------************--------------------
//CAST BLOG PAGE
//-------************--------------------
function nextBlog()
{
	$next	= $(".blogEntry .selected").removeClass("selected").parent().next();
	if($next.length) {
		$next.children("img").addClass("selected");
		replaceBlog($next.attr('id'));
	} 
	else {
		$(".blogEntry:first-child").children("img").addClass("selected");
		replaceBlog($(".blogEntry:first-child").attr('id'));
	}
}
function prevBlog()
{
	$prev	= $(".blogEntry .selected").removeClass("selected").parent().prev();
	
	
	if($prev.length) {
		$prev.children("img").addClass("selected");
		replaceBlog($prev.attr('id'));
	} 
	else {
		$(".blogEntry:last-child").children("img").addClass("selected");
		replaceBlog($(".blogEntry:last-child").attr('id'));
	}
}
function replaceBlog(name)
{
	
	flashvars.flvPath = "http://s3.amazonaws.com/media.hair/blogs/"+name+".flv";
	flashvars.imagePath = "/flash/blog/frame/"+name+".jpg";
	swfobject.embedSWF("/flash/cast_blog_player_v01.swf", "vidplayer", "470", "302", "9.0.0","expressInstall.swf", flashvars, params, attributes);
	Tracker.track('/blog/video/'+name);
	
	$("#blogDesc").html(descriptions[name]);
	$("#blogName").html($("#"+name+" .entryName").html());
	$('body').animate({scrollTop:0}, 350);
    $('html').animate({scrollTop:0}, 350);
    $('html, body').animate({scrollTop:0}, 350);
}

//-------************--------------------
//MEDIA PAGE
//-------************--------------------
function showVideo()
{
	$("#musicplayer").html('');
	$("#mediaNavigation .selected").removeClass("selected");
	$("#video-tab").addClass("selected");
	$("#video").css({ visibility:'visible' });
	$("#music").css({ visibility:'hidden' });
	$("#photos").css({ visibility:'hidden' });
	$("#video").css({ display:'block' });
	$("#music").css({ display:'none' });
	$("#photos").css({ display:'none' });
	$("#video").css({ height:'302px' });
	$("#music").css({ height:'0' });
	$("#photos").css({ height:'0' });
	$("#videoFooter").css({ display:'block' });
	$("#musicFooter").css({ display:'none' });
	$("#photosFooter").css({ display:'none' });
	var flashvars = {};
	var params = {};
	var attributes = {};
	params.wmode = "transparent";
	swfobject.embedSWF("/flash/IMU_video.swf", "video", "631", "302", "9.0.0", "/flash/expressInstall.swf", flashvars, params, attributes);
	setContactTop();
}
function showMusic()
{
var flashvars = {};
var params = {};
var attributes = {};
params.wmode = "transparent";
swfobject.embedSWF("/flash/IMU_video.swf", "video", "631", "302", "9.0.0", "/flash/expressInstall.swf", flashvars, params, attributes);
swfobject.embedSWF("/flash/hair_mp3Player_v6.swf", "musicplayer", "631", "302", "9.0.0", "/flash/expressInstall.swf");



	$("#mediaNavigation .selected").removeClass("selected");
	$("#music-tab").addClass("selected");
	$("#video").css({ visibility:'hidden' });
	$("#music").css({ visibility:'visible' });
	$("#photos").css({ visibility:'hidden' });
	$("#video").css({ display:'none' });
	$("#music").css({ display:'block' });
	$("#photos").css({ display:'none' });
	$("#video").css({ height:'0' });
	$("#music").css({ height:'375px' });
	$("#photos").css({ height:'0' });
	$("#videoFooter").css({ display:'none' });
	$("#musicFooter").css({ display:'block' });
	$("#photosFooter").css({ display:'none' });
/*	swfobject.embedSWF("/flash/hair_mp3Player_v6.swf", "music", "631", "302", "9.0.0", "/flash/expressInstall.swf"); */
	setContactTop();
}
function showPhotos()
{
	$("#mediaNavigation .selected").removeClass("selected");
	$("#photos-tab").addClass("selected");
	$("#video").css({ display:'none' });
	$("#music").css({ display:'none' });
	$("#photos").css({ display:'block' });
	$("#videoFooter").css({ display:'none' });
	$("#musicFooter").css({ display:'none' });
	$("#photosFooter").css({ display:'block' });
	setContactTop();
}


//-------************--------------------
//NEWS AND REVIEWS PAGE
//-------************--------------------
function showNews()
{
	$("#newsNav .selected").removeClass("selected");
	$("#news-tab").addClass("selected");
	$("#newsSection").css({ display:'block' });
	$("#audience").css({ display:'none' });
	$("#critics").css({ display:'none' });
	setContactTop();
}
function showAudience()
{
	$("#newsNav .selected").removeClass("selected");
	$("#audience-tab").addClass("selected");
	$("#newsSection").css({ display:'none' });
	$("#audience").css({ display:'block' });
	$("#critics").css({ display:'none' });
	$("#gradBG").css({width:'0'});
	$("#gradBG").animate({width:"295px"},3000);
	setContactTop();
}
function showCritics()
{
	$("#newsNav .selected").removeClass("selected");
	$("#critics-tab").addClass("selected");
	$("#newsSection").css({ display:'none' });
	$("#audience").css({ display:'none' });
	$("#critics").css({ display:'block' });
	setContactTop();
}
function showMoreNews()
{
	$("#moreNews").css({ display:'block' });
	$("#newsReadMore").html("<a href=\"javascript:showLessNews()\">View Less</a>");
	setContactTop();
}
function showLessNews()
{
	$("#moreNews").css({ display:'none' });
	$("#newsReadMore").html("<a href=\"javascript:showMoreNews()\">View More</a>");
	setContactTop();
}
function showMoreAudience()
{
	$("#moreAudience").css({ display:'block' });
	$("#audienceReadMore").html("<a href=\"javascript:showLessAudience()\">View Less</a>");
	setContactTop();
}
function showLessAudience()
{
	$("#moreAudience").css({ display:'none' });
	$("#audienceReadMore").html("<a href=\"javascript:showMoreAudience()\">View More</a>");
	setContactTop();
}
function showMoreCritics()
{
	$("#moreCritics").css({ display:'block' });
	$("#criticsReadMore").html("<a href=\"javascript:showLessCritics()\">View Less</a>");
	setContactTop();
}
function showLessCritics()
{
	$("#moreCritics").css({ display:'none' });
	$("#criticsReadMore").html("<a href=\"javascript:showMoreCritics()\">View More</a>");
	setContactTop();
}
function showPopOver()
{
	$("#popOver").css({ display:'block' });
	currentHeart=5;
	$("#formGradBG").css({width:'0'});
	$("#formGradBG").animate({width:'175'},2000);
}
function closePopOver()
{
	$("#popOver").css({ display:'none' });
}
function showPopLotto()
{
	$("#popLotto").css({ display:'block' });
}
function closePopLotto()
{
	$("#popLotto").css({ display:'none' });
}

function setHeart(heartNum)
{
	heartNum = heartNum * 35;
	//$("#formGradBG").animate({width:heartNum},200)
	$("#formGradBG").css({width:heartNum});
}
function setRating(heartNum)
{
	currentHeart=heartNum;
	$("#rating").val(heartNum);
}
function popContact()
{
	setContactTop();
	if (contactStatus=='down')
	{
		$("#footerPop").css({display:'block'});
		$("#contactForm").animate({top:'0'},750);
		contactStatus='up';
	}
	else
	{
		$("#contactForm").animate({top:'273px'},750);
		contactStatus='down';
		setTimeout("$('#footerPop').css({display:'none'})",750);
			
	}
}
function popContactHome()
{
	$("#footerPop").css({top:"495px"});
	if (contactStatus=='down')
	{
		$("#footerPop").css({display:'block'});
		$("#contactForm").animate({top:'0'},750);
		contactStatus='up';
	}
	else
	{
		$("#contactForm").animate({top:'273px'},750);
		contactStatus='down';
		setTimeout("$('#footerPop').css({display:'none'})",750);
			
	}
}
function setContactTop(){
	docHeight=$(document).height()-311;
	docHeight=docHeight + 'px';
	$("#footerPop").css({top:docHeight});
}
//-------************--------------------
//NEWSLETTER FUNCTIONS
//-------************--------------------
function postNewsletter() {
	var html = $("#newsletter").html();
	
	e	= $("#newsletter .email").val();
	if(!e || !e.match(/^[\w\.+-]+@[\w\.+-]+\.[\w\.+-]+$/)) {
		alert("You must enter a valid email address.");
		return;
	}

	$("#newsletter").fadeTo(300, 0.0, function() {
		$(this).html('<div id="newsletterText">Please wait...</div>');
		$(this).fadeTo(300, 1.0);
	});
	
	$.ajax({
		type: "POST",
		url: "/land/addNewsletter.php",
		data: {
			account_id: "287",
			email: e
		},
		success: function(response) {
			//if(/error/.test(response)) { alert(response); }
			$("#newsletter").fadeTo(300, 0.0, function() {
				$(this).html('<div id="newsletterText">You have been added to the newsletter</div>');
				$(this).fadeTo(300, 1.0);
			});
		},
		error: function(r, t, e) {
			$("#newsletter").fadeTo(300, 0.0, function() {
				$(this).html(html);
				$(this).fadeTo(300, 1.0);
			});
		}
	});
}
function focus() {
	if(!$("#newsletter .email").val() == "Enter Your Email Here") {
		$("#newsletter .email").val("");
	}
}
function blur() {
	if(!$("#newsletter .email").val().replace(/[\s]/, '')) {
		$("#newsletter .email").val("Enter Your Email Here");
	}
}
//-------************--------------------
//SPREAD THE LOVE FUNCTIONS
//-------************--------------------

function tracksong(id)
{
	$.ajax({
	   type: "POST",
	   url: "/media_count.php",
	   data: "media_id="+id,
	   success: function(msg){
	 		if (msg=='no')
				alert('NO');
			else
			{
				alert('YES');
			}
	   }
 	});
}

//-------************--------------------
//GIVING GARDEN FUNCTIONS
//-------************--------------------
var gardenPages = new Array();
gardenPages[1]='<img src="/img/giving_garden_slices/CityHarvWeb.JPG" alt="Gg CH">Now serving New York City for more than 25 years, <strong>City Harvest</strong> is the world\'s first food rescue organization, dedicated to feeding the city\'s hungry men, women, and children. This year, City Harvest will collect over 25 million pounds of excess food from all segments of the food industry, including restaurants, grocers, corporate cafeterias, manufacturers, and farms. This food is then delivered free of charge to nearly 600 community food programs throughout New York City using a fleet of trucks and bikes as well as volunteers on foot. Each week, City Harvest helps over 260,000 hungry New Yorkers find their next meal. City Harvest also addresses hunger\'s underlying causes by supporting affordable access to nutritious food in low-income communities, educating individuals, families, and communities in the prevention of diet-related diseases, channeling a greater amount of local farm food into high-need areas, and enhancing the ability of our agency partners to feed hungry men, women, and children.<br/><br/><a href="giveredir.php?url=http://www.broadwayoffers.com/go.aspx?MD=2001%26MC=GIVEFUL%26PID=7119%26AID=GIV000000437" target="_blank"><img src="/img/charity_button.gif" width="621" height="34" alt="Charity Button"></a>';
gardenPages[2]='<img src="/img/giving_garden_slices/RedCrossNY.jpg" alt="Gg Red Cross"><strong>The American Red Cross</strong> in Greater New York is a nonprofit humanitarian organization, led by volunteers, that provides relief to individuals affected by disasters, and helps people prevent, prepare for, and respond to emergencies. It accomplishes this mission through services that are consistent with its Congressional Charter and the Fundamental Principles of the International Red Cross movement.<br/><br/><a href="giveredir.php?url=http://www.broadwayoffers.com/go.aspx?MD=2001%26MC=GIVEFUL%26PID=7119%26AID=GIV000000500" target="_blank"><img src="/img/charity_button.gif" width="621" height="34" alt="Charity Button"></a>';
gardenPages[3]='<img src="/img/giving_garden_slices/gg_bway_cares.gif" width="91" height="221" alt="Gg Bway Cares"><strong>BROADWAY CARES/EQUITY FIGHTS AIDS</strong> is the nation\'s leading industry-based, nonprofit AIDS fundraising and grants making organization. By drawing upon the talents and generosity of the American theatre community, since 1988 BC/EFA has raised over $175 million for critically needed services for people with AIDS and other serious illnesses. BC/EFA is the major supporter of seven programs at The Actors\' Fund - including The AIDS Initiative, The Phyllis Newman Women\'s Health Initiative, The Hirschfeld Free Health Clinic at The Aurora in NYC, The Dancers\' Resource and two supportive housing residences. BC/EFA also awards grants to over 400 AIDS and family service organizations yearly.  <a href="http://www.broadwaycares.org" target="_blank">www.broadwaycares.org</a><br/><br/><a target="_blank" href="giveredir.php?url=http://www.broadwayoffers.com/go.aspx?MD=2001%26MC=GIVEFUL%26PID=7119%26AID=GIV000000201"><img src="/img/charity_button.gif" width="621" height="34" alt="Charity Button"></a>';
gardenPages[4]='<img src="/img/giving_garden_slices/gg_seeds_of_peace.gif" width="177" height="176" alt="Gg Seeds Of Peace"><strong>Seeds of Peace</strong> Treaties are negotiated by governments. Peace is made by people. Seeds of Peace is doing what no government can. It is sowing the seeds of peace among the next generation of leaders. It is educating them to develop empathy, respect, and confidence. It is equipping them with communication and negotiation skills. It is enabling them to see the human face of their enemies. By empowering them to emerge as tomorrow\'s leaders, Seeds of Peace is working to forge the personal relationships so critical to peacemaking and reconciliation.<br/><br/><a href="giveredir.php?url=http://www.broadwayoffers.com/go.aspx?MD=2001%26MC=GIVEFUL%26PID=7119%26AID=GIV000000142" target="_blank"><img src="/img/charity_button.gif" width="621" height="34" alt="Charity Button"></a>';
gardenPages[5]='<img src="/img/giving_garden_slices/BwyImpact.JPG" alt="Broadway Impact"><strong>Broadway Impact</strong> is a grassroots organization of the Theatre community and its fans, mobilizing in support of marriage equality. We are a community of actors, directors, stage managers, fans, producers - pretty much anyone who has ever seen, been in or worked on a Broadway show - united by the simple belief that anyone who wants to should be able to get married.<br/><br/><a href="giveredir.php?url=http://www.broadwayoffers.com/go.aspx?MD=2001%26MC=GIVEFUL%26PID=7119%26AID=GIV000000445" target="_blank"><img width="621" height="34" alt="Charity Button" src="/img/charity_button.gif"/></a>';

function changeContent(page)
{
	$("#gardenContent").html(gardenPages[page]);
}