/* BROWSER DETECTION FOR ALT STYLESHEETS */

var x = navigator;
var userAgent = x.userAgent;
var renderingEngine = /webkit/i;
var mozEngine = /firefox/i;
var thePlatform = /win/i;



// IF THIS IS A WEBKIT BROWSER, LOAD THE FOLLOWING STYLESHEET
if (userAgent.match(renderingEngine)) {
	document.write ("<link rel='stylesheet' href='resources/css/webkit.css' type='text/css' />");
	}


// IF THIS IS A MOZILLA BROWSER USING WINDOWS, LOAD THE FOLLOWING STYLESHEET
if (userAgent.match(mozEngine) && userAgent.match(thePlatform) ) {
	document.write ("<link rel='stylesheet' href='resources/css/mozilla-win.css' type='text/css' />");
	}




// SET YEAR FOR COPYRIGHT
var todayDate = new Date();
var thisYear = todayDate.getFullYear();



/* ROLLOVERS */

function rollOver(theID) {
	var theID = theID;
	var theImage = document.getElementById(theID).src;

	var theExt = ".gif";
	var theRoll = theImage.replace(theExt, "_over.gif");
	document.getElementById(theID).src = theRoll;
	}

function rollOut(theID) {
	var theID = theID;
	var theImage = document.getElementById(theID).src;

	var theExt = "_over.gif";
	var theRoll = theImage.replace(theExt, ".gif");
	document.getElementById(theID).src = theRoll;

	}






/* JQUERY FUNCTIONS  */
$(document).ready(function(){


	/* TOGGLE MENUS ON/OFF */

	//IE7-8 Transparency Fix



	// Company Menu
	$("#company").hover(
	function() {
		$("#company-menu").show();

		// restores transparency in IE7/8
		if ($.browser.msie && $.browser.version < 9 ) {
			$('#company-menu').css({'filter' : 'alpha(opacity=80)'});
			}

		$("#company > a").addClass("down");
		},
		function() {
			$("#company-menu").hide("slow");
			$("#company > a").removeClass("down");
			}
		);

	// Solutions Menu
	$("#solutions").hover(
	function() {
		$("#solutions-menu").show();

		// restores transparency in IE7/8
		if ($.browser.msie && $.browser.version < 9 ) {
			$('#solutions-menu').css({'filter' : 'alpha(opacity=80)'});
			}

		$("#solutions > a").addClass("down");
		},
		function() {
			$("#solutions-menu").hide("slow");
			$("#solutions > a").removeClass("down");
			}
		);

	// News Menu
	$("#news").hover(
	function() {
		$("#news-menu").show();

		// restores transparency in IE7/8
		if ($.browser.msie && $.browser.version < 9 ) {
			$('#news-menu').css({'filter' : 'alpha(opacity=80)'});
			}

		$("#news > a").addClass("down");
		},
		function() {
			$("#news-menu").hide("slow");
			$("#news > a").removeClass("down");
			}
		);

	// Media Menu
	$("#media").hover(
	function() {
		$("#media-menu").show();

		// restores transparency in IE7/8
		if ($.browser.msie && $.browser.version < 9 ) {
			$('#media-menu').css({'filter' : 'alpha(opacity=80)'});
			}

		$("#media > a").addClass("down");
		},
		function() {
			$("#media-menu").hide("slow");
			$("#media > a").removeClass("down");
			}
		);

	// Contact Menu  -- NOT used currently
	$("#contact").hover(
	function() {
		$("#contact-menu").show();

		// restores transparency in IE7/8
		if ($.browser.msie && $.browser.version < 9 ) {
			$('#contact-menu').css({'filter' : 'alpha(opacity=80)'});
			}

		$("#contact > a").addClass("down");
		},
		function() {
			$("#contact-menu").hide("slow");
			$("#contact > a").removeClass("down");
			}
		);



// LANDING PAGE RIGHT BUTTON ROLLOVERS
	$("#right-buttons a  > img").hover(function(){
		var theImg = $(this).attr("src");
		var theID = $(this).attr("id");

		var theExt = ".jpg";
		var theRoll = theImg.replace(theExt, "_over.jpg");

		document.getElementById(theID).src= theRoll;
		},
		function() {
			var theImg = $(this).attr("src");
			var theID = $(this).attr("id");

			var theExt = "_over.jpg";
			var theRoll = theImg.replace(theExt, ".jpg");

			document.getElementById(theID).src= theRoll;
			}
		);



});