	var delay = 1000;    //1000 ~ 1 second
	var duration = 15;    //15 seconds
	var timerRunning = false;
	var timerId = null;
	var userClicked = false;
	
	var speed = 600;	
	
	function hideAd() {			
		//$("#blackout").fadeOut(speed);	
		$("#blackout").animate({opacity:0},speed);
		$("#blackout").hide();
		$("#divpopup").fadeOut(speed);	
		$(document.body).css("overflow","visible");
	}
	
	function showAd() {					
		$("#blackout").show();
		$("#blackout").animate({opacity:0.8},speed);
		$("#divpopup").fadeIn(speed);		
		if($.browser.msie)
			$(document.body).css("overflow","hidden");
	}
	
	function stopTimer() {		
		if(timerRunning) {
			clearTimeout(timerId);					
		}
		timerRunning = false;			
	}
	
	function startTimer() {
		if(duration == 0) {    			
			stopTimer();
			
			hideAd();						
		}
		else {
			var count = document.getElementById("count");
			count.firstChild.nodeValue -= 1;
			
			duration -= 1;
			timerRunning = true;
			timerId = self.setTimeout("startTimer()",delay);
		}
	}
	
	function hide() {				
		//Stop the timer
		stopTimer();			
		hideAd();
		userClicked = true;
	}
	
	function show() {
		duration = 15;
		stopTimer();
		$("#count").text(15);
		showAd();
		startTimer();
	}


function bottomSect(){
	
document.write('<div id="bottom_container" class="std3">Copyright &copy; 2009 <a href="http://www.blueorange.com.sg" target="_blank">Blue Orange Pte Ltd</a>. Creator of <a href="http://www.myhometutor.org" target="_blank">MyHomeTutor&#8482;</a>, <a href="http://academy.myhometutor.org" target="_blank">MyHomeTutor Academy</a> and <a href="http://www.olevelguru.com" target ="_blank">OLevelGuru&#8482;</a> &nbsp;| &nbsp;<a href="terms.html"><b>Terms and Conditions</b></a><br><br><span style="font-size:11px;">This website is tested to work on Internet Explorer, Firefox, Safari, Opera & Google Chrome</span></div>');
}

function unhide(divID) {
    var item = document.getElementById(divID);
    var hint = document.getElementById(divID + "_hint");
    if (item) {
        if(item.className == 'hidden') {
          item.className = 'unhidden';
		  //hint.firstChild.nodeValue = "<img src='../images/drop_up.gif'>";
		  hint.innerHTML = '<img src="images/drop_down.gif" border="0">';
         /*hint.firstChild.nodeValue = '(click to minimize chapter list)';*/
        }
        else {
          item.className = 'hidden';
          //hint.firstChild.nodeValue = "<img src='../images/drop_down.gif'>";
          /*hint.firstChild.nodeValue = '(click to expand chapter list)';*/
		   hint.innerHTML = '<img src="images/drop_up.gif" border="0">';
        //item.className=(item.className=='hidden')?'unhidden':'hidden';
        }
    }
}

function fullScreen(theURL) {
    window.open(theURL);
} 