
// Timer variable used for recalling the setNav function if the
// flash movie has not fully loaded (usally Netscape only).
var nsTimerID;

// Get the javascript DOM handle to the named flash movie.
function getFlashMovieObject(movieName) {
	if (navigator.appName.indexOf("Microsoft Internet") != -1) {
		return eval("window.document." + movieName);
	} else {
		return eval("window.document.embeds." + movieName);
	}
}

// Set the flash nav menu to the correct category by calling setNav([1-8])
// from the onLoad() event in the body tag.
function setNav(navCategory) {
	if (navigator.userAgent.indexOf("Mac") == -1) {
		// Get the handle to the flash movie. The name of the movie is set
		// in the ID and NAME arguments of the HTML OBJECT and EMBED tags.
		var flashMovie = getFlashMovieObject("nav_content");

		if (flashMovie.PercentLoaded() != 100) {
			nsTimerID = setTimeout("setNav(" + navCategory + ");", 100);
		} else {
			// Goto and play the selected movie clip timeline (called with the same
			// syntax as used by Flash actions).
			switch (navCategory) {
				case 1:
					flashMovie.TGotoLabel("/page_heading", "corporate_overview");
					flashMovie.TGotoFrame("/but_corporate", 6);					
					break;
				case 2:
					flashMovie.TGotoLabel("/page_heading", "products");
					flashMovie.TGotoFrame("/but_products", 6);	
					break;
				case 3:
					flashMovie.TGotoLabel("/page_heading", "clients");
					flashMovie.TGotoFrame("/but_clients", 6);
					break;
				case 4:
					flashMovie.TGotoLabel("/page_heading", "news");
					flashMovie.TGotoFrame("/but_news", 6);
					break;
				case 5:
					flashMovie.TGotoLabel("/page_heading", "faqs");
					flashMovie.TGotoFrame("/but_faqs", 6);
					break;
				case 6:
					flashMovie.TGotoLabel("/page_heading", "contact_us");
					flashMovie.TGotoFrame("/but_contact", 6);
					break;
				case 7:
					flashMovie.TGotoLabel("/page_heading", "privacy_policy");
					flashMovie.TGotoFrame("/but_privacy", 6);
					break;
				case 8:
					flashMovie.TGotoLabel("/page_heading", "investor_relations");
					flashMovie.TGotoFrame("/but_investor", 6);
					break;
			}
		}
	}
} 

// Used to skip the intro on the homepage flash navigation movie.
function setMainNav() {
	if (navigator.userAgent.indexOf("Mac") == -1) {
		// Get the handle to the flash movie. The name of the movie is set
		// in the ID and NAME arguments of the HTML OBJECT and EMBED tags.
		var flashMovie = getFlashMovieObject("nav_home");
		
		if (flashMovie.PercentLoaded() != 100) {
			nsTimerID = setTimeout("setMainNav();", 10);
		} else {
			// Goto and play the selected movie clip timeline (called with the same
			// syntax as used by Flash actions).
			flashMovie.TGotoLabel("/", "end");
		}
	}
} 

// A work-a-round for Macs.  There is no communication from javascript to flash movies
// on Mac browsers so we must write the page heading with HTML.
function writeHeadingOnMac(navCategory) {
	if (navigator.userAgent.indexOf("Mac")!= -1) {
		var catNames = new Array("Corporate Overview", "Products", "Clients", "News", "FAQ's", "Contact Us", "Privacy Policy", "Investor Relations");
		document.writeln('<span class="macHeader">' + catNames[navCategory - 1] + '</span><br />');
	}
}

// This function simple opens a new popup (image) window.
function winOpen(theURL, winName, popW, popH, allowScrolling) {
	var winLeft = (screen.width - popW) / 2;
	var winUp = (screen.height - popH - 50) / 2;
	winProp = 'width=' + popW + ',height=' + popH + ',left=' + winLeft + ',top=' + winUp + ',status=no'
	if (allowScrolling) {
		winProp = winProp + ',scrollbars=yes,resizable=yes'
	} else {
		winProp = winProp + ',scrollbars=no,resizable=no'
	}
	Win = window.open(theURL, winName, winProp)
	if (parseInt(navigator.appVersion) >= 4) { 
		Win.window.focus();
	}
}


