//Browser check & redirect

// JavaScript Browser Sniffer
// Eric Krok, Andy King, Michel Plungjan Jan. 31, 2002
// see http://www.webreference.com/ for more information
var agt=navigator.userAgent.toLowerCase();
var appVer = navigator.appVersion.toLowerCase();

// *** BROWSER VERSION ***

var is_minor = parseFloat(appVer);
var is_major = parseInt(is_minor);

var is_opera = (agt.indexOf('opera') != -1);

var is_ff = (agt.indexOf('firefox/') != -1);

var iePos  = appVer.indexOf('msie');
if (iePos !=-1) {
	is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)));  //added missing ; - 030617 - bdn
	is_major = parseInt(is_minor);
}

    // ditto Konqueror
                                      
    var is_konq = false;
    var kqPos   = agt.indexOf('konqueror');
    if (kqPos !=-1) {                 
       is_konq  = true;
       is_minor = parseFloat(agt.substring(kqPos+10,agt.indexOf(';',kqPos)));
       is_major = parseInt(is_minor);
    }                                 

    var is_getElementById   = (document.getElementById) ? "true" : "false"; // 001121-abk
    var is_getElementsByTagName = (document.getElementsByTagName) ? "true" : "false"; // 001127-abk
    var is_documentElement = (document.documentElement) ? "true" : "false"; // 001121-abk

    var is_safari = ((agt.indexOf('safari')!=-1)&&(agt.indexOf('mac')!=-1))?true:false;
    var is_khtml  = (is_safari || is_konq);

    var is_gecko = ((!is_khtml)&&(navigator.product)&&(navigator.product.toLowerCase()=="gecko"))?true:false;
    var is_gver  = 0;
    if (is_gecko) is_gver=navigator.productSub;

    var is_moz   = ((agt.indexOf('mozilla/5')!=-1) && (agt.indexOf('spoofer')==-1) &&
                    (agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1)  &&
                    (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)     &&
                    (is_gecko) && 
                    ((navigator.vendor=="")||(navigator.vendor=="Mozilla")));
    if (is_moz) {
       var is_moz_ver = (navigator.vendorSub)?navigator.vendorSub:0;
       if(!(is_moz_ver)) {
           is_moz_ver = agt.indexOf('rv:');
           is_moz_ver = agt.substring(is_moz_ver+3);
           is_paren   = is_moz_ver.indexOf(')');
           is_moz_ver = is_moz_ver.substring(0,is_paren);
       }
       is_minor = is_moz_ver;
       is_major = parseInt(is_moz_ver);
    }

var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
	&& (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
	&& (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)
	&& (!is_khtml) && (!(is_moz))) && (agt.indexOf('firefox/')==-1);

if ((navigator.vendor)&&
	((navigator.vendor=="Netscape6")||(navigator.vendor=="Netscape"))&&
	(is_nav)) {
		is_major = parseInt(navigator.vendorSub);
		// here we need is_minor as a valid float for testing. We'll
		// revert to the actual content before printing the result. 
		is_minor = parseFloat(navigator.vendorSub);
}

var is_nav2 = (is_nav && (is_major == 2));
var is_nav3 = (is_nav && (is_major == 3));
var is_nav4 = (is_nav && (is_major == 4));
var is_nav4up = (is_nav && is_minor >= 4);  // changed to is_minor for
                                                // consistency - dmr, 011001
var is_navonly = (is_nav && ((agt.indexOf(";nav") != -1) || (agt.indexOf("; nav") != -1)) );

var is_nav6   = (is_nav && is_major==6);    // new 010118 mhp
var is_nav6up = (is_nav && is_minor >= 6); // new 010118 mhp, added missing ; - 030617 - bdn

var is_nav5   = (is_nav && is_major == 5 && !is_nav6); // checked for ns6
var is_nav5up = (is_nav && is_minor >= 5);

