var currentProfile = 0;

jQuery(document).ready(function(){
		
		function getNextProfile(){
			
		}
		function getPrevProfile(){
		}
		
		
		jQuery('#next-profile-button').click(function(){
													  var nextprofid;
													  if(currentProfile + 1 != numberOfProfiles){
														  nextprofid = currentProfile +1;
													  }else{
														  nextprofid = 0;
													  }
													  //alert('nextprofid'+nextprofid+'-curr'+currentProfile+'-max'+numberOfProfiles);
													 changeProfile(nextprofid);
													  
													  return false;
													  
													  });
		
		jQuery('#prev-profile-button').click(function(){
													  var prevprofid;
													  if(currentProfile != 0){
														  prevprofid = currentProfile -1;
													  }else{
														  prevprofid = numberOfProfiles-1;
													  }
													  //alert('nextprofid'+nextprofid+'-curr'+currentProfile+'-max'+numberOfProfiles);
													 changeProfile(prevprofid);
													  
													  return false;
													  
													  });
		
		function changeProfile(nextprofid){
			 var currentProfileArray = getProfile(nextprofid);
			  currentProfile = nextprofid;
			  
			  jQuery("#rand-section h1").replaceWith('<h1>'+currentProfileArray[0]+'</h1>');
			  jQuery("#rand-section #profileContent").replaceWith('<div id="profileContent">'+currentProfileArray[1]+'</div>');
			  jQuery('#wrap.home').css('background', 'url('+currentProfileArray[2]+') no-repeat 0px 15px');
			jQuery("#profileCounter").replaceWith('<li id="profileCounter">'+(nextprofid+1)+'/'+numberOfProfiles+'</li>');
			jQuery(".twitter-share-button").replaceWith('<script id="twitter-link" src="http://platform.twitter.com/widgets.js" type="text/javascript"></script><a href="'+currentProfileArray[4]+'" class="twitter-share-button">Tweet</a>');
		}
});
