$(document).ready(function(){
  var current_image_id = 0;
  var image_tags=new Array("<img src=\"http://www.postling.com/images/screenshot_1.jpg\" width=\"699\" height=\"330\">","<img src=\"http://www.postling.com/images/screenshot_2.jpg\" width=\"699\" height=\"330\">","<img src=\"http://www.postling.com/images/screenshot_3.jpg\" width=\"699\" height=\"330\">","<img src=\"http://www.postling.com/images/screenshot_4.jpg\" width=\"699\" height=\"330\">","<img src=\"http://www.postling.com/images/screenshot_5.jpg\" width=\"699\" height=\"330\">");
  
  var captions=new Array("Step 1: Write your blog post","Step 2: Choose where you want to publish your post","Step 3: Update your Facebook and Twitter status with a link to your post","Step 4: Publish the photos you uploaded to Flickr","Step 5: You're done! From your dashboard, you can review your previous posts.");
  
  check_button_color();
  $("#button_prev").click(function(){
    if( current_image_id > 0 ){ current_image_id--; }
    $("#photo_cell").html(image_tags[current_image_id]);
    $("#caption_cell").html(captions[current_image_id]);
    $("#count").html( (current_image_id+1)+' of 5');
    check_button_color();
  });
  $("#button_next").click(function(){
    if( current_image_id < image_tags.length-1 ){ current_image_id++; }
    $("#photo_cell").html(image_tags[current_image_id]);
    $("#caption_cell").html(captions[current_image_id]);
    $("#count").html( (current_image_id+1)+' of 5');
    check_button_color();
  });
  
  function check_button_color()
  {
    if(current_image_id==0)
    {  
      $("#button_prev").removeClass("index_prev_next");
      $("#button_prev").addClass("index_prev_next_grey");
      $("#button_prev").removeClass("fake_button");
    }
    else
    {
      $("#button_prev").removeClass("index_prev_next_grey");
      $("#button_prev").addClass("index_prev_next");
      $("#button_prev").addClass("fake_button");
    }
    
    if(current_image_id == image_tags.length-1)
    {
      $("#button_next").removeClass("index_prev_next");
      $("#button_next").addClass("index_prev_next_grey");
      $("#button_next").removeClass("fake_button");
    }
    else
    {
      $("#button_next").removeClass("index_prev_next_grey");
      $("#button_next").addClass("index_prev_next");
      $("#button_next").addClass("fake_button");
    }
  }
  
});
	
