// JavaScript Document

var domIE
var domMoz

if(document.getElementById && document.all){
	domIE = true
}

if(document.getElementById &&! document.all){
	domMoz = true
}

//names of dropdowns stored here
dropdown=new Array()
dropdown[0]="drop1"



//code for drops

function showdrop(thelayer){
	keep=thelayer; 
	hideall(); 
	showitnow=1
	showit(thelayer)
	}

function showit(thelayer){
		if (domIE||domMoz){
			document.getElementById(dropdown[thelayer]).style.visibility = "visible"
		}
	}


function hidedrop(){
	keep=-1; setTimeout('hideall()',500)
	}

keep=-1

function hideall(){
	for(i=0;i<dropdown.length;i++){  
		hideit=0; checkmousepos(i)
		if((domIE||domMoz) && keep!=i){
			if(hideit){			
				document.getElementById(dropdown[i]).style.visibility = "hidden"
			}
		}
	}
}

function getmousepos(e){
	if(domIE||domMoz){
		mousex=e.clientX; 
		mousey=e.clientY;
	}
}

function checkmousepos(i){          
	if(domIE||domMoz){  
		x_min = document.getElementById(dropdown[i]).style.pixelLeft
		x_max = document.getElementById(dropdown[i]).scrollWidth + x_min		
		y_min = document.getElementById(dropdown[i]).style.pixelTop
		y_max = document.getElementById(dropdown[i]).scrollHeoght + y_min
	
		
	if (mousex>=x_min && mousex<=x_max && mousey>=y_min && mousey<=y_max){
		hideit=0; 
		setTimeout('hideall()',500)
	}else { 
		hideit=1 
	}
	
	return hideit
	}
}


function layerObject(id,position,left,visibility) {
	this.obj = document.getElementById(id).style;
	this.obj.position = position;
	
	if (left<0){
		this.obj.left = 0
	}else{
		this.obj.left = left + "px";
	}

	this.obj.visibility = visibility;
	return this.obj;
} 


function layerSetup() {
	if (domIE||domMoz){
		width = document.getElementById("centerLayer").style.width
		centerLyr = new layerObject('centerLayer','absolute', available_width/2-(width.slice(0,3)/2),'visible');
	}
}

function centerInit(){
	
	if(domMoz) {
		available_width=innerWidth;
		available_height=innerHeight;
		layerSetup();

	} else if(domIE) {

		available_width=document.body.clientWidth;
		available_height=document.body.clientHeight;
		layerSetup();
	}
}
