// browser detection
   ns5 = (parseInt(navigator.appVersion)==5)?true:false;
   ie4 = (document.all || ns5)?true:false;
   ns4 = (document.layers && !ns5)?true:false;
 isMac = (navigator.appVersion.indexOf("Mac") != -1)?true:false;
 isWin = (navigator.appVersion.indexOf("Win") != -1)?true:false;
isUnix = (!isMac && !isWin);
window.name = "tdMain";

function quickJump(s){
	if (document.Globaldd.selectbox1.options[document.Globaldd.selectbox1.selectedIndex].value != "none") {
		url = document.Globaldd.selectbox1.options[document.Globaldd.selectbox1.selectedIndex].value
		window.open(url)
	}
}

function callOutBound(page){
	document.outbound.RequestedPage.value = page;
	document.outbound.submit();
}

function SetCookie(name,value,path,domain,expires,secure) {
  document.cookie = name + "=" + escape(value) +
  ((expires) ? "; expires=" + expires.toGMTString() : "") +
  ((path) ? "; path=" + path : "") +
  ((domain) ? "; domain=" + domain : "") +
  ((secure) ? "; secure" : "");
}
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 getCookieVal(offset) {
  var endstr = document.cookie.indexOf(";", offset);
  if (endstr == -1) endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
} 
function DeleteCookie (name,path,domain) {
  if (GetCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}
expdate = new Date();
Days = 60 //how long the cookie will last
expdate.setTime (expdate.getTime() + (Days * 24 * 60 * 60 * 1000));
function sourceParm(ArgString) {
parmSource="0"; //default to zero in case there are search args, but none is "source"
	if (ArgString.indexOf("&") != -1 ) { // if more than one search arg
		refParms=ArgString.split("&"); // split parms 
		searchParms=refParms;
		//check if any search parms are source ones
		for (i=0; i < searchParms.length; i++) {  // go through the array of parms passed
			if (searchParms[i].indexOf("source") != -1 || searchParms[i].indexOf("source") != -1) { // if find parm with word source
			parmSource=searchParms[i];  // find name-value pair with source name
			}
		} //end for
	}else {
		parmSource=ArgString;  // if only one search arg set as parmsource
	}
	if (parmSource != "0") { // if value changed from default
		parmID=parmSource.split("=") // split out the value from the label 
		return parmID[1];  // source value
	}
} //end sourceParm
function setRefererCookie(){
	var refID = document.referrer;
	var enteredURL = window.location.href;
	if (!refID) {refID=enteredURL;}
	exists = GetCookie('Referrer')
	if (!exists) { SetCookie('Referrer',refID,'/'); } 
}

function makeContact1(){ 
	if (isMac) { window.open("https://secure.tdcanadatrust.com/cgi-bin/contact/contact.pl?id=feedback&Referer=https://secure.tdcanadatrust.com/cgi-bin/contact/contact.pl&name=nexus")}
	else {window.open("https://secure.tdcanadatrust.com/cgi-bin/contact/contact.pl?id=feedback&Referer=https://secure.tdcanadatrust.com/cgi-bin/contact/contact.pl&name=nexus","contact","width=480,height=440,hotkeys=0,titlebar=0");
  }
}

function makeContact2(){ 
	if (isMac) { window.open("https://secure.tdcanadatrust.com/cgi-bin/contact/fr/contact.pl?id=feedback&Referer=https://secure.tdcanadatrust.com/cgi-bin/contact/fr/contact.pl&name=nexus")}
	else {window.open("https://secure.tdcanadatrust.com/cgi-bin/contact/fr/contact.pl?id=feedback&Referer=https://secure.tdcanadatrust.com/cgi-bin/contact/fr/contact.pl&name=nexus","contact","width=480,height=440,hotkeys=0,titlebar=0");
  }
}


function makeContact12(){ 
	if (isMac) { window.open("https://secure.tdcanadatrust.com/cgi-bin/contact/contact.pl?emailTitle=PERSONAL_ACCOUNTS&name=td&Referer=https://secure.tdcanadatrust.com/cgi-bin/contact/fr/contact.pl?start=nexus")}
	else {window.open("https://secure.tdcanadatrust.com/cgi-bin/contact/contact.pl?emailTitle=PERSONAL_ACCOUNTS&name=td&Referer=https://secure.tdcanadatrust.com/cgi-bin/contact/fr/contact.pl?start=nexus","contact","width=480,height=440,hotkeys=0,titlebar=0");
  }
}

setRefererCookie();


