    var agt=navigator.userAgent.toLowerCase();
    // *** BROWSER VERSION ***
    // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
    var is_major = parseInt(navigator.appVersion);
    var is_minor = parseFloat(navigator.appVersion);
    // Note: Opera and WebTV spoof Navigator.  We do strict client detection.
    // If you want to allow spoofing, take out the tests for opera and webtv.
    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));
    var is_nav4 = (is_nav && (is_major == 4));
    var is_nav4up = (is_nav && (is_major >= 4));
    var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
                          (agt.indexOf("; nav") != -1)) );
    var is_nav6 = (is_nav && (is_major == 5));
    var is_nav6up = (is_nav && (is_major >= 5));
    var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var is_ie3    = (is_ie && (is_major < 4));
    var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
    var is_ie4up  = (is_ie && (is_major >= 4));
    var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
    var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
    var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
    var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
    var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);

    // *** PLATFORM ***
    var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
    var is_mac    = (agt.indexOf("mac")!=-1);
	
	function EditPageOnLoad() {
	// if ( document.forms.length == 0 ) return;
	// formfields.Add(new validatedfield(form1.FirstName, 's', 'First Name', true));
}

function goto_URL(object) {
   window.open(object.options[object.selectedIndex].value,'_top');
}

var a = Math.random(); 
var zzzzadslotzzzz= a * 100000;

function win(fileName) {
     myFloater = window.open('','myWindow','scrollbars=no,status=no,width=610,height=475')
     myFloater.location.href = fileName;
}
function winFlash(fileName) {
     myFloater = window.open('','myWindow','scrollbars=no,status=no,width=465,height=485')
     myFloater.location.href = fileName;
}

function load(file,target) {
    if (target != '')
        target.window.location.href = file;
    else
        window.location.href = file;
}

//calling popup
var expDays = 365; // number of days the cookie should last

var page = "/flash/flash1.html";
var windowprops = "width=465,height=485,location=no,toolbar=no,menubar=no,scrollbars=no";

