
function showPic(id) {
    obj = $("#" + id);
        
    image_loc = obj.attr("src");
    image_loc = image_loc.toString().replace("s=medium", "");
        
    html = "<img src='" + image_loc + "' width='650px' />";

    show_window(html);
}



//This will take the uri and store it to a session variable;


function large_uri(uri, display_id, s) {
    uri = unescape(uri);
    var chunk_size = 500;//1KB
    s = typeof(s) != 'undefined' ? iterations : 0;

    
    iterations = uri.length / chunk_size;
    v = uri.substr(s * chunk_size, chunk_size);
    alert(v);
    $.get("index.php?store_uri&data=" + v, function(data) {
        $("#" + display_id).val(data);
    }).success(function(data, status) {
        alert(status);
    });
    
}



function show_window(d) {
    $("#popup").show();
    $("#window").fadeIn("slow");
    $("#popup_content").html(d);
}

function hide_window() {
    $("#popup").hide();
    $("#window").hide()
    return false;
}


function create_comment(args, id, table_base, table_row, prev_coms) {
    args = args + "&ajax=true";
    $.get("index.php?" + args, function(data) {
        if (data.toString().indexOf("topMessagePass") != -1) {
            $("div #" + id).find("#comments_comment").val("");
            //refresh the widget
            $.get("widgets.php?href=pages/comments/update_widget.php&prev=" + prev_coms + "&base=" + table_base + "&row=" + table_row, function(data) {
                   
                $("div #" + id).parent().parent().parent().find("#complete_wrap").html(data);
                $("div #" + id).find("#comments_comment").val("");
                $("div #" + id).find("#submit_button").val("Post Comment");
                    
            });
        } else {
            $("div #" + id).find("#submit_button").val("Post Comment");
        }
            
        $("div #" + id).find("#result").fadeTo(0, 0);
        $("div #" + id).find("#result").html(data);
        $("div #" + id).find("#result").fadeTo("slow", 1);
    });
}
    
function delete_comment(ref) {
    $.get(ref.attr("href") + "&ajax=true", function(data) {
        ref.parent().html("<div id='width: 220px;'>" + data + "</div>");
    });
    return false;
}
    
function view_all_comments(obj) {
    var ser = obj.attr("href");
    ser = ser.replace("b=", "href=");
    ser = ser.replace("index.php?", "");
    $.get("widgets.php?" + ser, function(data) {
        show_window(data); 
    });
    return false;
}

var fish_count = 0;
function refresh_home() {
    fish_count += 1;
    $.get("widgets.php?href=pages/gallery/home_page.php&s=" + fish_count, function(data) {
        $("#hudd_home_container").html(data);
    });
}



//window.setInterval(refresh_home, 5000);
