// Countdown from 5 minutes in the landing pages, Change according to requirement. 
// call <script type="text/javascript" src="scripts/countdown.js"></script> in the required pages

// Add <span id="MS"></span><span id="SS"></span> in the pages for inline display of the script. 
// Do not use minutes, seconds, description keywords in getElementById since InternetExplorer(IE) 
// does not like it. 

// No of minutes the count down should run. 
var mins = 5;

// how many seconds (don't change this)
// Multiply the mins with 60 for finding the no of loops that should be run
var secs = mins * 60;

// Function countdown runs decrement and displays 
function countdown() {
setTimeout('Decrement()',1000);
}

// Function Decrement() 
function Decrement() {
// Checks if minutes or seconds are present in the html pages. 
if (document.getElementById) {
// Set the minutes and seconds to the default value. 
minutes = mins;
seconds = secs;
// if less than a minute remaining
if (seconds < 59) {
seconds = seconds; // send only the seconds data
} else {
minutes = getminutes(); // send the minutes data
seconds = getseconds(); // send the seconds data
}

document.getElementById("MS").innerHTML = ((minutes < 10) ? "0" : ":") +minutes;
document.getElementById("SS").innerHTML = ((seconds < 10) ? ":0" : ":") +seconds;
if(secs > 0 ) { 
secs--;
} else {
popUpClose();
}
setTimeout('Decrement()',1000);
}
}
function getminutes() {
// minutes is seconds divided by 60, rounded down
mins = Math.floor(secs / 60);
return mins;
}
function getseconds() {
// take mins remaining (as seconds) away from total seconds remaining
return secs-Math.round(mins *60);
}

function popUpClose() {
newWindow.close();
}


