var donateCounter = 0;
var donateMessage1 = 'DONATE!!!!!!!!!!!!!!!!!!!!!!!!!!!!';
var donateMessage2 = 'CMON GET A FRIGGIN LIFE!!!!!!!!!!!!!!!!!!!!!!!!!!!!';
var donateMessage3 = 'CLASSY PAL. GO FRIG YOURSELF!!!!!!!!!!!!!!!!!!!!!!!!!!!!.';
var color = 888888;

var disableDonateImageSwaps = false;

function onDonateMouseOver()
{
	if( disableDonateImageSwaps == false )
		document.donateButton.src='../../image/directedperspective/donateneg.png';
}

function onDonateMouseOut()
{
	if( disableDonateImageSwaps == false )
	{
		document.donateButton.src='../../image/directedperspective/donate.png';
		updateDonate();
	}
}

function onDonateClick()
{
	// uncomment the next line to have the text "loading..." pop up when the donate button is clicked
  	document.getElementById('paypalLoadingDiv').style.display = 'block';

	// make the soon to be changed donate image (to loading) only show that loading image
	disableDonateImageSwaps = true;

	document.donateButton.src='../../image/directedperspective/donateLoading.png';
}

function updateDonate()
{
	donateCounter++;	

	if( donateCounter == 10 )
    {
		alert(donateMessage1);
	}

	if( donateCounter == 20 )
	{
		alert(donateMessage2);
	}

	if( donateCounter == 30 )
	{
		alert(donateMessage3);
	}

	if( donateCounter == 100 )
	{
		alert("Ok, you win. You don't have to donate");
	}

	if( donateCounter > 30 )
	{
		var randomnumber1 = (Math.floor(Math.random()*8)+1) * 1; //2^0 = 1
		var randomnumber2 = (Math.floor(Math.random()*8)+1) * 2; //2^1 = 2
		var randomnumber3 = (Math.floor(Math.random()*8)+1) * 4; //2^2 = 4
		var randomnumber4 = (Math.floor(Math.random()*8)+1) * 8; //2^3 = 8
		var randomnumber5 = (Math.floor(Math.random()*8)+1) * 16; //2^4 = 16
		var randomnumber6 = (Math.floor(Math.random()*8)+1) * 32; //2^5 = 32

		var mult = 15;
		if( color % 2)
			mult = 2;
		if( color % 3)
			mult = 5;
		if( color % 7)
			mult = 10;

		color = (randomnumber1 + randomnumber2 + randomnumber3 + 
			    randomnumber4 + randomnumber5 + randomnumber6) * mult;

		document.bgColor= '#' + color;
	}
}

function infoButtonOnClick( button )
{
  directedperspectivesform.videoInfoOrMessageBoard.value='videoInfo';
  document.getElementById('messageBoardDiv').style.display = 'none';
  document.getElementById('videoInformationDiv').style.display = 'block';

  
}

function talkButtonOnClick( button )
{
  directedperspectivesform.videoInfoOrMessageBoard.value='messageBoard';
  document.getElementById('videoInformationDiv').style.display = 'none';
  document.getElementById('messageBoardDiv').style.display = 'block';
}

function highlightMessageTextbox( textbox )
{
	textbox.focus();
	//textbox.select();
}

function highlightTextbox( textbox )
{
	textbox.focus();
	textbox.select();
}

function onInfoTalkButtonMouseOver()
{
  
}

function onInfoTalkButtonMouseOut()
{
  //alert('out');
}


