var thisPage = new String(location.href);
var thisPage = thisPage.substring(thisPage.lastIndexOf("\/")+1,thisPage.length);

function setImg(targetimg,imgsrc,targetcaption,caption) {
	document.getElementById(targetcaption).innerHTML = caption;
	document.getElementById(targetimg).src = imgsrc;
}

function popWin(url,width,height,options) {
	options = new String(options);

	if (options.indexOf('scrollbars') == 1) {
		var width = width + 20;
		var height = height + 20;
	}
	
	var fromleft = (screen.width / 2) - (width / 2);
	var fromtop = (screen.height / 2) - (height / 2);
	
	var winstr = "";
	
	winstr += (options.indexOf('toolbar')		== -1) ? ('toolbar=0,')		: ('toolbar=1,')
	winstr += (options.indexOf('location')		== -1) ? ('location=0,')	: ('location=1,')
	winstr += (options.indexOf('directories')	== -1) ? ('directories=0,')	: ('directories=1,')
	winstr += (options.indexOf('status')		== -1) ? ('status=0,')		: ('status=1,')
	winstr += (options.indexOf('menubar')		== -1) ? ('menubar=0,')		: ('menubar=1,')
	winstr += (options.indexOf('scrollbars')	== -1) ? ('scrollbars=0,')	: ('scrollbars=1,')
	winstr += (options.indexOf('resizable')		== -1) ? ('resizable=0,')	: ('resizable=1,')
	
	winstr += 'width='   + width    + ',';
	winstr += 'height='	 + height   + ',';
	winstr += 'screenY=' + fromtop  + ',';
	winstr += 'screenX=' + fromleft + ',';
	winstr += 'top='	 + fromtop  + ',';
	winstr += 'left='	 + fromleft;
	
	var newwin = window.open(url,'popWin',winstr);
	
	if (window.focus) {
		newwin.focus();
	}
}

/*2008 Fix to Images on products_assemblies page*/

var ie = false;
var lastNote = '';
if (document.all) { ie = true; }

function getObj(id) {
		if (ie) {
			return document.all[id];
		} else {
			return document.getElementById(id);
		}
	}

function showNote(name) {
		if (name == lastNote) {
			hideNote(name);
			return;
		}

		if (lastNote != '') { hideNote(lastNote); }
		var title = getObj(name + '_title');
		var body = getObj(name + '_body');
		//title.className = 'notehidden';
		body.className = 'notevisible';
		lastNote = name;
	}

function hideNote(name) {
		var title = getObj(name + '_title');
		var body = getObj(name + '_body');
		//title.className = 'note';
		body.className = 'notehidden';
		lastNote = '';
	}