// ***** Btn Rollover *****
function roll(imgName,imgState) {
	document.images[imgName].src = imgState
}
// ***********************************************************************

// ***** Preload Rollover Images ***************************************
if (document.images) {
	image1 = new Image(); image1.src = "/images/nav/about_interface_ON.gif";
	image2 = new Image(); image2.src = "/images/nav/contact_us_ON.gif";
	image3 = new Image(); image3.src = "/images/nav/market_segments_ON.gif";
	image4 = new Image(); image4.src = "/images/nav/products_ON.gif";
	image5 = new Image(); image5.src = "/images/nav/sample_basket_ON.gif";

	image100 = new Image(); image100.src = "/images/spacer.gif";
}
// *********************************************************************

// *********************************************************************
// Function to create pop-up windows at a custom size.
// w = width
// h = height
// d = directories
// l = location
// m = menubar
// r = resizeable
// sc = scrollbars
// st = status
// t = toolbar
// EXAMPLE CALL: <a href="javascript:popUp('[URL]','[WINDOW NAME]',400,300,1,1,0,0,0,0,0);">LINK</a>
// *********************************************************************
function popUp(URL,name,w,h,d,l,m,r,sc,st,t) {
	var featureStr = "";
	featureStr = "width=" + w + ",height=" + h + ",directories=" + d + ",location=" + l + ",menubar=" + m + ",resizable=" + r + ",scrollbars=" + sc + ",status=" + st + ",toolbar=" + t;
	window.open(URL,name,featureStr);
}

// ***** Show/Hide for email, save, print page icons ***************************************
var state = "none"; 
function showHideUtility(layer) { 
	if (state == "block") { 
		state = "none"; 
	} else { 
		state = "block"; 
	} 
	if (document.getElementById) {
		eval( "document.getElementById('" + layer + "').style.display = state"); 
	}
}
// *********************************************************************

// *********************************************************************
function returnimgcode(theimg) {
	var imghtml = ""
	if (theimg[1] != "") imghtml = '<a href="' + theimg[1] + '" target="' + optlinktarget + '">'
	imghtml += '<img src="' + theimg[0] + '" border="' + imgborderwidth + '">'
	if (theimg[1] != "") imghtml += '</a>'
	imghtml += '<br><br><p>' + theimg[2] + '</p>'
	return imghtml
}
function modifyimage(loadarea, imgindex) {
	if (document.getElementById) {
	var imgobj = document.getElementById(loadarea)
	if (imgobj.filters && window.createPopup) {
	imgobj.style.filter = filterstring
	imgobj.filters[0].Apply()
	}
	imgobj.innerHTML = returnimgcode(dynimages[imgindex])
	if (imgobj.filters && window.createPopup)
	imgobj.filters[0].Play()
	return false
	}
}

// *********************************************************************

// ***** Show/Hide Div blocks that need to replace each other  ***************************************
function hideAll() {
	if (document.getElementById) {
		var index = 0;
		while (document.getElementById("block" + index)) {
			document.getElementById("block" + index).style.display="none";
			index++;
		}
	}
}
function showBlock(index) {
	var currentId = "block" + index;
	hideAll();
	document.getElementById(currentId).style.display = "block";
}
// *********************************************************************


// ***** Show/Hide Dynamic DIV Popup Window (ex: ProductInformation - View Larger)  ***************************************
/*
function PopupRequestProcessor( reqtype, reqreq )
{
	this.popType = reqtype;
	this.popReq  = reqreq;
	this.popProcess = function(){
		alert("processStateChange type = " + this.popType);
	   	if ( this.popReq.readyState == 4 ) {
		alert("are you in this function");
	      	var divToProcess = document.getElementById( this.popType );
			alert("divToProcess = " + divToProcess);
	      	divToProcess.innerHTML = popReq.responseText;
	      	divToProcess.style.display = 'block';
	   	}
		};
	reqreq.onreadystatechange = this.popProcess;
}




var req;
	
function showPopUp( type, url ) {
	alert( "showPopUp type = " + type );
   	if ( window.XMLHttpRequest) {
      	document.getElementById( type ).style.display = 'block';
      	req = new XMLHttpRequest();
		
      	req.onreadystatechange = new function() { 
			if ( req.readyState == 4 ) {
			alert("ready state = 4");
		      	var divToProcess = document.getElementById( type );
				alert("divToProcess = " + divToProcess);
		      	divToProcess.innerHTML = req.responseText;
		      	divToProcess.style.display = 'block';
		   	}
		};
		req.onreadystatechange.type = type;
		
      	try{
         	req.open( "GET", url, true );
      	} catch( e ){}

      	req.send( null );
   	} else if( window.ActiveXObject ) {
      	req = new ActiveXObject( "Microsoft.XMLHTTP" );
      	if ( req ) {

			var myPop = new PopupRequestProcessor( type, req );
			alert( "Hello Again" );
         	req.open( "GET", url, true );
         	req.send();
      	}
   	}
}

function processStateChange( type ) {
	alert("processStateChange type = " + type);
   	if ( req.readyState == 4 ) {
	alert("are you in this function");
      	var divToProcess = document.getElementById( type );
		alert("divToProcess = " + divToProcess);
      	divToProcess.innerHTML = req.responseText;
      	divToProcess.style.display = 'block';
   	}
}
*/

