﻿var cpage = 1;

function swapimage(cid) {
    document.getElementById("image" + ccid).className = "hidden";
    document.getElementById("image" + cid).className = "productimage";
    ccid = cid;
}

function swapmainimage(o, cid) {
    document.getElementById("mainimage" + cid).setAttribute("src", o.getAttribute("src").replace("/_thumbnails", ""));
}

// Common Items
function paging(page, did, searchterm) {
    // get the increment
    var oincrement = increment;
    var cpage = ((totIncrement/830) * -1) + 1

    if (cpage < page) {
        // set temporary increment
        increment = (page - cpage) * oincrement;
        next_click();
    }
    else if (cpage > page) {
        // set temporary increment
        increment = (cpage - page) * oincrement;
        previous_click();
    }
    increment = oincrement;
}

function listsuccess(value, ctx, methodName) { 
    // Create a table for the new content
    var newtable = document.createElement("div");
    newtable.innerHTML = value;
    document.getElementById("productsouter").appendChild(newtable.firstChild);

    // Hide the loading notice
    if (ctx.greyoutcontent == "true") {
        greyoutContent(false);
    }
}

