/* Load style sheet */
// common styles for all browsers and platforms
var CssStyles = '<link rel="stylesheet" type="text/css" href="/CSS/NetJets.css" />';

// get user's browser 
var UserAgent = navigator.userAgent.toLowerCase(); 

//alert("UserAgent = " + UserAgent); // test ***

if(CheckFor('msie')){ // Microsoft Internet Explorer
	
	var UserBrowser = "IE";	
	
}else if(CheckFor('safari')){ // Safari
	
	var UserBrowser = "Safari"
	
	// load Safari CSS style sheet
	CssStyles = CssStyles + '<link rel="stylesheet" type="text/css" href="/CSS/Safari.css">';	
	
}else{ // use FireFox for all other browsers
	
	var UserBrowser = "FireFox";
	
	// load FireFox CSS style sheet
	CssStyles = CssStyles + '<link rel="stylesheet" type="text/css" href="/CSS/FireFox.css">';	
	
}

// get user's platform 
if(CheckFor('mac')){ // Mac 
	
    UserPlatform = "Mac";
	
	// load Macintosh CSS style sheet
    CssStyles = CssStyles + '<link rel="stylesheet" type="text/css" href="/CSS/Mac.css">';
   
}else{ // use Windows platfrom for all others
	
    UserPlatform = "Win32";
	
}

document.write(CssStyles);

function CheckFor(string){ // returns the starting character position or -1 if not found
	
	position = UserAgent.indexOf(string) + 1;
	
	return position;
}

/****************************/

// Create ActiveX Control for Flash

// Internet Explorer changed how it handles ActiveX controls with:
// Flash, QuickTime, RealOne, Acrobat Reader, Java Virtual Machine, and Windows Media Player. 
// Users will no longer be able to directly interact with Microsoft ActiveX controls without first activating their user interfaces. 
// Developers can update their web pages for ActiveX controls to function without user interaction. 
// More info: http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/activating_activex.asp

function FlashControl(
					   DivID, 
					   ClassID, 
					   CodeBase, 
					   Width, 
					   Height, 
					   Movie, 
					   Quality, 
					   FlashVars,
					   Menu, 
					   WMode, 
					   BgColor
		){

  var FlashObjectDiv = document.getElementById(DivID);
  
  // <div id="FlashObject"></div> replaces the <oject> and <embed> code on the originating page
  
  FlashObjectDiv.innerHTML = "" +

	
	"<object classid='" + ClassID  + 	
	"' codebase='" + CodeBase + 	
	"'    width='" + Width    + 	
	"'   height='" + Height   + "'>" +
	"<param name='movie'     value='" + Movie     + "' />" +
	"<param name='quality'   value='" + Quality   + "' />" +
	"<param name='flashvars' value='" + FlashVars + "' />" +
	"<param name='menu'      value='" + Menu      + "' />" +
	"<param name='wmode'     value='" + WMode     + "' />" +
	"<param name='bgcolor'   value='" + BgColor   + "' />" +
	"<embed   type='application/x-shockwave-flash'" +
	"' pluginspage='http://www.macromedia.com/go/getflashplayer'" +
	"'        menu='" + Menu    + 
	"'     bgcolor='" + BgColor + 
	"'     quality='" + Quality +
	"'   flashvars='" + FlashVars +
	"'         src='" + Movie   + 
	"'       wmode='" + WMode   + 
	"'       width='" + Width   + 
	"'      height='" + Height  + 
	"'>" +
	"</embed>";	
	"</object>";

}
// Changes height of the right and left divs

function ChangeDivHeight(){
		 
	 if( document.getElementById('LeftDiv').offsetHeight >= document.getElementById('RightDiv').offsetHeight)
	 {
	  // subtract top and bottom padding
	  document.getElementById('RightDiv').style.height =  (document.getElementById('LeftDiv'  ).offsetHeight - 30)   + "px";
	 }
	 else
	 {
	 document.getElementById('LeftDiv'  ).style.height = (document.getElementById('RightDiv').offsetHeight ) + "px";
	 };
	 
	 	// alert(  "LeftDiv"	+ document.getElementById('LeftDiv'  ).offsetHeight + " px" + "\n" + 
		//		"RightDiv" + document.getElementById('RightDiv').offsetHeight  + "px");
 }
 
 // Set LeftInnerDiv Width to leftDiv for 2ColumnPage Template

