//try this one, your comments are welcome.
function FormatDate(strDate) // strDate should be in the format of 04/11/2005 or 4/11/2005 is also ok.
{
var strEffectiveDate = 20050408; // this is your effective date 04/08/2005
var temp;
temp = "";
var i = 0;
var month ="";
var day = "";
var year = "";
var l1=0;
var stop1 = false;
var stop2 = false;;
var x = 0;
var date= "";
while(i < str.length)
{
if(stop1 == false)
{
if(strDate.charAt(i) != "/")
{
month = month + strDate.charAt(i);
l1 = l1 + 1;
}
}
if(strDate.charAt(i) == "/")
{
stop1 = true;
}
if(i>l1)
{
if(stop2 == false)
{
if(strDate.charAt(i) != "/")
{
day = day + strDate.charAt(i);
x = i;
}
}
if(strDate.charAt(i) == "/")
{
stop2 = true;
}
}
i = i +1;
}
i = 0;
while(i < strDate.length)
{
year = year + strDate.charAt(x+2+i);
i=i+1
}
if(month.length == 1)
{
month = "0"+month;
}
if(day.length == 1)
{
day = "0"+day;
}
date = year+month+day;
return date; //Now the strDate (04/11/2005) is in the format of 20050411
}
//Now update your page, First check your effective date
var diffDays;
if(FormatDate(yourCurrentDate) > strEffectiveDate )
{
diffDays = FormatDate(yourCurrentDate) - strEffectiveDate;
if(parseInt(diffDays) % 7 == 0)
{
//Referesh your page - beause it is in every 7 days increment.
}
}