/* displays box on Bronze membership download page when clicked on a Silver download
 and asks if member wants to upgrade to Silver */
function no_upgrade()
{
var r=confirm("I am Sorry," + '\n' + "You need to upgrade for full access to this product." + '\n' + " Would you like to Upgrade Now?");
if (r==true)
  {
  location = 'member.area.sl.php?id=5';
  }
else
  {   }
}

function currentyear()
// displays the current year in four digit format, can be used in the footer
{
var d = new Date();
document.write(d.getFullYear());
}

/* this fuction displays the date of two days ago, with the exception of the weekend */
function writtendate()
{
var d=new Date();
var today=d.getDay();
if (today == 2)
{
aDay = new Date();
aDay=new Date(aDay.setDate(aDay.getDate()-4));
}
else if (today == 1)
{
aDay = new Date();
aDay = new Date(aDay.setDate(aDay.getDate()-3));
}
else
{
aDay = new Date();
aDay = new Date(aDay.setDate(aDay.getDate()-2));
}
var day=aDay.getDay();
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var month=aDay.getMonth();
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
document.write(dayarray[day]+", "+montharray[month]+" "+aDay.getDate()+", "+(aDay.getFullYear()+""));
}

function myowndate(daysback)
/* a lot of sites have the date displayed of today, 
   as if the site was updated today, yeh right ;-)
   This function displays the date as being however many days ago
   you input into the fuction. The dates displayed will
   exclude Saturday and Sunday, No one works on the weekend right?
   the variable daysback can have the following values: 0,1,2,3,4,5,6,7
*/

{
var d=new Date();
var today=d.getDay();
var make1friday=(daysback+1);
var make2friday=(daysback+2);

if ((daysback-(Math.floor(daysback/7)*7))==0)//today
	{
	weekday=6;// saturday
	}
else if ((daysback-(Math.floor(daysback/7)*7))==1)// yesterday
	{
	weekday=7;//sunday
	}
else
	{
	weekday=(daysback-1);
	}
	
if (today == weekday)
	{
	aDay = new Date();
	aDay = new Date(aDay.setDate(aDay.getDate()-make1friday));
	}
else if (today == (daysback-(Math.floor(daysback/7)*7)))
	{
	aDay = new Date();
	aDay = new Date(aDay.setDate(aDay.getDate()-make2friday));
	}
else 
	{
	aDay = new Date();
	aDay = new Date(aDay.setDate(aDay.getDate()-daysback));
	}

var day=aDay.getDay();
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var month=aDay.getMonth();
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
document.write(dayarray[day]+", "+montharray[month]+" "+aDay.getDate()+", "+(aDay.getFullYear()+""));
}

// this fuction displays a different text to people of different membership levels on the upgrades page, whether they should upgrade or not
function upgradepageheader(memberlevel,firstname)
{
var level=memberlevel;
if (level == 5 )
  {
  document.write("==============================================<br><b>NOTE:<br><br>" + firstname + ", you are Already a SILVER Member!</b><br><br>You have access to all the material already<br>So, There is <u>no need</u> for you to Upgrade<br><br>You are still more than welcome to look at the upgrade page though :-)<br>==============================================<br>");
  }
else if (level == 10 )
	{
	document.write("==============================================<br><b>NOTE:<br><br>" + firstname + ", you are Joint Venture Member!</b><br>You have access to all the material already<br>So, There is <u>no need</u> for you to Upgrade<br><br>You are still more than welcome to look at the upgrade page though :-)<br>==============================================<br>");
	}
else
  {
  document.write("<b>Hi " + firstname + ", thank you for looking into upgrading your membership.<br>You will be glad you did!</b><br>");
  }
}

