$(document).ready(function(){

    var web_path = "/florez_main/";

        web_loc     = web_path + "portfolio/web/",

        flash_loc   = web_path + "portfolio/flash/",

        printed_loc =  web_path + "portfolio/printed/",
		
		graphics_loc =  web_path + "portfolio/graphics/",

        img_location  = web_path + "images/portfolio/",

        file_location = web_loc,

        files = web;

        

    var web_index       = 0,

        flash_index     = 0,

        printed_index   = 0,
		
		graphics_index   = 0,

        cur_index   = web_index;

    

    

    get_frame_data();

    $("#portfolio_next").click(function()

    {

        if(cur_index == files.length-1)

        {

            cur_index = 0;

        }else

        {

            cur_index++;

        }

        get_frame_data();

        return false;               

    });

    $("#portfolio_prev").click(function()

    {

        if(cur_index == 0)

        {

            cur_index = files.length-1;

        }else

        {

            cur_index--;

        }

        get_frame_data();

        return false;

    });

    $("#web, #printed, #flash, #graphics").click(function(){

            files = eval(this.id);

            file_location = eval(this.id + "_loc");

            cur_index = 0;

            get_frame_data();

            return false;

    });

    function get_frame_data()

    {

        $("#work_frame").fadeOut(500, function(){

            $("#work_frame").load(file_location+files[cur_index],function(html){

                    html = html.replace(/%%IMG_LOCATION%%/g,img_location);

                    $("#work_frame").html(html);

                    setTimeout('$("#work_frame").fadeIn(800);',300);

            });

        });

    }

        

});

