




var site_root = 'http://www.nihtraining.com/';


//	Browser d-tect
var w3c = (document.getElementById) ? true : false;
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;

var cursor_type = (document.all) ? 'hand' : 'pointer';
/*
if (w3c) {
	document.write('<style type="text/css">#flashContent { visibility: hidden; height: 450px; } </style>');
}
*/

//	Init function
function init() {
	
	loopSetLinks('A','ViewSite','scrollbars=yes,resizable=yes,status=yes,width=770,height=555');
	loopSetLinks('A','dVinciSite','scrollbars=yes,resizable=yes,status=yes,width=770,height=555');
	loopSetLinks('A','ViewCRISSite','scrollbars=yes,resizable=yes,status=yes,width=930,height=645');


	var document_imgs = document.getElementsByTagName('IMG');
	for (var aa=0; aa<document_imgs.length; aa++) {
		if (document_imgs[aa].src.indexOf('next_project.gif') != -1) {
			popARollie(document_imgs[aa],'images/next_project.gif','images/next_project_over.gif');
		}
		if (document_imgs[aa].src.indexOf('return.gif') != -1) {
			popARollie(document_imgs[aa],'images/return.gif','images/return_over.gif');
		}
		if (document_imgs[aa].src.indexOf('view_demo.gif') != -1) {
			popARollie(document_imgs[aa],'images/view_demo.gif','images/view_demo_over.gif');
		}
		if (document_imgs[aa].src.indexOf('course_for_credit.gif') != -1) {
			popARollie(document_imgs[aa],'images/course_for_credit.gif','images/course_for_credit_over.gif');
		}
		if (document_imgs[aa].src.indexOf('view_this_site.gif') != -1) {
			popARollie(document_imgs[aa],'images/view_this_site.gif','images/view_this_site_over.gif');
		}
	}
}

//	If browser is good, run onload function
if (w3c) { window.onload=init; }


function popARollie(obj,up_img,over_img) {
	obj.onmouseover = function () {
		this.src = over_img;
	}
	obj.onmouseout = function () {
		this.src = up_img; //site_root+
	}
}



function loopSetLinks(elem,target_match,param_string) {
	
	var the_elements = document.getElementsByTagName(elem);
	
	for (var aa=0; aa<the_elements.length; aa++) {		
		if (the_elements[aa].target.toLowerCase() == target_match.toLowerCase()) {
			the_elements[aa].onclick = function() {
				popupWindow(this, this.target, param_string)
				return false;
			}
		}
	}
}







//	Print code
function doPrint() {
	if (window.print) {
		window.print();
	} else {
		alert('To print this page, click on the File menu and choose Print \nor press Cntrl + P on your keyboard.');
	}
}









//	Popup window code
function popupWindow(url, target, features) {
	var page_position = (parseInt(navigator.appVersion) > 3) ? 'left=0,top=0,screenX=0,screenY=0,' : "";
	var popup_features = 'menubar=yes,status=yes,toolbar=yes,scrollbars=yes,resizable=yes,width=785,height=480';

	if (isUndefined(features)) {
		features = popup_features;
	}
	if (isUndefined(target)) {
		target = '_blank';
	}
	var the_window = window.open(url, target, page_position+features);
	the_window.focus();
	return the_window;
}

function linkPopup(src, features) {
	return popupWindow(src.getAttribute('href'),src.getAttribute('target') || '_blank',features);
}

//	Utility function [currently used in popupWindow()]
function isUndefined(v) { 
	//	Returns true if [v] is not defined, false otherwise
	//	IE 5.0 does not support the undefined keyword, so we cannot 
	//	do a direct comparison such as v===undefined.
	var undef;
	return v===undef;
}
//	End Popup window code

