function ponticlaro_handle_nav(){
    // modified from
    // http://www.atlantajones.com/2007/09/27/
    // easy-reusable-image-rollovers-with-jquery/
    
    // Preload all rollovers
    $("#nav img").each(function() {
        // Set the original src
        rollsrc = $(this).attr("src");
        rollON = rollsrc.replace(/.gif$/ig,"_f2.gif");
        $("<img>").attr("src", rollON);
    });
    
    // Navigation rollovers
    $("#nav a").mouseover(function(){
        imgsrc = $(this).children("img").attr("src");
        matches = imgsrc.match(/_f2/);
        
        // don't do the rollover if state is already ON
        if (!matches) {
        imgsrcON = imgsrc.replace(/.gif$/ig,"_f2.gif"); // strip off extension
        $(this).children("img").attr("src", imgsrcON);
        }
    });
        
    $("#nav a").mouseout(function(){
        $(this).children("img").attr("src", imgsrc);
    });
};

function ponticlaro_handle_header(){
    // modified from
    // http://www.atlantajones.com/2007/09/27/
    // easy-reusable-image-rollovers-with-jquery/
    
    // Preload all rollovers
    $("#header img").each(function() {
        // Set the original src
        rollsrc = $(this).attr("src");
        rollON = rollsrc.replace(/.gif$/ig,"_f02.gif");
        $("<img>").attr("src", rollON);
    });
    
    // Navigation rollovers
    $("#header a").mouseover(function(){
        imgsrc = $(this).children("img").attr("src");
        matches = imgsrc.match(/_f02/);
        
        // don't do the rollover if state is already ON
        if (!matches) {
        imgsrcON = imgsrc.replace(/.gif$/ig,"_f02.gif"); // strip off extension
        $(this).children("img").attr("src", imgsrcON);
        }
    });
        
    $("#header a").mouseout(function(){
        $(this).children("img").attr("src", imgsrc);
    });
};


function ponticlaro_handle_email_list(){
    // modified from
    // http://www.atlantajones.com/2007/09/27/
    // easy-reusable-image-rollovers-with-jquery/
    
    // Preload all rollovers
    $("#list img").each(function() {
        // Set the original src
        rollsrc = $(this).attr("src");
        rollON = rollsrc.replace(/.gif$/ig,"_f02.gif");
        $("<img>").attr("src", rollON);
    });
    
    // Navigation rollovers
    $("#list a").mouseover(function(){
        imgsrc = $(this).children("img").attr("src");
        matches = imgsrc.match(/_f02/);
        
        // don't do the rollover if state is already ON
        if (!matches) {
        imgsrcON = imgsrc.replace(/.gif$/ig,"_f02.gif"); // strip off extension
        $(this).children("img").attr("src", imgsrcON);
        }
    });
        
    $("#list a").mouseout(function(){
        $(this).children("img").attr("src", imgsrc);
    });
};

function ponticlaro_handle_photos(){
    // modified from
    // http://www.atlantajones.com/2007/09/27/
    // easy-reusable-image-rollovers-with-jquery/
    
    // Preload all rollovers
    $("#photos img").each(function() {
        // Set the original src
        rollsrc = $(this).attr("src");
        rollON = rollsrc.replace(/.gif$/ig,"_f02.gif");
        $("<img>").attr("src", rollON);
    });
    
    // Navigation rollovers
    $("#photos a").mouseover(function(){
        imgsrc = $(this).children("img").attr("src");
        matches = imgsrc.match(/_f02/);
        
        // don't do the rollover if state is already ON
        if (!matches) {
        imgsrcON = imgsrc.replace(/.gif$/ig,"_f02.gif"); // strip off extension
        $(this).children("img").attr("src", imgsrcON);
        }
    });
        
    $("#photos a").mouseout(function(){
        $(this).children("img").attr("src", imgsrc);
    });
}

function handleTintoJquery(){
    // frontpage flash-like slideshow
    $('#s5').cycle({ 
        fx:    'fade', 
        speed: 2500,
        timeout: 1200
    });

    // rollovers
    ponticlaro_handle_nav();
    ponticlaro_handle_header(); 
    ponticlaro_handle_email_list();    
    ponticlaro_handle_photos();  
        
    // TABS
    // handle the navigation
    $('#staff > ul').tabs({ 
        fx: { 
            opacity: 'toggle' 
        },
        selected: null
    }).bind('select.ui-tabs', function(e, ui){
        
    }).bind('show.ui-tabs', function(e, ui){
        var selected = $('#nav > ul').data('selected.ui-tabs');
        
    });
    
    // highslide
    hs.graphicsDir = '/wp-content/themes/tinto/js/highslide/graphics/';
    
    // Identify a caption for all images. 
    // This can also be set inline for each image.
    hs.captionId = 'the-caption';
    hs.outlineType = 'rounded-white';
    hs.align = 'center';
    hs.showCredits = 0;
};

// GET RESPONSE
function new_freecap(){
    if(document.getElementById)
    {
        thesrc = document.getElementById("freecap").src;
        document.getElementById("freecap").src = thesrc+"?"+Math.round(Math.random()*100000);
    } else {
        alert("Sorry, cannot autoreload image\nPlease reload the page and new Captcha will be loaded.");
    }
};
