﻿//******************************************
//BLACKWATERUSA - IC - JAVASCRIPT FUNCTIONS
//******************************************

//CREATE TIME LINE POPUP
function HistoryTimeLine() 
{
	var options = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=779,height=511";
	msgWindow=window.open('http://www.UStraining.com/ic/about/default.asp',"TimeLine",options);
}
//################### GSI CODE ########################
function prl_preloadImages() {
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=prl_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function prl_swapImgRestore() {
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function prl_findObj(n, d) {
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=prl_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function prl_swapImage() {
var i,j=0,x,a=prl_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=prl_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function prl_navPreload(){
prl_preloadImages("nav_runway_on.gif","nav_home_on.gif","nav_girl_on.gif","nav_restaurant.gif","nav_magazine.gif")
}
var prl_bnav_xMousePos = 0;var prl_bnav_yMousePos = 0;var prl_bnav_topX = 0;var prl_bnav_topY = 0;var prl_bnav_bottomX = 0;var prl_bnav_bottomY = 0;var prl_bnav_br;
var prl_bnav_isNavDivDisplayed = false;
var prl_bnav_tempTimeoutID;
if(navigator.appName == "Netscape" && document.layers != null){prl_bnav_br="ns";}
else if(navigator.appName == "Microsoft Internet Explorer" && document.all != null){prl_bnav_br="ie";}
else{prl_bnav_br=null}
if ((document.getElementById) && (prl_bnav_br!="ie")) { prl_bnav_br="ns6";}
var prl_bnav_IsMac = (navigator.appVersion.indexOf("Macintosh") != -1)
function prl_bnavSetNav(){ 
if (prl_bnav_br == "ie"){  
objBottomNavDiv = document.getElementById("othersitesPosDIV"); 
botNavX = objBottomNavDiv.offsetLeft + 502;
botNavY = objBottomNavDiv.offsetTop - 4 - 205;  
}else{
objBottomNavLayer = document.othersites;
botNavX = objBottomNavLayer.x - 94;
botNavY = objBottomNavLayer.y - 4 - 205;
}

if (prl_bnav_br == "ie"){
document.all["othersitesImgDiv"].style.left = botNavX;
document.all["othersitesImgDiv"].style.top = botNavY;
}else if (prl_bnav_br == "ns6"){
document.getElementById("othersitesImgDiv").style.left = botNavX;
document.getElementById("othersitesImgDiv").style.top = botNavY;
}else{
document.othersitesImgDiv.left = botNavX;
document.othersitesImgDiv.top = botNavY;
}
prl_bnav_topX = botNavX + 100
prl_bnav_topY = botNavY + 20
prl_bnav_bottomX = botNavX + 454
prl_bnav_bottomY = botNavY + 414
}
function prl_bnavShowNav(){
prl_swapBottomNavImage();
if (prl_bnav_br == "ie"){
document.all["othersitesImgDiv"].style.visibility = "visible";
}else if (prl_bnav_br == "ns6"){
document.getElementById("othersitesImgDiv").style.visibility = "visible";
}else{
document.othersitesImgDiv.visibility = "show";
}
prl_bnavDisplayElements(false);
prl_bnav_isNavDivDisplayed = true;
}
function prl_bnavHideNav(){
prl_swapBottomNavImage();
if (prl_bnav_br == "ie"){
document.all["othersitesImgDiv"].style.visibility = "hidden";
}else if (prl_bnav_br == "ns6"){
document.getElementById("othersitesImgDiv").style.visibility = "hidden";
}else{
document.othersitesImgDiv.visibility = "hidden";
}
prl_bnavDisplayElements(true);
prl_bnav_isNavDivDisplayed = false;
}
function prl_bnavDisplayElements(blnDisplay){
if (prl_bnav_br !="ie" || prl_bnav_IsMac){
return;
}
objSelects = document.all.tags("SELECT");
if (objSelects.length==0){
return;
}
var objSelects;
var strVisibility;
if(blnDisplay){
strVisibility="visible";
}else{
strVisibility="hidden";
}
for (var x = 0; x < objSelects.length; x++) {
objIndivSel = objSelects[x];
selx=0; sely=0; var selp;
if(objIndivSel.offsetParent){
selp=objIndivSel
while(selp.offsetParent){
selp=selp.offsetParent;
selx+=selp.offsetLeft;
sely+=selp.offsetTop;
}
}
if (selx < prl_bnav_bottomX && sely > prl_bnav_topY-30){
objIndivSel.style.visibility=strVisibility;
}
}
}
function prl_bnavCheckNav(){
tempID = setTimeout("prl_bnavCheckMousePos()",10);
}
function prl_bnavCheckMousePos(){
if (prl_bnav_br=="ns"){
document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = prl_bnavGetMouseXY;
}else if (prl_bnav_br=="ie"){
document.onmousemove = prl_bnavGetMouseXY;
}else if (prl_bnav_br=="ns6"){
document.onmousemove = prl_bnavGetMouseXY;
}
if (prl_bnav_xMousePos < prl_bnav_topX || prl_bnav_xMousePos > prl_bnav_bottomX || prl_bnav_yMousePos < prl_bnav_topY || prl_bnav_yMousePos > prl_bnav_bottomY){
prl_bnavHideNav();
}
}
function prl_bnavGetMouseXY(e){
if (prl_bnav_br == "ie"){
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
}else{
tempX = e.pageX
tempY = e.pageY
}
if (tempX < 0){tempX = 0}
if (tempY < 0){tempY = 0}
prl_bnav_xMousePos = tempX
prl_bnav_yMousePos = tempY
}
function prl_resizeWindow(){
if ((prl_bnav_br=="ns") || (prl_bnav_br=="ie" && prl_bnav_IsMac)){
window.location.reload();
return;
}else{
prl_bnavSetNav();
}
}
function prl_bnavOpenLink(link){
window.open(link);
prl_bnavHideNav();
}
function prl_bnavOnload(){
prl_navPreload();
prl_bnavSetNav();
prl_bnavCheckMousePos();
}
function prl_swapBottomNavImage(){
var blnOthersites = document.bnav_form.blnOthersites.value; 
if(blnOthersites == 1){
document.bnav_form.blnOthersites.value = 0;
}
else {
document.bnav_form.blnOthersites.value = 1;}
}
function prl_bnavToggle(){
if (!prl_bnav_isNavDivDisplayed){
prl_bnavShowNav();
prl_bnav_tempTimeoutID = setTimeout("prl_bnavHideNav()",8000);
}else{
prl_bnavHideNav();
clearTimeout(prl_bnav_tempTimeoutID);
}
}


//######## Open Centered Window #############
function OpenWindow(url, width, height)
{
	var x, y = 0;
	if (screen) {
		x = (screen.availWidth - width) / 2;
		y = (screen.availHeight - height) / 2;
	}   
	var options = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=" + width + ",height=" + height + ",screenX=" + x + ",screenY=" + y + ",left=" + x + ",top=" + y;
	msgWindow=window.open(url,'new',options);		
}


//################ Flash Detection ################

function writeFlashObject(url,flashvars,width,height) {
	if (detectFlash()) {
		document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"')
		document.writeln(' width="' + width + '" height="' + height + '">')
		document.writeln('<param name="allowScriptAccess" value="sameDomain" />')
		document.writeln('<param name="movie" value="' + url + '" />')
		document.writeln('<param name="flashvars" value="' + flashvars + '" />')
		document.writeln('<param name="quality" value="high" />')
		document.writeln('<param name="wmode" value="transparent" />')
		document.writeln('<param name="bgcolor" value="#000000" />')
		document.writeln('<embed src="' + url + '" flashvars="' + flashvars + '" quality="high" bgcolor="#000000" wmode="transparent" width="' + width + '" height="' + height + '" align="middle"')
		document.writeln(' allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
	}
	else {
		document.writeln('This page requires the Macromedia Flash player.<br><br><a href="http://www.macromedia.com/go/getflashplayer" target="_blank"><img src="http://209.223.98.213/pic/flash.gif" border="0"></a><br><br>You can download the Flash player<br> from Macromedia by <a href="http://www.macromedia.com/go/getflashplayer" target="_blank"><b>clicking here</b></a>.');
	}
}

var plugflash = false;
var MM_FlashCanPlay;
var MM_contentVersion = 6;

function detectFlash()
{
	var agent = navigator.userAgent.toLowerCase(); 
	var mac = agent.indexOf('mac') != -1;
	var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
	if (plugin) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
		for (var i = 0; i < words.length; ++i)
		{
		if (isNaN(parseInt(words[i])))
		continue;
		var MM_PluginVersion = words[i]; 
		}
		 MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
	}
	else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {
		//THIS WILL FIX THE FUNCTION PROB
		runvbscript();
	}
	if (MM_FlashCanPlay) {
		plugflash = true;
	} else{
		plugflash = false;
	}
	return plugflash;
}

function runvbscript() {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}


