//SCRIPTS USED IN WEBPAGES

//SCRIPTS USED IN WEBPAGES

	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 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/open.gif'>";*/
         hint.firstChild.nodeValue = '(click to minimize chapter list)';
        }
        else {
          item.className = 'hidden';
          /*hint.firstChild.nodeValue = "<img src='../images/closed.gif'>";*/
          hint.firstChild.nodeValue = '(click to expand chapter list)';
        //item.className=(item.className=='hidden')?'unhidden':'hidden';
        }
    }
}

function bottomSect(){
	
document.write('<div id="encase_bottom"><div class="quick_link link_bot"><p style="float:left;"><a href="subscribe.jsp">SUBSCRIBE TO OUR MAILING LIST</a></p><p style="float:right;"><a href="wheretobuy.html">LOCATION OF OUR STORES</a></p><div class="clearit"></div></div><div class="copyright"> <p style="float:left;">Copyright &copy; 2010 Blue Orange Pte Ltd. All rights reserved.</p><div class="clearit"></div></div></div>');
}