﻿// JScript File
var top = 0;
var button = 3;
var searchanchor;
var tempload;
var tophttpRequest = false;

function topmakeObjecttop() {
    var tophttpRequest;
    if (window.XMLHttpRequest) {
        tophttpRequest = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        try {
            tophttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            tophttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    return tophttpRequest;
}
tophttpRequest = topmakeObjecttop();
//function Top_processRequest_load() {
//    if (tophttpRequest == null) {
//        tophttpRequest = topmakeObjecttop();
//    }
////    if (tophttpRequest.readyState < 4) {
//        //           document.getElementById("tdloader").style.display="block";
//        //           document.getElementById("tdloader").innerHTML="<img src=\"images/loadinfo.net.gif\"  alt=\"loading\" />"

////    }
//    if (tophttpRequest.readyState == 4) {

//        if (tophttpRequest.status == 200) {
//            var response = tophttpRequest.responseText;
//            document.getElementById("itemload1").innerHTML = response;           
//        }
//    }
//}
function Top_processRequest_load_anchor() 
{
    if (tophttpRequest == null) 
    {
        tophttpRequest = topmakeObjecttop();
    }
    if (tophttpRequest.readyState < 4) 
    {
       //document.getElementById("itemload1").style.display="block";
       //document.getElementById("itemload1").innerHTML="<img src=\"images/ajax-loader.gif\"  alt=\"loading\" />";
       
       var strloader="<p class=\"bestuparrw\"><a href=\"javascript:void(0);\"><img src=\"images/bestArrw_top.png\" width=\"31\" height=\"15\" alt=\"\" /></a></p>"+
           "<div class=\"bestdiv\">"+
           "<h2>Best Sellers</h2>"+
           "<ul>"+
           "<li><span class=\"load\"><img src=\"images/ajax-loader.gif\"  alt=\"loading\" /></span></li>"+
           "<li><span class=\"load\"><img src=\"images/ajax-loader.gif\"  alt=\"loading\" /></span></li>"+
           "</ul>"+
           "</div>"+
           "<p class=\"bestdownarrw\"><a href=\"javascript:void(0);\"><img src=\"images/bestArrw_botm.png\" width=\"31\" height=\"15\" alt=\"\" /></a></p>";
       
       document.getElementById("itemload1").innerHTML=strloader;
    }
    if (tophttpRequest.readyState == 4) 
    {
        if (tophttpRequest.status == 200) 
        {
            var response = tophttpRequest.responseText;

            document.getElementById("itemload1").innerHTML = response;
//            if (searchanchor == 'b') {
//                button = button + 2;
//                top = top + 1;
//            }
//            if (searchanchor == 't') {
//                button = button - 2;
//                top = top - 1;
//            }
        }
    }
}
//function ItemloadIndex() {
//    tophttpRequest.open("POST", "Ajaxitemload.aspx", true);
//    tophttpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
//    tophttpRequest.onreadystatechange = Top_processRequest_load;
//    tophttpRequest.send("&mode=55");
//}
function ItemloadIndex1(OBJ) {    
    if (OBJ == 'b') 
    {
        searchanchor = 'b';
        if(document.getElementById("hidcurr").value==document.getElementById("hidpage").value)
        {
            document.getElementById("hidcurr").value=1;            
        }
        else
        {
            document.getElementById("hidcurr").value=parseInt(document.getElementById("hidcurr").value)+1;
        }        
//        tempload = button;
//        alert(tempload);
    }
    if (OBJ == 't') 
    {
        searchanchor = 't';
        
        if(document.getElementById("hidcurr").value==1)
        {
            document.getElementById("hidcurr").value=document.getElementById("hidpage").value;
        }
        else
        {
            document.getElementById("hidcurr").value=parseInt(document.getElementById("hidcurr").value)-1;
        }
        //tempload = top;
    }
    tophttpRequest.open("POST", "AjaxanchorItem.aspx", true);
    tophttpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    tophttpRequest.onreadystatechange = Top_processRequest_load_anchor;
    tophttpRequest.send("current=" + document.getElementById("hidcurr").value + "&page="+document.getElementById("hidpage").value+"&mode=5");
}




