
var site_root = '/';

//	Browser detection
var w3c = (document.getElementById) ? true : false;
var ie = (document.all && !w3c) ? true : false;
var ns4 = (document.layers) ? true : false;


var cursor_type = (document.all) ? 'hand' : 'pointer';
var content_div;
var banner_div;
var body_tag;



function init () {
	content_div = document.getElementById('content');
	banner_div = document.getElementById('banner');
	body_tag = document.getElementsByTagName('BODY')[0];
	
	setPDFlinks();
	
	if (document.getElementById('flashContent')) {
		insertFlash('intro.swf',225,670,'flashContent')
	}
}

if (w3c) { 
	window.onload=init;
	document.write('<style type="text/css">#flashContent { visibility: hidden; }</style>');
	}


function setPDFlinks() {
	var all_links = document.getElementsByTagName('A');

	for (var aa=0; aa<all_links.length; aa++) {		
		if (all_links[aa].target.toLowerCase() == 'externallink') {		
			all_links[aa].onclick = function() {
				popupWindow(this, this.target)
				return false;
			}
		}
	}
	
	
	for (var bb=0; bb<all_links.length; bb++) {		
		if (all_links[bb].target.toLowerCase() == 'pdflink') {		
			all_links[bb].onclick = function() {
				popPDF(this);
				return false;
			}
		}
	}
}

//	Popup window code
var page_position = (parseInt(navigator.appVersion) > 3) ? 'left=0,top=0,screenX=0,screenY=0,' : "";
var popup_features = 'menubar=yes,status=yes,scrollbars=yes,resizable=yes,width=785,height=550';

function popupWindow(url, target, features) {
	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);
}//	End Popup window code

//	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;
}


//	Pop up a PDF!!!
var the_pdf;
function popPDF(src,features) {
	the_pdf = src;
	var pdf_target = src.getAttribute('target') || 'PDFlink';
	if (isUndefined(features)) {
		features = 'menubar=yes,status=yes,scrollbars=yes,resizable=yes,width=750,height=485';
	}
	//alert(the_target);
	return popupWindow(site_root + 'pdf/pdf_launcher.html',pdf_target,features);
}

function doPDF(win_ref) {
	win_ref.location.href = the_pdf;
	//location.href=location.search.substring(1);
}



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.');
	}
}

//	FLASH PLAYER CHECK
//	Checks for Flash 4,5,6,7 plug-in. This works with Netscape, Mozilla, IE Win and IE5 Mac.
//	Variable [hasRightVersion] will be set to true or false
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;
var hasFlash2 = false;
var hasFlash3 = false;
var hasFlash4 = false;
var hasFlash5 = false;
var hasFlash6 = false;
var hasFlash7 = false;

var requiredVersion = 5;
var maxVersion = 7;
var actualVersion = 0;
var hasRightVersion = false;	


if (navigator.plugins) {
	if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]
	&& navigator.mimeTypes["application/x-shockwave-flash"] 
	&& navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {		
		var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
		var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
		var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
		
		hasFlash4 = flashVersion == 4;
		hasFlash5 = flashVersion == 5;
		hasFlash6 = flashVersion == 6; 
		hasFlash7 = flashVersion >= 7; 
	}
}

//	Write VBScript on IE Windows
if (isIE && isWin){
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
  	document.write('on error resume next \n');
  	document.write('hasFlash4 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
	document.write('hasFlash5 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');
	document.write('hasFlash6 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
	document.write('hasFlash7 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');	
  	document.write('</SCR' + 'IPT\> \n');
}
for (var i=2; i <= maxVersion; i++) {  
	if (eval("hasFlash" + i) == true) {
		actualVersion = i;
	}
}
if (actualVersion >= requiredVersion) {
	hasRightVersion = true;
}//	End Flash Player check

//	var site_bg = '#fdfaf3';

//	This function returns the <object> and <embed> tags in variable [oeTags]
function makeFlashTags(the_swf,the_height,the_width) {
	if (hasRightVersion) {
		var flashTag;
		if (isIE && isWin) {
			flashTag = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
			+ 'width="'+the_width+'" height="'+the_height+'"'
			+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
			+ '<param name="movie" value="'+the_swf+'" />'
			+ '<param name="play" value="true" />'
			+ '<param name="quality" value="high" />'
			+ '<param name="menu" value="false" />'
			//	+ '<param name="loop" value="false" />'
			//	+ '<param name="bgcolor" value="'+site_bg+'" />'
			+ '</object>';
		} else {
			flashTag = '<embed src="'+the_swf+'"'
			+ 'width="'+the_width+'" height="'+the_height+'"'
			+ 'play="true"'
			+ 'quality="high"'
			+ 'menu="false"'
			+ 'type="application/x-shockwave-flash"'
			+ 'pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
			//	+ 'loop="false"'
			+ '</embed>';			
		}
		return flashTag;
	}
}
//	This function swaps innerHTML of [the_container] with makeOETags()
function insertFlash(the_swf,the_height,the_width,the_container) {
	if (hasRightVersion) {
		document.getElementById(the_container).style.height = the_height+'px';
		document.getElementById(the_container).style.visibility = 'hidden';
		document.getElementById(the_container).innerHTML = makeFlashTags(the_swf,the_height,the_width);
		document.getElementById(the_container).style.visibility = 'visible';
	}
}










