 $(document).ready(function(){
 
 	/* set footer */
	$('#footer').footer();
	
	/* position global nav */
	$("#mainNav ul li").each(function() {
	  	var menuWid = $("#mainNav").outerWidth(true);
	  	var menuLeft = $("#mainNav").position().left;
	  	var thisLeft = $(this).position().left;
	  	var thisPos = thisLeft - menuLeft;
	  	var tmpWid = menuWid - thisPos;	  	
	  	var subWid = Math.round($("ul",this).outerWidth(true));
	  	var remWid = Math.round(tmpWid - subWid);
	  
	  	
	  	if(remWid < 1){
		$("ul",this).css("marginLeft",remWid + "px");
	  	}
	});
	
	/* global nav hover */
	$("#mainNav ul li").hover(
	  function () { 	
		$(this).addClass("on");
		$("ul:first",this).fadeIn(90);
	  }, 
	  function () {
		$(this).removeClass("on");
		$("ul:first",this).fadeOut(45);
	  }
	);
	
	/* newsletter signup */
	$("#signUpForm").submit(function(e) {
		e.preventDefault(); 

		var $form = $(this),
		email = $form.find( 'input[name="signUpEmail"]' ).val();

		$.post( '/newsletter/signup.php', { email: email },
			function( data ) {
			  $( "#signUpFormMsg" ).html( data );
			  $( "#signUpFormMsg" ).show();
			}
		);	    
	});
	
	/* industry links */
	$("#industryLinks").change(function(e) {
		e.preventDefault(); 
		var $url = $(this).val();
		
		if($url != ""){
			location.href = $url;   		
		} 
	});
	
	/* search 
	$("#searchKey").focus(function(e) {
		$(this).val('');		
	});
	$(document).keypress(function(e) {
	    if(e.keyCode == 13) {
	        alert('Searching site...');
	    }
	});*/


 });
 
 (function($){Footer={style:{absolute:{position:"absolute",bottom:0},relative:{position:"relative",bottom:"auto"}},configs:{timeOut:200,zIndex:200},browserAdjust:0,height:0,fHeight:0,fId:0,monitor:function(){if(Footer.height!==$(document).height()){Footer.setPosition();Footer.height=$(document).height();}if(Footer.fHeight!==$(Footer.fId).height()){Footer.setFsmHeight();Footer.footerHeight=$(Footer.fId).height();}setTimeout(function(){Footer.monitor();},Footer.configs.timeOut);},setPosition:function(){if(($(document).height()-Footer.browserAdjust)>$(window).height()){$("#footerMargin").remove();$(Footer.fId).css(Footer.style.relative);}else{if($("#footerMargin").size()==0){$(Footer.fId).parent().append("<div id='footerMargin' style='height: "+$(Footer.fId).height()+"px;'></div>");}$(Footer.fId).css(Footer.style.absolute);}},setFsmHeight:function(){if($("#footerMargin").size()>0&&$(Footer.fId).height()!==$("#footerMargin").height()){$("#footerMargin").height($(Footer.fId).height());}}};$.fn.footer=function(options){Footer.configs=$.extend(Footer.configs,options);if(Footer.configs.timeOut<1){Footer.configs.timeOut=1;}if($(this).attr("id")===""){$(this).attr("id","footerAutoGeneratedId");}$(this).css("z-index",Footer.configs.zIndex);Footer.fId="#"+$(this).attr("id");Footer.height=$(document).height();Footer.fHeight=$(this).height();if($.browser.msie){Footer.browserAdjust=4;}Footer.setPosition();Footer.monitor();};})(jQuery);

 

