/* WPstudios/FedericaCau/CodingKoala : GenericSkeleton */

// ----------------------------------------------------------
// CodingKoala : CUSTOM GENERIC PAGED SLIDER
// ----------------------------------------------------------
var gen_tPun;
var gen_curr_img   = 1;
var gen_prev_img   = 1;
var gen_max_img    = 1;
var gen_show_delay = 8 * 1000; // slider secs.
var gen_page_img   = 1;
var gen_page_width = 1;
var gen_slide_el; 
var dot_on  = '';
var dot_off = '';

function doSetSlideNum(el, n_imgs,p_imgs,w_imgs,d_on,d_off)
{
  dot_on  = d_on;
  dot_off = d_off;
  $('#dots').empty();
  
  gen_max_img     = n_imgs/p_imgs;
  gen_page_img    = p_imgs
  gen_page_width  = p_imgs * w_imgs;
  gen_slide_el    = el;
  
  $(gen_slide_el).css('width', ((gen_max_img) * gen_page_width)+'px');

  for(i = 0; i < n_imgs; i++)
    $('#dots').append("<img id='dot_"+(i+1)+"' src='"+dot_off+"' alt='o' border='0' style='cursor: pointer; padding-left: 2px;' onclick='javascript:doShowN("+(i+1)+")' />");

  doShow();
}

function doShow()
{ 
  $(gen_slide_el).animate({left: (gen_curr_img - 1)*(-1*gen_page_width)+'px'},600);

  k = (gen_prev_img - 1) * gen_page_img;
  for(y = 0; y < gen_page_img; y++)
    $('#dot_'+(k+y+1)).attr('src', dot_off);

  k = (gen_curr_img - 1) * gen_page_img;
  for(y = 0; y < gen_page_img; y++)
    $('#dot_'+(k+y+1)).attr('src', dot_on);
   
  gen_prev_img = gen_curr_img;
  gen_curr_img++;
  if(gen_curr_img > gen_max_img) gen_curr_img = 1;

  gen_tPun = setTimeout("doShow()",gen_show_delay);
}


function doShowN(x)
{
  clearInterval(gen_tPun);
  gen_curr_img = x;
  doShow();
}

function doShowNext() 
{
  clearInterval(gen_tPun);
  doShow();
}


function doShowPrev() 
{
  clearInterval(gen_tPun);
  gen_curr_img = gen_prev_img - 1;
  if(gen_curr_img < 1) gen_curr_img = gen_max_img;
  doShow();  
}
// ----------------------------------------------------------
// END
// ----------------------------------------------------------


$(document).ready(function(){ 
    // fix IE6 png issue
    $(document).pngFix();
}); 
