// JavaScript Document
var posx=0;
var posy=0;
var caption = Array();
var longtitle = Array();
var sWidth, sHeight;
sWidth = screen.width-30;
sHeight = screen.height;
var e;
/*if (parseInt(navigator.appVersion)>3) {
 sWidth = screen.width;
 sHeight = screen.height;
}
else if (navigator.appName == "Netscape" && parseInt(navigator.appVersion)==3 && navigator.javaEnabled()) {
 var jToolkit = java.awt.Toolkit.getDefaultToolkit();
 var jScreenSize = jToolkit.getScreenSize();
 sWidth = jScreenSize.width;
 sHeight = jScreenSize.height;
}*/
/*if (window.innerWidth){ //if browser supports window.innerWidth
	sWidth = window.innerWidth;
	sHeight = window.innerHeight;		
}else if(document.all){ //else if browser supports document.all (IE 4+)
	sWidth = document.body.clientWidth;
	sHeight = document.body.clientHeight;	
}	
*/
function $(id){
	return document.getElementById(id);
}
function show_tooltips1(no){
	//temp=show_tooltips(no)
	window.setTimeout('show_tooltips('+no+')', 2000);
	}
function show_tooltips(no){
	$('tooltips').innerHTML =longtitle[no]+'<p>'+caption[no];
	position_tooltips(e);
	$('tooltips').style.display = '';
}
function position_tooltips(e){
	if(e==null) e=window.event;
	if(e.pageX || e.pageY){
		posx=e.pageX; posy=e.pageY;
    }else if(e.clientX || e.clientY){
		if(document.documentElement.scrollTop){
			posx=e.clientX+document.documentElement.scrollLeft;
			posy=e.clientY+document.documentElement.scrollTop;
		}else{
			posx=e.clientX+document.body.scrollLeft;
			posy=e.clientY+document.body.scrollTop;
        }
    }
	var divHeight;
	if($('tooltips').offsetHeight){
		 divHeight=$('tooltips').offsetHeight;
	}else if($('tooltips').style.pixelHeight){
         divHeight=$('tooltips').style.pixelHeight;
    }
/*	alert(posy);
	alert(parseInt((parseInt(posy)+parseInt(divHeight))));
	alert(parseInt(sHeight));
*/	
	var h = (posy+divHeight+150);
	if(h>=parseInt(sHeight)){
		posy = parseInt(posy)-(divHeight+40);
	}
	//alert(posy);
	if((parseInt(posx)+400)>=sWidth){
		posx = parseInt(posx)-440;
	}
	
	$('tooltips').style.top = (parseInt(posy)+10)+'px';
	$('tooltips').style.left = (parseInt(posx)+10)+'px';
	/*var windowWidth, windowHeight;
	if (self.innerHeight) { // all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
	$('div_tooltips').style.top = (windowHeight-200)/2+'px';
	$('div_tooltips').style.left = (windowWidth-400)/2+'px';*/
}
function position_tooltips1(e){
	if(e==null) e=window.event;
	if(e.pageX || e.pageY){
		posx=e.pageX; posy=e.pageY;
    }else if(e.clientX || e.clientY){
		if(document.documentElement.scrollTop){
			posx=e.clientX+document.documentElement.scrollLeft;
			posy=e.clientY+document.documentElement.scrollTop;
		}else{
			posx=e.clientX+document.body.scrollLeft;
			posy=e.clientY+document.body.scrollTop;
        }
    }
	var divHeight=150;
	var h = (posy+divHeight+20);
	if(h>=parseInt(sHeight)){
		posy = parseInt(posy)-(divHeight+20);
	}
	if((parseInt(posx)+150)>=sWidth){
		posx = parseInt(posx)-150;
	}
	
	$('div_make').style.top = (parseInt(posy)+10)+'px';
	$('div_make').style.left = (parseInt(posx)+10)+'px';
}
function hide_tooltips(){
	$('tooltips').style.display = 'none';
}
//window.onmousemove = getMouse;
function tooltips(){
	var sc = document.getElementById('img_tbl').getElementsByTagName('img');
	for(var h=0; h<sc.length; h++){
		//sc[h].onmouseover=show_tooltips;
		sc[h].onmouseout=hide_tooltips;
		sc[h].onmousemove=position_tooltips;
	}
}

var secs
var timerID = null
var timerRunning = false
var delay = 1000

function InitializeTimer(no)
{
    // Set the length of the timer, in seconds
    secs = 2
    StopTheClock()
    StartTheTimer(no)
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer(no)
{
    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:
		show_tooltips(no)
		
        //alert("You have just wasted 10 seconds of your life.")
    }
    else
    {
        self.status = secs
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer("+no+")", delay)
    }
}
