function restoreUserNameAAII(){ 
 // search coockie: 
  var userNameAAII=getCookie("userNameAAII");
    if (!userNameAAII) return; // the cookie doesn't exist... 
  document.forms.logon.AAIILogon__userName.value=userNameAAII;
 } 

 function saveUserNameAAII(){ 
 // store it as a cookie that will expire in 2 years
  var now=new Date(); 
  expdelay=1000*60*60*24*365*2; // persistence: 2 years
  var expdate=new Date(Date.parse(now)+expdelay); 
  if (document.forms.logon.checkbox.checked){ 
   setCookie("userNameAAII",document.forms.logon.AAIILogon__userName.value,expdate); 
   }    
 } 

 // 
 // setCookie and getCookie are from: Netscape's Javascript User Guide 
 // 
 function setCookie(name, value, expire) { 
    document.cookie = name + "=" + escape(value) 
    + ((expire == null) ? "" : ("; expires=" + expire.toGMTString())) 
 } 
 function getCookie(Name) { 
    var search = Name + "=" 
    if (document.cookie.length > 0) { // if there are any cookies 
       offset = document.cookie.indexOf(search) 
       if (offset != -1) { // if cookie exists 
          offset += search.length 
          // set index of beginning of value 
          end = document.cookie.indexOf(";", offset) 
          // set index of end of cookie value 
          if (end == -1) 
             end = document.cookie.length 
          return unescape(document.cookie.substring(offset, end)) 
       } 
    } 
 } 

function popupWin800x550(temp){
	url = temp;
	var leftX = screen.availWidth;
	var topY = screen.availHeight;
	var w = 800;
	var h = 550;
	var propStr = 'width=' + w + ',height=' + h + ',left=' + ((leftX - w - 10) * .5) + ',top=' + ((topY - h - 30) * .5) + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes';
	MyWindow=window.open(url,'PrivacyWindow',propStr); 
	MyWindow.focus();
}

function popupSupport(temp){
	url = temp;
	var leftX = screen.availWidth;
	var topY = screen.availHeight;
	var w = 800;
	var h = 600;
	var propStr = 'width=' + w + ',height=' + h + ',left=' + ((leftX - w - 10) * .5) + ',top=' + ((topY - h - 30) * .5) + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes';
	MyWindow=window.open(url,'Support',propStr); 
	MyWindow.focus();
}


function MM_reloadPage(init) {  
  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);



if (document.getElementById){ 
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("zonal").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";

				if (ar[i].className=="submenuactive") 
				ar[i].className = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}

function ClassNew(obj, new_style) { 
  obj.className=new_style;
}

function switchclass(id){ 
   if(document.getElementById(id)){    
       var ele = document.getElementById(id);   
 	   var ar = document.getElementById("zonal").getElementsByTagName("div"); 
	   for (var i=0; i<ar.length; i++){
		   if (ele.id == ar[i].id) {
               if(ele.className=="menutitle"){    
                  ele.className="menutitleexpanded";        
               }else{ 
                  ele.className="menutitle";      
               } 
		   } else {
		       ar[i].className="menutitle";
		   }
	   } 
   } 
} 


function activemenu(currobj, spanId){ 
    if(document.getElementById(currobj)){    
           var ele = document.getElementById(currobj);   
 	   var currspan = document.getElementById(spanId); 
 	   var ar = currspan.getElementsByTagName("span"); 
           
	   for (var i=0; i<ar.length; i++){
	       if (ele.id == ar[i].id) {
                     ele.className="submenuactive";      
	       } else {
		   ar[i].className="none";
	       }
	   } 
   } 
} 


function compInfomenu(currobj){ 
    if(document.getElementById(currobj)){    
         var ele = document.getElementById(currobj);   
 	   var ar = document.getElementById("zonal2").getElementsByTagName("div"); 
           
	   for (var i=0; i<ar.length; i++){
	       if (ele.id == ar[i].id) {
                 ele.className="secmenutitleexpanded";      
	       } else {
		     ar[i].className="secmenutitle";
	       }
	   } 
   } 
} 


sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

var cur_link;
function doLinkClass(lnk) {
  if (lnk && lnk.blur) lnk.blur();	// remove marquee
  if (!lnk || cur_link == lnk) return;
  if (cur_link) cur_link.className = "done";
  lnk.className = "on";
  cur_link = lnk;
}

var cur_lyr;	// holds id of currently visible layer
function swapLayers(lnk,id) {
  doLinkClass(lnk);
  if (cur_lyr) hideLayer(cur_lyr);
  showLayer(id);
  cur_lyr = id;
}

function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "visible";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "hidden";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? getLyrRef(id,document): null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}

// get reference to nested layer for ns4
function getLyrRef(lyr,doc) {
	if (document.layers) {
		var theLyr;
		for (var i=0; i<doc.layers.length; i++) {
	  	theLyr = doc.layers[i];
			if (theLyr.name == lyr) return theLyr;
			else if (theLyr.document.layers.length > 0) 
	    	if ((theLyr = getLyrRef(lyr,theLyr.document)) != null)
					return theLyr;
	  }
		return null;
  }
}