/* this fuction displays the different icons on the first page of the mebership area, pending on the membership level */
function memberareaicons(memberlevel)
{
var level=memberlevel;
if (level == 5) // these are members that upgraded to Silver //
  {
  document.write("<table width=\"100%\" border=\"0\" cellpadding=\"10\"><tr><td width=\"33%\" align=\"center\"><a href=\"member.area.downloads.php?l=5\"><img src=\"images/arrow_down.png\" alt=\"Click here to go to the Downloads page\"><br />	<b><font face=\"Trebuchet MS\" size=\"+1\">My Downloads</font></b></a></td><td width=\"33%\" align=\"center\"><a href=\"member.area.profile.php\"><img src=\"images/cleverdollar-kids.jpg\" alt=\"Click here to view your profile\"><br /><b><font face=\"Trebuchet MS\" size=\"+1\">My Profile</font></b></a></td><td width=\"33%\" align=\"center\"><a href=\"member.area.promo.tools.php\"><img src=\"images/cleverdollar-promote.jpg\" alt=\"Click here to promote Allowance Secrets\"><br /><b><font face=\"Trebuchet MS\" size=\"+1\">Share</font></b></a></td></tr></table>");
  }
else if (level == 10)// these are the JV partners //
  {
  document.write("<table width=\"100%\" border=\"0\" cellpadding=\"10\"><tr><td width=\"33%\" align=\"center\"><a href=\"member.area.promo.tools.php\"><img src=\"images/cleverdollar-promote.jpg\" alt=\"Click here to promote Allowance Secrets\"><br /><b><font face=\"Trebuchet MS\" size=\"+1\">Share</font></b></a></td><td width=\"33%\" align=\"center\"><a href=\"member.area.profile.php\"><img src=\"images/cleverdollar-kids.jpg\" alt=\"Click here to view your profile\"><br /><b><font face=\"Trebuchet MS\" size=\"+1\">My Profile</font></b></a></td><td width=\"33%\" align=\"center\"><a href=\"member.area.downloads.php?l=10\"><img src=\"images/arrow_down.png\" alt=\"Click here to go to the Downloads page\"><br /><b><font face=\"Trebuchet MS\" size=\"+1\">My Downloads</font></b></a></td></tr></table>");
  }
else
  {  // this is for the free members //
  document.write("<table width=\"100%\" border=\"0\" cellpadding=\"10\"><tr><td width=\"25%\" align=\"center\"><a href=\"member.area.profile.php\"><img src=\"images/cleverdollar-kids.jpg\" alt=\"Click here to view your profile\"><br /><b><font face=\"Trebuchet MS\" size=\"+1\">My Profile</font></b></a></td><td width=\"25%\" align=\"center\"><a href=\"member.area.downloads.php?l=1\"><img src=\"images/arrow_down.png\" alt=\"Click here to go to the Downloads page\"><br /><b><font face=\"Trebuchet MS\" size=\"+1\">My Downloads</font></b></a></td><td width=\"25%\" align=\"center\"><a href=\"member.area.promo.tools.php\"><img src=\"images/cleverdollar-promote.jpg\" alt=\"Click here to promote Allowance Secrets\"><br /><b><font face=\"Trebuchet MS\" size=\"+1\">Share</font></b></a></td><td width=\"25%\" align=\"center\"><a href=\"member.area.sl.php?id=5\"><img src=\"images/arrow_up.png\" alt=\"Click here to go to Upgrade your membership\"><br /><b><font face=\"Trebuchet MS\" size=\"+1\">Upgrade</font></b></a></td></tr></table>");
  }
}

/* this fuction shows the first two steps on the main page depending on the membership level */
function steps1_2(memberlevel)
{
var l = memberlevel;

switch (l)
{
	case 5:  // these are Silver members //
		document.write("<b><span style=\"background-color: yellow;\">Step 1 - Get Your Products</span></b><br><br>Access your products from the downloads link above. If you purchased any of our upgrades you will also find them on that page. And you can also access your products at any time from the <a href=\"member.area.downloads.php?l=5\"><b>\"Downloads\"</b></a> button in the top menu.<br /><br /><br /><b><span style=\"background-color: yellow;\">Step 2 - Update Your Profile</span></b><br><br>Make sure you update your details, this way we make sure you get the up to date info. You can change your details at any time from the <a href=\"member.area.profile.php\"><b>&quot;Profile&quot;</b></a> button in the top menu.<br>This is also the place where you update your <b>PayPal email address</b> so we can pay you your commissions on any sales you have made.<br>As a Silver member you can earn 50% on any sale you referred.");
  	break;
	case 10:  // these are JV members //
		document.write("<b><span style=\"background-color: yellow;\">Step 1 - Promote</span></b><br><br>To help you make money by promoting &quot;Allowance Secrets&quot;, I've created a ton of great marketing tools that you can find in the affiliate tool box - so you can get started right away, without worrying about creating emails, banners, etc!<br><a href=\"member.area.promo.tools.php\"><b>So go there right now</b></a> and send one of the professional email promotions to everyone you think would want to know about this great course, and tell them how amazing it really is!<br>You can earn <b>75%</b> on any sale through your referral link. Just for copying and pasting some of my promotion tools!.<br /><br /><br /><b><span style=\"background-color: yellow;\">Step 2 - Update Your Profile</span></b><br><br>Make sure you update your details, this way you make sure you get up to date info about any changes or additions to our Affiliate Toolbox.<br>This is also the place where you  update your <b>PayPal email address</b> so we can pay you your commissions on the sales you have made.<br>You can change your details at any time from the <a href=\"member.area.profile.php\"><b>&quot;Profile&quot;</b></a> button in the top menu.");
	break;
	default:  // this is for the free - Bronze members
		document.write("<b><span style=\"background-color: yellow;\">Step 1 - Get Your Products</span></b><br><br>Access your products from the downloads link above. If you purchased any of our upgrades you will also find them on that page. And you can also access your products at any time from the <a href=\"member.area.downloads.php?l=1\"><b>\"Downloads\"</b></a> button in the top menu.<br /><br /><br /><b><span style=\"background-color: yellow;\">Step 2 - Update Your Profile</span></b><br><br>Make sure you update your details, this way we make sure you get the up to date info. You can change your details at any time from the <a href=\"member.area.profile.php\"><b>&quot;Profile&quot;</b></a> button in the top menu.<br>This is also the place where you update your <b>PayPal email address</b> so we can pay you your commissions on any sales you have made.<br>As a Bronze member you can earn 25% on any sale you referred.");
	}
}

