$(document).ready(function()
{

	var randnum = Math.floor(Math.random()*5);

//set the links for the sector focus images
      var imglink = Array(5)
      imglink[0] = "/corrs/website/web.nsf/Content/SF_EnergyResources";
      imglink[1] = "/corrs/website/web.nsf/Content/SF_FinancialServices";
      imglink[2] = "/corrs/website/web.nsf/Content/SF_Government";
      imglink[3] = "/corrs/website/web.nsf/Content/SF_Media";
      imglink[4] = "/corrs/website/web.nsf/Content/SF_EngineeringPropertyInfrastructureConstruction";

	var imghref = imglink[randnum];
	var imgnumb="../AttachmentsByTitle/sector"+randnum+".jpg/$FILE/sector"+randnum+".jpg";

//set the image src to the randomly selected image
	$('#sector').attr({src: imgnumb});
//set the corresponding image link
	$('#sectorlink').attr({href: imghref});



var curpage = 1;
var limit = 3;

function pagechange(button){	 

	var slideout = "#item"+curpage;

	if(button=='left'){ if(curpage==1){curpage=limit} else {curpage-=1}; }; 
	
	if(button=='right'){ if(curpage==limit){curpage=1} else {curpage+=1}; };
	
	var slidein = "#item"+curpage;
	
	$(slideout).fadeOut(300, function () { $(slidein).fadeIn(300); });

};

$("#arrowright").click(function (event) { pagechange('right'); event.preventDefault(); });
$("#arrowleft").click(function (event) { pagechange('left'); event.preventDefault(); });
	
	});