/*/////////////////////////////////////////////////////////
// tweaks.js - functions for LFM sites by Rob van der Gulik
// add <script src="tweaks.js"></script> in header section
// Copyright ©2010 LFM Tweaks, All Rights Reserved
//
// Please read the Readme.txt file for instruction on how
// to install and use the scripts 
//
// http://lfmtweaks.com 
////////////////////////////////////////////////////////*/


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()+""));
}

function do_upgrade()
/* The following function displays box on membership download page
   when clicked on a higher level download link and asks if member wants to upgrade
   when the member clicks on the yes button, it will take them to the upgrades page
*/
{
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 = 'members.php?mf=ug';
  }
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());
}