$(document).ready(function(){
	$('#navmain').find('a').removeClass('active');
	$("#scrollable").scrollable({items:'.items',horizontal:true,size:9});
	//$("#devices").scrollable({items:'.items',horizontal:true,size:6});
	$('#profiles .items a').click(function(){
	if (p != null)
{
	profile = $("#profiles .items a."+p+"").attr("id");
	var alink = $("#profiles .items a."+p);		 					   	   
	if (p == "rorysutherland")
		profileLoad = "/profiles/rory-sutherland.aspx"; 
	else if (p == "halhigdon")
		profileLoad = "/profiles/hal-higdon.aspx"; 
	else if (p == "tylerstroebel")
		profileLoad = "/profiles/tyler-stroebel.aspx";
	else if (p == "tomholland")
		profileLoad = "/profiles/tom-holland.aspx";
	else if (p == "cadelevans")
		profileLoad = "/profiles/09-tour-de-france.aspx";
	else if (p == "askerjeukendrup")
		profileLoad = "/profiles/asker-jeukendrup.aspx";
	else if (p == "sarahhaskins")
		profileLoad = "/profiles/sarah-haskins.aspx";
	else if (p == "breewee")
		profileLoad = "/profiles/bree-wee.aspx";
	else if (p == "taylorphinney")
		profileLoad = "/profiles/taylor-phinney.aspx";
	else if (p == "bengreenfield")
		profileLoad = "/profiles/ben-greenfield.aspx";
	else if (p == "jeremiahbishop")
		profileLoad = "/profiles/jeremiah-bishop.aspx";
	else if (p == "joefriel")
		profileLoad = "/profiles/joe-friel.aspx";
	else if (p == "teamsaxobank")
		profileLoad = "/profiles/team-saxo-bank.aspx";
	else if (p == "usabmx")
		profileLoad = "/profiles/jill-kintner.aspx";
	else if (p == "stationarybike")
		profileLoad = "/profiles/stationary-bike.aspx";
	else if (p == "weightloss")
		profileLoad = "/profiles/weightloss.aspx";
	else if (p == "strengthtraining")
		profileLoad = "/profiles/strength-training.aspx";
	else if (p == "distancemeter")
		profileLoad = "/profiles/upload-gps-data-from-the-iphone.aspx";
	else if (p == "tomdanielson")
	{
		profileLoad = "/profiles/tom-danielson.aspx";
		$("#homemaininnerleft").click(function(){window.location.href = alink.find("img").attr("id");});
		$("#homemaininnerleft").css({cursor:"pointer"});
	}	
	else if (p == "cycling")
	{
		profile = "/media/66365/tomdanielson_quote.jpg";
		profileLoad = "/profiles/tom-danielson.aspx";
		$("#homemaininnerleft").click(function(){window.location.href = alink.find("img").attr("id");});
		$("#homemaininnerleft").css({cursor:"pointer"});
	}	
	else if (p == "timex")
		profileLoad = "/profiles/timex.aspx";
	else if (p == "smheartlink")
		profileLoad = "/profiles/smheartlink.aspx";
	else if (p == "pjlarson")
		profileLoad = "/profiles/pj-larsen.aspx";
	else if (p == "marcopinotti")
		profileLoad = "/profiles/marco-pinotti.aspx";
	else if (p == "heatherlockwood")
		profileLoad = "/profiles/heather-lockwood.aspx";
	else if (p == "michaellong")
		profileLoad = "/profiles/michael-long.aspx";
	else if (p == "personaltrainer_stock")
		profileLoad = "/profiles/personal-trainer-professionals.aspx";
	else if (p == "bike")
		profileLoad = "/profiles/dominique-cornu.aspx";
	else if (p == "kickboxing")
		profileLoad = "/profiles/kickboxing.aspx";
	else if (p == "columbia")
		profileLoad = "/profiles/team-columbia.aspx";
	else if (p == "09tdf")
		profileLoad = "/profiles/09-tour-de-france.aspx";
	else
		profileLoad = alink.find("img").attr("id");		
	$(alink).addClass("on");
	$("#homeintro").load(profileLoad + " div#homepagecontent");
	$("div#homepagemain").css({'background-image':"url('"+profile+"')"});
}
	});
 });
