// JavaScript Document

$fadeinspeed = 1500;

function changefeatured($company){
	//alert($company);
	$current = ".company-"+$company;	
	
	if ($company=="nuffnang"){			
		$next = "ripplewerkz";
	}else if($company=="ripplewerkz"){
		$next = "jipaban";
	}else if($company=="jipaban"){
		$next = "churp";		
	}else if($company=="churp"){
		$next = "nuffnang";				
	}
	//$($current).hide();
	$(".company_info").hide();
	$(".company-"+$next).fadeIn($fadeinspeed);
	$("body").attr("id",$next);
	return $next;
	
}

$(document).ready(function(){
	//("body").attr("id","jipaban");
	
	// Hide all company info
	$(".company_info").hide();
	// Show the selected one..
	$(".company-"+$selectedcoy).show();
	
	if ($autorotate == 1){
		$rotateIntervalId = window.setInterval(function(){
			$selectedcoy = changefeatured($selectedcoy);
		},8000); 
	}

	
	$('.company-boxes a').click(function(e) {
		 if ($stayonpage==1){
			 e.preventDefault();
			  $company = $(this).attr('rel');
			  $(".company_info").hide();
			  $selectedcoy = $company;
			  $("body").attr("id",$company);
			  $(".company-"+$company).fadeIn($fadeinspeed);
			  clearInterval($rotateIntervalId);
		 }
	});
	
	$(function() {
	  $defaultdescription = $("#nav-description").html();
	  
	  $('.topnav a img').hover(function() {
		   $(this).fadeOut(00);
		   var currentImg = $(this).attr('src');
		   $(this).attr('src', $(this).attr('hover'));
		  $(this).attr('hover', currentImg);
		  $(this).fadeIn(00);						
	   }, function() {
		   var currentImg = $(this).attr('src');
		   $(this).attr('src', $(this).attr('hover'));
		   $(this).attr('hover', currentImg);
		  
	   });  
	  	
	}); 
	
});

$(document).ready(function(){

});