var is_nav7   = (is_nav && is_major == 7);
var is_nav7up = (is_nav && is_minor >= 7);

var is_ie   = ((iePos!=-1) && (!is_opera) && (!is_khtml));
var is_ie3  = (is_ie && (is_major < 4));

var is_ie4   = (is_ie && is_major == 4);
var is_ie4up = (is_ie && is_minor >= 4);
var is_ie5   = (is_ie && is_major == 5);
var is_ie5up = (is_ie && is_minor >= 5);
    
var is_ie5_5  = (is_ie && (agt.indexOf("msie 5.5") !=-1)); // 020128 new - abk
var is_ie5_5up =(is_ie && is_minor >= 5.5);                // 020128 new - abk
	
var is_ie6   = (is_ie && is_major == 6);
var is_ie6up = (is_ie && is_minor >= 6);
		
//alert(is_ff);
//alert("is ie="+is_ie+" is nav="+is_nav);
//alert("ie4="+is_ie4+"ie5up="+is_ie5up+"nav4="+is_nav4+"nav5="+is_nav5+"nav6up="+is_nav6up);
if (is_ff == false){
if(is_ie && is_ie5up == false){
	window.location = "recommendations.htm";
} else if (is_nav && is_nav6up == false){
	window.location = "recommendations.htm";
} 
}
//--------------------------------------------------------------------

function mmLoadMenus() {
  if (window.mm_menu_0120152627_0) return;
              window.mm_menu_0120152627_0 = new Menu("root",95,17,"Verdana, Arial, Helvetica, sans-serif",11,"#FFFFFF","#FFFFFF","#2E546A","#627F8F","left","middle",3,0,500,-5,7,true,false,true,0,true,true);
  mm_menu_0120152627_0.addMenuItem("New Item 1","location='untitled.asp'");
  mm_menu_0120152627_0.addMenuItem("New Item 2","location='untitled.asp'");
  mm_menu_0120152627_0.addMenuItem("New Item 3","location='untitled.asp'");
   mm_menu_0120152627_0.hideOnMouseOut=true;
   mm_menu_0120152627_0.bgColor='#555555';
   mm_menu_0120152627_0.menuBorder=1;
   mm_menu_0120152627_0.menuLiteBgColor='#FFFFFF';
   mm_menu_0120152627_0.menuBorderBgColor='#777777';
	 
    window.mm_menu_0121085959_0 = new Menu("root",147,17,"Verdana, Arial, Helvetica, sans-serif",11,"#FFFFFF","#FFFFFF","#2E546A","#627F8F","left","middle",3,0,500,-5,7,true,false,true,0,true,true);
  mm_menu_0121085959_0.addMenuItem("Accounting","location='sol01.asp'");
  mm_menu_0121085959_0.addMenuItem("Service","location='sol02.asp'");
  mm_menu_0121085959_0.addMenuItem("Parts","location='sol03.asp'");
  mm_menu_0121085959_0.addMenuItem("TrafficCop","location='trafficCop.asp'");
  mm_menu_0121085959_0.addMenuItem("Finance&nbsp;&&nbsp;Insurance","location='sol05.asp'");
  mm_menu_0121085959_0.addMenuItem("DCS","location='sol06.asp'");
   mm_menu_0121085959_0.hideOnMouseOut=true;
   mm_menu_0121085959_0.bgColor='#555555';
   mm_menu_0121085959_0.menuBorder=1;
   mm_menu_0121085959_0.menuLiteBgColor='#FFFFFF';
   mm_menu_0121085959_0.menuBorderBgColor='#777777';
window.mm_menu_0121130913_0 = new Menu("root",95,17,"Verdana, Arial, Helvetica, sans-serif",11,"#FFFFFF","#FFFFFF","#2E546A","#627F8F","left","middle",3,0,500,-5,7,true,false,true,0,true,true);
  mm_menu_0121130913_0.addMenuItem("New&nbsp;Item&nbsp;1","location='#'");
  mm_menu_0121130913_0.addMenuItem("New&nbsp;Item&nbsp;2","location='#'");
   mm_menu_0121130913_0.hideOnMouseOut=true;
   mm_menu_0121130913_0.bgColor='#555555';
   mm_menu_0121130913_0.menuBorder=1;
   mm_menu_0121130913_0.menuLiteBgColor='#FFFFFF';
   mm_menu_0121130913_0.menuBorderBgColor='#777777';

mm_menu_0121130913_0.writeMenus();
} // mmLoadMenus()<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
// Example: obj = findObj("image1");
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}

