
function setWraperHeight(){
var wrap = document.getElementById('wrapper-id');
wrap.style.height = window.innerHeight + 'px';
}

function highLightMenu(id){
var img = document.getElementById(id);
img.src = '/images/common/global_menu_divider_over.png';
}

function unhighLightMenu(id){
var img = document.getElementById(id);
img.src = '/images/common/global_menu_divider.png';
}

function highLightJoin(id){
var img = document.getElementById(id);
img.src = '/images/common/join_over.png';
}

function unhighLightJoin(id){
var img = document.getElementById(id);
img.src = '/images/common/join.png';
}



function showsubnav(id){

var subnav = 'subnav-id-'+id;

var subnav_obj = document.getElementById(subnav);

subnav_obj.style.display = 'block';

}


function hidesubnav(id){
var subnav = 'subnav-id-'+id;

var subnav_obj = document.getElementById(subnav);

subnav_obj.style.display = 'none';

}

var currentFact = 0;
var player = true;

function previousFact(auto) {
	if (player == true && auto == false)
	{
		StopStartRotate('play-pause-button-id');
	}
	
	var previousFact;
	if (currentFact == 0)
	{
		previousFact = divNum;
	}else {
		previousFact= currentFact - 1;
	}
	
	var currentFact_obj = document.getElementById('fact-div-id-'+currentFact);
	var previousFact_obj = document.getElementById('fact-div-id-'+previousFact);
	if (previousFact_obj != null)
	{
			currentFact_obj.style.display = 'none';
			previousFact_obj.style.display = 'block';
			currentFact = previousFact;
	}

}

function nextFact(auto) {
	
	if (player == true && auto == false)
	{
		StopStartRotate('play-pause-button-id');
	}
	var nextFact;
	if (currentFact == divNum)
	{
		nextFact = 0;
	}else {
		nextFact = currentFact + 1;
	}
	
	
	var currentFact_obj = document.getElementById('fact-div-id-'+currentFact);
	var nextFact_obj = document.getElementById('fact-div-id-'+nextFact);
	if (nextFact_obj != null)
	{
		currentFact_obj.style.display = 'none';
		nextFact_obj.style.display = 'block';
		currentFact = nextFact;
	}
	
	
}

/* ================================================================================================== */
/*	Auto Run Function */
/* ================================================================================================== */


var secs
var timerID = null
var timerRunning = false
var delay = 1000
var imgId = 1
var stop = false


function InitializeTimer()
{
    // Set the length of the timer, in seconds
    secs = 15
    StopTheClock()
    StartTheTimer()
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer()
{
    if (secs==0)
    {
        StopTheClock()
        // Here's where you put something useful that's
        // supposed to happen after the allotted time.
        // For example, you could display a message:
		
      
		nextFact(true);
		
			if (stop == false)
			{
				InitializeTimer()
			}
			
    }
    else
    {
        //self.status = secs
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
}


function StopStartRotate(id) {
	
	
	var Obj = document.getElementById(id);
	if (stop == false)
	{
		stop = true;
		player = false;
		Obj.src = '/images/index/play.jpg';
		secs = 999;
	}else {
		stop = false;
		Obj.src = '/images/index/pause.jpg';
		player = true;
		secs = 0;
		imgId=intPage;
		StartTheTimer()
	}
		
}


