function setuprollovers(nav){

	
	setrollover('about');
	setrollover('represent');
	setrollover('products');
	setrollover('contact');
	
	pic1= new Image(); 
	pic1.src="images/nav_about_on.gif";
	pic2= new Image(); 
	pic2.src="images/nav_represent_on.gif";
	pic3= new Image(); 
	pic3.src="images/nav_products_on.gif";
	pic4= new Image(); 
	pic4.src="images/nav_contact_on.gif"; 
	pic5= new Image(); 
	pic5.src="images/nav_bg_on.gif";
}

function setrollover(e){
	
	var el = document.getElementById(e);
	
	if(el.className != "current"){
		el.onmouseover = rollover;
		el.onmouseout = rollout;
		el.onmousedown = goto;
		
	}else{
		el.innerHTML = "<div><span>&nbsp;</span></div>";
	}
}

function rollover(){
	this.className = "over";
	document.getElementById("nav_" + this.id).className = "hover";
	
}

function rollout(){
	this.className = "out";
	document.getElementById("nav_" + this.id).className = "";
}

function goto(){
	document.location = this.id + ".php";
}

function showlegal(){
	newwindow=window.open('disclaimer.html','name','height=330,width=250,status=no,toolbar=no,scrollbars=no,resizable=yes');
	if (window.focus) {newwindow.focus()}
	return false;
}




/**********************
 *
 * THE NAVIGATION
 *
 **********************/
//http://www.learningjquery.com/2007/09/animated-scrolling-with-jquery-12
$(document).ready(function(){
 
 
 	$('.dropdown_current').click(function(){
		$('.dropdown_content').show();
	});
		
	/*$('.dropdown').bind("mouseleave", function(){
		//$('.dropdown_content').hide();
		//beginTimer(); //begin countdown
	});
	*/
	$().bind("mousedown", function(){
		$('.dropdown_content').hide();								   
	});
	
	$('.dropdown_content li').bind("mousedown", function(){
		$('.dropdown_content').hide();
		dropdown_selected(this.id);
		
		//clearTimer();
	});
	
/*	
var dropdownTimer; //the timer for the products dropdown	


function beginTimer(){
	dropdownTimer = setTimeout(endTimer,700);
}

function clearTimer(){
		clearTimeout(dropdownTimer);
}

function endTimer(){
	$('.dropdown_content').hide();	
}

*/
 
 var containerTop = $('#nav').offset().top;
 var containerBottom = $('#footer').offset().top;
 
 var navHeight = 405;
 var maxBottom = containerBottom - navHeight - containerTop;
 
 var newmargin = 0;

var thisy = 0;
var bottomy = 0;

var iebody = (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body;

	function movenav(newcss){
		$('#about div a').css({ margin: newcss });
		$('#represent div a').css({ margin: newcss });
		$('#products div a').css( { margin: newcss } );
		$('#contact div a').css({ margin: newcss });
		
		$('#about div span').css({ margin: newcss });
		$('#represent div span').css({ margin: newcss });
		$('#products div span').css( { margin: newcss } );
		$('#contact div span').css({ margin: newcss });
	}
	

	$(window).scroll(function(){
		
		
		//thisy = document.documentElement.scrollTop;
		thisy = document.all? iebody.scrollTop : pageYOffset;
		
		bottomy = thisy + $(window).height(); //current y position of bottom of viewport
		
		if(thisy > containerTop){
	
			if(thisy < maxBottom ){
				newmargin = bottomy - navHeight - containerTop - 10;
				
				if(newmargin > maxBottom){
					newmargin = maxBottom;
				}
				
				movenav(newmargin + "px 0px 0px");
			}else{
				newmargin = maxBottom;
				movenav(newmargin + "px 0px 0px");
			}
	
		}else{
			movenav("0px");
		}
		
	});
	
	
});

