$(document).ready(function(){ 
	$.fn.easySlider;


$("#list1").click(function(){	
	CallfadeInOutAuto(1);
});
$("#list2").click(function(){					   
	CallfadeInOutAuto(2);
});
$("#list3").click(function(){					   
	CallfadeInOutAuto(3);
});
$("#list4").click(function(){					   
	CallfadeInOutAuto(4);
});

function CallfadeInOutAuto(show){ 
	
	//alert(show); return false;
	titleNameSecond = "#slider"+show;
	var imageNameArray = new Array('turck_image.gif', 'dump-truck.jpg', 'box-truck.jpg', 'dodge-5500-service-truck.jpg');
	for(i=1;i<=4;i++){
		//alert(i);
		if(show != i)
		{
			titleNameFirst = "slider"+(i);
			document.getElementById('list'+i).className='';
			document.getElementById(titleNameFirst).style.display = 'none';
		}
		else
		{
			//alert(show);
			imgPath = document.getElementById(show).src;
			imageLength = imageNameArray[show-1].length;
			pathLength = imgPath.length;
			relativeLength = pathLength - imageLength;
			imageName = imgPath.substr(relativeLength)
			//alert(imageName);
			if(imageName == 'turck_image.gif')
			{
				name = '<a href="type_of_equipment.php">Fed Ex/DHL Truck Financing</a>';
			}
			else if(imageName == 'dump-truck.jpg')
			{
				name = '<a href="type_of_equipment.php">Commercial Dump Truck Financing</a>';
			}
			else if(imageName == 'box-truck.jpg')
			{
				name = '<a href="type_of_equipment.php">Commercial Box Truck Financing</a>';
			}
			else if(imageName == 'dodge-5500-service-truck.jpg')
			{
				name = '<a href="type_of_equipment.php">Medium Duty Truck Financing</a>';
			}
			$(titleNameSecond).fadeIn('slow');
			document.getElementById('list'+show).className='active';
			document.getElementById('ImageName').innerHTML = name;
		}
	}
	
}
});