/* this fuction shows the last steps on the main page depending on the membership level */
function steps3_5(memberlevel)
{
var l = memberlevel;

switch (l)
{
	case 5:  // these are Silver members //
		document.write("<b><span style=\"background-color: yellow;\">Step 3 - Share</span></b><br><br>You\'ll like what you see and I am sure you\'ll know people that will benefit from the information, just like you did.<br>So, make sure you let them know (you can earn 50% on any sale you refer).<br>There are a ton of great marketing tools for you to use,  you can find these in the &quot;Share&quot; area - so you can get started right away, without worrying about creating emails, banners, etc!<br />You can access the Promo tools at any time from the <a href=\"member.area.promo.tools.php\"><b>&quot;Share&quot;</b></a> button in the top menu.<br /><br /><br /><b><span style=\"background-color: yellow;\">Step 4  - Grab Your Free Bonuses!</span></b>");
  	break;
	case 10:  // these are JV members //
		document.write("<b><span style=\"background-color: yellow;\">Step 3 - Get Your Products</span></b><br><br>Access your products from the link above. You have access to all the products for your review. You can also access your products at any time from the <a href=\"member.area.downloads.php?l=10\"><b>&quot;My Products&quot;</b></a> button in menu at the top of the page.<br /><br /><br /><b><span style=\"background-color: yellow;\">Step 4  - Grab Your Free Bonuses!</span></b>");
	break;
	default:  // this is for the free - Bronze members //
		document.write("<b><span style=\"background-color: yellow;\">Step 3 - Share</span></b><br><br>You\'ll like what you see and I am sure you\'ll know people that will benefit from the information, just like you did.<br>So, make sure you let them know (you can earn 25% on any sale you refer).<br>There are a ton of great marketing tools for you to use,  you can find these in the &quot;Share&quot; area - so you can get started right away, without worrying about creating emails, banners, etc!<br />You can access the Promo tools at any time from the <a href=\"member.area.promo.tools.php\"><b>&quot;Share&quot;</b></a> button in the top menu.<br /><br /><br /><b><span style=\"background-color: yellow;\">Step 4 - Upgrade!</span></b><br><br>To get the full benefit out of your membership, you need to <a href=\"member.area.sl.php?id=5\"><b>Upgrade</b></a> to a Silver member. This way you will be able to download the complete &quot;The Insider\'s Secrets to Teaching Children About Money&quot; book and all the bonuses that the contibutors of the book have provided for you.<br /><br /><br /><b><span style=\"background-color: yellow;\">Step 5  - Grab Your Free Bonuses!</span></b>");
	}
}

/* this function writes some text on the promo page, pending on how many people the member has referred */
function toolbox(referrals)
{
var num = referrals;
if (num == 0)
  {
  document.write("people.<br>Have you tried any of the promotion material yet?");
  }
else if (num==1)
  {
  document.write("person.<br><u>Thank you</u>, Keep up the good work!");
  }
else if (num>1 && num<=10)
  {
  document.write("people.<br><u>Thank you</u>, Keep up the good work!");
  }
else if (num>10 && num<=25)
  {
  document.write("people.<br><u>Wow</u>, Thanks for Helping Spread the Word!");
  }
else if (num>25 && num<=40)
  {
  document.write("people.<br><b>You Rock!</b>");
  }
else 
  {
  document.write("people.<br><b>You are Awesome!</b>");
  } 
}
/* this function writes the membership status and the referral percentage on the promote page */
function levelpercent(memberlevel)
{
var l = memberlevel;

switch (l)
{
	case 5:  // these are Silver members //
		document.write("As a <b>Silver member</b> you earn a <u>cool</u> <b>50%</b> commission!<br><font size=\"-1\">You also earn 10% on your second level.</font>");
  	break;
	case 10:  // these are JV members //
		document.write("As a <b>JV Partner</b> you earn a <u>Massive</u> <b>75%</b> commission!<br><font size=\"-1\">You also earn 20% on your second level.</font>");
	break;
	default:  // this is for the free -Bronze members //
		document.write("As a <b>Bronze</b> member you earn <b>25%</b> commission<br><a href=\"member.area.sl.php?id=5\"><b>Click Here</b></a> to upgrade and earn a <u>cool</u> 50% commission");
	}
}