function init(id,lyr) {
  var lnk = getElemRefs(id);
  swapLayers(lnk,lyr);
}

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 popupWin(temp){
	url = temp;
	var leftX = screen.availWidth;
	var topY = screen.availHeight;
	var w = 665;
	var h = 475;
	var propStr = 'width=' + w + ',height=' + h + ',left=' + ((leftX - w - 10) * .5) + ',top=' + ((topY - h - 30) * .5) + ',toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes';
	MyWindow=window.open(url,'MyWindow',propStr); 
	MyWindow.focus();
}

function popupWinPrivacy(temp){
	url = temp;
	var leftX = screen.availWidth;
	var topY = screen.availHeight;
	var w = 665;
	var h = 530;
	var propStr = 'width=' + w + ',height=' + h + ',left=' + ((leftX - w - 10) * .5) + ',top=' + ((topY - h - 30) * .5) + ',toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes';
	MyWindow=window.open(url,'PrivacyWindow',propStr); 
	MyWindow.focus();
}

function popupWinAddress(temp){
	url = temp;
	var leftX = screen.availWidth;
	var topY = screen.availHeight;
	var w = 665;
	var h = 350;
	var propStr = 'width=' + w + ',height=' + h + ',left=' + ((leftX - w - 10) * .5) + ',top=' + ((topY - h - 80) * .5) + ',toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes';
	MyWindow=window.open(url,'MyWindow',propStr); 
	MyWindow.focus();
}
function popupExtURLAddress(temp,exttemp){
  	url = temp+'?exturl='+exttemp;
  	var leftX = screen.availWidth;
  	var topY = screen.availHeight;
  	var w = 665;
  	var h = 350;
  	var propStr = 'width=' + w + ',height=' + h + ',left=' + ((leftX - w - 10) * .5) + ',top=' + ((topY - h - 80) * .5) + ',toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes';
  	MyWindow=window.open(url,'MyWindow',propStr);
	MyWindow.focus();
}
function popupExtURLWebPay(temp){
  	url = temp;
  	var leftX = screen.availWidth;
  	var topY = screen.availHeight;
  	var w = 760;
  	var h = 350;
  	var propStr = 'width=' + w + ',height=' + h + ',left=' + ((leftX - w - 10) * .5) + ',top=' + ((topY - h - 80) * .5) + ',toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes';
  	MyWindow=window.open(url,'MyWindow',propStr);
	MyWindow.focus();
}
//Glossary PopUp
function jump(url) {
	var leftX = screen.availWidth;
	var topY = screen.availHeight;
	var w = 438;
	var h = 438;
	var propStr = 'width=' + w + ',height=' + h + ',left=' + ((leftX - w - 10) * .5) + ',top=' + ((topY - h - 30) * .5) + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no';
	TheNewWin = window.open(url, 'Glossary', propStr);
	TheNewWin.focus();
}

/////////////////GLOSSARY//////////////////////////
function changeCategory(category) {
window.location="http://www.mazdacredit.com/glossary/glossary_main.jhtml?id=0&account=1&category=" + category;
}

/////////////////// BROWSER DETECT ///////////////////////////

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{	// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		}
	]
};
BrowserDetect.init();

function accepted()
{
	document.cookie="ABSVisited=true; path=/;";
	window.location = "http://www.mazdacredit.com/institutionalinvestments/index.jhtml";
}

function send()
{
	document.cookie="FIAVisited=true; path=/; expires=Wed, 01-Aug-2008 00:00:00 GMT";
	window.open('https://www3483.ntrs.com/nta/frd/public/login/SignOn.jsp');
}

function check_page_visit(cookiename) {
	if (cookiename == "ABSVisited")
	{
		if (!getCookie(cookiename))
		{
			window.location = "http://www.mazdacredit.com/institutionalinvestments/terms.jhtml";
		}
		else
		{
			window.location = "http://www.mazdacredit.com/institutionalinvestments/index.jhtml";
		}
	}
	if (cookiename == "FIAVisited")
	{
		if (!getCookie(cookiename))
		{
			window.location = "http://www.mazdacredit.com/interestadvantage/terms.jhtml";
		}
		else
		{
			window.open('https://www3483.ntrs.com/nta/frd/public/login/SignOn.jsp');
		}
	}

}

    //-----------for glossary---------------
	var TheNewWin;
    function jump(url) {
	var leftX = screen.availWidth;
	var topY = screen.availHeight;
	var w = 400;
	var h = 400;
	var propStr = 'width=' + w + ',height=' + h + ',left=' + ((leftX - w - 1) * .960) + ',top=' + ((topY - h - 0) * .0) + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes';
	TheNewWin = window.open(url, 'Glossary', propStr);
	TheNewWin.focus();
     }
	 
	function popUpPage(url) {
	    popupWindow = window.open(url,"win",'toolbar=0, location=0, directories=0, status=1, width=322, height=257, scrollbar=1');
	}
	function popFullWin(url) {
	    popupWindow = window.open(url,"win",'toolbar=1, location=0, directories=0, status=1, width=870, height=600, scrollbars=1');
	}	
	//------------end glossary------------
	
//for opening new pop up window	

