var timerID = 0;
var opt = 0;
var mwidth=10;
var mheight=10;
var display = 1;
var cT = 0;
var cL = 0;
var mousex;
var mousey;
var IE = document.all?true:false
// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

function show_box(eid) {
	document.getElementById(eid).style.display='block';
}

/*******************************8
show a div or hide a div
********************************/
function showhidebox(eid){
	if(document.getElementById(eid).style.display == 'none') {
		document.getElementById(eid).style.display='block';
	}else if (document.getElementById(eid).style.display == 'block'){
		document.getElementById(eid).style.display='none';
	}else{
		document.getElementById(eid).style.display='block';
	}
}
 
function show_box_on_mouse_pos(eid, w, h) {
	document.getElementById(eid).style.display='block';
	document.getElementById(eid).style.border='1px solid #333333';
	document.getElementById(eid).style.width = w + 'px';
	document.getElementById(eid).style.height = h + 'px';
	document.getElementById(eid).style.top = mousey + 'px';
	document.getElementById(eid).style.left = mousex + 'px';
}

function showlo_confirm(eid, content) {

 	var extratop = 150;
 	var extraleft = 380;
	//IE position and alpha
	if (navigator.appName.indexOf("Microsoft")!=-1) { 
        toppos = document.body.clientHeight / 2 - ((document.body.clientHeight / 2) / 1.1); 
        leftpos = document.body.clientWidth / 2 - extraleft; 
				document.getElementById(eid).style.filter="alpha(opacity="+opt+")";
    }else{ //ns 6 position and opacity
        toppos = window.innerHeight / 2 - extratop; 
        leftpos = window.innerWidth / 2 - extraleft;
				document.getElementById(eid).style.MozOpacity = opt + '%';
				document.getElementById(eid).style.opacity = opt/100
    } 
    
    //scroll postion
		if(document.documentElement.scrollTop){
        leftpos=leftpos+document.documentElement.scrollLeft;
        toppos=toppos+document.documentElement.scrollTop;
        }
    else{
        leftpos=leftpos+document.body.scrollLeft;
        toppos=toppos+document.body.scrollTop;
    }

  
  if (opt == 0){
  		document.getElementById(eid).style.display='block';
  }
  
	document.getElementById(eid).style.top = toppos + 'px'; 
	document.getElementById(eid).style.left = leftpos + 'px';
	//document.getElementById(eid).style.width = mwidth + 'px'; 
	//document.getElementById(eid).style.height = mheight + 'px';
	
	//mwidth = mwidth + 50;
	//mheight = mheight + 50;
	//opt = 100;
	if (display == 1) {
		if (opt >= 100){
			display = 0;
			clearTimeout(timerID);
			mwidth = 0;
			mheight = 0;
		}else{
			opt = opt + 10;
			
		}
		timerID = setTimeout("showlo_confirm('"+eid+"')", 50);
	} 
	
	
}


function hidelo_confirm(eid) {
	document.getElementById(eid).style.display='none';
	document.getElementById('overlay').style.display='none';
	//alert('HELLO');
	opt = 0;
	mwidth = 0;
	mheight = 0;
	timerID = 0;
	display = 1;
	//resetVars();
}

 
//variable that will increment through the images
var step=0;
function slideit(xid, imgnum){
//if browser does not support the image object, exit.
if (!document.images)
return;
document.getElementById(xid + '0').src=eval("image["+step+"].src");
step++;
document.getElementById(xid + '1').src=eval("image["+step+"].src");
step++;
document.getElementById(xid + '2').src=eval("image["+step+"].src");
step++;

if (step>=imgnum)
step=0;
 
//call function "slideit()" every 2.5 seconds
setTimeout("slideit('"+xid+"', "+imgnum+")",3000);
}

 


//
// getPageSize()
// Returns array with page width, height and window width, height
//
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	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;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

//get absolute position of an element
function getoffset(e)  
{  
	var t=e.offsetTop;  
	var l=e.offsetLeft;  
	while(e=e.offsetParent)  
	{  
	t+=e.offsetTop;  
	l+=e.offsetLeft;  
	}  
	var rec = new Array(1);  
	rec[0] = t;  
	rec[1] = l;  
	return rec  
}  

function mouseMove(e){
  if (IE) { // grab the x-y pos.s if browser is IE
    mousex = event.clientX + document.body.scrollLeft
    mousey = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    mousex = e.pageX
    mousey = e.pageY
  }
 
}
 
document.onmousemove = mouseMove;
 