function GetCookie (name) {  
var arg = name + "=";  
var alen = arg.length;  
var clen = document.cookie.length;  
var i = 0;  
while (i < clen) {    
var j = i + alen;    
if (document.cookie.substring(i, j) == arg)      
return getCookieVal (j);    
i = document.cookie.indexOf(" ", i) + 1;    
if (i == 0) break;   
}  
return null;
}
function SetCookie (name, value) {  
var argv = SetCookie.arguments;  
var argc = SetCookie.arguments.length;  
var expires = (argc > 2) ? argv[2] : null;  
var path = (argc > 3) ? argv[3] : null;  
var domain = (argc > 4) ? argv[4] : null;  
var secure = (argc > 5) ? argv[5] : false;  
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
((path == null) ? "" : ("; path=" + path)) +  
((domain == null) ? "" : ("; domain=" + domain)) +    
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {  
var exp = new Date();  
exp.setTime (exp.getTime() - 1);  
var cval = GetCookie (name);  
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function amt(){
var count = GetCookie('count')
if(count == null) {
SetCookie('count','1')
return 1
}
else {
var newcount = parseInt(count) + 1;
DeleteCookie('count')
SetCookie('count',newcount,exp)
return count
   }
}
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

function checkCount() {
var count = GetCookie('count');
if (count == null) {
count=1;
SetCookie('count', count, exp);

window.open(page, "", windowprops);

}
else {
count++;
SetCookie('count', count, exp);
   }
}

function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',noresize'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}


//calling image zooms
function Zoom(imgName,imgWidth,imgHeight) {
zoomWindow = window.open('', 'zoomWin', 'width='+imgWidth+',height='+imgHeight+'top=10,left=5,toolbar=0,menubar=0,location=0,scrollbars=0')
zoomWindow.document.write("<html><head><title>Loading image, please wait...<\/title><\/head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 text='",imgWidth,imgHeight,"'><center><a href='#' onClick =javascript:window.close()><img src='",imgName,"' alt='Click to Close' border='0'><\/a><\/center><\/body><\/html>")
zoomWindow.focus()
zoomWindow.window.resizeTo(imgWidth+8, imgHeight+29);
zoomWindow.document.title = "Automobile Magazine"
}

//dushaneZoom with no size limit
function dushaneZoom(purl){
	patsy=window.open('','patsy','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=400,height=200,top=10,left=5');
	patsy.document.writeln('<html><head><title>Loading image, please wait...</title>');
	patsy.document.writeln('<script language="javascript">');
	patsy.document.writeln('var NS = (navigator.appName=="Netscape")?true:false;');
	patsy.document.writeln('function eddie() {');
	patsy.document.writeln('fwidth = (NS)?window.innerWidth:document.body.clientWidth;');
	patsy.document.writeln('fheight = (NS)?window.innerHeight:document.body.clientHeight;');
	patsy.document.writeln('dwidth = document.images[0].width - fwidth');
	patsy.document.writeln('dheight = document.images[0].height - fheight;');
	patsy.document.writeln('this.window.resizeBy(dwidth, dheight);');
	patsy.document.writeln('this.document.title = "Automobile Magazine"');
	patsy.document.writeln('self.focus();');
	patsy.document.writeln('};');
	patsy.document.write('</script>  ');
	patsy.document.write('</head>'); patsy.document.write('<body bgcolor=#000000 text=#FFFFFF leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onLoad=eddie()>'); 
	patsy.document.write('<a href="javascript:window.close();"><img src=' + purl + ' border=0></a></body></html>'); 
	patsy.document.close(); }

//popup window stuff
var newWindow1;
function openWindow(url,w,h,nam,x,y)
{
  //if (x == undefined) { x = screen.width/2;}
  //if (y == undefined) { y = screen.height/2;}
  //if (x == undefined) { x = 0;}
  //if (y == undefined) { y = 0;}
  //alert(w + "," + h + "," + x + "," + y);
  var bName = navigator.appName;
  var bVer = parseInt(navigator.appVersion);
  var NS3 = (bName == "Netscape" && bVer >= 3);
  var IE5 = (bName == "Microsoft Internet Explorer" && bVer >= 5);
  var IE4 = (bName == "Microsoft Internet Explorer" && bVer >= 4);
  if (nam == ""){
    nam = "popwin"
  }
  if (!newWindow1 || newWindow1.closed)
    newWindow1 = window.open(url, nam, "toolbar=no,location=no,scrollbars=no,resizable=no,status=yes,width=" + w +",height=" + h + ",left=" + x + ",top=" + y + ",alwaysRaised", true);
  else
  {      
    newWindow1.location=url;
    newWindow1.focus();
  }
}

//script for top navigation
var persistmenu="yes"
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only
var pagenum;

function baseurl() {
    var urlparts = new Array();
    var testURL = 'http://www.automobilemag.com/used_cars/jsdkfjsk';
    urlparts = document.URL.split('.com/');
    if( urlparts.length > 1 ){
        var partone = urlparts[1];
        urlparts = partone.split('/');
    }
    return urlparts[0];
}

if (document.getElementById){
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj, obj2){
    if(document.getElementById){
    var el = document.getElementById(obj);
    var topel = document.getElementById(obj2);
    var ar = document.getElementById("masterdiv").getElementsByTagName("span");
        if(el.style.display != "block"){
            for (var i=0; i<ar.length; i++){
                if (ar[i].className=="submenu")
                ar[i].style.display = "none";
            }
            el.style.display = "block";
        }

        for (var i=1; i<=10;i++){
            if(i != pagenum){	            
                var cur = document.getElementById("top"+i);
                cur.style.background = '#f1f1f1';
                cur.style.color = '#525252';                
            }
        }

        if(obj2 != "top"+pagenum){
            topel.style.background = "url('http://www.automobilemag.com/images_nd/navbg_on2.gif') repeat-x";
        }
            topel.style.color = '#ffffff';
    }
}

function SwitchMenuOut(aEvent){
    var myEvent = window.event ? window.event : aEvent;
    var found = 0;

    if( window.event){
        if( myEvent.toElement.parentNode.nodeName != "#document" ){
            if(myEvent.toElement.parentNode.id  == "masterdiv"){
                found = 1;
            }else if(myEvent.toElement.parentNode.parentNode.nodeName != "#document"){
                if(myEvent.toElement.parentNode.parentNode.id == "masterdiv"){
                    found = 1;
                } else if( myEvent.toElement.parentNode.parentNode.parentNode.nodeName != "#document"){
                    if(myEvent.toElement.parentNode.parentNode.parentNode.id == "masterdiv"){
                        found = 1;
                    } else if( myEvent.toElement.parentNode.parentNode.parentNode.parentNode.nodeName != "#document"){
                    if(myEvent.toElement.parentNode.parentNode.parentNode.parentNode.id == "masterdiv"){
                        found = 1;
                    }
                }
                }
            }
        }
    } else {
        if( myEvent) {
			if( myEvent.relatedTarget){
	            if( myEvent.relatedTarget.parentNode.nodeName != "#document" ){
	                if(myEvent.relatedTarget.parentNode.id  == "masterdiv"){
	                    found = 1;
	                }else if(myEvent.relatedTarget.parentNode.parentNode.nodeName != "#document"){
	                    if(myEvent.relatedTarget.parentNode.parentNode.id == "masterdiv"){
	                        found = 1;
	                    } else if( myEvent.relatedTarget.parentNode.parentNode.parentNode.nodeName != "#document"){
	                        if(myEvent.relatedTarget.parentNode.parentNode.parentNode.id == "masterdiv"){
	                            found = 1;
	                        } else if( myEvent.relatedTarget.parentNode.parentNode.parentNode.parentNode.nodeName != "#document"){
	                        if(myEvent.relatedTarget.parentNode.parentNode.parentNode.parentNode.id == "masterdiv"){
	                            found = 1;
	                        }
	                    }
	                    }
	                }
	            }
			}
        } else {
			found = 1;
		}
    }

    if( found == 0 ){
        for (var i=1; i<=10;i++){
            document.getElementById("sub"+i).style.display = "none";
            if(i != pagenum){                
                document.getElementById("top"+i).style.background = '#f1f1f1';
                document.getElementById("top"+i).style.color = '#525252';
            } else {
                document.getElementById("sub"+i).style.display = "block";
            }
        }
    }
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
}

var dirname = baseurl();

if( dirname == 'new_cars')
    pagenum = 1;
else if( dirname == 'used_cars')
    pagenum = 2;
else if( dirname == 'reviews')
    pagenum = 3;
else if( dirname == 'auto_shows')
    pagenum = 4;
else if( dirname == 'future_cars')
    pagenum = 5;
else if( dirname == 'multimedia')
    pagenum = 6;
else if( dirname == 'features')
    pagenum = 7;

if( pagenum ){
    document.getElementById("sub"+pagenum).style.display="block";
    document.getElementById("top"+pagenum).style.background = "url('http://www.automobilemag.com/images_nd/navbg_on.gif') repeat-x";
    document.getElementById("top"+pagenum).style.color = "#ffffff";
}
}

function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid=inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate