/*****************************************************
MouseOver
Copyright (C) 2003
Etcetera Inc
www.etcnj.com
Coder : Ron Endgecomb 2nd
		ron@etcnj.com
*****************************************************/

function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=(navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}

var bw=lib_bwcheck();

function makeObj(obj,nest){
    nest=(!nest) ? "":'document.'+nest+'.'
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
  	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
	this.up=goUp;this.down=goDown;
	this.moveIt=moveIt; this.x=0; this.y=0;
    this.obj = obj + "Object"
    eval(this.obj + "=this")
    return this
}

function getObj(obj){
	this.el=bw.dom?document.getElementsByTagName(obj):bw.ie4?document.all[obj]:bw.ns4?eval('document.'+obj):0;
	return this;
	}

function swapImage(){
	var imgarr=getObj('img');
	var imgPreload=new Array();
	for(var i=0; i<imgarr.el.length; i++){
		imgPreload[i] = new Image();
		temp = imgarr.el[i].getAttribute('src');
		if(temp.indexOf("1.") > -1){
			begin = temp.substring(0,temp.indexOf("1."));
			end = temp.substring(temp.indexOf("1.") + 1, temp.length);
			imgPreload[i] = begin + 2 + end;
			mouseCommands(imgarr.el[i],imgarr.el[i].src,imgPreload[i]);
			}
		}
	}
	
function mouseCommands(img,source,swapimg){
	img.onmouseover = function(){
		img.src = swapimg;
		}
	img.onmouseout = function(){
		img.src = source;
		}	
	}

/*window.onload = function() {
            initializeMenu("infoMenu", "infoActuator", 3, "info");
            initializeMenu("solutionsMenu", "solutionsActuator", 2, "solutions");
            initializeMenu("servicesMenu", "servicesActuator", 0);
            initializeMenu("industryMenu", "industryActuator", 0);
			initializeMenu("documentsMenu", "documentsActuator", 0);
			if (bw.bw){
				 swapImage();
				 }
					
			} */

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

/* Toggle layers Function */
function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
   var obj = document.layers ? document.layers[szDivID] :
   document.getElementById ?  document.getElementById(szDivID).style :
   document.all[szDivID].style;
   obj.visibility = document.layers ? (iState ? "show" : "hide") :
   (iState ? "visible" : "hidden");
}

/* Move my layers  
function myMoveBy (myObj,x,y){
thisObj = document.getElementById(myObj);
thisObj.style.left = parseInt(thisObj.style.left) + x + "px";
thisObj.style.top = parseInt(thisObj.style.top) + y + "px";
}*/
/* Move my layers 
function myMoveBy (myObj,x,y, section){
thisObj = makeObj(myObj, 'divScrollTextCont');
thisObj.css.left = x+px
thisObj.css.top = y+px
//thisSec = makeObj(section, 'divText');

}*/ 

var multipleOpen = null; // 1 YES - null NO
var isSet = null;

function setSections(){
	var secarr=getObj('div');
	for(i=0; i<secarr.el.length; i++){
		tempId = secarr.el[i].getAttribute('id');
		if(tempId.indexOf("section") > -1){
			tempSection = new makeObj(tempId);		
			tempHref = new makeObj(tempId + 'href');
			tempSection.css.display = "none";
			if(isSet == null && tempId == "section1")tempSection.css.display = "block";
			if(isSet == null)setMOCommands(tempSection, tempHref);
			}
		}
	isSet = 1;
	}

function setMOCommands(section, href){

	href.el.onclick = function(){
		/*Taking this code out so at least one thing will always be displayed
		Leaving code here in case we deceide to reimplement
		if(section.css.display == "block"){
			isSet = null;
			if(multipleOpen == null)setSections();
			section.css.display = "none";
			scroll(-20);
			}
		else{*/
			if(multipleOpen == null)setSections();
			section.css.display = "block";			
			scroll(-20);
			//} This needed to come out too
		}
	}
	
function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}