function SetLeftInnerDivWidth(){
	
	//document.getElementById("LeftInnerDiv").style.width = document.getElementById('LeftDiv').offsetHeight + "px";
	document.getElementById("LeftInnerDiv").style.width = 547 + "px";
	//alert(document.getElementById("LeftInnerDiv").style.width);
	//alert(document.getElementById("LeftDiv").style.width);
 }
 
 // changes the height of LeftDivInnerLeft and LeftNav
 
  function CheckLeftNavHeight() {
	 //If the height of the Left Nav is greater than or equal to the LeftInnerDivLeft than set the
	 // height of the LeftInnerDivLeft = LeftNav
	 // Default Height of LeftNav 231px
		 
	 if (document.getElementById('LeftNav').offsetHeight >= document.getElementById('LeftDivInnerLeft').offsetHeight  )
	 {
		// add 30px bottom padding
		
		document.getElementById('LeftNav').style.height = (document.getElementById('LeftNav').offsetHeight ) + "px";
	 
		document.getElementById('LeftDivInnerLeft').style.height = (document.getElementById('LeftNav').offsetHeight - 60)  + "px";
		
		
	 }else {
		
		document.getElementById('LeftNav').style.height = document.getElementById('LeftDivInnerLeft').offsetHeight   + "px";
	 
	 }
	 
	 //alert(document.getElementById('LeftNavId').offsetHeight + "\n"+ document.getElementById('LeftDivInnerLeftId').offsetHeight );
			 
}
 

function HighlightActiveLink(ImageID){ // highlight active link
			   
  //alert("document.location.href.substr(document.location.href.lastIndexOf(\"/\") + 1) = " + document.location.href.substr(document.location.href.lastIndexOf("/") + 1, document.location.href.lastIndexOf(".asp") - document.location.href.lastIndexOf("/") - 1)); // test ***
  
	try{
  // parse the page name (the value between last backslash "/" and ".asp" of the url)
  document.getElementById(document.location.href.substr(document.location.href.lastIndexOf("/") + 1, document.location.href.lastIndexOf(".asp") - document.location.href.lastIndexOf("/") - 1)).style.backgroundColor = "#a9c4d4";	
  
  document.getElementById(document.location.href.substr(document.location.href.lastIndexOf("/") + 1, document.location.href.lastIndexOf(".asp") - document.location.href.lastIndexOf("/") - 1)).style.backgroundImage = "url(/images/bg_LeftNavItem_On.gif)";			 
	
	}catch(err){
		// "NetJets_Differences.asp" has no link		
	}
	
  
}			

function newsletter(id) {
	window.open('/Learn_More/newsletter.asp?id='+ id, 'newsletter'+id, 'height=690,width=1000,toolbar=no,menubar=no,location=no,scrollbars=no,status=no');
}

//Fleet Flash called by this for Bookmarking
function showFlash(swf, w, h)
{
	document.getElementById('FleetFlashFile').style.display = 'none';
	 
	var isMSIE = navigator.appName.indexOf("Microsoft") != -1;
	var l1 = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+w+'" height="'+h+'" id="flashapp" align="">'
	document.write('<param name="allowScriptAccess" value="always" />');
	var l2 = '<param name="movie" value="'+swf+'" />' + '<param name="bgcolor" value="#E2E9ED" />'
	var l3 = '<param name="menu" value="false" />'
	var l4 = '<param name="quality" value="best" />'
	var l5 = '<param name="FlashVars" value="initialURL='+document.location+'&isMSIE='+isMSIE+'" />'
	var l6 = '<embed src="'+swf+'" FlashVars="initialURL='+document.location+'&isMSIE='+isMSIE+'" menu="false" quality="best" width="'+w+'" height="'+h+'" name="flashapp" align="" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object>'
	document.write(l1+l2+l3+l4+l5+l6);
	
}
