function OpenSimpleBooking(Lang, Type, OptionalGuid)
{
    var Guid = '3AD64F41-D84A-4439-92E4-FC43B70AA0FE';
    if(OptionalGuid != null) { Guid = OptionalGuid; }
    if(Guid != null && Guid != '')
    {
        var wndParams = 'scrollbars=no,resizable=yes,location=no,menubar=no,status=no,width=630,height=400';
        var Url = 'https://www.simplebooking.it/booking.aspx';
        Url += '?GUID=' + Guid;
        Url += '&LANG=' + ((Lang != null && Lang != '') ? Lang : 'EN');
        if(Type != null) { Url += '&DO=' + Type; }
        //pageTracker._link(Url);
        var frm = document.createElement('form');
        frm.id = 'frmSB';
        frm.name = 'frmSB';
        frm.action = Url;
        frm.method = 'POST';
        var wndFrm = window.open('','OnlineBooking_' + this.Guid, wndParams);
        wndFrm.id = wndFrm.name;
        wndFrm.document.open();
        wndFrm.document.write('Loading...');
        wndFrm.document.close();
        frm.target = wndFrm.name;
        pageTracker._linkByPost(frm);
        var body = FindBody();
        body.appendChild(frm);
        frm.submit();
    }
    else { alert('Please specify a valid GUID.'); }
}
function FindBody()
{
    //var body = document.childNodes[1];
    //if(body != null && body.nodeName == 'BODY') return body;
    //body = document.getElementsByTagName('BODY')[0];
    //if(body != null && body.nodeName == 'BODY') return body;
    body = FindNodeByName(document.childNodes, 'BODY');
    return body;

}
function FindNodeByName(nodes, tagName)
{
    for(var i = 0; i < nodes.length; i++)
    {
        if(nodes[i].nodeName.toUpperCase() == tagName.toUpperCase())
        {
            return nodes[i];
        }
        if(nodes[i].hasChildNodes())
        {
            var node = FindNodeByName(nodes[i].childNodes, tagName);
            if(node != null) { return node; }
        }
    }
    return null;
}