var req;

function showPopUp( type, url ) {
	var popType = type;
   	if( window.XMLHttpRequest) {
      	document.getElementById( "popUp" ).style.display = 'block';
      	req = new XMLHttpRequest();
      	req.onreadystatechange = processStateChange;
      	try {
         	req.open( "GET", url, true );
      	} catch( e ) {}

      	req.send( null );
   	} else if( window.ActiveXObject ) {
      	req = new ActiveXObject( "Microsoft.XMLHTTP" );
      	if( req ) {
         	req.onreadystatechange = processStateChange;
         	req.open( "GET", url, true );
         	req.send();
      	}
   	}
}

function processStateChange() {
   	if( req.readyState == 4 ) {
      	var divToProcess = document.getElementById( "popUp" );
      	divToProcess.innerHTML = req.responseText;
      	divToProcess.style.display = 'block';
   	}
}

function closeParent() {
   	document.getElementById( "popUp" ).style.display = 'none';
}



var req2;

function showPopUpLogin( type, url ) {
	var popType = type;
   	if( window.XMLHttpRequest) {
      	document.getElementById( "popUpLogin" ).style.display = 'block';
      	req2 = new XMLHttpRequest();
      	req2.onreadystatechange = processStateChange2;
      	try {
         	req.open( "GET", url, true );
      	} catch( e ) {}

      	req2.send( null );
   	} else if( window.ActiveXObject ) {
      	req2 = new ActiveXObject( "Microsoft.XMLHTTP" );
      	if( req2 ) {
         	req2.onreadystatechange = processStateChange2;
         	req2.open( "GET", url, true );
         	req2.send();
      	}
   	}
}
function processStateChange2() {
   	if( req2.readyState == 4 ) {
      	var divToProcess = document.getElementById( "popUpLogin" );
      	divToProcess.innerHTML = req2.responseText;
      	divToProcess.style.display = 'block';
   	}
}

function closeParentLogin( type ) {
   	document.getElementById( "popUpLogin" ).style.display = 'none';
}


/*
var req;
	
function showPopUp( url ){
   if( window.XMLHttpRequest){
      document.getElementById( "popUp" ).style.display = 'block';
      req = new XMLHttpRequest();
      req.onreadystatechange = processStateChange;
      try{
         req.open( "GET", url, true );
      }catch( e ){}

      req.send( null );
   }else if( window.ActiveXObject ){
      req = new ActiveXObject( "Microsoft.XMLHTTP" );
      if( req ){
         req.onreadystatechange = processStateChange;
         req.open( "GET", url, true );
         req.send();
      }
   }
}

function processStateChange(){
   if( req.readyState == 4 ){
      var divToProcess = document.getElementById( "popUp" );
      divToProcess.innerHTML = req.responseText;
      divToProcess.style.display = 'block';
   }
}

function closeParent(){
   document.getElementById( "popUp" ).style.display = 'none';
}
*/


// *********************************************************************


// ***** Show/Hide Dynamic Tool Tips for "What is this?" links  ***************************************
var tipwidth='300px' //default tooltip width
var tipbgcolor='#E3E3E3'  //tooltip bgcolor
var disappeardelay=100  //tooltip disappear speed onMouseout (in miliseconds)
var vertical_offset="0px" //horizontal offset of tooltip from anchor link
var horizontal_offset="-3px" //horizontal offset of tooltip from anchor link

//No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="toolTipDiv" style="visibility:hidden;width:'+tipwidth+';background-color:'+tipbgcolor+'" ></div>')

function getposOffset(what, offsettype){
	var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
return totaloffset;
}


function showhide(obj, e, visible, hidden, tipwidth){
	if (ie4||ns6)
		dropmenuobj.style.left=dropmenuobj.style.top=-500
	if (tipwidth!=""){
		dropmenuobj.widthobj=dropmenuobj.style
		dropmenuobj.widthobj.width=tipwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
	obj.visibility=visible
else if (e.type=="click")
	obj.visibility=hidden
}

function iecompattest(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
	var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
	if (whichedge=="rightedge"){
		var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
		dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
	if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
		edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
	var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
	dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
	if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
		edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
}
return edgeoffset
}

function toolTip(menucontents, obj, e, tipwidth){
	if (window.event) event.cancelBubble=true
	else if (e.stopPropagation) e.stopPropagation()
		clearhidetip()
		dropmenuobj=document.getElementById? document.getElementById("toolTipDiv") : toolTipDiv
		dropmenuobj.innerHTML=menucontents

	if (ie4||ns6){
		showhide(dropmenuobj.style, e, "visible", "hidden", tipwidth)
		dropmenuobj.x=getposOffset(obj, "left")
		dropmenuobj.y=getposOffset(obj, "top")
		dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
		dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
	}
}

function hidetip(e){
	if (typeof dropmenuobj!="undefined"){
		if (ie4||ns6)
			dropmenuobj.style.visibility="hidden"
	}
}

function delayhidetip(){
	if (ie4||ns6)
		delayhide=setTimeout("hidetip()",disappeardelay)
}

function clearhidetip(){
	if (typeof delayhide!="undefined")
		clearTimeout(delayhide)
}
// *********************************************************************