/* 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 = 30 * 1000; // slider secs.
var gen_page_img   = 1;
var gen_page_width = 1;
var gen_slide_el; 

function doSetSlideNum(el, n_imgs,p_imgs,w_imgs)
{
  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');

  doShow();
}

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

  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
// ----------------------------------------------------------

// ----------------------------------------------------------
// CodingKoala : CUSTOM GENERIC PAGED SLIDER
// ----------------------------------------------------------
/**
 * <span class="Obfuscated" title="some title">
 * some link text [ someone AT gmail DOT com ]
 * <span>
 **/
jQuery.fn.deobfuscate = function()
{
        return this.each(function()
        {
                var content = $(this).text();

                /* grab the part inside the braces, swap out placeholders, and trim
                 */
                var obfuscated = content.match(/\[(.*)\]/);
                var address = obfuscated[1]
                        .replace(' AT ', '@')
                        .replace(' DOT ', '.')
                        .replace(/^\s+|\s+$/g, '');

                /* get everything before the braces and trim
                 */
                var text = content.match(/.?[^[]+/);

                text = (text[0] != content)
                        ? text[0].replace(/^\s+|\s+$/g, '')
                        : address;      // if there's no text part, use the address

                var title = $(this).attr('title') || '';

                $(this).replaceWith($('<a class="link" href="mailto:' + address + '" title="' +
title + '">' + text + '</a>'));
        });

};
// ----------------------------------------------------------
// END
// ----------------------------------------------------------


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