﻿// JScript File

function TestAjax(){
    AjaxWebService.WS.HelloWorld(TestAjaxOK);
}

function TestAjaxOK(res){
    alert(res);
}

function Unload(div){
    ScriviDiv(div,"")
}

function Load(div){
    ScriviDiv(div,TextLoad)
}


function getfield(id){

    var obj;
    obj=document.getElementById(id);
    
    if (obj!=null) {
    return obj.value;
    }
    else{
    return "";
    }

}

//messaggio di LOADING generico
var TextLoad="<img src='img/load.gif' border=0/><font color='#B2B2B2'><b> Caricamento in corso...</b></font>";

function ScriviDiv(div,txt) {
    var obj;
    obj=document.getElementById(div);
    //alert(obj);
    if (obj!=null){
        obj.innerHTML=txt;
    }
}


//Caricamento prodotti
function Apri(pagina,posX) {
    Load("DIV_PRODOTTO_LOAD");
    AjaxWs.WS.CaricaPagina(pagina,posX,CaricaPaginaOK);
}


//DIV_SPAZIO_VERT
function ImpostaVert(PosX) {

    /*
     var obj;
    obj=document.getElementById("DIV_SPAZIO_VERT");
    //alert(obj);
    if (obj!=null){
        obj.style.height=PosX;
    }
    */
    var objImg;
    //IMG_SPAZIO_VERT
    objImg=document.getElementById("IMG_SPAZIO_VERT");
    
    if (objImg!=null){
        objImg.height=PosX;
    }
    
}

function CaricaPaginaOK(res){
    
     
    if (res.Errore==""){
        ImpostaVert(res.PosX)
        ScriviDiv("DIV_PRODOTTO",res.RenderResult);
        }
        else
        {
        alert(res.Errore);
        
        }
    Unload("DIV_PRODOTTO_LOAD");
}



