﻿function customizePage(s) {
    if (s.indexOf("{InserisciSponsor}")!=-1)   {
        xml.open ("GET","inserisciSponsor.aspx?fck="+ new Date(),false);
        xml.send(null);
        if (xml.readyState==4)
            if (xml.status==200)
                s=s.replace("{InserisciSponsor}",xml.responseText);
    }
        
    g1=s.indexOf("{Gioco=");   
    if (g1!=-1)   {
        g2=s.indexOf("}",6);
        if (g2>g1)  {
            xml.open ("GET","gamesInsert.aspx?fck="+ new Date() +"&id="+ s.substr(g1+7,g2-g1-7),false);
            xml.send(null);
            if (xml.readyState==4)
                if (xml.status==200)
                    s=s.replace(s.substr(g1,g2-g1+1),xml.responseText);
            }
    }           
    return s;
}

function giocoGioca()   {
    i=document.getElementById("giocoId").value;
    r=document.getElementById("giocoPlay").value;
    if (r=="") {
        alert("Inserire la risposta");
        document.getElementById("giocoPlay").focus();
        return false;
    }
    
    openPage("gamesplay.aspx?id="+ i +"&r="+ r);
    return false;
}