var alertm = 0
var mainurl = "http://www.hotnot.lt";
function ShowDialog(text) {

    if (alertm == 0) {
        alertm = 1;

        if (text != "Prašome prisijungti prie sistemos su savo prisijungimo vardu ir slaptažodžiu.") {
            // create a new <div>
            div = document.createElement('div');
            div.className = 'maindialog';
            div.name = 'mdid';

            document.body.appendChild(div);

            closediv = document.createElement("input");
            closediv.type = "button";
            closediv.className = "closedialogbtn";
            closediv.value = "";
            closediv.onclick = function () {
                document.body.removeChild(div);
                alertm = 0;
            };

            div.appendChild(closediv);

            subdiv = document.createElement('div');
            subdiv.className = 'subdialog';

            var html = text;
            subdiv.innerHTML = html;

            div.appendChild(subdiv);


        } else {
            // create a new <div>
            div = document.createElement('div');
            div.id = 'mainlogreg';
            div.name = 'mdid';

            document.body.appendChild(div);

            subdiv = document.createElement('div');
            subdiv.id = 'warpersubmainlogreg';

            subsubdiv = document.createElement('div');
            subsubdiv.id = 'submainlogreg';

            subdiv.appendChild(subsubdiv);

            div.appendChild(subdiv);
            closediv = document.createElement("input");
            closediv.type = "button";
            closediv.id = "closelr";
            closediv.value = "";
            closediv.onclick = function () {
                document.body.removeChild(div);
                alertm = 0;
            };

            var ajaxRequest; // The variable that makes Ajax possible!

            try {
                // Opera 8.0+, Firefox, Safari
                ajaxRequest = new XMLHttpRequest();
            } catch(e) {
                // Internet Explorer Browsers
                try {
                    ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
                } catch(e) {
                    try {
                        ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                    } catch(e) {
                        // Something went wrong
                        alert("Įvyko naršyklės klaida!");
                        return false;
                    }
                }
            }
            // Create a function that will receive data sent from the server
            ajaxRequest.onreadystatechange = function () {
                if (ajaxRequest.readyState == 4) {
                    var ajaxDisplay = subsubdiv;
                    ajaxDisplay.innerHTML = ajaxRequest.responseText;
                    subsubdiv.appendChild(closediv);
                }
            }
            ajaxRequest.open("GET", mainurl + "/reglogin.php", true);
            ajaxRequest.send(null);
            window.scrollBy(0,1);

        }

    }
}

function BlackScreen(page) {

    if (alertm == 0) {
        alertm = 1;


            // create a new <div>
            div = document.createElement('div');
            div.id = 'mainlogreg';
            div.name = 'mdid';

            document.body.appendChild(div);

            subdiv = document.createElement('div');
            subdiv.id = 'warpersubmainlogreg';

            subsubdiv = document.createElement('div');
            subsubdiv.id = 'submainlogscr';

            subdiv.appendChild(subsubdiv);

            div.appendChild(subdiv);
            closediv = document.createElement("input");
            closediv.type = "button";


							closediv.id = "closelrscr";


						closediv.value = "";
            closediv.onclick = function () {
                document.body.removeChild(div);
                alertm = 0;
            };

            var ajaxRequest; // The variable that makes Ajax possible!

            try {
                // Opera 8.0+, Firefox, Safari
                ajaxRequest = new XMLHttpRequest();
            } catch(e) {
                // Internet Explorer Browsers
                try {
                    ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
                } catch(e) {
                    try {
                        ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                    } catch(e) {
                        // Something went wrong
                        alert("Įvyko naršyklės klaida!");
                        return false;
                    }
                }
            }
            // Create a function that will receive data sent from the server
            ajaxRequest.onreadystatechange = function () {
                if (ajaxRequest.readyState == 4) {
                    var ajaxDisplay = subsubdiv;
                    ajaxDisplay.innerHTML = ajaxRequest.responseText;
                    subsubdiv.appendChild(closediv);
                }
            }
            ajaxRequest.open("GET", mainurl + "/" + page, true);
            ajaxRequest.send(null);



    }
}

function go_down() {
    window.scrollBy(0,1)
}

function HoroLoad(page, id) {

    if (alertm == 0) {
        alertm = 1;


            // create a new <div>
            div = document.createElement('div');
            div.id = 'mainlogreg';
            div.name = 'mdid';

            document.body.appendChild(div);

            subdiv = document.createElement('div');
            subdiv.id = 'warpersubmainlogreg';

            subsubdiv = document.createElement('div');
            subsubdiv.id = 'submainlogscr';

            subdiv.appendChild(subsubdiv);

            div.appendChild(subdiv);
            closediv = document.createElement("input");
            closediv.type = "button";

							closediv.id = "closelr";


						closediv.value = "";
            closediv.onclick = function () {
                document.body.removeChild(div);
                alertm = 0;
            };

            var ajaxRequest; // The variable that makes Ajax possible!

            try {
                // Opera 8.0+, Firefox, Safari
                ajaxRequest = new XMLHttpRequest();
            } catch(e) {
                // Internet Explorer Browsers
                try {
                    ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
                } catch(e) {
                    try {
                        ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                    } catch(e) {
                        // Something went wrong
                        alert("Įvyko naršyklės klaida!");
                        return false;
                    }
                }
            }
            // Create a function that will receive data sent from the server
            ajaxRequest.onreadystatechange = function () {
                if (ajaxRequest.readyState == 4) {
                    var ajaxDisplay = subsubdiv;
                    ajaxDisplay.innerHTML = ajaxRequest.responseText;
                    subsubdiv.appendChild(closediv);
                }
            }
            ajaxRequest.open("GET", mainurl + "/" + page, true);
            ajaxRequest.send(null);
            setTimeout('go_down()', 500);
            ajax_multi('http://www.hotnot.lt/horoscope_ajax.php?horo='+id, 'horo_body', '6');
             setTimeout('go_down()', 4000);



    }
}

function UploadMusic() {

    if (alertm == 0) {
        alertm = 1;


            // create a new <div>
            div = document.createElement('div');
            div.id = 'mainlogreg';
            div.name = 'mdid';

            document.body.appendChild(div);

            subdiv = document.createElement('div');
            subdiv.id = 'warpersubmainlogreg';

            subsubdiv = document.createElement('div');
            subsubdiv.id = 'submainlogscr';

            subdiv.appendChild(subsubdiv);

            div.appendChild(subdiv);
            closediv = document.createElement("input");
            closediv.type = "button";
            closediv.id = "closelr";
            closediv.value = "";
            closediv.onclick = function () {
                document.body.removeChild(div);
                alertm = 0;
            };

            var ajaxRequest; // The variable that makes Ajax possible!

            try {
                // Opera 8.0+, Firefox, Safari
                ajaxRequest = new XMLHttpRequest();
            } catch(e) {
                // Internet Explorer Browsers
                try {
                    ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
                } catch(e) {
                    try {
                        ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                    } catch(e) {
                        // Something went wrong
                        alert("Įvyko naršyklės klaida!");
                        return false;
                    }
                }
            }
            // Create a function that will receive data sent from the server
            ajaxRequest.onreadystatechange = function () {
                if (ajaxRequest.readyState == 4) {
                    var ajaxDisplay = subsubdiv;
                    ajaxDisplay.innerHTML = ajaxRequest.responseText;
                    subsubdiv.appendChild(closediv);
                }
            }
            ajaxRequest.open("GET", mainurl + "/uploadmusic.php", true);
            ajaxRequest.send(null);



    }
}