function changeProp(id,styleProp,val){
	//alert("changeProp");
	if(document.getElementById){
		id.style[styleProp] = val;
	}else if(document.all){
		id.style[styleProp] = val;
	}
	else if(document.layers){
		id[styleProp] = val;
	}
}
function getPixel(navItem,cmd){
	if(document.getElementById){
	div = navItem;
	//div = document.getElementById([navItem])
		if(cmd == "height"){
			//alert(h = (div.offsetHeight ? div.offsetHeight :  div.style.height ? parseInt( div.style.height ) : 0));
			return (div.offsetHeight ? div.offsetHeight :  div.style.height ? parseInt( div.style.height ) : 0);
		}else{
			//in this comment u see at the end I added a number that is if the element we are checking has it's top style value set - if it doesn't don't add a number
			//alert(hPos = (div.offsetHeight ? div.offsetHeight :  div.style.height ? parseInt( div.style.height ) : 0) + parseInt(div.style.top));
			//alert(hPos = (div.offsetHeight ? div.offsetHeight :  div.style.height ? parseInt( div.style.height ) : 0));
			return (div.offsetHeight ? div.offsetHeight :  div.style.height ? parseInt( div.style.height ) : 0);
		}
	}
}
function setBorders(){
	//alert("setBorders");
	setNav();
	changeProp(findObj('brcorner'),'top',getPixel(findObj('content'),'pos')+71);
	changeProp(findObj('rtborder'),'height',getPixel(findObj('content'),'pos')-16);
	changeProp(findObj('footer2'),'top',getPixel(findObj('content'),'pos')+67);
}
//SET ACTIVE NAV ITEM BG COLOR
function setNav() {
	var test = document.location.pathname;
	var test2 = test.split("/");
	var test3 = test2[test2.length-1];
	if (test3=="corp01.asp") {
		changeProp(findObj('nav_corp'),'backgroundColor','#627F8F');
	}
	else if (test3=="prod01.asp") {
		changeProp(findObj('nav_prod'),'backgroundColor','#627F8F');
	}
	else if (test3=="serv01.asp") {
		changeProp(findObj('nav_svcs'),'backgroundColor','#627F8F');
	}
	else if (test3=="sol01.asp") {
		changeProp(findObj('nav_sol'),'backgroundColor','#627F8F');
	}
	else if (test3=="sol02.asp") {
		changeProp(findObj('nav_sol'),'backgroundColor','#627F8F');
	}
	else if (test3=="sol03.asp") {
		changeProp(findObj('nav_sol'),'backgroundColor','#627F8F');
	}
	else if (test3=="sol04.asp") {
		changeProp(findObj('nav_sol'),'backgroundColor','#627F8F');
	}
	else if (test3=="sol05.asp") {
		changeProp(findObj('nav_sol'),'backgroundColor','#627F8F');
	}
	else if (test3=="sol06.asp") {
		changeProp(findObj('nav_sol'),'backgroundColor','#627F8F');
	}
	else if (test3=="tech01.asp") {
		changeProp(findObj('nav_tech'),'backgroundColor','#627F8F');
	}
	else if (test3.indexOf("news.asp") != -1) {
		changeProp(findObj('nav_news'),'backgroundColor','#627F8F');
	}
}

