var its;
var browserName = '';
var browserNameLong = '';
var browserNew = '';
var preloadFlag = false;
var Macintosh = navigator.userAgent.indexOf('Mac')>0;

function its() {
	var n = navigator;
	var ua = ' ' + n.userAgent.toLowerCase();
	var pl = n.platform.toLowerCase();
	var an = n.appName.toLowerCase();

	this.version = n.appVersion;
	this.nn = ua.indexOf('mozilla') > 0;

	if(ua.indexOf('compatible') > 0) {
		this.nn = false;
	}
	
	this.opera = ua.indexOf('opera') > 0;
	this.ie = ua.indexOf('msie') > 0;
	this.major = parseInt( this.version );
	this.minor = parseFloat( this.version );

	this.mac = ua.indexOf('mac') > 0;
	this.win = ua.indexOf('win') > 0;

	if(this.ie) {
		if(ua.indexOf("msie 5") > 1) {
			var msieIndex = navigator.appVersion.indexOf("MSIE") + 5;
			this.major = parseFloat(navigator.appVersion.substr(msieIndex,3));
		}
	}

	return this;
}

function browserNaming() {
	its = new its();
	
	if (!document.getElementById) {
		browserNew = false;
	}
	else {
		browserNew = true;
	}

	if (its.opera) {
		browserName = "Opera";
	}
	else if (its.ie) {
		browserName = "IE";
	}
	else {
		browserName = "NS";
	}

	browserNameLong = browserName + its.major;
}

function checkMenu(menuId) {
	theMenu = menuId + "Nav";
	if (menuStates[theMenu]) {
		menuSwitcher(theMenu,'off');
		menuStates[theMenu] = false;
	}
	else {
		menuSwitcher(theMenu,'on');
		menuStates[theMenu] = true;
		resetNavs(menuId);
	}
}

function menuSwitcher(menuId,param) {
	if (browserNew) {
		d = document.getElementById(menuId);
		if (param=="on") {
			d.style.display = 'inline';
		}
		else {
			d.style.display = 'none';
		}
	}
	else {
		d = document.all[menuId];
		d.className = param;
	}
}

function resetNavs(menuId) {
	for (i=0; i<submenuNumb; i++) {
		if (menuNames[i]!=menuId) {
			theMenu = menuNames[i] + "Nav";
			menuStates[theMenu] = false;
			if (browserNew) {
				d = document.getElementById(theMenu);
				d.style.display = 'none';
			}
			else {
				d = document.all[menuId];
				d.className = 'off';
			}
		}
	}
}

ts_visibility = new Array();

ts_visibility['ts_us'] = false;
ts_visibility['ts_ca'] = false;
ts_visibility['ts_ca'] = false;
ts_visibility['ts_fr'] = false;
ts_visibility['ts_de'] = false;
ts_visibility['ts_uk'] = false;
ts_visibility['ts_la'] = false;
ts_visibility['ts_jp'] = false;

function visibilitySwitcher(divId) {
	if(ts_visibility[divId]) {
		imgId = "trigger-"+divId;
		if(browserNew) {
			d = document.getElementById(divId);
			d.style.display = 'none';
			i = document.getElementById(imgId);
			i.src = "/images/global/tech_support/expand_icon.gif";
		}
		else {
			d = document.all[divId];
			d.className = 'off';
			document.images[imgId].src = "/images/global/tech_support/expand_icon.gif";
		}
		ts_visibility[divId] = false;
	}
	else {
		imgId = "trigger-"+divId;
		if(browserNew) {
			d = document.getElementById(divId);
			d.style.display = 'inline';
			i = document.getElementById(imgId);
			i.src = "/images/global/tech_support/colapse_icon.gif";
		}
		else {
			d = document.all[divId];
			d.className = 'on';
			document.images[imgId].src = "/images/global/tech_support/colapse_icon.gif";
		}
		for(x in ts_visibility) {
			if(x!=divId) {
				imgId = "trigger-"+x;
				if(browserNew) {
					d = document.getElementById(x);
					d.style.display = 'none';
					i = document.getElementById(imgId);
					i.src = "/images/global/tech_support/expand_icon.gif";
				}
				else {
					d = document.all[divId];
					d.className = 'off';
					document.images[imgId].src = "/images/global/tech_support/expand_icon.gif";
				}
				ts_visibility[x] = false;
			}
		}
		ts_visibility[divId] = true;
	}
}