/* Namespace for this cookie object, since we've got a conflict somewhere. */
var PCF_cookie = jQuery.cookie;
var my_cookie = "feature_choice";
var days_to_keep = 7;


//console.log("Delete the cookie");
//PCF_cookie(my_cookie, "null");


function start_slideshow() {
    jQuery(".text-holder span.feature-slideshow").cycle({
      fx: "fade",
      timeout: 4500,
      delay:  -2000,
      sync: true
    });
}
  
  if ( PCF_cookie(my_cookie) == null ) {
  
    start_slideshow();
  
  } else {
  
    if ( jQuery( ".feature-slideshow a.img-box#" + PCF_cookie(my_cookie) ).length > 0 ) {
  
      //console.log( "show just this item. [.feature-slideshow a.img-box#" + PCF_cookie(my_cookie) + "]");

      jQuery( "#" + PCF_cookie(my_cookie) ).fadeIn("fast");
    
    } else {
  
      //console.log( "item not found. [.feature-slideshow a.img-box#" + PCF_cookie(my_cookie) + "] begin slideshow." );
    
      start_slideshow();
    
    }
  
  }

  jQuery(".feature-slideshow a.img-box").click(function(){
  
    // Set our cookie to the ID of the chosen feature and expire
    // when we choose.
    PCF_cookie( my_cookie, jQuery(this).attr("id"), { expires: days_to_keep } );
  
    //console.log( "Cookie:" + PCF_cookie(my_cookie) );
      
    //return false;
  
  });
