/***Global JavaScript utility functions***/// global variablesvar ua = navigator.userAgent.toLowerCase();var nn4 = document.layers ? 1:0var nn6 = (document.getElementById && (ua.indexOf('netscape') != -1)) ? 1:0var dom = document.getElementById ? 1:0var ie = (ua.indexOf('msie') != -1) ? 1:0var ie4 = (document.all && !document.getElementById) ? 1:0var mac = (ua.indexOf('mac') != -1) ? 1:0var out = new Array();	// out rolloversvar over = new Array(); // over rollovers// dhtml DOM selectorfunction getDOM(div){	if (ie4) 	{		return document.all[div].style; 	}	if (dom) 	{		return document.getElementById(div).style;	}		if (nn4) 	{		return document.layers[div];	}}// hide a layer// Addition if statment added by Matt to stop Netscape error - Jan 3, 2003function hideLyr(div){	if (getDOM(div)) {		getDOM(div).visibility = "hidden";	}}// show a layer// Addition if statment added by Matt to stop Netscape error - Jan 3, 2003function showLyr(div){	if (getDOM(div)) {		getDOM(div).visibility = "visible";	}}// close the imagesfunction subimgClose(){	for (i=0; i<subimgs.length; i++)	{		hideLyr(subimgs[i]);	}}// return layer visibilityfunction getLyrVis(div){	if ((getDOM(div).visibility == "visible") || (getDOM(div).visibility == "show"))	{		return true;	}	else	{		return false;	}	}// hide a bunch of layers, then show one the// last one (last param passed)function vis(){	var divs = vis.arguments;	var len = divs.length;	if (len == 1) 	{		showLyr(divs[0]);		menuOn = divs[0];		return;	}	for (i=0; i<len; i++)	{		hideLyr(divs[i]);	}	}/* Function cssFix and nnCheck performs a soft reload of the page in netscape browsers to fix the Netscape CSS positioning bug. */function cssFix() {  if (document.cssFix.initWindowWidth != window.innerWidth || document.cssFix.initWindowHeight != window.innerHeight) {    history.go(0);  }}function nnCheck() {  if (document.layers) {      document.cssFix = new Object;      document.cssFix.initWindowWidth = window.innerWidth;      document.cssFix.initWindowHeight = window.innerHeight;      window.onresize = cssFix;  }  }nnCheck();function do_nothing () {	return true;}// Removes the focus from the linksfunction removeFocus() {	empty_var = do_nothing();   	for (i = 0; i < document.links.length; i++) {        document.links[i].blur;    }}//document.onmousedown = removeFocus;//document.onmouseup = removeFocus;//document.onfocus = removeFocus;// Accepts an array of divs turns them all invisible// and then makes visible one divfunction switchDivs(div, arrayDivs){	len = arrayDivs.length;	if (len != 1) {					for (i=0; i<len; i++) {			hideLyr(arrayDivs[i]);		}		showLyr(div);	}}/***** OPEN A  NEW WINDOW WITH SELECTED IMAGE AND BACKGROUND ******/function displayImageWin(imagePath, bgcolor, vehicleName, redbar) {  if (redbar == true) {    }  window.onerror = null;  PreView=window.open("","Preview","width=701,height=521,menubar=yes,status=yes");  PreView.document.open();  PreView.document.write("<HTML><HEAD>");  PreView.document.write("<TITLE>" + vehicleName + ": Photo</TITLE>");  PreView.document.write("</HEAD><BODY MARGINHEIGHT='0' MARGINWIDTH='0' LEFTMARGIN='0' TOPMARGIN='0' BGCOLOR='#" + bgcolor + "' TEXT='000000'>");  PreView.document.write("<TABLE BORDER='0' cellpadding='0' cellspacing='0' HEIGHT='100%' WIDTH='100%'>");  if (redbar == true) {	PreView.document.write("<TR><TD height='64' ALIGN='left' bgcolor='#D60010'><img src='/NWS/media/shared/h_toyota_mtb.gif' width='181' height='63'></TD></TR>");//  	PreView.document.write("<TR><TD height='64' ALIGN='left' bgcolor='#D60010'><img src='/NWS/media/shared/ico_logo.gif' width='116' height='63'></TD></TR>");  }  PreView.document.write("<TR><TD ALIGN='center' VALIGN='middle'>");  PreView.document.write("<IMG SRC='" + imagePath + "'>");  PreView.document.write("</TD></TR></TABLE>");  PreView.document.write("</BODY></HTML>");  PreView.document.close();  PreView.focus();}/************ OPENS PDF BROCHURE ***************/function pdf (brochure) {	window4=window.open(brochure,'EBrochure','status=yes,scrollbars=yes,resizable=yes,menubar=yes');	if (navigator.appVersion.substring(0,1) >= "3") {window4.focus()};}// mouseovers for the bullets in the Echo & Celica sectionsfunction bulletMon(bulletNum, div, num) {	if (!num) {		num = 1;	}	if (nn4 && div) 	{		document[div].document["img"+bulletNum].src = over[num].src;      }     else     {    	document["img"+bulletNum].src = over[num].src;                      }}// mouseouts for the bullets in the Echo & Celica sectionsfunction bulletMoff(bulletNum, div, menuSelect, num) {	if (!num) {		num = 1;	}	if ((bulletNum != menuSelect) && (bulletNum!=0))	{		if (nn4 && div) 		{			document[div].document["img"+bulletNum].src = out[num].src; 	    }     	else 	    {    		document["img"+bulletNum].src = out[num].src;                    	    }	}}/****** Status Message ******/// global function sets status messages to blank (testing it by using the word Toyota)function msg(){   window.status='Toyota';   return true;}//documentonmouseover = msg;/**** End Status Message *****/// Opens a new window at a specific height and width, with or without scrollbarsfunction win_open(desination, width, height, scrolling) {	if (scrolling == true) {		scrollbar = 1;	} else {		scrollbar = 0;	}	window.open(desination, "", "width=" + width + ",height=" + height + ",status=1,scrollbars=" + scrollbar);}// Opens a new window at a specific height and width, with or without scrollbarsfunction win_open_sidebyside(desination, width, height, scrolling) {	if (scrolling == true) {		scrollbar = 1;	} else {		scrollbar = 0;	}	window.open(desination, "", "width=" + width + ",height=" + height + ",menubar=1,status=1,scrollbars=" + scrollbar);}//Opens dealer websitefunction win_open_leave(desination, width, height, scrolling, url) {        if (scrolling == true) {                scrollbar = 1;        } else {                scrollbar = 0;        }        leaveURL = url;        window.open(desination, "", "width=" + width + ",height=" + height + ",status=1,scrollbars=" + scrollbar);}// Opens a new window inside the browser window with specific height and width as well as how much padding to the left and topfunction win_open_inside(desination, width, height, paddingLeft, paddingTop) {	var leftVar = 0;	var topVar = 0;	var extraPadding = 0;	if (document.all) {		topVar = window.screenTop;		leftVar = window.screenLeft;	} else if (document.layers) {		topVar = window.screenY;		leftVar = window.screenX;		extraPadding = window.outerHeight - window.innerHeight;		if (window.statusbar.visible = true) {			extraPadding -= 25;		}		if (extraPadding < 0) {			extraPadding = 0		}	} else if (document.getElementById) {		topVar = window.screenY;		leftVar = window.screenX;		extraPadding = window.outerHeight - window.innerHeight;		if (window.statusbar.visible = true) {			extraPadding -= 22;		}		if (extraPadding < 0) {			extraPadding = 0		}	}	topVar = topVar + parseInt(paddingTop) + extraPadding;	leftVar = leftVar + parseInt(paddingLeft);	window.open(desination, "", "left=" + leftVar + ",top=" + topVar + ",width=" + width + ",height=" + height + ",status=1,scrollbars=0");}/***** OPEN A  NEW WINDOW WITH SELECTED QUICKTIME MOVIE ******/function quicktime(movie, w, h, title) {	qtHTML = window.open("","qt","width="+w+",height="+h+",status=1,scrollbars=0");	qtHTML.document.open();	qtHTML.document.write('<html><head><title>' + title + '</title></head>');	qtHTML.document.write('<body bgcolor="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">');	qtHTML.document.write('<embed src="' + movie + '" width="'+w+'" height="'+h+'" controller=true autoplay=true></embed>');	qtHTML.document.write('</body></html>');	qtHTML.document.close();	qtHTML.focus();}// Opens a new window to a specific location and closes the window behind itfunction openAndClose (desination) {	window.open(desination, "new", ",height=450,width=550,status=1,toolbar=1,location=1,menubar=1,scrollbars=1,resizable=1;");	window.self.close();}// This function closes a pop-up window and changes the location of the parent windowfunction updateParentAndClose(desination)  {   	opener.document.location = desination;	window.self.close();}// latch a rollover on nav itemsfunction rolloverLatch(num,div,hider){		if (hider) {		//alert(hider);		for (i=0; i < hider; i++)		{			if (i != num) {				moff(i,div);			}		}		} else {		for (i=0; i < out.length; i++)		{			if (i != num) {				moff(i,div);			}		}		}}// WebObject compatible version of updateParentAndClosefunction updateWOParentAndClose(destination){   do    {               slashx = document.URL.indexOf("/", 7)               if (slashx == -1)                       break               host = document.URL.substring(7, slashx)               wourlx = document.URL.lastIndexOf("wourl=")               if (wourlx == -1)                       break               wourl = document.URL.substring(wourlx + 6)               url = "http://" + host + wourl + "?page=" + destination       } while (false);       opener.location.href = url;       window.self.close();}function openCenteredWindow(url, height, width, name, parms) {	var left = Math.floor( (screen.width - width) / 2);	var top = Math.floor( (screen.height - height) / 2);	var winParms = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width;		if (parms) 	{ 		winParms += "," + parms; 	}		var win = window.open(url, name, winParms);		if (parseInt(navigator.appVersion) >= 4) 	{		win.window.focus();	}		return win;}//v1.0//Copyright 2006 Adobe Systems, Inc. All rights reserved.function AC_AddExtension(src, ext){  if (src.indexOf('?') != -1)    return src.replace(/\?/, ext+'?');   else    return src + ext;}function AC_Generateobj(objAttrs, params, embedAttrs) {   var str = '<object ';  for (var i in objAttrs)    str += i + '="' + objAttrs[i] + '" ';  str += '>';  for (var i in params)    str += '<param name="' + i + '" value="' + params[i] + '" /> ';  str += '<embed ';  for (var i in embedAttrs)    str += i + '="' + embedAttrs[i] + '" ';  str += ' ></embed></object>';  document.write(str);}function AC_FL_RunContent(){  var ret =     AC_GetArgs    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"     , "application/x-shockwave-flash"    );  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);}function AC_SW_RunContent(){  var ret =     AC_GetArgs    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"     , null    );  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);}function AC_GetArgs(args, ext, srcParamName, classid, mimeType){  var ret = new Object();  ret.embedAttrs = new Object();  ret.params = new Object();  ret.objAttrs = new Object();  for (var i=0; i < args.length; i=i+2){    var currArg = args[i].toLowerCase();        switch (currArg){	      case "classid":        break;      case "pluginspage":        ret.embedAttrs[args[i]] = args[i+1];        break;      case "src":      case "movie":	        args[i+1] = AC_AddExtension(args[i+1], ext);        ret.embedAttrs["src"] = args[i+1];        ret.params[srcParamName] = args[i+1];        break;      case "onafterupdate":      case "onbeforeupdate":      case "onblur":      case "oncellchange":      case "onclick":      case "ondblClick":      case "ondrag":      case "ondragend":      case "ondragenter":      case "ondragleave":      case "ondragover":      case "ondrop":      case "onfinish":      case "onfocus":      case "onhelp":      case "onmousedown":      case "onmouseup":      case "onmouseover":      case "onmousemove":      case "onmouseout":      case "onkeypress":      case "onkeydown":      case "onkeyup":      case "onload":      case "onlosecapture":      case "onpropertychange":      case "onreadystatechange":      case "onrowsdelete":      case "onrowenter":      case "onrowexit":      case "onrowsinserted":      case "onstart":      case "onscroll":      case "onbeforeeditfocus":      case "onactivate":      case "onbeforedeactivate":      case "ondeactivate":      case "type":      case "codebase":        ret.objAttrs[args[i]] = args[i+1];        break;      case "width":      case "height":      case "align":      case "vspace":       case "hspace":      case "class":      case "title":      case "accesskey":      case "name":      case "id":      case "tabindex":        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];        break;      default:        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];    }  }  ret.objAttrs["classid"] = classid;  if (mimeType) ret.embedAttrs["type"] = mimeType;  return ret;}var newWindow = null;function closeWin(){	if (newWindow != null){		if(!newWindow.closed)			newWindow.close();	}}function popUpWin(url, type, strWidth, strHeight){		closeWin();			type = type.toLowerCase();		if (type == "fullscreen"){		strWidth = screen.availWidth;		strHeight = screen.availHeight;	}	var tools="";	leftPos = 0	topPos = 0	if (screen) 	{		leftPos = (screen.width / 2) - 475		topPos = (screen.height / 2) - 283	}	if (type == "standard") tools = "resizable,toolbar=yes,location=yes,scrollbars=yes,menubar=yes,width="+strWidth+",height="+strHeight+",top=0,left=0";	if (type == "console" || type == "fullscreen") tools = "resizable,toolbar=no,location=no,scrollbars=no,width="+strWidth+",height="+strHeight+",left="+leftPos+",top="+topPos;			newWindow = window.open(url, 'newWin', tools);	newWindow.focus();}function loadVR() {	leftPos = 0	topPos = 0	if (screen) 	{		leftPos = (screen.width / 2) - 359		topPos = (screen.height / 2) - 196	}	qtHTML = window.open("","qt","width=730,height=443,left="+leftPos+",top="+topPos+",status=1,scrollbars=1");	qtHTML.document.open();	qtHTML.document.write('<html><head><title>Highlander: 360</title>'); 	qtHTML.document.write('<style type="text/css">p {font: 11px Verdana}</style>');	qtHTML.document.write('</head>');	qtHTML.document.write('<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">');	qtHTML.document.write('<table width="716" height="437" border="0" cellpadding="0" cellspacing="0">');	qtHTML.document.write('<tr>');	qtHTML.document.write('<td valign="top">');	qtHTML.document.write('<p align="center">SPORT MODEL</p>');	qtHTML.document.write('<object CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="716" height="398" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">');	qtHTML.document.write('<param name="src" value="img/ext/highlander_ext.mov">');	qtHTML.document.write('<param name="autoplay" value="true">');	qtHTML.document.write('<param name="loop" value="false">');	qtHTML.document.write('<param name="controller" value="true">');	qtHTML.document.write('<embed src="img/ext/highlander_ext.mov" width="716" height="398" autoplay="true" loop="false" controller="true" pluginspage="http://www.apple.com/quicktime/">');	qtHTML.document.write('</embed>');	qtHTML.document.write('</object>');	qtHTML.document.write('</td>');	qtHTML.document.write('</tr>');	qtHTML.document.write('</table>');  	qtHTML.document.write('</body></html>');	qtHTML.document.close();	qtHTML.focus();}function doPopUp(e){//set defaults - if nothing in rel attrib, these will be usedvar t = "standard";var w = "780";var h = "580";//look for parametersattribs = this.rel.split(" ");if (attribs[1]!=null) {t = attribs[1];}if (attribs[2]!=null) {w = attribs[2];}if (attribs[3]!=null) {h = attribs[3];}//call the popup scriptpopUpWin(this.href,t,w,h);//cancel the default link action if pop-up activatedif (window.event) 	{	window.event.returnValue = false;	window.event.cancelBubble = true;	} else if (e) 	{	e.stopPropagation();	e.preventDefault();	}}function findPopUps(){var popups = document.getElementsByTagName("a");for (i=0;i<popups.length;i++)	{	if (popups[i].rel.indexOf("popup")!=-1)		{		// attach popup behaviour		popups[i].onclick = doPopUp;		// add popup indicator		if (popups[i].rel.indexOf("noicon")==-1)			{			popups[i].style.backgroundImage = "url(pop-up.gif)";			popups[i].style.backgroundPosition = "0 center";			popups[i].style.backgroundRepeat = "no-repeat";			popups[i].style.paddingLeft = "15px";			}		// add info to title attribute to alert fact that it's a pop-up window		popups[i].title = popups[i].title + " [Opens in pop-up window]";		}	}}addEvent(window, 'load', findPopUps, false);function addEvent(elm, evType, fn, useCapture){	if(elm.addEventListener)	{		elm.addEventListener(evType, fn, useCapture);		return true;	}else if (elm.attachEvent)	{		var r = elm.attachEvent('on' + evType, fn);		return r;	}	else	{	elm['on' + evType] = fn;	}}