// Script adds the KB search line to web pages
// to use script add this code to web page 
//	<script language="JavaScript" src="http://www.is.mines.edu/includefiles/KBSearchBAr.js"></script>
//	<script language="JavaScript">
// 	 	define(24,"IS")
//              //define(deptID,"department name")
//	</script>
//
//    BY Jason Stringer
//    5/7/02
//
//





var deptID
var deptname
var top1;
var top2;
var top3;
var navName = navigator.appName ;
var brVer = navigator.userAgent; var brNum; var reg = new RegExp('/');
var testver 


//function to find out the users browser
function verNumIE() {
   
	var brVerId = brVer.indexOf('MSIE');
  	 brNum = brVer.substr(brVerId,8);
   	writeout();

}//end function


function verNumOt() {
   if (navigator.appName == 'Netscape') {
      
       if (parseInt(navigator.appVersion) >= 5 ){
           
           top1 = 53;
           top2 = 18;
           top3 = 17;
            writeout()
        }else{
           
           
             top1 = 10;
           top2 = 31;
           top3 = 32;
          writeoutlayers()
         }
     
  } else {
    //all other bowsers
    top1 = 53;
   top2 = 18;
   top3 = 17;
   writeout()
   
  }
 var brVerId = brVer.search(reg);
   brNum = brVer.substring(brVerId+1);

}//end function






function define(id,name){
	//don't do anything...  Old IS KB is obsolete.
}

/*
function define(id,name){

   //set vars and check browser
	deptID = id;
	deptname = name;
	if (navigator.appName == 'Microsoft Internet Explorer') {
 
  		top1 = 58;
  		top2 = 18;
  		top3 = 19;
   		writeout()
	} else {
 		 verNumOt() ;
  
	}


}//end function
// function to create KB line all W3C standard browsers
*/

function writeout(){

	document.writeln("<div id='QRY'    style='position: absolute; top:"+top1+"; left: 392; width: 305; z-index: 4; height: 40'>"); 
  	document.writeln("<table border='0' cellspacing='0' width='168'>");
	document.writeln("<tr>");
	document.writeln("<td colspan='2' align='center'>");
	//document.writeln("<p align='center'>");
	document.writeln("<font size='1' face='Arial Narrow' color='#FF0000'>Search the "+deptname+" Knowledgebase</font>");
	document.writeln("</td></tr>");

	document.writeln("<tr><td valign='center' width='109'>");
	document.writeln("<form method='POST' name='kbdept' action='http://www.is.mines.edu/kb/index.asp' TARGET=_blank>");
	document.writeln("<input type='hidden' name='deptid' value='"+deptID+"'>");
	document.writeln("<input type='hidden' name='submitted' value='1'>");
	document.writeln("<input type='text' name='query' onClick='cleartext()' size='22' style='font-size: 10px; font-family:Arial; position:absolute; left:0; top:"+top2+"' value='Enter Keywords or *' >");

         var temp
         temp = 
	document.writeln("</form>");
	document.writeln("</td><td valign='bottom' align='center' width='80'>");
	document.writeln("<input type='image' name='searchbttn2' style='position:absolute; left:120; top:"+top3+"' onClick='submitfunction()' src='/includefiles/searchbttn2.gif' border='0' value='search' alt='searches the F&O base of frequently asked questions' ONMOUSEOVER='buttonover(this)' ONMOUSEOUT='buttonout(this)'width='46' height='16'>");

        document.writeln("</td></tr>");

	document.writeln("</table>");
	document.writeln("</div>");
}//end function

// function to create kb line for Netscape 4.0 because it doesn't like div tags  
function writeoutlayers(){

	document.writeln("<layer id='Layer1' width='305' height='40' z-index='4' left='347' top='"+top1+"' >"); 
	document.writeln("<table border='0' cellspacing='0' width='305'>");
	document.writeln("<tr>");
	document.writeln("<td colspan='2'>");
	document.writeln("<p align='left'>");
	document.writeln("<font size='1' face='Arial Narrow' color='#FF0000'>Search the " + deptname + " Knowledgebase</font>");
	document.writeln("</td></tr>");

	document.writeln("<tr><td valign='center' width='305'>");
	document.writeln("<form method='POST' name='kbdept' action='http://www.is.mines.edu/kb/index.asp' TARGET=_blank>");
	document.writeln("<input type='hidden' name='deptid' value='"+deptID+"'>");
	document.writeln("<input type='hidden' name='submitted' value='1'>");
	document.writeln("<input type='text' onClick='cleartext()' name='query' size='19' value='Enter Keywords or *' >");

	document.writeln("<input type='Submit' name='Button' value='Search'  >");
	document.writeln("</form>");


	document.writeln("</table>");
	document.writeln("</layer>");
}

 //function to submit document for W3C browsers
          
function submitfunction(){
	document.kbdept.submit()


}
function buttonover(obj){



	obj.src = 'http://www.is.mines.edu/includefiles/searchbttn2_over.gif'

}
function buttonout(obj){



	obj.src = 'http://www.is.mines.edu/includefiles/searchbttn2.gif'

}
function cleartext(){

	document.kbdept.query.value = "";


}