/*Browsercheck object*/
function cm_bwcheck(){
	//In theory we should use object detection, but this script needs work-arounds for almost every browser...
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent.toLowerCase()
	this.dom=document.getElementById?1:0
	this.ns4=(!this.dom && document.layers)?1:0;
	this.op=window.opera 
	this.moz=(this.agent.indexOf("gecko")>-1 || window.sidebar)
	this.ie=this.agent.indexOf("msie")>-1 && !this.op
	if(this.op){
		this.op5=(this.agent.indexOf("opera 5")>-1 || this.agent.indexOf("opera/5")>-1)
		this.op6=(this.agent.indexOf("opera 6")>-1 || this.agent.indexOf("opera/6")>-1)
		this.op7=this.dom&&!this.op5&&!this.op6 //So all higher opera versions will use it
	}else if(this.moz) this.ns6 = 1
	else if(this.ie){
		this.ie4 = !this.dom && document.all
  	this.ie5 = (this.agent.indexOf("msie 5")>-1)
  	this.ie55 = (this.ie5 && this.agent.indexOf("msie 5.5")>-1)
  	this.ie6 = this.dom && !this.ie4 && !this.ie5 && ! this.ie55
	}
	this.mac=(this.agent.indexOf("mac")>-1)
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.op5 || this.op6 || this.op7)
  this.usedom= this.ns6||this.op7//Use dom creation
  this.reuse = this.ie||this.op7||this.usedom //Reuse layers
  this.px=this.dom&&!this.op5?"px":""
	return this
}
var bw=new cm_bwcheck()

window.onerror = null;

 var menuActive = 0
 var menuOn = 0
 var onLayer
 var timeOn = null// LAYER SWITCHING CODE


function getSearchPosition(layerParentName, layerName) {
	if(document.layers){
		h = document.layers[layerName].top;
	}
	if(document.all){
		h=document.all[layerParentName].offsetHeight - document.all[layerName].offsetHeight - 21;
	}	
	if(document.getElementById){
		h=document.getElementById(layerParentName).offsetHeight - document.getElementById(layerName).offsetHeight - 25;	
	}
showLayer('Search', h);
}
 
// SHOW MENU
function showLayer(layerName, h){
 if (timeOn != null) {
	 clearTimeout(timeOn)
	 hideLayer(onLayer)
 }
 if(!(bw.op5 || bw.op6)) {
	if(document.layers){
		document.Search.top=h;	
		document.Search.visibility="visible";
		document.body.captureEvents("Event.MOUSEDOWN"); document.body.onmousedown=hideLayer(onLayer)
	}
	if(document.all){
		document.all.Search.style.top=h;
		document.all.Search.style.visibility="visible";
	}
	if(document.getElementById){
		document.getElementById("Search").style.top=h;
		document.getElementById("Search").style.visibility="visible";
	}
 onLayer = layerName
 hLayer = h	
}
}

// HIDE MENU
function hideLayer(layerName){
 if (menuActive == 0) {
	if(document.layers){
		document.Search.visibility="hidden";
	}
	if(document.all){
		document.all.Search.style.visibility="hidden";
	}
	if(document.getElementById){
		document.getElementById("Search").style.visibility="hidden";
	}
 }
}

// TIMER FOR BUTTON MOUSE OUT
function btnTimer() {
	if(document.layers) {
		document.captureEvents("Event.MOUSEOVER"); document.onmouseover=showLayer(onLayer)
 	}
	else{
		 timeOn = setTimeout("btnOut()",1000)
	}
//alert(timeOn)
}

// BUTTON MOUSE OUT
function btnOut(layerName) {
	 if (menuActive == 0) {
	 hideLayer(onLayer)
 }
}

// MENU MOUSE OVER 
function menuOver(itemName) {
	 clearTimeout(timeOn);
	 menuActive = 1
}

// MENU MOUSE OUT 
function menuOut(itemName) {
	 menuActive = 0 
	 timeOn = setTimeout("hideLayer(onLayer)", 200)
 }

 