function openWin(theURL,winName) 
 { 
  var win=window.open(theURL,winName,'width=800,height=550,scrollbars=yes,toolbar=yes,resizable=yes,menubar=yes'); 
  } 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //-----------for vehicle inspection---------------
	var TheNewVIWin;
    function jumpVI(url) {
	var leftX = screen.availWidth;
	var topY = screen.availHeight;
	var w = 450;
	var h = 600;
	var propStr = 'width=' + w + ',height=' + h + ',left=' + ((leftX - w - 1) * .960) + ',top=' + ((topY - h - 0) * .0) + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes';
	TheNewVIWin = window.open(url, 'VehicleInspection', propStr);
	TheNewVIWin.focus();
     }
	 
	function popUpPage(url) {
	    popupWindow = window.open(url,"win",'toolbar=0, location=0, directories=0, status=1, width=322, height=257, scrollbar=1');
	}
	//------------end vehicle inspection------------
	
//for opening new pop up window	

function openVIWin(theURL,winName) 
 { 
  var win=window.open(theURL,winName,'width=570,height=450,scrollbars=yes,toolbar=yes,resizable=yes,menubar=yes'); 
  } 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	
//for style sheets

var bV=parseInt(navigator.appVersion);
var bName = navigator.appName;
var bType;

//to pull in correct style sheet
if  (((navigator.appVersion.indexOf("Mac") != -1)) && ((navigator.appVersion.indexOf("MSIE") == -1))) {
	document.write("<link rel=\"stylesheet\" href=\"http://www.mazdacredit.com/style/mac-net.css\" TYPE=\"text/css\" />");
	 }
else if ((navigator.appVersion.indexOf("Mac") != -1)) {
	document.write("<link rel=\"stylesheet\" href=\"http://www.mazdacredit.com/style/mac.css\" type=\"text/css\" />");
	var bVer = "MacIE"; }
else if  (((navigator.appName.indexOf("Netscape") != -1)) && ((navigator.appVersion.indexOf("MSIE") == -1))) {
	document.write("<link rel=\"stylesheet\" href=\"http://www.mazdacredit.com/style/pc-net.css\" TYPE=\"text/css\" />"); }
else {
	document.write("<link rel=\"stylesheet\" href=\"http://www.mazdacredit.com/style/pc.css\" type=\"text/css\" />"); }

	
//quick link pulldown menu	
function jumper(foo, index) {
   if (index == 3) {
      window.open("https://www.acctaccess.com/aaii?REQUEST_CLASS=AccountAccessController&display=true&BrandID=lan&CountryCode=US&LanguageCode=en");
   }
   else {
      location = foo;
   }
}   

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.0
  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 && document.getElementById) x=document.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];}
}

	//for banner image rotation
	//fill array with images to be rotated, in this case the top of the page pictures
	var ar = new Array('<img src="http://www.mazdacredit.com/images/en/us/primuscredit/banners/primus_generic_top_1.jpg" alt="" width="422" height="82" border="0" />', '<img src="http://www.mazdacredit.com/images/en/us/primuscredit/banners/primus_generic_top_2.jpg" alt="" width="422" height="82" border="0" />', '<img src="http://www.mazdacredit.com/images/en/us/primuscredit/banners/primus_generic_top_3.jpg" alt="" width="422" height="82" border="0" />', '<img src="http://www.mazdacredit.com/images/en/us/primuscredit/banners/primus_generic_top_4.jpg" alt="" width="422" height="82" border="0" />');
	var num = Math.floor(Math.random() * ar.length);

//secured messaging code

 function NewWindow1(temp){
	url = temp;
	var leftX = screen.availWidth;
	var topY = screen.availHeight;
	var w = 640;
	var h = 350;
	var propStr = 'width=' + w + ',height=' + h + ',left=' + ((leftX - w - 10) * .5) + ',top=' + ((topY - h - 80) * .5) + ',toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes';
	MyWindow=window.open(url,'MyWindow',propStr); 
	MyWindow.focus();
}
//for opening new pop up window	

function openWin(theURL,winName) 
 { 
  var win=window.open(theURL,winName,'width=800,height=550,scrollbars=yes,toolbar=yes,resizable=yes,menubar=yes,location=yes,status=yes'); 
 } 

 function popupWin(temp){
	url = temp;
	var leftX = screen.availWidth;
	var topY = screen.availHeight;
	var w = 665;
	var h = 530;
	//var h = 475;
	var propStr = 'width=' + w + ',height=' + h + ',left=' + ((leftX - w - 10) * .5) + ',top=' + ((topY - h - 30) * .5) + ',toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes';
	MyWindow=window.open(url,'Privacy',propStr); 
	MyWindow.focus();
}	
 function popupWin1(temp){
	url = temp;
	var leftX = screen.availWidth;
	var topY = screen.availHeight;
	var w = 550;
	var h = 300;
	var propStr = 'width=' + w + ',height=' + h + ',left=' + ((leftX - w - 10) * .5) + ',top=' + ((topY - h - 30) * .5) + ',toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes';
	MyWindow=window.open(url,'Copyright',propStr); 
	MyWindow.focus();
}	
